TRI-ML / realtime_panoptic

Official PyTorch implementation of CVPR 2020 Oral: Real-Time Panoptic Segmentation from Dense Detections
MIT License
115 stars 25 forks source link

cannot reshape array of size 1077804 into shape (375,1242,3) when running demo.py #8

Closed sarimmehdi closed 4 years ago

sarimmehdi commented 4 years ago

Hello. I get this error:

Traceback (most recent call last):
  File "/home/sarim/PycharmProjects/trajectory_prediction/realtime_panoptic/scripts/demo.py", line 100, in <module>
    demo()
  File "/home/sarim/PycharmProjects/trajectory_prediction/realtime_panoptic/scripts/demo.py", line 91, in demo
    seg_vis = visualize_segmentation_image(semseg_prob[0], input_image, cityscapes_colormap)
  File "/home/sarim/PycharmProjects/trajectory_prediction/realtime_panoptic/realtime_panoptic/utils/visualization.py", line 132, in visualize_segmentation_image
    colored_predictions_numpy = colored_predictions_numpy.reshape(original_image_height, original_image_width, 3)
ValueError: cannot reshape array of size 1077804 into shape (375,1242,3)

Process finished with exit code 1

When I run demo.py. The instance segmentations (with bounding boxes) are drawn correctly but the model fails for panoptic segmentations. Please tell me what could be wrong here, thank you!

sarimmehdi commented 4 years ago

Edit: I fixed the error by replacing this line: https://github.com/TRI-ML/realtime_panoptic/blob/97ee03657c82b19a628f52764703cb1c693d08a0/realtime_panoptic/models/rt_pano_net.py#L126

With this: downsampled_level = math.ceil(images.tensors[0].shape[-1] / semantic_logits.shape[-1])