#Training FCN on a Weed Dataset

9 messages · Page 1 of 1 (latest)

vocal wraith
#

Hey, I am trying to train a FCN model(https://pytorch.org/vision/stable/models/generated/torchvision.models.segmentation.fcn_resnet50.html#torchvision.models.segmentation.fcn_resnet50) on a segmentation dataset however the loss doesn't seem to decrease and converge and I'm totally clueless why. I do my backward and forward propagation as well and zero grad my optimizer and .train() my model when needed.

Here is the link to my notebook: https://colab.research.google.com/drive/1lu2taUVvR4o3mYYTFnYkD2gY6lV_K3Rt?usp=sharing

Any help to point me in the right direction would be appreciated.

vocal wraith
#

still need help on this ^

agile hawk
#

If every pixel can only be assigned to one class, I would recommend using a Cross Entropy loss instead of a Binary cross entropy and changing your mask to instead a single channel of discrete class labels

#

And you have pretrained=False when you load the model, I would recommend you change it to true and fine tune the model cause it has a lot of inherent knowledge, you just need to do something akin to transfer learning on it

vocal wraith
agile hawk
#

You can remove the last layer of the model or add another one

vocal wraith
agile hawk
#

And how do you know it isn’t even calculating gradients?

vocal wraith
#

Because I had to specify on the predictions preds["out"].requires_grad = True to avoid errors which means that the gradients weren't being calculated by the model in the first place.