thomashopkins32 / HuBMAP

Hacking the Human Vasculature (Kaggle Competition)
Apache License 2.0
0 stars 0 forks source link

Data Transformations #6

Closed thomashopkins32 closed 11 months ago

thomashopkins32 commented 1 year ago

Do some experimentation in what some different image transformations would do if we included them during training.

Create a new notebook to visualize some of the transformations and make sure the annotations are still available and correct.

thomashopkins32 commented 1 year ago

Apparently dilation has been showing massive jumps in improvement for other people in the competition.

In a nutshell, it involves expanding the annotated region by doing a max-pool operation that preserves or expands the original image size.

This should only be used on dataset 2 since these annotations are of poorer quality.

https://scikit-image.org/docs/stable/api/skimage.morphology.html#skimage.morphology.binary_dilation

thomashopkins32 commented 11 months ago

We will have to use the torchvision functional API for altering both the image and mask with the exact same transform.

Here are the transforms I am currently considering with reasons for why I am including them.

Transform Reason
ColorJitter Training images might have slightly different brightness, contrast, saturation, etc. This should be set to a low amount of jitter since the images are not that different.
GaussianBlur Not sure about this one. The resolution on the all of the images I have seen are very good. This might help with biasing toward more general predictions if used in a low amount.
RandomAffine Translation and scale changes would be helpful in small amounts. I would prefer to use horizontal/vertical flipping instead of rotations. This one is a maybe since I am not a fan of the changes to the border pixels.
RandomHorizontalFlip Must have. No point in not doing this.
RandomVerticalFlip Must have. No point in not doing this.

One additional thing that can be tried is to reconstruct the whole slide image (WSI) by joining the different patches together. Then we can perform a random crop to get different 512x512 patches of our own. I noticed that some people on Kaggle were trying some things with the WSI.

thomashopkins32 commented 11 months ago

We can do translation but we should fill it in with white pixels. There are some images that appear on the edges of the WSI where half the image can be full of pixels very close to white. We need the network to be robust to this kind of situation so including translated images where the fill is with white pixels could be helpful.

This translation should happen before any brightness, contrast, or saturation changes since the original images near the borders will not have exactly white pixels.