pytorch-grad-cam icon indicating copy to clipboard operation
pytorch-grad-cam copied to clipboard

the example in README need to update

Open 578223592 opened this issue 11 months ago • 1 comments

this link :https://jacobgil.github.io/pytorch-gradcam-book/Class%20Activation%20Maps%20for%20Semantic%20Segmentation.html

image

i found now the code can automatic use the same device of model:


class BaseCAM:
    def __init__(self,
                 model: torch.nn.Module,
                 target_layers: List[torch.nn.Module],
                 reshape_transform: Callable = None,
                 compute_input_gradient: bool = False,
                 uses_gradients: bool = True,
                 tta_transforms: Optional[tta.Compose] = None) -> None:
        self.model = model.eval()
        self.target_layers = target_layers

        # Use the same device as the model.
        self.device = next(self.model.parameters()).device
xxx

578223592 avatar Mar 14 '24 07:03 578223592

感谢您的贡献,而且我发现如此好用的东西在中文论坛,比如csdn博客园等中文社区没有太多中文资料,我觉得可以多做一些中文的入门资料,如果您有兴趣而且打算这么做,我很乐意参与并提供一些力所能及的帮助。

578223592 avatar Mar 14 '24 07:03 578223592