I have pytorch1.1.0 and torchvision0.2.2 installed in my anaconda environment.
I can: 1. import torch; 2.import torchvision (following the toturial) Yet when from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, error raised as:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "D:\Applications\PyCharm 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'torchvision.models.detection'
I suspect that my version of torchvision is somewhat low. But my GPU driver only support cudatoolkit9.0, and version 0.2.2 is automatically chosen when I install torchvision.
Hi @feiyangsuo, in 0.2.2 release torchvision did not have a detection module as you can see here.
If you are unable to update to the latest version of torchvison, I would suggest playing with the source code of the module available here. Through this, I have learnt better than tutorials.
Hope this helps!
You need torchvision>=0.3.0 to be able to use torchvision.models.detection.
Closing following @bisakhmondal and @pmeier comments
Most helpful comment
You need
torchvision>=0.3.0to be able to usetorchvision.models.detection.