jiwoon-ahn / psa

Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation, CVPR 2018
MIT License
380 stars 62 forks source link

How to extract the classification probability of each class? #17

Open Juliachang opened 5 years ago

Juliachang commented 5 years ago

Hi @jiwoon-ahn,

I am trying to output the classification probability of 20 classes of VGG-based model. Can I take the probabilities from infer_cls.py? (e.g., https://github.com/jiwoon-ahn/psa/blob/b091fe85c05e6dd537b1e682a66ccd266c1f18e8/network/vgg16_cls.py#L28)

Since in infer_cls.py, you only do forward_cam instead of forward, I am wondering if you can take the outputted probability of each class from here. My understanding is, I can only obtain the CAMs from here. If my understanding is wrong, do you have any suggestions about how to take the probability of each class of the multi-label classifier out? Thanks a lot!

jiwoon-ahn commented 5 years ago

Perhaps, you could reuse https://github.com/jiwoon-ahn/psa/blob/ff17bf5ecc58082ed91db8042584ea8d7874ddb6/train_cls.py#L121-L124 Here, x means the classification probabilities before sigmoid function.

Juliachang commented 5 years ago

Hi @jiwoon-ahn,

Thanks for answering. I found the classification probabilities successfully. Another question is, I use the VGG weights that you provided on github to check the accuracy of CAMs. But I cannot achieve the mIoU that you reported. (VGG-16: Train(mIoU):48.9, Val(mIoU):46.6)

I scaled the outputed cam response to 0-1 and set a threshold to 0.15. If the response is over the threshold, I count the IoU with the segmentation ground truth. My counted mIoU is 36.4. Can you tell me how you obtain the mIoU numbers? Do I need to keep training your model based on the provided weights?

It would be so great if you can share your experience with me. Thanks a lot!

jieruyao49 commented 4 years ago

Hi @jiwoon-ahn,

Thanks for answering. I found the classification probabilities successfully. Another question is, I use the VGG weights that you provided on github to check the accuracy of CAMs. But I cannot achieve the mIoU that you reported. (VGG-16: Train(mIoU):48.9, Val(mIoU):46.6)

I scaled the outputed cam response to 0-1 and set a threshold to 0.15. If the response is over the threshold, I count the IoU with the segmentation ground truth. My counted mIoU is 36.4. Can you tell me how you obtain the mIoU numbers? Do I need to keep training your model based on the provided weights?

It would be so great if you can share your experience with me. Thanks a lot!

How do you calculate mIOU? Where to download GT? Could you refer to any source code or reference regarding this? Thanks a lot!