ModuleNotFoundError: No module named 'torchvision.models.detection'
原创
©著作权归作者所有:来自51CTO博客作者是念的原创作品,请联系作者获取转载授权,否则将追究法律责任
今天在运行pytorch 的时候,出现了下面的错误:
Traceback (most recent call last):
File "train.py", line 14, in <module>
from models.retinaface import RetinaFace
File "/media/data/projects/faceDetect/Face-Detector-1MB-with-landmark/models/retinaface.py", line 3, in <module>
import torchvision.models.detection.backbone_utils as backbone_utils
ModuleNotFoundError: No module named 'torchvision.models.detection'
解决方法
pip install torchvision==0.4
参考文献
[1].from torchvision.models.detection.faster_rcnn import FastRCNNPredictor builtins.ModuleNotFoundError: No module named 'torchvision.models'; 'torchvision' is not a package. https://github.com/pytorch/vision/issues/1414