Open andyluo7 opened 7 months ago
@andyluo7 Since you are not using the weights trained by mmdetection, you should use the configuration file name for inference, for example
python demo/image_demo.py demo/demo.jpg \
glip_atss_swin-t_a_fpn_dyhead_pretrain_obj365
--texts 'bench . car .' -c
I encountered the same error and was able to resolve it by using the following instead:
python demo/image_demo.py demo/demo.jpg configs/glip/glip_atss_swin-t_a_fpn_dyhead_pretrain_obj365.py --weights glip_tiny_a_mmdet-b3654169.pth --texts 'bench. car'
hope it helps!
The same issue to me. :(
@andyluo7 Since you are not using the weights trained by mmdetection, you should use the configuration file name for inference, for example
python demo/image_demo.py demo/demo.jpg \ glip_atss_swin-t_a_fpn_dyhead_pretrain_obj365 --texts 'bench . car .' -c
Hi! I use the groundingdino_swinb_cogcoor_mmdet-55949c9c.pth and in-house inference code which can directly use the xml annotation files. But when I tested the model's performance using this pth file, this issue occurred but when I use the finetuned gdino_b's pth file to run the test process, it worked. I wonder the reason why this happened and how the solution will be.
Thanks for your error report and we appreciate it a lot.
Checklist
Describe the bug Ran into the following error of the Multi-modal algorithm inference demo. mmdet was installed from source. The image and webcam demo works.
(openmmlab) user@puget-253012:~/openmmlab/mmdetection$ python demo/image_demo.py demo/demo.jpg glip_tiny_a_mmdet-b3654169.pth --texts bench The model is a weight file, automatically assign the model to --weights Loads checkpoint by local backend from path: glip_tiny_a_mmdet-b3654169.pth Traceback (most recent call last): File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/infer/infer.py", line 462, in _init_model cfg_string = checkpoint['message_hub']['runtime_info']['cfg'] KeyError: 'message_hub'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "demo/image_demo.py", line 192, in
main()
File "demo/image_demo.py", line 179, in main
inferencer = DetInferencer(**init_args)
File "/home/user/openmmlab/mmdetection/mmdet/apis/det_inferencer.py", line 99, in init
super().init(
File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/infer/infer.py", line 180, in init
self.model = self._init_model(cfg, weights, device) # type: ignore
File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/infer/infer.py", line 464, in _init_model
assert 'meta' in checkpoint, (
AssertionError: If model(config) is not provided, the checkpoint mustcontain the config string in
meta
ormessage_hub
, but bothmeta
andmessage_hub
are not found in the checkpoint.Reproduction
python demo/image_demo.py demo/demo.jpg glip_tiny_a_mmdet-b3654169.pth --texts bench
Environment
python mmdet/utils/collect_env.py
to collect necessary environment information and paste it here. sys.platform: linux Python: 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 4090 CUDA_HOME: /usr/local/cuda-12.2 NVCC: Cuda compilation tools, release 12.2, V12.2.140 GCC: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 PyTorch: 2.2.0+cu121 PyTorch compiling details: PyTorch built with:TorchVision: 0.17.0+cu121 OpenCV: 4.7.0 MMEngine: 0.10.3 MMDetection: 3.3.0+44ebd17
$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.)Error traceback If applicable, paste the error trackback here.
Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!