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

Issue with Instance and Panoptic labels using Panoptic deeplab model #5222

Open
similalwani opened this issue Feb 22, 2024 · 1 comment
Open

Comments

@similalwani
Copy link

similalwani commented Feb 22, 2024

Instructions To Reproduce the Issue:

Modified the colab notebook tutorial from detectron2 in the following way to create panoptic labels using panoptic deeplab model under the directory detectron2/projects for a custom dataset. When I used the Panoptic FPN model from the model zoo, it gives me correct labels but when I use the panoptic deeplab model (link in the code below), there are 2 issues:

  1. For 3 out of 10 images, the code below gives a key error for 'instances'.
  2. The panoptic labels obtained have the 'pred' tuple values as 8000, 2000, etc and the segments_info is null when it shouldn't be so. (refer this: https://detectron2.readthedocs.io/en/latest/tutorials/models.html#model-output-format)

Changes I made to reproduce issue:

        cfg = get_cfg()
        from detectron2.projects.panoptic_deeplab import add_panoptic_deeplab_config  
        add_panoptic_deeplab_config(cfg)
        # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library
        cfg.merge_from_file("detectron2/projects/Panoptic-DeepLab/configs/Cityscapes-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024.yaml")
        cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5  # set threshold for this model
        # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well
        cfg.MODEL.WEIGHTS = 'Desktop/detectron2/model_final_bd324a.pkl'
        predictor = DefaultPredictor(cfg)

Environment:

Pasting the output of the following command:

wget -nc -nv https://github.com/facebookresearch/detectron2/raw/main/detectron2/utils/collect_env.py && python collect_env.py

sys.platform                     linux
Python                           3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0]
numpy                            1.24.3
detectron2                       0.6 @Desktop/detectron2/detectron2
Compiler                         GCC 9.4
CUDA compiler                    CUDA 12.3
detectron2 arch flags            Desktop/detectron2/detectron2/_C.cpython-38-x86_64-linux-gnu.so; cannot find cuobjdump
DETECTRON2_ENV_MODULE            <not set>
PyTorch                          2.2.0+cu118 @/tools/miniconda3/envs/panoptic/lib/python3.8/site-packages/torch
PyTorch debug build              False
torch._C._GLIBCXX_USE_CXX11_ABI  False
GPU available                    Yes
GPU 0,1,2,3                      NVIDIA H100 PCIe (arch=9.0)
Driver version                   535.86.05
CUDA_HOME                        /tools/miniconda3/envs/panoptic
Pillow                           10.2.0
torchvision                      0.17.0+cu118 @/tools/miniconda3/envs/panoptic/lib/python3.8/site-packages/torchvision
torchvision arch flags           /tools/miniconda3/envs/panoptic/lib/python3.8/site-packages/torchvision/_C.so; cannot find cuobjdump
fvcore                           0.1.5.post20221221
iopath                           0.1.9
cv2                              4.6.0
-------------------------------  ----------------------------------------------------------------------------------------------------
PyTorch built with:
  - GCC 9.3
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.3.2 (Git Hash 2dc95a2ad0841e29db8b22fbccaf3e5da7992b01)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX512
  - CUDA Runtime 11.8
  - NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_90,code=sm_90
  - CuDNN 8.7
  - Magma 2.6.1
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.2.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

Please help solve this!

@similalwani similalwani changed the title Instance and Panoptic labels issue Issue with Instance and Panoptic labels using Panoptic deeplab model Feb 22, 2024
@Programmer-RD-AI
Copy link
Contributor

Hi,
For the given issues check the following..

  1. Keyerror : 'image_id'; while evaluation of Custom Dataset with CocoEvaluator() #2431
  2. If segments_info is None, all pixel values in pred must be ≥ -1. Pixels with value -1 are assigned void labels. Otherwise, the category id of each pixel is obtained by category_id = pixel // metadata.label_divisor.

and when merging from file add cfg.set_new_allowed(True)

Thank you...

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