SHI-Labs / OneFormer

OneFormer: One Transformer to Rule Universal Image Segmentation, arxiv 2022 / CVPR 2023
https://praeclarumjj3.github.io/oneformer
MIT License
1.41k stars 128 forks source link

results by running demo.py inconsistent with the results on hugging face demo #60

Closed Cindy0725 closed 1 year ago

Cindy0725 commented 1 year ago

Hi,

I downloaded the two checkpoints and config files trained on coco dataset, and the results I can get are different (worse) from the results on the Hugging Face demo page.

This is the input image: img

This is the output from Hugging Face demo (task = panoptic, backbone = dinat, dataset = coco), the result is perfect: panoptic_coco_dinat

But I downloaded and run demo.py and set the corresponding checkpoint and config file for coco dataset (task = panoptic, backbone = dinat), the visulized output looks like this: demo_image2_coco_dinat_panoptic

Did I miss any pre or post-processings? Or I run the demo.py in a wrong way?

praeclarumjj3 commented 1 year ago

Hi @Cindy0725, thanks for your interest in our work. Are you sure you set the task as panoptic while running demo.py? Could you share the command that you executed? From your shared results, it seems the task is set to instance.

Cindy0725 commented 1 year ago

Hi, thank you very much for your quick reply! This is the command that I executed:

python demo.py --config-file '/home/zhangyicindy/Total3DUnderstanding/OneFormer/configs/coco/dinat/oneformer_dinat_large_bs16_100ep.yaml' --input '/home/zhangyicindy/Total3DUnderstanding/demo/inputs/2/img.jpg' --output /home/zhangyicindy/Total3DUnderstanding/OneFormer/output/demo_image2_coco_dinat_panoptic --task "panoptic" --opts MODEL.IS_TRAIN False MODEL.IS_DEMO True MODEL.WEIGHTS '/home/zhangyicindy/Total3DUnderstanding/OneFormer/150_16_dinat_l_oneformer_coco_100ep.pth'

praeclarumjj3 commented 1 year ago

Hi @Cindy0725, thanks for sharing the command. When you set task as panoptic, you would observe three results being saved inside the instance_inference, panoptic_inference and semantic_inference named directories. We visualize results for all three tasks when task=panoptic [Code]. Could you check?

FYI, I get the attached output (inside panoptic_inference) with the following command:

python demo/demo.py \
         --config-file configs/coco/dinat/oneformer_dinat_large_bs16_100ep.yaml \
         --input input.jpeg \
         --output demo_image2_coco_dinat_panoptic \
         --task panoptic \
         --opts MODEL.IS_TRAIN False MODEL.IS_DEMO True MODEL.WEIGHTS 150_16_dinat_l_oneformer_coco_100ep.pth

demo_image2_coco_dinat_panoptic

Cindy0725 commented 1 year ago

Thank you very much for your help! It now works, I think the problem comes from the output path I give. When I use the original output path, the instance_inference, panoptic_inference and semantic_inference directories are empty. When I change to your command, it works well. Thanks again and have a nice day!