open-mmlab / mmdetection

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

CO-DETR Demo Error: 'list' object has no attribute 'chunked_size' #11482

Open ShenZheng2000 opened 6 months ago

ShenZheng2000 commented 6 months ago

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version.

Describe the bug

A simple demo with CO-DETR throws the following error.

The model and loaded state dict do not match exactly

unexpected key in source state_dict: query_head.label_embedding.weight

missing keys in source state_dict: query_head.dn_generator.label_embedding.weight

/longdata/anurag_storage/2PCNet/LLIE/mmdetection/mmdet/apis/det_inferencer.py:130: UserWarning: dataset_meta or class names are not saved in the checkpoint's meta data, use COCO classes by default.
  warnings.warn(
02/19 14:29:41 - 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/aghosh/anaconda3/envs/openmmlab/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__}, '
Traceback (most recent call last):
  File "demo/image_demo.py", line 192, in <module>
    main()
  File "demo/image_demo.py", line 182, in main
    inferencer.model.test_cfg.chunked_size = chunked_size
AttributeError: 'list' object has no attribute 'chunked_size'

Reproduction

python demo/image_demo.py \
    demo/demo.jpg \
    projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_lsj_16xb1_3x_coco.py \
    --weights pretrained/co_dino_5scale_lsj_swin_large_1x_coco-3af73af2.pth
Mo-ABO commented 6 months ago

I just commented "inferencer.model.test_cfg.chunked_size = chunked_size" and the problem solved :D

yangxunkai commented 2 months ago

@ShenZheng2000 I also encountered the same problem. How did I solve it?