microsoft / GLIP

Grounded Language-Image Pre-training
MIT License
2.2k stars 194 forks source link

AssertionError: Invalid type <class 'NoneType'> for key #115

Open charismaticchiu opened 1 year ago

charismaticchiu commented 1 year ago

Hi I managed to build GLIP and use the following command to test zero-shot on COCO

python tools/test_grounding_net.py --config-file configs/pretrain/glip_Swin_L.yaml --weight MODEL/glip_large_model.pth TEST.IMS_PER_BATCH 1 MODEL.DYHEAD.SCORE_AGG "MEAN" TEST.EVAL_TASK detection MODEL.DYHEAD.FUSE_CONFIG.MLM_LOSS False OUTPUT_DIR results

If I used the default confg, I get the following error. image

I changed the defaults.py in maskrcnn_benchmark about _C.DATASETS.PREDEFINED_TEXT _C.DATASETS.OVERRIDE_CATEGORY _C.DATASETS.SUPRESS_QUERY _C.DATASETS.CAPTION_PROMPT (They were all set to None, and I set them to "")

and I was able to get the dataset loaded. But get the following error. Do you know what was wrong in the code? Do we need to specify more paths?

The combined datasets are: ('coco_2017_val',).

loading annotations into memory... Done (t=0.89s) creating index.. index created! coco_2017_val has the 5000 data points COCODataset 2023-06-30 17:23:49,852 maskrcnn_benchmark.inference INFO: Start evaluation on coco_2017_val dataset(5000 images). Traceback (most recent call last): File "tools/test_grounding_net.py", line 222, in main() File "tools/test_grounding_net.py", line 215, in main cfg=cfg File "/usr/{dir}/GLIP/maskrcnn_benchmark/engine/inference.py", line 426, in inference all_queries, all_positive_map_label_to_token = create_queries_and_maps_from_dataset(dataset, cfg) File "/usr/{dir}/GLIP/maskrcnn_benchmark/engine/inference.py", line 204, in create_queries_and_maps_from_dataset labels_i, label_list_i, additional_labels = cfg.DATASETS.SUPRESS_QUERY if cfg.DATASETS.USE_SUPRESS_QUERY else None, cfg = cfg) File "/usr/{dir}/GLIP/maskrcnn_benchmark/engine/inference.py", line 227, in create_queries_and_maps caption_prompt = load_from_yaml_file(caption_prompt) File "/usr/{dir}/GLIP/maskrcnn_benchmark/data/datasets/tsv.py", line 34, in load_from_yaml_file with open(yaml_file, 'r') as fp: FileNotFoundError: [Errno 2] No such file or directory: ''

Thank you!

AmrinKareem commented 1 year ago

I have the same issue @charismaticchiu How did you solve it? I really appreciate any help you can provide.

ChenNuoling commented 2 months ago

I try to install yacs>=1.8.0 . It works.