You get this error when you change the number of classes, maybe while retraining your U net model with different number of classes.
I suggest you change the new model instance by using num_of_classes=99
The model whose pretrained weights you are trying to load has 291 classes whilst yours has 99 only.
2 Likes