xingyizhou / CenterTrack

Simultaneous object detection and tracking using center points.
MIT License
2.38k stars 526 forks source link

No module named 'torchvision.models.utils #134

Open dyl25984 opened 4 years ago

dyl25984 commented 4 years ago

My torch version is 1.0.0 and torchvision version is 0.2.1. When I run demo.py by using the command: python demo.py tracking,ddd --load_model ../models/nuScenes_3Dtracking.pth --dataset nuscenes --pre_hm --track_thresh 0.1 --demo ../videos/nuscenes_mini.mp4 --test_focal_length 633 It shows: Traceback (most recent call last): File "demo.py", line 14, in from detector import Detector File "/home/user/CenterTrack/src/lib/detector.py", line 13, in from model.model import create_model, load_model File "/home/user/CenterTrack/src/lib/model/model.py", line 14, in from .networks.generic_network import GenericNetwork File "/home/user/CenterTrack/src/lib/model/networks/generic_network.py", line 9, in from .backbones.mobilenet import MobileNetV2 File "/home/user/CenterTrack/src/lib/model/networks/backbones/mobilenet.py", line 14, in from torchvision.models.utils import load_state_dict_from_url ModuleNotFoundError: No module named 'torchvision.models.utils' How should I do to sovle this problem?

wowkie83 commented 3 years ago

try pytorch 1.4. It worksfor me.

wzwb commented 3 years ago

try one of followings: from torch.hub import load_state_dict_from_url from torch.utils.model_zoo import load_url as load_state_dict_from_url

zoeveryday commented 3 years ago

same problem here.

My environment is: python=3.6 pytorch=1.0.0 torchvision=0.2.1 cuda=10.0 cudnn=7

I setup my environment using the following command:

# CUDA 10.0
conda install pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch

Still can't get the demo to run...

wzwb commented 3 years ago

Yes , my environment is same to you ,you can see what i said before.

zoeveryday commented 3 years ago

Yes , my environment is same to you ,you can see what i said before.

Thanks for the reply. I was able to solve the problem by upgrading my pytorch version to 1.4, and torchvision to 0.5.0

Here is the command I used: pip install torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html

My docker image is nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04

chiranthancv95 commented 11 months ago

If using Higher version of Pytorch, try replacing the line "from torchvision.models.utils import load_state_dict_from_url" to "from torch.hub import load_state_dict_from_url" This should work.