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

Why do I get an error when visualizing with GradCAM methods? How to solve it? #1013

Open
3 tasks done
928928LN opened this issue Jun 19, 2024 · 1 comment
Open
3 tasks done

Comments

@928928LN
Copy link

Prerequisite

🐞 Describe the bug

D:\Software\anaconda\setup\envs\openmmlab\lib\site-packages\torchvision\io\image.py:11: UserWarning: Failed to load image Python extension: Could not find module 'D:\Software\anaconda\setup\envs\openmmlab\Lib\site-packages\torchvi
sion\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
warn(f"Failed to load image Python extension: {e}")
The algorithm currently used is yolov8
Loads checkpoint by local backend from path: work_dirs/yolov8_s_fast_1xb12-40e_cocoDA1new/epoch_500.pth
Exception ignored in: <function BaseCAM.del at 0x000001C4E5D2A3A0>
Traceback (most recent call last):
File "D:\Software\anaconda\setup\envs\openmmlab\lib\site-packages\pytorch_grad_cam\base_cam.py", line 189, in del
self.activations_and_grads.release()
AttributeError: 'GradCAM' object has no attribute 'activations_and_grads'
Traceback (most recent call last):
File "demo/boxam_vis_demo.py", line 276, in
main()
File "demo/boxam_vis_demo.py", line 199, in main
model_wrapper, boxam_detector_visualizer = init_detector_and_visualizer(
File "demo/boxam_vis_demo.py", line 170, in init_detector_and_visualizer
boxam_detector_visualizer = BoxAMDetectorVisualizer(
File "e:\software\mmyolo\mmyolo\utils\boxam_utils.py", line 260, in init
self.cam = method_class(
TypeError: init() got an unexpected keyword argument 'use_cuda'

Environment

Package Version Editable project location


addict 2.4.0
albumentations 1.3.1
annotated-types 0.6.0
appdirs 1.4.4
attrs 23.2.0
autocommand 2.2.2
Bottleneck 1.3.5
certifi 2023.7.22
charset-normalizer 3.1.0
chumpy 0.70
click 8.1.3
colorama 0.4.6
contourpy 1.1.0
cycler 0.11.0
Cython 0.29.35
docker-pycreds 0.4.0
e2cnn 0.2.3
einops 0.8.0
exceptiongroup 1.2.0
filelock 3.14.0
flake8 7.0.0
fonttools 4.40.0
fsspec 2024.5.0
gitdb 4.0.11
GitPython 3.1.41
grad-cam 1.5.2
huggingface-hub 0.23.2
idna 3.4
imagecorruptions 1.1.2
imageio 2.33.1
importlib-metadata 6.7.0
importlib-resources 5.12.0
inflect 7.0.0
iniconfig 2.0.0
interrogate 1.5.0
isort 4.3.21
jaraco.classes 3.3.0
jaraco.collections 5.0.0
jaraco.context 4.3.0
jaraco.functools 4.0.0
jaraco.structures 2.2.0
jaraco.text 3.12.0
jaraco.ui 2.3.0
jaraco.windows 5.8.0
joblib 1.3.2
json-tricks 3.17.3
kiwisolver 1.4.4
kwarray 0.6.16
lazy_loader 0.3
Markdown 3.4.3
markdown-it-py 3.0.0
matplotlib 3.7.1
mccabe 0.7.0
mdurl 0.1.2
memory-profiler 0.61.0
mkl-fft 1.3.6
mkl-random 1.2.2
mkl-service 2.4.0
mmcls 1.0.0rc6
mmcv 2.0.0
mmdet 3.0.0 d:\software\anaconda\setup\envs\openmmlab\lib\site-packages\mmdet-3.0.0-py3.8.egg
mmengine 0.7.4
mmpose 1.3.0
mmrazor 1.0.0
mmrotate 1.0.0rc1
mmyolo 0.6.0 e:\software\mmyolo
model-index 0.1.11
modelindex 0.0.2
more-itertools 10.1.0
mpmath 1.3.0
munkres 1.1.4
networkx 3.1
numexpr 2.8.4
numpy 1.24.3
opencv-python 4.7.0.72
opencv-python-headless 4.9.0.80
openmim 0.3.7
ordered-set 4.1.0
packaging 23.1
pandas 2.0.2
parameterized 0.9.0
path 16.9.0
Pillow 9.4.0
pip 23.1.2
platformdirs 3.8.0
pluggy 1.3.0
prettytable 3.9.0
protobuf 3.20.1
psutil 5.9.7
py 1.11.0
pycocotools 2.0.6
pycodestyle 2.11.1
pydantic 2.5.3
pydantic_core 2.14.6
pyflakes 3.2.0
Pygments 2.15.1
pyparsing 3.1.0
pytest 7.4.4
python-dateutil 2.8.2
pytz 2022.7
PyWavelets 1.4.1
PyYAML 6.0
qudida 0.0.4
regex 2023.6.3
requests 2.31.0
rich 13.4.2
safetensors 0.4.3
scikit-image 0.21.0
scikit-learn 1.3.2
scipy 1.10.1
seaborn 0.12.2
sentry-sdk 1.39.2
setproctitle 1.3.3
setuptools 67.8.0
shapely 2.0.1
six 1.16.0
sklearnn 0.0.1
smmap 5.0.1
sympy 1.12
tabulate 0.9.0
termcolor 2.3.0
terminaltables 3.1.10
threadpoolctl 3.2.0
tifffile 2023.7.10
timm 1.0.3
toml 0.10.2
tomli 2.0.1
torch 1.10.1
torchaudio 0.10.1
torchvision 0.11.2
tqdm 4.66.4
ttach 0.0.3
typing_extensions 4.6.3
tzdata 2023.3
ubelt 1.3.4
unicodedata2 15.0.0
urllib3 2.0.3
wandb 0.17.0
wcwidth 0.2.12
wheel 0.38.4
xdoctest 1.1.2
xtcocotools 1.14.3
yapf 0.40.1
zipp 3.15.0

Additional information

1.没有做任何修改
2.用的自己的数据集

@daitakei
Copy link

Using grad-cam 1.3.6 fixes the issue in my case:

pip install 'grad-cam==1.3.6'

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

2 participants