• Stars
    star
    2,160
  • Rank 21,344 (Top 0.5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[ICLR 2023] Official implementation of the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection"

DINO

PWC PWC

This is the official implementation of the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection". (DINO pronounced `daΙͺnoʊ' as in dinosaur)

Authors: Hao Zhang*, Feng Li*, Shilong Liu*, Lei Zhang, Hang Su, Jun Zhu, Lionel M. Ni, Heung-Yeung Shum

News

[2023/7/10] We release Semantic-SAM, a universal image segmentation model to enable segment and recognize anything at any desired granularity. Code and checkpoint are available!
[2023/4/28]: We release a strong open-set object detection and segmentation model OpenSeeD that achieves the best results on open-set object segmentation tasks. Code and checkpoints are available here.
[2023/4/26]: DINO is shining again! We release Stable-DINO which is built upon DINO and FocalNet-Huge backbone that achieves 64.8 AP on COCO test-dev.
[2023/4/22]: With better hyper-params, our DINO-4scale model achieves 49.8 AP under 12ep settings, please check detrex: DINO for more details.
[2023/3/13]: We release a strong open-set object detection model Grounding DINO that achieves the best results on open-set object detection tasks. It achieves 52.5 zero-shot AP on COCO detection, without any COCO training data! It achieves 63.0 AP on COCO after fine-tuning. Code and checkpoints will be available here.
[2023/1/23]: DINO has been accepted to ICLR 2023!
[2022/12/02]: Code for Mask DINO is released (also in detrex)! Mask DINO further Achieves 51.7 and 59.0 box AP on COCO with a ResNet-50 and SwinL without extra detection data, outperforming DINO under the same setting!.
[2022/9/22]: We release a toolbox detrex that provides state-of-the-art Transformer-based detection algorithms. It includes DINO with better performance. Welcome to use it!

[2022/9/18]: We organize ECCV Workshop Computer Vision in the Wild (CVinW), where two challenges are hosted to evaluate the zero-shot, few-shot and full-shot performance of pre-trained vision models in downstream tasks:

    [Workshop]         [IC Challenge]         [OD Challenge]
[2022/8/6]: We update Swin-L model results without techniques such as O365 pre-training, large image size, and multi-scale test. We also upload the corresponding checkpoints to Google Drive. Our 5-scale model without any tricks obtains 58.5 AP on COCO val.
[2022/7/14]: We release the code with Swin-L and Convnext backbone.
[2022/7/10]: We release the code and checkpoints with Resnet-50 backbone.
[2022/6/7]: We release a unified detection and segmentation model Mask DINO that achieves the best results on all the three segmentation tasks (54.7 AP on COCO instance leaderboard, 59.5 PQ on COCO panoptic leaderboard, and 60.8 mIoU on ADE20K semantic leaderboard)! Code will be available here.
[2022/5/28] Code for DN-DETR is available here.
[2020/4/10]: Code for DAB-DETR is avaliable here.
[2022/3/8]: We reach the SOTA on MS-COCO leader board with 63.3AP!
[2022/3/9]: We build a repo Awesome Detection Transformer to present papers about transformer for detection and segmenttion. Welcome to your attention!

SOTA results

Introduction

We present DINO (DETR with Improved deNoising anchOr boxes) with:

  1. State-of-the-art & end-to-end: DINO achieves 63.2 AP on COCO Val and 63.3 AP on COCO test-dev with more than ten times smaller model size and data size than previous best models.
  2. Fast-converging: With the ResNet-50 backbone, DINO with 5 scales achieves 49.4 AP in 12 epochs and 51.3 AP in 24 epochs. Our 4-scale model achieves similar performance and runs at 23 FPS.

Methods

method

Model Zoo

We have put our model checkpoints here [model zoo in Google Drive][model zoo in η™ΎεΊ¦η½‘η›˜]οΌˆζε–η "DINO"), where checkpoint{x}_{y}scale.pth denotes the checkpoint of y-scale model trained for x epochs.

12 epoch setting

name backbone box AP Checkpoint Where in Our Paper
1 DINO-4scale R50 49.0 Google DriveΒ /Β BaiDuΒ  Table 1
2 DINO-5scale R50 49.4 Google DriveΒ /Β BaiDuΒ  Table 1
3 DINO-4scale Swin-L 56.8 Google DriveΒ 
4 DINO-5scale Swin-L 57.3 Google DriveΒ 

24 epoch setting

name backbone box AP Checkpoint Where in Our Paper
1 DINO-4scale R50 50.4 Google DriveΒ /Β BaiDuΒ  Table 2
2 DINO-5scale R50 51.3 Google DriveΒ /Β BaiDuΒ  Table 2

36 epoch setting

