Official code of the paper "Expanding Low-Density Latent Regions for Open-Set Object Detection" (CVPR 2022)

Overview

OpenDet

Expanding Low-Density Latent Regions for Open-Set Object Detection (CVPR2022)
Jiaming Han, Yuqiang Ren, Jian Ding, Xingjia Pan, Ke Yan, Gui-Song Xia.
arXiv preprint.

OpenDet2: OpenDet is implemented based on detectron2.

Setup

The code is based on detectron2 v0.5.

  • Installation

Here is a from-scratch setup script.

conda create -n opendet2 python=3.8 -y
conda activate opendet2

conda install pytorch=1.8.1 torchvision cudatoolkit=10.1 -c pytorch -y
pip install detectron2==0.5 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.8/index.html
git clone https://github.com/csuhan/opendet2.git
cd opendet2
pip install -v -e .
  • Prepare datasets

Please follow datasets/README.md for dataset preparation. Then we generate VOC-COCO datasets.

bash datasets/opendet2_utils/prepare_openset_voc_coco.sh
# using data splits provided by us.
cp datasets/voc_coco_ann datasets/voc_coco -rf

Model Zoo

We report the results on VOC and VOC-COCO-20, and provide pretrained models. Please refer to the corresponding log file for full results.

  • Faster R-CNN
Method backbone mAPK↑(VOC) WI AOSE mAPK↑ APU↑ Download
FR-CNN R-50 80.06 19.50 16518 58.36 0 config model
PROSER R-50 79.42 20.44 14266 56.72 16.99 config model
ORE R-50 79.80 18.18 12811 58.25 2.60 config model
DS R-50 79.70 16.76 13062 58.46 8.75 config model
OpenDet R-50 80.02 12.50 10758 58.64 14.38 config model
OpenDet Swin-T 83.29 10.76 9149 63.42 16.35 config model
  • RetinaNet
Method mAPK↑(VOC) WI AOSE mAPK↑ APU↑ Download
RetinaNet 79.63 14.16 36531 57.32 0 config model
Open-RetinaNet 79.64 10.74 17208 57.32 10.55 config model

Note:

  • You can also download the pre-trained models at github release or BaiduYun with extracting code ABCD.
  • The above results are reimplemented. Therefore, they are slightly different from our paper.
  • The official code of ORE is at OWOD. So we do not plan to include ORE in our code.

Online Demo

Try our online demo at huggingface space.

Train and Test

  • Testing

First, you need to download pretrained weights in the model zoo, e.g., OpenDet.

Then, run the following command:

python tools/train_net.py --num-gpus 8 --config-file configs/faster_rcnn_R_50_FPN_3x_opendet.yaml \
        --eval-only MODEL.WEIGHTS output/faster_rcnn_R_50_FPN_3x_opendet/model_final.pth
  • Training

The training process is the same as detectron2.

python tools/train_net.py --num-gpus 8 --config-file configs/faster_rcnn_R_50_FPN_3x_opendet.yaml

To train with the Swin-T backbone, please download swin_tiny_patch4_window7_224.pth and convert it to detectron2's format using tools/convert_swin_to_d2.py.

wget https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth
python tools/convert_swin_to_d2.py swin_tiny_patch4_window7_224.pth swin_tiny_patch4_window7_224_d2.pth

Citation

If you find our work useful for your research, please consider citing:

