Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo中的推理跑不起来啊,提示Please check whether "mmdet" is a correct scope, or whether the registry is initialized. #11927

Open
lingdujunshang opened this issue Aug 29, 2024 · 3 comments
Assignees

Comments

@lingdujunshang
Copy link

mmcv终于编好了(证明贴在最下面),mmdetection看起来也没报错,但是,验证安装仍然跑不动,,,

这是cpu跑的报错,但是好歹还能看到结果,cuda的根本没结果
(mm_env2) xuqing@dell-PowerEdge-R740:~/projects/mm_env2/mmdetection$ python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu
Loads checkpoint by local backend from path: rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth
The model and loaded state dict do not match exactly

unexpected key in source state_dict: data_preprocessor.mean, data_preprocessor.std

08/29 11:03:26 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized.
/home/xuqing/projects/mm_env2/lib/python3.9/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
/home/xuqing/projects/mm_env2/lib/python3.9/site-packages/torch/functional.py:512: UserWarning: torch.meshgrid: in an
upcoming release, it will be required to pass the indexing argument. (Triggered internally at
../aten/src/ATen/native/TensorShape.cpp:3587.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
results have been saved at outputs

这是cuda的报错:

(mm_env2) xuqing@dell-PowerEdge-R740:~/projects/mm_env2/mmdetection$ python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cuda
Loads checkpoint by local backend from path: rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth
The model and loaded state dict do not match exactly

unexpected key in source state_dict: data_preprocessor.mean, data_preprocessor.std

08/29 11:06:23 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized.
/home/xuqing/projects/mm_env2/lib/python3.9/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 段错误 (核心已转储)

下面是其他的安装成功证明:

mmcv装好了
(mm_env2) xuqing@dell-PowerEdge-R740:~/projects/mm_env2/mmcv$ python .dev_scripts/check_installation.py
Start checking the installation of mmcv ...
CPU ops were compiled successfully.
CUDA ops were compiled successfully.
mmcv has been installed successfully.

Environment information:

sys.platform: linux
Python: 3.9.19 (main, Apr 6 2024, 17:57:55) [GCC 11.4.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0,1: NVIDIA GeForce RTX 4090
CUDA_HOME: /usr/local/cuda-11.8
NVCC: Cuda compilation tools, release 11.8, V11.8.89
GCC: x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
PyTorch: 2.3.0+cu118
PyTorch compiling details: PyTorch built with:

  • GCC 9.3
  • C++ Version: 201703
  • Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v3.3.6 (Git Hash 86e6af5974177e513fd3fee58425e1063e7f1361)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • LAPACK is enabled (usually provided by MKL)
  • NNPACK is enabled
  • CPU capability usage: AVX512
  • CUDA Runtime 11.8
  • NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-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=sm_37;-gencode;arch=compute_90,code=sm_90
  • CuDNN 8.9.7
    • Built with CuDNN 8.7
  • Magma 2.6.1
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.3.0, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

TorchVision: 0.18.0+cu118
OpenCV: 4.10.0
MMEngine: 0.10.4
MMCV: 2.0.0
MMCV Compiler: GCC 11.4
MMCV CUDA Compiler: 11.8

mmdetection装好了:
(mm_env2) xuqing@dell-PowerEdge-R740:~/projects/mm_env2/mmdetection$ pip install -v -e .
Using pip 23.0.1 from /home/xuqing/projects/mm_env2/lib/python3.9/site-packages/pip (python 3.9)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///home/xuqing/projects/mm_env2/mmdetection
Running command python setup.py egg_info
running egg_info
creating /tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info
writing /tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'mmdet/VERSION'
warning: no files found matching 'mmdet/.mim/demo//'
adding license file 'LICENSE'
writing manifest file '/tmp/pip-pip-egg-info-fx2uhm19/mmdet.egg-info/SOURCES.txt'
Preparing metadata (setup.py) ... done
Requirement already satisfied: matplotlib in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (3.9.2)
Requirement already satisfied: numpy in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (1.26.3)
Requirement already satisfied: pycocotools in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (2.0.8)
Requirement already satisfied: scipy in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (1.13.1)
Requirement already satisfied: shapely in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (2.0.6)
Requirement already satisfied: six in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (1.16.0)
Requirement already satisfied: terminaltables in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (3.1.10)
Requirement already satisfied: tqdm in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from mmdet==3.3.0) (4.66.5)
Requirement already satisfied: pillow>=8 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (10.2.0)
Requirement already satisfied: packaging>=20.0 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (24.1)
Requirement already satisfied: python-dateutil>=2.7 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (2.9.0.post0)
Requirement already satisfied: cycler>=0.10 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (0.12.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (3.1.4)
Requirement already satisfied: contourpy>=1.0.1 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (1.3.0)
Requirement already satisfied: importlib-resources>=3.2.0 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (6.4.4)
Requirement already satisfied: fonttools>=4.22.0 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from matplotlib->mmdet==3.3.0) (4.53.1)
Requirement already satisfied: zipp>=3.1.0 in /home/xuqing/projects/mm_env2/lib/python3.9/site-packages (from importlib-resources>=3.2.0->matplotlib->mmdet==3.3.0) (3.20.1)
Installing collected packages: mmdet
Attempting uninstall: mmdet
Found existing installation: mmdet 3.3.0
Uninstalling mmdet-3.3.0:
Removing file or directory /home/xuqing/projects/mm_env2/lib/python3.9/site-packages/mmdet.egg-link
Removing pth entries from /home/xuqing/projects/mm_env2/lib/python3.9/site-packages/easy-install.pth:
Removing entry: /home/xuqing/projects/mm_env2/mmdetection
Successfully uninstalled mmdet-3.3.0
Running setup.py develop for mmdet
Running command python setup.py develop
running develop
running egg_info
writing mmdet.egg-info/PKG-INFO
writing dependency_links to mmdet.egg-info/dependency_links.txt
writing requirements to mmdet.egg-info/requires.txt
writing top-level names to mmdet.egg-info/top_level.txt
reading manifest file 'mmdet.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'mmdet/VERSION'
warning: no files found matching 'mmdet/.mim/demo//'
adding license file 'LICENSE'
writing manifest file 'mmdet.egg-info/SOURCES.txt'
running build_ext
Creating /home/xuqing/projects/mm_env2/lib/python3.9/site-packages/mmdet.egg-link (link to .)
Adding mmdet 3.3.0 to easy-install.pth file

Installed /home/xuqing/projects/mm_env2/mmdetection

Successfully installed mmdet-3.3.0

@lingdujunshang
Copy link
Author

没戏。debug到mmengine/registry/registry.py就搞不懂了,,我是多么希望在rtmdet_tiny_8xb32-300e_coco.py某个字段加上个save-dir就能搞定了啊,,,唉,这都走了99步了。。。。

@lingdujunshang lingdujunshang changed the title demo中的 demo中的推理跑不起来啊,提示Please check whether "mmdet" is a correct scope, or whether the registry is initialized. Aug 29, 2024
@XiaoSiJi-GCY
Copy link

同样的警告,跑完后没有图像显示,检测框也没有。请问解决了吗?

@rookie1999
Copy link

同样的警告,跑完后没有图像显示,检测框也没有。请问解决了吗?

兄弟,我也是,推理一直显示进度条,有解决方法戳我一下,拜托了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants