Closed RocaPiedra closed 2 years ago
Hi,
All of the methods can be used as well. I will add the missing ones to cam.py in the next update, but you can already import and use them.
I think you can use any classification model. The key thing is to get the target layer. Just print the model, and then figure out the name of the CNN layer you want to use. like layer4. I should probably add utilities for automatically extracting those layers, but that's the way for now. There are some examples of target_layers in the Readme/cam.py.
Vision Transformers are a bit more tricky because of the reshape_transform required, but there are examples.
Hi,
I'm using your work as a library to integrate visualization methods with the Carla Simulator for my master's thesis (thanks a lot for such an amazing repo!!), so far I've been able to use alexnet and ResNet succesfully. I would like to implement as many methods with as many models but I don't have a lot of time and I would like to know which architectures I could use without needing to tweak anything, right now I just do this:
cam_method = MethodCAM(model=self.model, target_layers=self.target_layers, use_cuda=True)
grayscale_cam = cam_method(input_tensor=input_tensor)
I'm doing the preprocessing as they explain in the PyTorch documentation for ResNet and alexnet but I don't know much about the other architectures that you cite in the Choosing your target layer section, are all of those models ready to use with the library?
Also, I'm using the methods you showcase in the readme's section Using from code as a library:
from pytorch_grad_cam import GradCAM, ScoreCAM, GradCAMPlusPlus, AblationCAM, XGradCAM, EigenCAM, FullGrad
Would it be possible to use the rest of methods (LayerCAM, EigenGradCAM and GradCamElementWise) in the repo with the library too?Thanks in advance!