@InProceedings{han2022opendet,
    title     = {Expanding Low-Density Latent Regions for Open-Set Object Detection},
    author    = {Han, Jiaming and Ren, Yuqiang and Ding, Jian and Pan, Xingjia and Yan, Ke and Xia, Gui-Song},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    year      = {2022}
}
Comments
  • 关于论文中图2 tsne可视化的问题 ’

    关于论文中图2 tsne可视化的问题 ’

    @csuhan 您好,我想请教论文中的一个点。 Figure 2. t-SNE visualization of latent features. 这里提到彩色的点是VOC类别(已知),而黑色三角点则是非VOC类别(未知,取自COCO)

    在您的工作中,您将未知类别设定为数量为1的1个类别(而不是更多数量),这样训出来的模型,我们就很自然地认为,未知类别也会聚成一个簇,就像图2 (b)中一样。同时还有一些离散点,分散在各个已知类别簇中。

    但是实际上来看,1个未知类别,它应该蕴含了众多潜在的类别,例如COCO类别数量-VOC类别数量=80-20=60,也就是1个未知类别可能就蕴含了潜在的60个类别。而将60个类别的特征聚集在了一起,形成了图2 (b),这是不是有点奇怪?也就是想问,只有1个未知类的类中心,是不是不太合理?

    想请教您的看法,谢谢!

    opened by ChibisukeDragon 4
  • Question about loss_cls_ic

    Question about loss_cls_ic

    Nice job! I am trying to reproduce your work. But I find that loss_cls_ic is 0 for most of the time after the training started. Is it normal? (I set batch_size=4 because of the limited computational resources.) Thanks.

    opened by Yifei-Y 3
  • error: Multiple top-level packages discovered in a flat-layout: ['demo', 'configs', 'opendet2', 'datasets', 'detectron2'].

    error: Multiple top-level packages discovered in a flat-layout: ['demo', 'configs', 'opendet2', 'datasets', 'detectron2'].

    When I followed the README to install opendet2, I got some trouble. Here is my command. I have several rtx3090 gpus.

    # CUDA V11.1
    # torch 1.9.0
    # python 3.8
    conda create -n opendet2 python=3.8 -y
    conda activate opendet2
    # get pytorch 1.9.0. I got RuntimeError: CUDA error: device-side assert triggered when using torch 1.8.1
    pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
    # build opencv
    pip install opencv-python
    pip install opencv-contrib-python
    # build detectron2. DO NOT build detectron2 from latest SOURCE. In the latest version, some named methods have been removed.
    pip install detectron2==0.5 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html
    # build opendet2
    cd opendet2
    pip install -v -e .
    

    When I run the last command pip install -v -e ., I got these error message:

    (opendet2) yupeng@ubuntu:~/opendet/opendet2$ pip install -v -e .
    Using pip 21.2.4 from /home/yupeng/anaconda3/envs/opendet2/lib/python3.8/site-packages/pip (python 3.8)
    Looking in indexes: https://mirrors.bfsu.edu.cn/pypi/web/simple/
    Obtaining file:///home/yupeng/opendet/opendet2
        Running command python setup.py egg_info
        error: Multiple top-level packages discovered in a flat-layout: ['demo', 'configs', 'opendet2', 'datasets', 'detectron2'].
    
        To avoid accidental inclusion of unwanted files or directories,
        setuptools will not proceed with this build.
    
        If you are trying to create a single distribution with multiple packages
        on purpose, you should not rely on automatic discovery.
        Instead, consider the following options:
    
        1. set up custom discovery (`find` directive with `include` or `exclude`)
        2. use a `src-layout`
        3. explicitly set `py_modules` or `packages` with a list of names
    
        To find more information, look for "package discovery" on setuptools docs.
    WARNING: Discarding file:///home/yupeng/opendet/opendet2. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    (opendet2) yupeng@ubuntu:~/opendet/opendet2$
    

    I could use pip install setuptools==58.2.0 and retry pip install -v -e ., then everything is fine. It seems there are some problems by using the lateset setuptools>=61.0. Maybe you can find more information in the link below: https://github.com/pypa/setuptools/issues/3197 https://github.com/pypa/setuptools/issues/3227 https://github.com/facebookresearch/detectron2/issues/3943 https://github.com/facebookresearch/detectron2/issues/3811 Good luck.

    opened by ChibisukeDragon 2
  • 8GPU训练发生死锁

    8GPU训练发生死锁

    使用基本的resnet backbone的faster rcnn会发生死锁。我简单的把Base_RCNN_FPN.yaml换成了detectron2中的Base_RCNN_C4.yaml。 使用readme中示例代码训练时卡在训练第一个batch的地方,GPU占用率100%,但是显存只占了2400M,一夜过去14小时还是卡在该位置,没有任何输出或报错。改为单GPU训练正常,可以提供一些帮助吗?

    opened by buaali 0
  • CUDA error: device-side assert triggered

    CUDA error: device-side assert triggered

    When I run train_net.py, I get this issue after loading R-50.pkl. I want to know how to solve that. Thanks a lot. My environment: CUDA 11.1, python 3.7, torch 1.8.1

    opened by Millielele 0
  • 对bias参数weight_decay的处理

    对bias参数weight_decay的处理

    opendet2/solver/build.py line 39: 注释和代码不符,注释中bias的weight_decay为默认值,实际代码中被设为None,导致以下错误: TypeError: add(): argument 'alpha' must be Number, not NoneType

    opened by sunxuhao 2
  • Reproducibility issue

    Reproducibility issue

    Hi,

    Amazing work on open-set detection! I trained the model after doing the dataset separation steps you suggest, and with exact same configs. The only difference is that I used 1 GPU instead of 8 GPUs, and these are the results I obtained. Interestingly, WI and AOSE metrics are worse, but AP is better. Do you think this much difference is expected just from using fewer GPUs, or is there some other issue I need to look for? Thanks in advance.

    VOC-COCO-20 Result | WI ↓ | AOSE ↓ | AP u↑ -- | -- | -- | -- Paper | 14.95 | 11286 | 14.93 Reproduced | 20.68 | 13370 | 21.36

    VOC-COCO-0.5n Result | WI ↓ | AOSE ↓ | AP u↑ -- | -- | -- | -- Paper | 6.44 | 3944 | 9.05 Reproduced | 55 | 5369 | 18.09

    opened by misraya 3
  • Running command python setup.py egg_info     error: Multiple top-level packages discovered in a flat-layout: ['data', 'engine', 'solver', 'config', 'modeling', 'evaluation'].

    Running command python setup.py egg_info error: Multiple top-level packages discovered in a flat-layout: ['data', 'engine', 'solver', 'config', 'modeling', 'evaluation'].

    Running command python setup.py egg_info error: Multiple top-level packages discovered in a flat-layout: ['data', 'engine', 'solver', 'config', 'modeling', 'evaluation'].

    opened by roywang021 1
