You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on an image segmentation project in the healthcare domain using the UNet model. Due to the lack of data, I have employed data augmentation by dividing the images into smaller patches of dimensions 256 x 256. After training the model, I proceeded to test it on the test data. Unfortunately, I encountered an issue when displaying the prediction result of the full image. However, when I display the patches individually, the prediction results are correct.
Note: I used the code "206_sem_segm_large_images_using_unet_with_patchify.py" for the testing phase.
for i in range(patches.shape[0]):
for j in range(patches.shape[1]):
print(i,j)
single_patch = patches[i,j,:,:,:,:]
single_patch_prediction = (model.predict(single_patch)[0,:,:,0] > 0.5).astype(np.uint8)
predicted_patches.append(single_patch_prediction)
Hello everyone,
I am working on an image segmentation project in the healthcare domain using the UNet model. Due to the lack of data, I have employed data augmentation by dividing the images into smaller patches of dimensions 256 x 256. After training the model, I proceeded to test it on the test data. Unfortunately, I encountered an issue when displaying the prediction result of the full image. However, when I display the patches individually, the prediction results are correct.
Note: I used the code "206_sem_segm_large_images_using_unet_with_patchify.py" for the testing phase.
This is the testing phase of my code:
`patches = patchify(test_img, (256, 256, 3), step = 128)
predicted_patches = []
for i in range(patches.shape[0]):
for j in range(patches.shape[1]):
print(i,j)
single_patch = patches[i,j,:,:,:,:]
single_patch_prediction = (model.predict(single_patch)[0,:,:,0] > 0.5).astype(np.uint8)
predicted_patches.append(single_patch_prediction)
predicted_patches = np.array(predicted_patches)
predicted_patches_reshaped = np.reshape(predicted_patches, (patches.shape[0], patches.shape[1], 256, 256))
new_array = np.expand_dims(predicted_patches_reshaped, axis=2)
expnd_array = np.repeat(np.expand_dims(new_array, axis=-1), 3, axis=-1)
reconstructed_image = unpatchify(expnd_array, large_image.shape)`
The prediction result of the full image
The prediction results of the patches
Thank you for helping me!
The text was updated successfully, but these errors were encountered: