Home

Awesome

OTA: Optimal Transport Assignment for Object Detection

GitHub

This project provides an implementation for our CVPR2021 paper "OTA: Optimal Transport Assignment for Object Detection" on PyTorch.

<img src="./ota.png" width="700" height="330">

Requirements

Get Started


python3 -m pip install 'git+https://github.com/Megvii-BaseDetection/cvpods.git'
# (add --user if you don't have permission)

# Or, to install it from a local clone:
git clone https://github.com/Megvii-BaseDetection/cvpods.git
python3 -m pip install -e cvpods

# Or,
pip install -r requirements.txt
python3 setup.py build develop
cd /path/to/cvpods/datasets
ln -s /path/to/your/coco/dataset coco
git clone https://github.com/Megvii-BaseDetection/OTA.git
cd playground/detection/coco/ota.res50.fpn.coco.800size.1x  # for example

# Train
pods_train --num-gpus 8

# Test
pods_test --num-gpus 8 \
    MODEL.WEIGHTS /path/to/your/save_dir/ckpt.pth # optional
    OUTPUT_DIR /path/to/your/save_dir # optional

# Multi node training
## sudo apt install net-tools ifconfig
pods_train --num-gpus 8 --num-machines N --machine-rank 0/1/.../N-1 --dist-url "tcp://MASTER_IP:port"

Results on COCO val set

ModelBackboneLR Sched.mAPRecallAP50/AP75/APs/APm/APlDownload
RetinaNetR501x36.553.456.2/39.3/21.9/40.5/47.7-
Faster R-CNNR501x38.152.258.9/41.0/22.5/41.5/48.9-
FCOSR501x38.757.057.5/41.7/22.6/42.7/49.9-
FreeAnchorR501x38.455.457.0/41.1/21.9/41.7/51.8-
ATSSR501x39.457.757.5/42.7/22.9/42.9/51.2-
PAA(w/. Voting)R501x40.4---
OTAR501x40.759.058.4/44.3/23.2/45.0/53.6weights

Results on COCO test-dev

ModelBackboneLR Sched.Training Scale (ShortSide)mAPAP50/AP75/APs/APm/APlDownload
OTAR1012x640~80045.363.5/49.3/26.9/48.8/56.1weights
OTAX1012x640~80047.065.8/51.1/29.2/50.4/57.9weights
OTAX101-DCN2x640~80049.267.6/53.5/30.0/52.5/62.3weights
OTA*X101-DCN2x640~80051.568.6/57.1/34.1/53.7/64.1weights

* stands for ATSS-style testing time augmentation. To enable testing time augmentation, add/modify the following code frac in the corresponding config.py


TEST=dict(
    DETECTIONS_PER_IMAGE=300,
    AUG=dict(
        ENABLED=True,
        MAX_SIZE=3000,
        MIN_SIZES=(400, 500, 600, 640, 700, 900, 1000, 1100, 1200, 1300, 1400, 1800),
        EXTRA_SIZES=((800, 1333),),
        SCALE_FILTER=True,
        SCALE_RANGES=(
        [96, 10000], [96, 10000], [64, 10000], [64, 10000], [64, 10000], [0, 10000], [0, 10000], [0, 256], [0, 256], [0, 192], [0, 192], [0, 96], [0, 10000])
    )
),

Acknowledgement

This repo is developed based on cvpods. Please check cvpods for more details and features.

License

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