name backbone box AP Checkpoint Where in Our Paper
1 DINO-4scale R50 50.9 Google DriveΒ /Β BaiDuΒ  Table 2
2 DINO-5scale R50 51.2 Google DriveΒ /Β BaiDuΒ  Table 2
3 DINO-4scale Swin-L 58.0 Google DriveΒ 
4 DINO-5scale Swin-L 58.5 Google DriveΒ 

Installation

Installation

We use the environment same to DAB-DETR and DN-DETR to run DINO. If you have run DN-DETR or DAB-DETR, you can skip this step. We test our models under python=3.7.3,pytorch=1.9.0,cuda=11.1. Other versions might be available as well. Click the Details below for more details.

  1. Clone this repo
git clone https://github.com/IDEA-Research/DINO.git
cd DINO
  1. Install Pytorch and torchvision

Follow the instruction on https://pytorch.org/get-started/locally/.

# an example:
conda install -c pytorch pytorch torchvision
  1. Install other needed packages
pip install -r requirements.txt
  1. Compiling CUDA operators
cd models/dino/ops
python setup.py build install
# unit test (should see all checking is True)
python test.py
cd ../../..

Data

Data

Please download COCO 2017 dataset and organize them as following:

COCODIR/
  β”œβ”€β”€ train2017/
  β”œβ”€β”€ val2017/
  └── annotations/
  	β”œβ”€β”€ instances_train2017.json
  	└── instances_val2017.json

Run

1. Eval our pretrianed models

Download our DINO model checkpoint "checkpoint0011_4scale.pth" from this link and perform the command below. You can expect to get the final AP about 49.0.

bash scripts/DINO_eval.sh /path/to/your/COCODIR /path/to/your/checkpoint
2. Inference and Visualizations

For inference and visualizations, we provide a notebook as an example.

3. Train a 4-scale model for 12 epochs

We use the DINO 4-scale model trained for 12 epochs as an example to demonstrate how to evaluate and train our model.

You can also train our model on a single process:

bash scripts/DINO_train.sh /path/to/your/COCODIR
4. Supports for Swin Transformer

To train Swin-L model, you need to first download the checkpoint of Swin-L backbone from link and specify the dir of the pre-trained backbone when running the scripts. Here is an example.

bash scripts/DINO_train_submitit_swin.sh /path/to/your/COCODIR /path/to/your/pretrained_backbone 
5. Distributed Run

As the training is time consuming, we suggest to train the model on multi-device.

If you plan to train the models on a cluster with Slurm, here is an example command for training:

# for DINO-4scale: 49.0
bash scripts/DINO_train_submitit.sh /path/to/your/COCODIR

# for DINO-5scale: 49.4
bash scripts/DINO_train_submitit_5scale.sh /path/to/your/COCODIR

Notes: The results are sensitive to the batch size. We use 16(2 images each GPU x 8 GPUs for DINO-4scale and 1 images each GPU x 16 GPUs for DINO-5scale) by default.

Or run with multi-processes on a single node:

# for DINO-4scale: 49.0
bash scripts/DINO_train_dist.sh /path/to/your/COCODIR
6. Training/Fine-tuning a DINO on your custom dataset

To train a DINO on a custom dataset from scratch, you need to tune two parameters in a config file:

  • Tuning the num_classes to the number of classes to detect in your dataset.
  • Tuning the parameter dn_labebook_size to ensure that dn_labebook_size >= num_classes + 1

To leverage our pre-trained models for model fine-tuning, we suggest add two more commands in a bash:

  • --pretrain_model_path /path/to/a/pretrianed/model. specify a pre-trained model.
  • --finetune_ignore label_enc.weight class_embed. ignore some inconsistent parameters.

Links

Our model is based on DAB-DETR and DN-DETR.

DN-DETR: Accelerate DETR Training by Introducing Query DeNoising.
Feng Li*, Hao Zhang*, Shilong Liu, Jian Guo, Lionel M. Ni, Lei Zhang.
IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2022.
[paper] [code] [中文解读]

DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR.
Shilong Liu, Feng Li, Hao Zhang, Xiao Yang, Xianbiao Qi, Hang Su, Jun Zhu, Lei Zhang.
International Conference on Learning Representations (ICLR) 2022.
[paper] [code]

We also thank great previous work including DETR, Deformable DETR, SMCA, Conditional DETR, Anchor DETR, Dynamic DETR, etc. More related work are available at Awesome Detection Transformer.

LICNESE

DINO is released under the Apache 2.0 license. Please see the LICENSE file for more information.

Copyright (c) IDEA. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Bibtex

If you find our work helpful for your research, please consider citing the following BibTeX entry.

