DeepLabv3.pytorch icon indicating copy to clipboard operation
DeepLabv3.pytorch copied to clipboard

Very high loss on using BCELoss

Open prk-vinay opened this issue 4 years ago • 2 comments

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?

prk-vinay avatar Jan 31 '21 19:01 prk-vinay

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.

chenxi116 avatar Feb 03 '21 14:02 chenxi116

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?

prk-vinay avatar Feb 07 '21 13:02 prk-vinay