[CVPR 2022] Official code for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration"

MDCA Calibration This is the official PyTorch implementation for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved

MDCA Calibration 21 Dec 22, 2022
Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".

nvdiffrec Joint optimization of topology, materials and lighting from multi-view image observations as described in the paper Extracting Triangular 3D

NVIDIA Research Projects 1.4k Jan 1, 2023
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 2022
The 7th edition of NTIRE: New Trends in Image Restoration and Enhancement workshop will be held on June 2022 in conjunction with CVPR 2022.

NTIRE 2022 - Image Inpainting Challenge Important dates 2022.02.01: Release of train data (input and output images) and validation data (only input) 2

Andrés Romero 37 Nov 27, 2022
Official Implementation of CVPR 2022 paper: "Mimicking the Oracle: An Initial Phase Decorrelation Approach for Class Incremental Learning"

(CVPR 2022) Mimicking the Oracle: An Initial Phase Decorrelation Approach for Class Incremental Learning ArXiv This repo contains Official Implementat

Yujun Shi 24 Nov 1, 2022
Official PyTorch implementation of the paper "Deep Constrained Least Squares for Blind Image Super-Resolution", CVPR 2022.

Deep Constrained Least Squares for Blind Image Super-Resolution [Paper] This is the official implementation of 'Deep Constrained Least Squares for Bli

MEGVII Research 141 Dec 30, 2022
Official repository for the paper "Self-Supervised Models are Continual Learners" (CVPR 2022)

Self-Supervised Models are Continual Learners This is the official repository for the paper: Self-Supervised Models are Continual Learners Enrico Fini

