Unet segmentation model for vehicle components (fastai v2). Bad results

I am trying to use fastai v2 to train an unet segmentation model on vehicle parts data set of around 100 images. The images were taken for particular views of the car, where mostly a smaller areas of the parts are included in one image. I am not sure why the accuracy is that bad (Dice>3). Should the images include a larger view of the car? Should I add more images? OR…?

Any suggestion will be appreciated.


Your training and validation loss are still decreasing, so the model can still improve. This could be the reason why your results don’t look that good.

Regarding the Dice loss, I think you need to use DiceLossMulti as you have multiple labels.

Thank’s for the answer, I just have thought about this before 5 minutes. I will run for 20 epoch and see what happened.

After 20 epochs, unfortunately no improvement.

Update! I corrected the metric function using this code:


Then I run:

But the result did not change:

DiceLossMulti is not found in latest fastai, 2.4.x…right?
DiceLoss() is loss and DiceMulti() is metrics.

So, you can only use DiceLoss() as you loss function or you code up FoculLoss, which is not hard as it is just spin-off from BCE loss.

Let us know how it goes?