Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Output of Cam doesn't match the bounding box #29

Open
sriniwaas opened this issue Mar 20, 2018 · 5 comments
Open

Output of Cam doesn't match the bounding box #29

sriniwaas opened this issue Mar 20, 2018 · 5 comments

Comments

@sriniwaas
Copy link

@brucechou1983 :
After training, using cam.py, I am getting the predicted cam output and bounding box mismatch. Please help.

screen shot 2018-03-20 at 1 44 55 pm

@walterwang
Copy link

were u able to find a solution on this?

@jennyzu
Copy link

jennyzu commented Apr 15, 2019

I have the same issue. Does anybody have a solution or idea?

@Sadam1195
Copy link

@jennyzu @walterwang I don't see any normalization (with imagenet_mean and imagenet_std values) in cam.py since transform_batch_images is not called. I think due to this test.py and cam.py return different predictions for same images hence the box doesn't fit right on heatmap. As I understand this normalization is a part of input pipeline during training, so this function should be called in cam.py, too. When you include transform_batch_images in cam.py output will be correct heatmap so you'll get correct bounding box.

@gmarceca
Copy link

gmarceca commented Aug 1, 2019

In addition to @Sadam1195 comment I am afraid there is a bug here
https://github.com/brucechou1983/CheXNet-Keras/blob/master/cam.py#L54 and
class_weights[index] should be replaced by class_weights[:, index]
in order to sum across all last conv layer filters (1024) for a given index.
You can see an example here
https://github.com/jacobgil/keras-cam/blob/master/cam.py#L34

@monteiro141
Copy link

In addition to @Sadam1195 comment I am afraid there is a bug here https://github.com/brucechou1983/CheXNet-Keras/blob/master/cam.py#L54 and class_weights[index] should be replaced by class_weights[:, index] in order to sum across all last conv layer filters (1024) for a given index. You can see an example here https://github.com/jacobgil/keras-cam/blob/master/cam.py#L34

By adding class_weights[:, index] my final grad cam is weird

image

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

No branches or pull requests

6 participants