kevin-ssy / CLIP_as_RNN

Official Implementation for CVPR 2024 paper: CLIP as RNN: Segment Countless Visual Concepts without Training Endeavor
95 stars 3 forks source link

Evaluate(from ReadMe) Error #6

Closed StuHude closed 3 months ago

StuHude commented 3 months ago

Congrats! What fantastic work! But I would like to ask, when I tried to evaluate directly according to your command, I found that it does not run, and coco.yaml seems incomplete, for example, what should its "ignore_background" be set to? And after I set it up, it runs with an error:

Traceback (most recent call last): File "/home/Clip_as_RNN/evaluate.py", line 511, in main(args) File "/home/Clip_as_RNN/evaluate.py", line 499, in main evaluate( File "/home/Clip_as_RNN/evaluate.py", line 325, in evaluate label_pred = eval_semantic( File "/home/Clip_as_RNN/evaluate.py", line 163, in eval_semantic all_masks, scores = inference_car( File "/home/Clip_as_RNN/utils/inference_pipeline.py", line 76, in inference_car masks, scores = car_model(img, sentences) File "/root/miniconda3/envs/car0/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/root/miniconda3/envs/car0/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl return forward_call(args, *kwargs) File "/home/Clip_as_RNN/modeling/model/car.py", line 317, in forward pseudo_masks, conf_scores = self._forward_car(im_ori, text) File "/home/Clip_as_RNN/modeling/model/car.py", line 308, in _forward_car final_predicted_masks = torch.zeros(len(text), refined_masks[0].shape) IndexError: index 0 is out of bounds for dimension 0 with size 0

It would be very helpful if you could take a look at it. Thank you very much!

kevin-ssy commented 3 months ago

May I know which dataset you are running on?

StuHude commented 3 months ago

cocostuff,After I downloaded the dataset according to your readme and ran evaluate.py, coco.yaml seemed incomplete, after changing ds_name to cocostuff to match evaluta.py code and adding ignore_backgound=False: The model is running on cuda 5000 Test: [ 0/5000] eta: 15:33:16 mIoU: 0.1095 (0.1095) time: 11.1993 data: 0.0974 max mem: 2309 Test: [ 1/5000] eta: 17:13:29 mIoU: 0.0000 (0.0548) time: 12.4043 data: 0.0495 max mem: 2341 Test: [ 2/5000] eta: 18:58:25 mIoU: 0.0000 (0.0365) time: 13.6666 data: 0.0335 max mem: 2375 Test: [ 3/5000] eta: 18:19:22 mIoU: 0.1178 (0.0568) time: 13.2004 data: 0.0255 max mem: 2375 Test: [ 4/5000] eta: 18:40:27 mIoU: 0.8393 (0.2133) time: 13.4562 data: 0.0207 max mem: 2375 Test: [ 5/5000] eta: 18:32:36 mIoU: 0.0000 (0.1778) time: 13.3646 data: 0.0174 max mem: 2375 Test: [ 6/5000] eta: 18:14:13 mIoU: 0.1357 (0.1718) time: 13.1464 data: 0.0151 max mem: 2375 Test: [ 7/5000] eta: 18:22:25 mIoU: 0.1268 (0.1661) time: 13.2477 data: 0.0134 max mem: 2375 Test: [ 8/5000] eta: 18:40:04 mIoU: 0.6354 (0.2183) time: 13.4625 data: 0.0121 max mem: 2375 Test: [ 9/5000] eta: 18:41:37 mIoU: 0.0000 (0.1965) time: 13.4837 data: 0.0110 max mem: 2375 Test: [ 10/5000] eta: 18:36:35 mIoU: 0.7929 (0.2507) time: 13.4260 data: 0.0101 max mem: 2375 Test: [ 11/5000] eta: 18:42:39 mIoU: 0.3038 (0.2551) time: 13.5016 data: 0.0093 max mem: 2375 Test: [ 12/5000] eta: 18:54:21 mIoU: 0.0000 (0.2355) time: 13.6451 data: 0.0087 max mem: 2375 Traceback (most recent call last): File "/home/Clip_as_RNN/evaluate.py", line 511, in main(args) File "/home/Clip_as_RNN/evaluate.py", line 499, in main evaluate( File "/home/Clip_as_RNN/evaluate.py", line 325, in evaluate label_pred = eval_semantic( File "/home/Clip_as_RNN/evaluate.py", line 163, in eval_semantic all_masks, scores = inference_car( File "/home/Clip_as_RNN/utils/inference_pipeline.py", line 76, in inference_car masks, scores = car_model(img, sentences) File "/root/miniconda3/envs/car0/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/root/miniconda3/envs/car0/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl return forward_call(args, *kwargs) File "/home/Clip_as_RNN/modeling/model/car.py", line 317, in forward pseudo_masks, conf_scores = self._forward_car(im_ori, text) File "/home/Clip_as_RNN/modeling/model/car.py", line 308, in _forward_car final_predicted_masks = torch.zeros(len(text), refined_masks[0].shape) IndexError: index 0 is out of bounds for dimension 0 with size 0

and I found that this error is also reported for other data sets, and it is reported during the evaluate phase(VOC:320/1449)

kevin-ssy commented 3 months ago

Thank you for your feedback.

There are several bugs to be fixed:

  1. In the config file config/coco.yaml, you need to add ignore_background: False at line 50 under the parent attribute test

  2. In the file evaluate.py, line 81 and line 264, replace cocostuff to coco

  3. In the file modeling/model/car.py, add the following after line 296:

    if len(refined_masks) != len(mask_proposals):
      refined_masks = mask_proposals

Thank you for pointing this out. We will try to fix that in the original codebase ASAP.

Apology for any inconvenience.

Kevin