Skip to content
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

the example in README need to update #491

Open
578223592 opened this issue Mar 14, 2024 · 1 comment
Open

the example in README need to update #491

578223592 opened this issue Mar 14, 2024 · 1 comment

Comments

@578223592
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant