How to standardize image data for a simple Unet

Viewed 944

I am hoping to train a Unet to segment very simple image data (examples of the input, the expected prediction, and the final thresholded prediction below).

The Unet seems to be learning the pixel magnitudes as well. For example, if I feed it an image from a different source that used higher exposure time (so the objects look the same, but the pixel intensities may be much different in magnitude), then the algorithm fails miserably.

I've tried different preprocessing methods ad hoc to address this overfitting. I tried z-scoring the images before training, ie:

img = (img - np.mean(img)) / np.std(img)

I also have tried using the keras ImageDataGenerator to augment my data. I don't have a firm grasp on what's going on underneath the hood of each of these computations (and especially how they interact with each other). I also find that when I do standardizations such as the one above, it distorts the input image and I'm no longer certain how to interpret the output. How do I recover the original structure that I am interested in?

I'd really appreciate any pointers on basic ways to approach this problem. My ultimate goal is to be able to feed input images as shown below, with diverse pixel distributions but very consistent object morphology, and train a Unet to predict the 2 classes as shown below (just foreground and background, essentially).

Note: I am adapting this Kaggle implementation of the Unet: https://www.kaggle.com/keegil/keras-u-net-starter-lb-0-277

images

0 Answers
Related