学习mmpretrain,运行tools/visualization/vis_cam.py输出热力图,遇到报错TypeError: GradCAM.__init__() got an unexpected keyword argument 'use_cuda'。
报错定位到vis_cam.py文件:
def init_cam(method, model, target_layers, use_cuda, reshape_transform):
"""Construct the CAM object once, In order to be compatible with
mmpretrain, here we modify the ActivationsAndGradients object."""
GradCAM_Class = METHOD_MAP[method.lower()]
cam = GradCAM_Class(
model=model, target_layers=target_layers, use_cuda=use_cuda)