Enrico Fini 73 Dec 18, 2022
Official implementation of the paper 'Details or Artifacts: A Locally Discriminative Learning Approach to Realistic Image Super-Resolution' in CVPR 2022

LDL Paper | Supplementary Material Details or Artifacts: A Locally Discriminative Learning Approach to Realistic Image Super-Resolution Jie Liang*, Hu

null 150 Dec 26, 2022
Sound-guided Semantic Image Manipulation - Official Pytorch Code (CVPR 2022)

?? Sound-guided Semantic Image Manipulation (CVPR2022) Official Pytorch Implementation Sound-guided Semantic Image Manipulation IEEE/CVF Conference on

CVLAB 58 Dec 28, 2022
[CVPR 2022] Official Pytorch code for OW-DETR: Open-world Detection Transformer

OW-DETR: Open-world Detection Transformer (CVPR 2022) [Paper] Akshita Gupta*, Sanath Narayan*, K J Joseph, Salman Khan, Fahad Shahbaz Khan, Mubarak Sh

Akshita Gupta 127 Dec 27, 2022
Official source code of Fast Point Transformer, CVPR 2022

Fast Point Transformer Project Page | Paper This repository contains the official source code and data for our paper: Fast Point Transformer Chunghyun

null 182 Dec 23, 2022
This is the formal code implementation of the CVPR 2022 paper 'Federated Class Incremental Learning'.

Official Pytorch Implementation for GLFC [CVPR-2022] Federated Class-Incremental Learning This is the official implementation code of our paper "Feder

Race Wang 57 Dec 27, 2022
Code for our CVPR 2022 Paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection"

GEN-VLKT Code for our CVPR 2022 paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection". Contributed by Yue Lia

Yue Liao 47 Dec 4, 2022
This is the code for the paper "Jinkai Zheng, Xinchen Liu, Wu Liu, Lingxiao He, Chenggang Yan, Tao Mei: Gait Recognition in the Wild with Dense 3D Representations and A Benchmark. (CVPR 2022)"

Gait3D-Benchmark This is the code for the paper "Jinkai Zheng, Xinchen Liu, Wu Liu, Lingxiao He, Chenggang Yan, Tao Mei: Gait Recognition in the Wild

null 82 Jan 4, 2023
Official implementation of "Can You Spot the Chameleon? Adversarially Camouflaging Images from Co-Salient Object Detection" in CVPR 2022.

Jadena Official implementation of "Can You Spot the Chameleon? Adversarially Camouflaging Images from Co-Salient Object Detection" in CVPR 2022. arXiv

Qing Guo 13 Nov 29, 2022
Official Pytorch implementation of "Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes", CVPR 2022

Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes / 3DCrowdNet News ?? 3DCrowdNet achieves the state-of-the-art accuracy on 3D

Hongsuk Choi 113 Dec 21, 2022
Commonality in Natural Images Rescues GANs: Pretraining GANs with Generic and Privacy-free Synthetic Data - Official PyTorch Implementation (CVPR 2022)

Commonality in Natural Images Rescues GANs: Pretraining GANs with Generic and Privacy-free Synthetic Data (CVPR 2022) Potentials of primitive shapes f

null 31 Sep 27, 2022
Official implementation for "QS-Attn: Query-Selected Attention for Contrastive Learning in I2I Translation" (CVPR 2022)

QS-Attn: Query-Selected Attention for Contrastive Learning in I2I Translation (CVPR2022) https://arxiv.org/abs/2203.08483 Unpaired image-to-image (I2I

Xueqi Hu 50 Dec 16, 2022
Official pytorch implementation for Learning to Listen: Modeling Non-Deterministic Dyadic Facial Motion (CVPR 2022)

Learning to Listen: Modeling Non-Deterministic Dyadic Facial Motion This repository contains a pytorch implementation of "Learning to Listen: Modeling

null 50 Dec 17, 2022