facebookresearch / Mask2Former

Code release for "Masked-attention Mask Transformer for Universal Image Segmentation"
MIT License
2.56k stars 385 forks source link

How to solve:UnboundLocalError: local variable 'height' referenced before assignment #86

Open fxooooooooo opened 2 years ago

fxooooooooo commented 2 years ago

(mask2former) lin@lin:~/Desktop/Mask2Former-main/demo_video$ python demo.py --config-file /home/lin/Desktop/Mask2Former-main/configs/youtubevis_2021/video_maskformer2_R50_bs16_8ep.yaml --video-input 2.mp4 --opts MODEL.WEIGHTS /home/lin/Desktop/Mask2Former-main/ckpts/model_final_b8aae2.pkl [04/18 14:27:29 detectron2]: Arguments: Namespace(confidence_threshold=0.5, config_file='/home/lin/Desktop/Mask2Former-main/configs/youtubevis_2021/video_maskformer2_R50_bs16_8ep.yaml', input=None, opts=['MODEL.WEIGHTS', '/home/lin/Desktop/Mask2Former-main/ckpts/model_final_b8aae2.pkl'], output=None, save_frames=False, video_input='2.mp4') [04/18 14:27:31 fvcore.common.checkpoint]: [Checkpointer] Loading from /home/lin/Desktop/Mask2Former-main/ckpts/model_final_b8aae2.pkl ... [04/18 14:27:31 fvcore.common.checkpoint]: Reading a file from 'MaskFormer Model Zoo' Traceback (most recent call last): File "demo.py", line 172, in predictions, visualized_output = demo.run_on_video(vid_frames) File "/home/lin/Desktop/Mask2Former-main/demo_video/predictor.py", line 51, in run_on_video predictions = self.predictor(frames) File "/home/lin/Desktop/Mask2Former-main/demo_video/predictor.py", line 116, in call inputs = {"image": input_frames, "height": height, "width": width} UnboundLocalError: local variable 'height' referenced before assignment

My device:single GPU 2080Ti

bowenc0221 commented 2 years ago

Can you check if input frames are empty: https://github.com/facebookresearch/Mask2Former/blob/c233619f7ea011cd565174a1b211bde1f43e38db/demo_video/predictor.py#L105