BIT_CD icon indicating copy to clipboard operation
BIT_CD copied to clipboard

python demo.py ModuleNotFoundError: No module named 'torchvision.models.utils'

Open Jalhiane23 opened this issue 4 years ago • 2 comments

when i run demo.py file i have the error ModuleNotFoundError: No module named 'torchvision.models.utils'

Jalhiane23 avatar Dec 24 '21 20:12 Jalhiane23

Same here. Did you ever figure it out?

ColeFrankenhoff avatar Jun 13 '23 21:06 ColeFrankenhoff

错误原因:torchvision的版本问题 解决方案:将BIT_CD-master\models\resnet.py第3行from torchvision.models.utils import load_state_dict_from_url 替换为from torch.hub import load_state_dict_from_url

123664jhkny avatar Sep 13 '23 13:09 123664jhkny