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) [email protected]:~/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) [email protected]:~/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
Cascaded Deep Video Deblurring Using Temporal Sharpness Prior and Non-local Spatial-Temporal Similarity

This repository is the official PyTorch implementation of Cascaded Deep Video Deblurring Using Temporal Sharpness Prior and Non-local Spatial-Temporal Similarity

hippopmonkey 4 Dec 11, 2022
Convnext-tf - Unofficial tensorflow keras implementation of ConvNeXt

ConvNeXt Tensorflow This is unofficial tensorflow keras implementation of ConvNe

29 Oct 06, 2022
Implementation of the "PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences" paper.

PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences Introduction Point cloud sequences are irregular and unordered in the spatial dimen

Hehe Fan 63 Dec 09, 2022
Scalable, event-driven, deep-learning-friendly backtesting library

...Minimizing the mean square error on future experience. - Richard S. Sutton BTGym Scalable event-driven RL-friendly backtesting library. Build on

Andrew 922 Dec 27, 2022
Rlmm blender toolkit - A set of tools to streamline level generation in UDK straight from Blender

rlmm_blender_toolkit A set of tools to streamline level generation in UDK straig

Rocket League Mapmaking 0 Jan 15, 2022
Code for: Gradient-based Hierarchical Clustering using Continuous Representations of Trees in Hyperbolic Space. Nicholas Monath, Manzil Zaheer, Daniel Silva, Andrew McCallum, Amr Ahmed. KDD 2019.

gHHC Code for: Gradient-based Hierarchical Clustering using Continuous Representations of Trees in Hyperbolic Space. Nicholas Monath, Manzil Zaheer, D

Nicholas Monath 35 Nov 16, 2022
Python code for loading the Aschaffenburg Pose Dataset.

Aschaffenburg Pose Dataset (APD) This repository contains Python code for loading and filtering the Aschaffenburg Pose Dataset. The dataset itself and

1 Nov 26, 2021
Bayesian dessert for Lasagne

Gelato Bayesian dessert for Lasagne Recent results in Bayesian statistics for constructing robust neural networks have proved that it is one of the be

Maxim Kochurov 84 May 11, 2020
DCGAN-tensorflow - A tensorflow implementation of Deep Convolutional Generative Adversarial Networks

DCGAN in Tensorflow Tensorflow implementation of Deep Convolutional Generative Adversarial Networks which is a stabilize Generative Adversarial Networ

Taehoon Kim 7.1k Dec 29, 2022
EgoNN: Egocentric Neural Network for Point Cloud Based 6DoF Relocalization at the City Scale

EgonNN: Egocentric Neural Network for Point Cloud Based 6DoF Relocalization at the City Scale Paper: EgoNN: Egocentric Neural Network for Point Cloud

19 Sep 20, 2022
Multivariate Time Series Forecasting with efficient Transformers. Code for the paper "Long-Range Transformers for Dynamic Spatiotemporal Forecasting."

Spacetimeformer Multivariate Forecasting This repository contains the code for the paper, "Long-Range Transformers for Dynamic Spatiotemporal Forecast

QData 440 Jan 02, 2023
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 01, 2023
A map update dataset and benchmark

MUNO21 MUNO21 is a dataset and benchmark for machine learning methods that automatically update and maintain digital street map datasets. Previous dat

16 Nov 30, 2022
[2021][ICCV][FSNet] Full-Duplex Strategy for Video Object Segmentation

Full-Duplex Strategy for Video Object Segmentation (ICCV, 2021) Authors: Ge-Peng Ji, Keren Fu, Zhe Wu, Deng-Ping Fan*, Jianbing Shen, & Ling Shao This

Daniel-Ji 55 Dec 22, 2022
MegEngine implementation of YOLOX

Introduction YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and ind

旷视天元 MegEngine 77 Nov 22, 2022
Offcial repository for the IEEE ICRA 2021 paper Auto-Tuned Sim-to-Real Transfer.

Offcial repository for the IEEE ICRA 2021 paper Auto-Tuned Sim-to-Real Transfer.

47 Jun 30, 2022
Implementation of "Generalizable Neural Performer: Learning Robust Radiance Fields for Human Novel View Synthesis"

Generalizable Neural Performer: Learning Robust Radiance Fields for Human Novel View Synthesis Abstract: This work targets at using a general deep lea

163 Dec 14, 2022
Fully Convolutional DenseNets for semantic segmentation.

Introduction This repo contains the code to train and evaluate FC-DenseNets as described in The One Hundred Layers Tiramisu: Fully Convolutional Dense

485 Nov 26, 2022
Procedural 3D data generation pipeline for architecture

Synthetic Dataset Generator Authors: Stanislava Fedorova Alberto Tono Meher Shashwat Nigam Jiayao Zhang Amirhossein Ahmadnia Cecilia bolognesi Dominik

Computational Design Institute 49 Nov 25, 2022
Evolutionary Scale Modeling (esm): Pretrained language models for proteins

Evolutionary Scale Modeling This repository contains code and pre-trained weights for Transformer protein language models from Facebook AI Research, i

Meta Research 1.6k Jan 09, 2023