pytorch / captum

Model interpretability and understanding for PyTorch
https://captum.ai
BSD 3-Clause "New" or "Revised" License
4.85k stars 489 forks source link

How can i compute Integrated Gradients for object detection(Yolov5) ? #982

Open akashlp27 opened 2 years ago

akashlp27 commented 2 years ago

Hey, how can I compute IG for object detection models such as yolov5 wherein the model's output will usually be (class, bboxes, score), where as certain classification models give prediction probability for all classes, any suggestions would help a lot...

99warriors commented 2 years ago

Hi @akashlp27 Thank you for the question - you could try wrapping your original model to produce predictions for a pre-specified bbox. This way the wrapped model produces the output that IG expects. You'll need to make a new wrapped model for each bbox.

akashlp27 commented 2 years ago

Thanks for the reply, will try it out

mshergad commented 1 year ago

Hi @akashlp27 - were you able to do this? I have the exact same problem and I’m not sure how to pre specify bounding boxes in yolov5