Closed zhangxiwensjtu closed 2 years ago
targets is a list of custom modules that output a score function we want the CAM to explain, like the category (or in the case of object detection, maybe the IOU etc). Since they get an image, use the model, and then output a scalar, I thought it made sense the type annotation will be torch.nn.Module, but maybe it should actually be a "Callable".
However in the case of EigenCAM, it doesn't use targets. EigenCAM doesn't compute the CAM to optimize some property (for example explaining a specific category) -> it doesn't have class specific explainability. Therefore it's not used at all in EigenCAM. But it will be used in the other methods that have class specific explainability, like AblationCAM (in the object detection tutorials) or gradcam.
I'm not sure if the code still expects a list of targets, maybe it will work if it's empty. Would have to check. But in any case for EigenCAM it doesn't use it.
Hi, I am trying to implement EigenCam for my Swin_based_Cascade_RCNN network. I find that in the Faster RCNN tutorial, we set
to specify what we are interested in to show on cam. However, when I dive into the code, I am confused that it seems
targets
are never used. For example, when I run:the code goes to the
__call__
function, which calls theforward()
function, and thenand then it goes to:
However, this returns to:
which never use the parameter
targets
(which istarget_category
here).Besides, I am confused why
targets
is a list of nn.module(List[torch.nn.Module]) in the function annotation:shouldn't it be a custom class?