-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
YOLOv5 and ScoreCAM #242
Comments
Hi, |
I'm using the Yolov5 model so just I'm just using the below code from the tutorial. I managed to get ScoreCAM working for a Faster RCNN with the same dataset so I don't think its that.
|
Thanks, sorry for the delay in the response. |
Hi, I have been using a YOLOv5s model, I have adapted the YOLOv5 notebook below. I still get the same error mentioned above.
|
Oh ok, now I got it. The example in the YOLO notebook uses EigenCAM, it's a method that doesn't require a "target". So will need to rewrite FasterRCNNBoxScoreTarget for YOLO (since the model outputs the boxes in a different format). |
I can try doing that |
Oh ok thank you for clearing that up. If that's possible that would be great. |
First I want to thank jacobgil for your brilliant works, especially for those tutorials, they are very helpful, even more useful than tutorials provided in captum.ai. Anyway, I've been trying to get pytorch-grad-cam to output cam image for specific labels and wrote ScoreTarget class for yolo. I try to get ablationCam working for yolov5, but after some tinkering, things got stuck. My understanding is that AblationCam replace the target layer I provided (like AttributeError: 'AblationLayerYolo' object has no attribute 'f' So my question is do I need to implement this f thing myself? cause from what I saw, ablation layer should have .set_next_batch and call, and this f thing seem to be something native to yolov5, but since the layer replacement occurs, I also need to address it. By the way, maybe score-cam can be adopted for yolo-v5 more easily? cause from what I see there is no layer replacement there. |
did u able to implement that? |
Similar error here! |
Hi I have pretrained a YOLOv5 model on a custom dataset and have tried to use the tutorial code to use ScoreCAM but seem to get the below error.
ValueError: only one element tensors can be converted to Python scalars
Which points to line 59 in score_cam.py (below).
outputs = [target(o).cpu().item() for o in self.model(batch)]
I'm unsure of how to fix this as the batch is a tensor that is the same shape as my other implementation using ScoreCAM with a Faster RCNN network.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: