Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Juliachang opened this issue Mar 9, 2019 · 3 comments
Open

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

Juliachang opened this issue Mar 9, 2019 · 3 comments

Comments

@Juliachang
Copy link

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.,

x = x.view(-1, 20)
)

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
Copy link
Owner

Perhaps, you could reuse

psa/train_cls.py

Lines 121 to 124 in ff17bf5

img = pack[1]
label = pack[2].cuda(non_blocking=True)
x = model(img)

Here, x means the classification probabilities before sigmoid function.

@Juliachang
Copy link
Author

Juliachang commented Mar 15, 2019

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants