ModuleNotFoundError: No module named ‘torchvision.models.utils‘

Posted AI浩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ModuleNotFoundError: No module named ‘torchvision.models.utils‘相关的知识,希望对你有一定的参考价值。

  File "/home/ps/wanghao/DBNet.pytorch-master/tools/train.py", line 78, in <module>
    main(config)
  File "/home/ps/wanghao/DBNet.pytorch-master/tools/train.py", line 24, in main
    from models import build_model, build_loss
  File "/home/ps/wanghao/DBNet.pytorch-master/models/__init__.py", line 5, in <module>
    from .model import Model
  File "/home/ps/wanghao/DBNet.pytorch-master/models/model.py", line 8, in <module>
    from models.backbone import build_backbone
  File "/home/ps/wanghao/DBNet.pytorch-master/models/backbone/__init__.py", line 7, in <module>
    from .shufflenetv2 import *
  File "/home/ps/wanghao/DBNet.pytorch-master/models/backbone/shufflenetv2.py", line 7, in <module>
    from torchvision.models.utils import load_state_dict_from_url
ModuleNotFoundError: No module named 'torchvision.models.utils'

from torchvision.models.utils import load_state_dict_from_url

改为:

from torch.hub import load_state_dict_from_url

以上是关于ModuleNotFoundError: No module named ‘torchvision.models.utils‘的主要内容,如果未能解决你的问题,请参考以下文章

ModuleNotFoundError: No module named 'gdbm'

Python:ModuleNotFoundError: No module named 'windows'

PySpark 自定义 UDF ModuleNotFoundError: No module named

用Java调用.py程序出现ModuleNotFoundError: No module named 'java'

ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions' .ipynb文件转换.py文件时遇到错误(示例

ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions' .ipynb文件转换.py文件时遇到错误(示例