Unet Segmentation Loss interpretation

Hello, I was trying to use Lesson 3 Unet example with my data. I have 330 Sentinel 2 images (256 by 256 pixels) with masks. I was trying to segment out forest from the other types of landscapes. I trained the network for a bunch of epochs and managed to get to around 80% accuracy with 0.45-0.46 train and validation loss
image

I used the same function from the course to measure accuracy. As for the choice of the learning rate, I used the same procedure describing in Lesson 3. Using lr finder.

From that point, I wasn’t able to make loss any lower regardless of how many epochs I used for training. Also, I noticed that most of the time validation loss is slightly bigger than train loss (which, as I understand, is a sign of overfitting?).

I was trying to double-check my model on nonlabeled images. After 5-15 epochs, they started to segment out forests (even thou not very accurately). However, after further pieces of training model started to treat everything as non-forest.

Here is also my notebook:

Is the small amount of data the problem? Or maybe I am just missing something, as my expectation was that model has to start overfitting wildly at some point. However, it doesn’t seem to. Would be very grateful for any ideas and suggestions. And actually happy to enter this wonderful community!

That is a sign of under fitting. With so few images, results will be quite choppy.

1 Like

I see, thank you!
Is there any rule of thumb about the “big enough” size of dataset? Also, is it possible to improve performance by data augmentation?

Try using dice loss, works fairly well for binary segmentation

Which Sentinel bands are you using? Just RGB or something more? You could benefit from adding infrared band, maybe even more if you add your own band which would be combination of other bands. For example adding NDVI band (which would be of course combination of Red and Infrared band), since NDVI is really important in your case I would say. In that case your input would be images with 4 channels: Red, Green, Blue and NDVI.

Another important thing for distinguish forest from the rest is definitely texture, how to focus on texture I am not sure, Unet should take care of it by itself. But it also depends on what is the size of your pixel in the nature.

Regarding expanding dataset, I am not sure which tool are you using for manipulating with your images, but maybe you could take some “large” image, say 10000 x 10000 pixels, label it and then crop that image in many small patches.

Usually adding augmented images improve performance, but it is hard to say from which kind of augmentation could you benefit, since I don’t know how your images look like.

1 Like