@misc{zhang2022dino,
      title={DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection}, 
      author={Hao Zhang and Feng Li and Shilong Liu and Lei Zhang and Hang Su and Jun Zhu and Lionel M. Ni and Heung-Yeung Shum},
      year={2022},
      eprint={2203.03605},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

@inproceedings{li2022dn,
      title={Dn-detr: Accelerate detr training by introducing query denoising},
      author={Li, Feng and Zhang, Hao and Liu, Shilong and Guo, Jian and Ni, Lionel M and Zhang, Lei},
      booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
      pages={13619--13627},
      year={2022}
}

@inproceedings{
      liu2022dabdetr,
      title={{DAB}-{DETR}: Dynamic Anchor Boxes are Better Queries for {DETR}},
      author={Shilong Liu and Feng Li and Hao Zhang and Xiao Yang and Xianbiao Qi and Hang Su and Jun Zhu and Lei Zhang},
      booktitle={International Conference on Learning Representations},
      year={2022},
      url={https://openreview.net/forum?id=oMI9PjOb9Jl}
}

More Repositories

1

Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
Jupyter Notebook
14,724
star
2

GroundingDINO

[ECCV 2024] Official implementation of the paper "Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection"
Python
6,003
star
3

T-Rex

[ECCV2024] API code for T-Rex2: Towards Generic Object Detection via Text-Visual Prompt Synergy
Python
2,147
star
4

DWPose

"Effective Whole-body Pose Estimation with Two-stages Distillation" (ICCV 2023, CV4Metaverse Workshop)
Python
2,136
star
5

detrex

detrex is a research platform for DETR-based object detection, segmentation, pose estimation and other visual recognition tasks.
Python
2,001
star
6

awesome-detection-transformer

Collect some papers about transformer for detection and segmentation. Awesome Detection Transformer for Computer Vision (CV)
1,261
star
7

MaskDINO

[CVPR 2023] Official implementation of the paper "Mask DINO: Towards A Unified Transformer-based Framework for Object Detection and Segmentation"
Python
1,149
star
8

Grounding-DINO-1.5-API

API for Grounding DINO 1.5: IDEA Research's Most Capable Open-World Object Detection Model Series
Python
680
star
9

OpenSeeD

[ICCV 2023] Official implementation of the paper "A Simple Framework for Open-Vocabulary Segmentation and Detection"
Python
650
star
10

Motion-X

[NeurIPS 2023] Official implementation of the paper "Motion-X: A Large-scale 3D Expressive Whole-body Human Motion Dataset"
Python
542
star
11

DN-DETR

[CVPR 2022 Oral] Official implementation of DN-DETR
Python
535
star
12

DAB-DETR

[ICLR 2022] Official implementation of the paper "DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR"
Jupyter Notebook
499
star
13

OSX

[CVPR 2023] Official implementation of the paper "One-Stage 3D Whole-Body Mesh Recovery with Component Aware Transformer"
Python
291
star
14

HumanTOMATO

[ICML 2024] πŸ…HumanTOMATO: Text-aligned Whole-body Motion Generation
Python
276
star
15

MotionLLM

[Arxiv-2024] MotionLLM: Understanding Human Behaviors from Human Motions and Videos
Python
226
star
16

deepdataspace

The Go-To Choice for CV Data Visualization, Annotation, and Model Analysis.
TypeScript
212
star
17

Stable-DINO

[ICCV 2023] Official implementation of the paper "Detection Transformer with Stable Matching"
Python
203
star
18

Lite-DETR

[CVPR 2023] Official implementation of the paper "Lite DETR : An Interleaved Multi-Scale Encoder for Efficient DETR"
Python
182
star
19

DreamWaltz

[NeurIPS 2023] Official implementation of the paper "DreamWaltz: Make a Scene with Complex 3D Animatable Avatars".
Python
176
star
20

MP-Former

[CVPR 2023] Official implementation of the paper: MP-Former: Mask-Piloted Transformer for Image Segmentation
Python
99
star
21

HumanSD

The official implementation of paper "HumanSD: A Native Skeleton-Guided Diffusion Model for Human Image Generation"
Python
92
star
22

HumanArt

The official implementation of CVPR 2023 paper "Human-Art: A Versatile Human-Centric Dataset Bridging Natural and Artificial Scenes"
86
star
23

ED-Pose

The official repo for [ICLR'23] "Explicit Box Detection Unifies End-to-End Multi-Person Pose Estimation "
Python
73
star
24

DQ-DETR

[AAAI 2023] DQ-DETR: Dual Query Detection Transformer for Phrase Extraction and Grounding
54
star
25

DisCo-CLIP

Official PyTorch implementation of the paper "DisCo-CLIP: A Distributed Contrastive Loss for Memory Efficient CLIP Training".
Python
47
star
26

LipsFormer

Python
34
star
27

DiffHOI

Official implementation of the paper "Boosting Human-Object Interaction Detection with Text-to-Image Diffusion Model"
Python
29
star
28

hana

Implementation and checkpoints of Imagen, Google's text-to-image synthesis neural network, in Pytorch
Python
17
star
29

TOSS

[ICLR 2024] Official implementation of the paper "Toss: High-quality text-guided novel view synthesis from a single image"
Python
15
star
30

IYFC

C++
9
star
31

TAPTR

6
star
32

detrex-storage

2
star