chenxi116 / DeepLabv3.pytorch

PyTorch implementation of DeepLabv3
Other
253 stars 47 forks source link

Very high loss on using BCELoss #19

Open prk-vinay opened 3 years ago

prk-vinay commented 3 years ago

Hi, I wanted to try your code on SWIMSEG dataset. It has only two classes- cloud and sky (background). I got IoU of 80%. But I wanted to BCELoss instead of CrossEntropyLoss so that I could reduce the number of output channels to just 1 instead of 2. Hence, I used use BCELoss (For this, I also introduced a sigmoid layer at the end of the model). The problem is that it is now giving huge error and output tensor is quickly moving towards 0, i.e., I am getting all the outputs as 0s. I tried changing learning rates. But it was not very helpful. Any idea, what's going wrong?

chenxi116 commented 3 years ago

Sorry I don't use BCELoss very often, so I don't have a good guess what might be the cause here. From the mathematical side of things, BCELoss looks doable to me.

prk-vinay commented 3 years ago

Sorry I don't use BCELoss very often, so I don't have a good guess what might be the cause here. From the mathematical side of things, BCELoss looks doable to me.

Thanks for your reply. Is there any other loss function that I should consider for binary classification?