open-mmlab / mmdetection

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

the error message as follow #11521

Open heavytank opened 7 months ago

heavytank commented 7 months ago

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

03/07 15:54:04 - 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/gf/.local/lib/python3.8/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/gf/.local/lib/python3.8/site-packages/torch/functional.py:507: 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:3549.) return _VF.meshgrid(tensors, kwargs) # type: ignore[attr-defined] Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Traceback (most recent call last): File "demo/image_demo.py", line 192, in main() File "demo/image_demo.py", line 184, in main inferencer(
call_args) File "/home/gf/mmdetection-main/mmdet/apis/det_inferencer.py", line 403, in call preds = self.forward(data, forward_kwargs) File "/home/gf/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "/home/gf/.local/lib/python3.8/site-packages/mmengine/infer/infer.py", line 296, in forward return self.model.test_step(inputs) File "/home/gf/.local/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 145, in test_step return self._run_forward(data, mode='predict') # type: ignore File "/home/gf/.local/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 361, in _run_forward results = self(data, mode=mode) File "/home/gf/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/gf/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "/home/gf/mmdetection-main/mmdet/models/detectors/base.py", line 94, in forward return self.predict(inputs, data_samples) File "/home/gf/mmdetection-main/mmdet/models/detectors/single_stage.py", line 110, in predict results_list = self.bbox_head.predict( File "/home/gf/mmdetection-main/mmdet/models/dense_heads/base_dense_head.py", line 197, in predict predictions = self.predict_by_feat( File "/home/gf/mmdetection-main/mmdet/models/dense_heads/base_dense_head.py", line 279, in predict_by_feat results = self._predict_by_feat_single( File "/home/gf/mmdetection-main/mmdet/models/dense_heads/base_dense_head.py", line 423, in _predict_by_feat_single return self._bbox_post_process( File "/home/gf/mmdetection-main/mmdet/models/dense_heads/base_dense_head.py", line 485, in _bbox_post_process det_bboxes, keep_idxs = batched_nms(bboxes, results.scores, File "/home/gf/.local/lib/python3.8/site-packages/mmcv/ops/nms.py", line 319, in batched_nms dets, keep = nms_op(boxes_for_nms[mask], scores[mask], nmscfg) File "/home/gf/.local/lib/python3.8/site-packages/mmengine/utils/misc.py", line 395, in new_func output = old_func(args, *kwargs) File "/home/gf/.local/lib/python3.8/site-packages/mmcv/ops/nms.py", line 127, in nms inds = NMSop.apply(boxes, scores, iou_threshold, offset, score_threshold, File "/home/gf/.local/lib/python3.8/site-packages/torch/autograd/function.py", line 553, in apply return super().apply(args, **kwargs) # type: ignore[misc] File "/home/gf/.local/lib/python3.8/site-packages/mmcv/ops/nms.py", line 27, in forward inds = ext_module.nms( RuntimeError: Unknown layout

BYALPERENK commented 7 months ago

i have same problem

BountyMage commented 7 months ago

I also encountered this issue, and i solved it by matching torch, cuda and mmcv version correctly. first, you should check on https://mmcv.readthedocs.io/en/latest/get_started/installation.html to see torch, cuda dependency for mmcv image then,you shoud go to https://pytorch.org/get-started/previous-versions/, and then select a proper install command for other steps, just follow the GET STARTED guide.

lingdujunshang commented 1 month ago

I also encountered this issue, and i solved it by matching torch, cuda and mmcv version correctly. first, you should check on https://mmcv.readthedocs.io/en/latest/get_started/installation.html to see torch, cuda dependency for mmcv image then,you shoud go to https://pytorch.org/get-started/previous-versions/, and then select a proper install command for other steps, just follow the GET STARTED guide.

It doesn't work at all,i tried torch2.2.0,torch2.3.0,torch2.4.0,,pip install mmcv==2.0.0rc4,,2.2.0 and 2.1.0,,,finally i compiled by source code,it works will when i run this command: python .dev_scripts/check_installation.py,,but it still remind me that registry error or save_dir or something wrong,,,,i tried mim with pip,with minconda,,,,,feel so tired...thinking about giving up...