mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Bug] If torchvision=0.13.0, what should I do to change my resnet50 pretrain code in config

Open Jasonqian123 opened this issue 2 years ago • 3 comments

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmdetection

Environment

PS G:\qxz\mmdetection-master\mmdetection-master> python mmdet/utils/collect_env.py fatal: not a git repository (or any of the parent directories): .git sys.platform: win32
Python: 3.8.13 (default, Oct 19 2022, 22:38:03) [MSC v.1916 64 bit (AMD64)] CUDA available: True
GPU 0: Quadro RTX 8000
CUDA_HOME: None
MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30145 版
GCC: n/a
PyTorch: 1.12.0+cu116
PyTorch compiling details: PyTorch built with:

  • C++ Version: 199711
  • MSVC 192829337
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  • OpenMP 2019
  • LAPACK is enabled (usually provided by MKL)
  • CPU capability usage: AVX2
  • CUDA Runtime 11.6
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_ 80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.3.2 (built against CUDA 11.5)
  • Magma 2.5.4
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.6, CUDNN_VERSION=8.3.2, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:exp erimental -IC:/actions-runner/_work/pytorch/pytorch/builder/windows/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF _WITH_AVX512=1, TORCH_VERSION=1.12.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

TorchVision: 0.13.0+cu116 OpenCV: 4.6.0 MMCV: 1.5.0 MMCV Compiler: MSVC 192930145 MMCV CUDA Compiler: not available MMDetection: 2.25.3+

Reproduces the problem - code sample

1668587333(1)

Reproduces the problem - command or script

python tools/train.py

Reproduces the problem - error message

Traceback (most recent call last): File "G:/qxz/mmdetection-master/mmdetection-master/tools/train.py", line 223, in main() File "G:/qxz/mmdetection-master/mmdetection-master/tools/train.py", line 194, in main model.init_weights() File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\base_module.py", line 116, in init_weights m.init_weights() File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\base_module.py", line 105, in init_weights initialize(self, self.init_cfg) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\cnn\utils\weight_init.py", line 613, in initialize _initialize(module, cp_cfg) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\cnn\utils\weight_init.py", line 517, in _initialize func(module) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\cnn\utils\weight_init.py", line 489, in call load_checkpoint( File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\checkpoint.py", line 581, in load_checkpoint checkpoint = _load_checkpoint(filename, map_location, logger) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\checkpoint.py", line 520, in _load_checkpoint return CheckpointLoader.load_checkpoint(filename, map_location, logger) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\checkpoint.py", line 285, in load_checkpoint return checkpoint_loader(filename, map_location) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\checkpoint.py", line 425, in load_from_torchvision model_urls = get_torchvision_models() File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\runner\checkpoint.py", line 132, in get_torchvision_models model_urls = mmcv.load(json_path) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\fileio\io.py", line 57, in load with StringIO(file_client.get_text(file)) as f: File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\fileio\file_client.py", line 1006, in get_text return self.client.get_text(filepath, encoding) File "E:\anaconda\envs\qxz1\lib\site-packages\mmcv\fileio\file_client.py", line 535, in get_text with open(filepath, 'r', encoding=encoding) as f: FileNotFoundError: [Errno 2] No such file or directory: 'E:\anaconda\envs\qxz1\lib\site-packages\mmcv\model_zoo/torchvision_0.12.json'

Process finished with exit code 1

Additional information

I check the erro message and find this instruction, but I don't know how to set my config. My torchvision=0.13.0. 1668587167(1)

Jasonqian123 avatar Nov 16 '22 08:11 Jasonqian123

It seems that you need to upgrade your MMCV to the most recent version.

ZwwWayne avatar Nov 29 '22 02:11 ZwwWayne

@wanghonglie Hi~ it seems a bug in MMCV, just as you say

image

'model_zoo/torchvision_0.12.json' is a linux format path, which is not compatible with windows platform. It should be corrected as:

osp.join(mmcv.__path__[0], 'model_zoo', 'torchvision_0.12.json')

Would you mind proposing a PR to fix this :smile: ?

HAOCHENYE avatar Nov 29 '22 03:11 HAOCHENYE

Resolved in https://github.com/open-mmlab/mmengine/pull/820

HAOCHENYE avatar Dec 21 '22 04:12 HAOCHENYE

I have also encountered the same problem. Have you resolved it image

xiaoou886 avatar Jun 03 '23 07:06 xiaoou886