Vision: ModuleNotFoundError: No module named 'torchvision.models.detection'

Created on 3 May 2020  路  3Comments  路  Source: pytorch/vision

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.

models question object detection

Most helpful comment

You need torchvision>=0.3.0 to be able to use torchvision.models.detection.

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Abolfazl-Mehranian picture Abolfazl-Mehranian  路  3Comments

alpha-gradient picture alpha-gradient  路  3Comments

chinglamchoi picture chinglamchoi  路  3Comments

zhang-zhenyu picture zhang-zhenyu  路  3Comments

IssamLaradji picture IssamLaradji  路  3Comments