open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.13k stars 9.38k forks source link

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

Open lingdujunshang opened 3 weeks ago

lingdujunshang commented 3 weeks ago

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:

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 commented 3 weeks ago

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

XiaoSiJi-GCY commented 2 days ago

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

rookie1999 commented 1 day ago

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

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