Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo.py not working #123

Open
shashank288 opened this issue Dec 23, 2022 · 1 comment
Open

Demo.py not working #123

shashank288 opened this issue Dec 23, 2022 · 1 comment

Comments

@shashank288
Copy link

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 tools_d2/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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants