isht7 / pytorch-deeplab-resnet

DeepLab resnet v2 model in pytorch
MIT License
602 stars 118 forks source link

fine tune on custom image #16

Closed vra closed 6 years ago

vra commented 6 years ago

Hi @isht7 , Thanks for your great work, I really appreciate it. I want to ask you when I run train.py on my custom images, how should I to modify outS function? I don't quite understand why do we need outS function even after I read the comments above it and original paper of deeplab v2 (sorry for dumb me..), could you please give some some advice?

isht7 commented 6 years ago

Hello @vra, outS function is used to calculate the size of the final output blob of deeplab resnet given the size of the input image.(You do not need to modify this if you are using custom data. Just make sure that your input images are square in shape) Doing this is necessary because I send different sized images into the net, which is a form of data augmentation. To calculate loss, I need to resize the ground truth labels to the shape of the output blob. Remember, deeplab resnet calculates losses on input images over multiple scales ( 1x, 0.75x, 0.5x ). For this reason, it is used multiple time in train.py. It is also used in the model file here, have a look at how the total loss is calculated in deeplab resnet from the caffe prototxt to understand what is done in the model file.

vra commented 6 years ago

Hi @isht7 , Thanks for your quick and clear response. I got it and I will check the caffe prototxt file to configure out how to total loss is calculated.