bowenc0221 / panoptic-deeplab

This is Pytorch re-implementation of our CVPR 2020 paper "Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation" (https://arxiv.org/abs/1911.10194)
Apache License 2.0
585 stars 117 forks source link

Demo.py not working #123

Open shashank288 opened 1 year ago

shashank288 commented 1 year ago

Hi team,

I am trying to set up the codebase in my system and I have installed the necessary requirements as mentioned in the readme section of this repository.

ISSUE 1:-

However, whenever I am trying to run the demo.py file (with webcam operation enabled) from the root folder of the repo. I am getting the following error:-

Command used :- `python tools_d2\demo.py --config-file C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Re po\panoptic-deeplab\configs\panoptic_deeplab_R101_os32_cityscapes.yaml --webcam

Command prompt output :-

`Traceback (most recent call last): File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\tools_d2\demo.py", line 14, in from d2.predictor import VisualizationDemo File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\tools_d2\d2__init__.py", line 1, in from .backbone import d2_xception_65 File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\tools_d2\d2\backbone.py", line 7, in from segmentation.config.hrnet_config import MODEL_CONFIGS as HRNET_DEFAULT_CONFIGS ModuleNotFoundError: No module named 'segmentation'

ISSUE 2:-

When I try to work around the first issue by commenting out the import:- from .backbone import d2_xception_65 in the __init__.py file present in _toolsd2/d2, I get the following error:-

Command used :- `python tools_d2\demo.py --config-file C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Re po\panoptic-deeplab\configs\panoptic_deeplab_R101_os32_cityscapes.yaml --webcam

[12/23 00:43:43 detectron2]: Arguments: Namespace(config_file='C:\\EDS\\Current_tasks\\POC\\Panoptic_segmentation_GT_generator\\Repo\\panoptic-deeplab\\configs\\panoptic_deeplab_R101_os32 _cityscapes.yaml', webcam=True, video_input=None, input=None, output=None, confidence_threshold=0.5, opts=[]) WARNING [12/23 00:43:43 d2.config.compat]: Config 'C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\configs\panoptic_deeplab_R101_os32_cityscapes.yaml' ha s no VERSION. Assuming it to be compatible with latest v2. Traceback (most recent call last): File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\tools_d2\demo.py", line 80, in <module> cfg = setup_cfg(args) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\tools_d2\demo.py", line 26, in setup_cfg cfg.merge_from_file(args.config_file) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\venv\lib\site-packages\detectron2\config\config.py", line 69, in merge_from_file self.merge_from_other_cfg(loaded_cfg) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\venv\lib\site-packages\fvcore\common\config.py", line 132, in merge_from_other_cfg return super().merge_from_other_cfg(cfg_other) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\venv\lib\site-packages\yacs\config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\venv\lib\site-packages\yacs\config.py", line 478, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "C:\EDS\Current_tasks\POC\Panoptic_segmentation_GT_generator\Repo\panoptic-deeplab\venv\lib\site-packages\yacs\config.py", line 491, in _merge_a_into_b raise KeyError("Non-existent config key: {}".format(full_key)) KeyError: 'Non-existent config key: MODEL.BN_MOMENTUM' This issue occurs with all the configuration files present in ROOT/configs folder.

Could someone please help me troubleshoot these issues ? Thanks in advance đŸ˜€.

wowo0709 commented 1 year ago

Hi. I want to share a simple solution about ISSUE1 with the writer or potential users who encountered this issue.

The reason why ISSUE1 occurs is the segmentation folder(or package) isn't added to the Python path.

You can simply insert a line import _init_paths before importing segmentation module at panoptic-deeplab\tools_d2\d2\backbone.py file.

I hope this simple solution could help you guys. Thanks.