dvlab-research / PanopticFCN

Fully Convolutional Networks for Panoptic Segmentation (CVPR2021 Oral)
Apache License 2.0
393 stars 53 forks source link

Using the demo/demo.py #17

Closed mikkkeldp closed 3 years ago

mikkkeldp commented 3 years ago

Hi,

Could I please get some additional guidance as to how to infer on a directory of images?

I saw another issue where someone advised to do the following in demo.py: From

# To use demo for Panoptic-DeepLab, please uncomment the following two lines.
# from detectron2.projects.panoptic_deeplab import add_panoptic_deeplab_config  # noqa
# add_panoptic_deeplab_config(cfg)

To

from panopticfcn.config import add_panopticfcn_config  # noqa
add_panopticfcn_config(cfg)

This seem to work, but i get the following error:

Arguments: Namespace(confidence_threshold=0.5, config_file='/home/mikkel/Desktop/masters/detectron2/projects/PanopticFCN/configs/PanopticFCN-Star-R50-3x.yaml', input='/home/mikkel/Desktop/masters/detectron2/datasets/Flickr8k/69189650_6687da7280.jpg', opts=[], output='/home/mikkel/Desktop/masters/detectron2/datasets/Flickr8k_out/', video_input=None, webcam=False)
Traceback (most recent call last):
  File "demo/demo.py", line 165, in <module>
    demo = VisualizationDemo(cfg)
  File "/home/mikkel/Desktop/masters/detectron2/demo/predictor.py", line 35, in __init__
    self.predictor = DefaultPredictor(cfg)
  File "/home/mikkel/Desktop/masters/detectron2/detectron2/engine/defaults.py", line 283, in __init__
    self.model = build_model(self.cfg)
  File "/home/mikkel/Desktop/masters/detectron2/detectron2/modeling/meta_arch/build.py", line 22, in build_model
    model = META_ARCH_REGISTRY.get(meta_arch)(cfg)
  File "/home/mikkel/.local/lib/python3.8/site-packages/fvcore/common/registry.py", line 71, in get
    raise KeyError(
KeyError: "No object named 'PanopticFCN' found in 'META_ARCH' registry!"
yanwei-li commented 3 years ago

Hi, thanks for your interest! The main reason is that the module panopticfcn has not been registered in Detectron2. So, you can simply add "panopticfcn": "PanopticFCN" to path_to_detectron2/detectron2/projects/__init__.py. Then you can enjoy it by python3 demo/demo.py --config-file xxxx. Hope this could help you.

mikkkeldp commented 3 years ago

Hi,

Thanks for the reply, but I'm unfortunately still getting the same error as before. I'm running this as follows:

python3 demo/demo.py --config-file /home/mikkel/Desktop/masters/detectron2/projects/PanopticFCN/configs/PanopticFCN-Star-R50-3x.yaml --input /home/mikkel/Desktop/masters/detectron2/datasets/Flickr8k/69189650_6687da7280.jpg
yanwei-li commented 3 years ago

Hi, it works well for me, and I'm wondering whether the project works (train or inference) normally following the steps in README?

mikkkeldp commented 3 years ago

Hi, yes, I've done the inference and achieved the correct accuracies as in the paper. Do you have any other idea why this is not working?

mikkkeldp commented 3 years ago

Oh, I forgot to mention, when I import

from panopticfcn.config import add_panopticfcn_config  # noqa

it gives me

ModuleNotFoundError: No module named 'panopticfcn'

so I just manually added the add_panopticfcn_config to demo.py.

mikkkeldp commented 3 years ago

Nevermind, I'm stupid. Figured it out. Thanks for the help!

fatihyildiz-cs commented 3 years ago

I'm also getting the following error:

KeyError: "No object named 'PanopticFCN' found in 'META_ARCH' registry!"

Do you have a solution? Thanks