Skip to content

cgnerds/DeTR-LAB

Repository files navigation

DeTR-LAB

Library of Detection with Transformer

Requirements

  • We recommend you to use Anaconda to create a conda environment:
conda create -n detr python=3.6
  • Then, activate the environment:
conda activate detr
  • Requirements:
pip install -r requirements.txt 

We suggest that PyTorch should be higher than 1.9.0 and Torchvision should be higher than 0.10.3. At least, please make sure your torch is version 1.x.

This repository

In this repository, you can enjoy:

  • DETR
  • Anchor-DETR
  • DINO

Experiments

DETR

I evaluate DETR by loading official pretrained weight.

Model backbone FPS
3090
FLOPs Params AP Weight
DETR-R50 R-50 37 95.2 B 36.7 M 41.7 github
DETR-R50-DC5 R-50 20 162.1 B 36.7 M 43.0 github
DETR-R101 R-101 25 174.7 B 55.7 M 43.1 github
DETR-R101-DC5 R-101 14 241.6 B 55.7 M 44.3 github

Anchor DETR

I evaluate AnchorDETR by loading official pretrained weight.

Model backbone FPS
3090
FLOPs Params AP Weight
Anchor-DETR-R50 R-50 37 97.0 B 30.7 M 42.1 github
Anchor-DETR-R50-DC5 R-50 20 154.0 B 30.7 M 44.2 github
Anchor-DETR-R101 R-101 21 176.5 B 49.7 M 43.5 github
Anchor-DETR-R101-DC5 R-101 16 233.5 B 49.7 M 45.2 github

Train

sh train.sh

You can change the configurations of train.sh, according to your own situation.

However, limited by my GPU, I can't verify whether this repository can reproduce the performance of the official DETR.

Test

python test.py -d coco \
               --cuda \
               -v detr_r50 \
               --weight path/to/weight \
               --root path/to/dataset/ \
               --show

Evaluation

python eval.py -d coco-val \
               --cuda \
               -v detr_r50 \
               --weight path/to/weight \
               --root path/to/dataset/

Demo

I have provide some images in data/demo/images/, so you can run following command to run a demo:

python demo.py --mode image \
               --path_to_img dataset/demo/images/ \
               -v detr_r50 \
               --cuda \
               --weight path/to/weight \
               --show

If you want run a demo of streaming video detection, you need to set --mode to video, and give the path to video --path_to_vid

python demo.py --mode video \
               --path_to_img dataset/demo/videos/video_name \
               -v detr_r50 \
               --cuda \
               --weight path/to/weight \
               --show

If you want run video detection with your camera, you need to set --mode to camera

python demo.py --mode camera \
               -v detr_r50 \
               --cuda \
               --weight path/to/weight \
               --show

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published