psa icon indicating copy to clipboard operation
psa copied to clipboard

CAMs on custom dataset

Open sinAshish opened this issue 6 years ago • 7 comments

Hi Jiwoon

I trained the classification model on my own dataset which has binary labels(present or not present). I made the necessary changes to your code. But while generating CAMs using infer_cls.py. All I get is completely black or white images. Are there any other modifications that I need to make to generate cams except for the softmax with BCELoss. and changing labels from 20 to 2?

sinAshish avatar Feb 18 '19 04:02 sinAshish

Hi @sinAshish, Here are my tips for your case: 1) We hypothesize the background confidence scores by setting alphas because there's no such label in PASCAL VOC. If your dataset has background labels, I don't recommend you to do this. Instead, you can threshold CAMs by some value or just take argmax of classes per pixel. 2) Check the classification accuracy of your validation set. (probably you should get over 95% acc)

jiwoon-ahn avatar Feb 19 '19 08:02 jiwoon-ahn

Thanks for the suggestion. I'll try it out and see if it works.

sinAshish avatar Feb 19 '19 18:02 sinAshish

I have trained the classification model on my own data set, which is similar to your result. How do you solve this problem? @sinAshish

XZNWU avatar Feb 25 '19 01:02 XZNWU

I take argmax of classes per pixel as suggested by @jiwoon-ahn . But I haven't yet run the code so can't say for sure if it would work.

sinAshish avatar Feb 25 '19 16:02 sinAshish

My loss decreases to a very less extent, like from .68 to around .43 or .48. I use log_softmax with NLLLoss. What about you @xiangzhang06 ?

sinAshish avatar Feb 27 '19 06:02 sinAshish

Hello! Has anyone found any success with this? When I try to run infer_cls, every value in the CAM comes up as 0. The only change in train_cls I made was changing the number of labels, and loss only decreases from 0.6929 to 0.606.

dalonzom avatar Nov 26 '19 02:11 dalonzom

Hello! Has someone solved such a problem? I also got all-zero CAMs.

zijinY avatar May 10 '21 09:05 zijinY