detectron2: Error on run demo.py for Panoptic-DeepLab
Hello,
I tested the projet “Panoptic-DeepLab” by using demo.py (changed “import add_panoptic_deeplab_config, setting config” ) but I got error like below.
------------------------ log ----------------------------------------------------------------------
sem_seg_head.predictor.{bias, weight}
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File “demopan.py”, line 92, in <module>
predictions, visualized_output = demo.run_on_image(img)
File “/home/appuser/detectron2/demo/predictor.py”, line 48, in run_on_image
predictions = self.predictor(image)
File “/home/appuser/detectron2/detectron2/engine/defaults.py”, line 217, in call
predictions = self.model([inputs])[0]
File “/home/appuser/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “/home/appuser/detectron2/projects/Panoptic-DeepLab/panoptic_deeplab/panoptic_seg.py”, line 104, in forward
sem_seg_results, sem_seg_losses = self.sem_seg_head(features, targets, weights)
File “/home/appuser/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “/home/appuser/detectron2/projects/Panoptic-DeepLab/panoptic_deeplab/panoptic_seg.py”, line 301, in forward
y = self.layers(features)
File “/home/appuser/detectron2/projects/Panoptic-DeepLab/panoptic_deeplab/panoptic_seg.py”, line 312, in layers
y = super().layers(features)
File “/home/appuser/detectron2/projects/DeepLab/deeplab/semantic_seg.py”, line 221, in layers
proj_x = self.decoder[f]“project_conv”
File “/home/appuser/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “/home/appuser/detectron2/detectron2/layers/aspp.py”, line 114, in forward
“Input size: {} pool_kernel_size: {}”.format(size, self.pool_kernel_size)
ValueError: pool_kernel_size must be divisible by the shape of inputs. Input size: torch.Size([64, 114]) pool_kernel_size: (32, 64)
…
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (7 by maintainers)
@charlescho64 @soldierofhell
I tested with some random images online and could not reproduce your issue. This image below is not a Cityscapes image and Panoptic-DeepLab gives reasonable predictions.
The command I’m using:
python demo/demo.py --config-file projects/Panoptic-DeepLab/configs/Cityscapes-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024_dsconv.yaml --input output/8-Figure1-1.png --output output/demo --opts MODEL.WEIGHTS models/model_final_23d03a.pklNote that I did not set
INPUT.CROP.ENABLED False, instead I uncommented these lines in ASPP:I haven’t tried setting
INPUT.CROP.ENABLED False. But Cityscapes is a dataset with high-resolution images, so I’m not sure if the model generalizes well to low-resolution inputs.https://github.com/facebookresearch/detectron2/blob/f71d8458e7fb9a45bf46518e8371bef5a8afb93e/detectron2/layers/aspp.py#L131-L136
I further tested with COCO pre-trained model, and it also works
Uncomment these two lines: https://github.com/facebookresearch/detectron2/blob/5c9e0d9595316ce3447612a4ce1f602911bde2b7/demo/demo.py#L23-L25