Object Detection and Instance Segmentation

October 7, 2023 · View on GitHub

Detection and instance segmentation on MS COCO 2017 is implemented based on MMDetection.

Models

ModelAPbAP^bAP50bAP_{50}^bAP75bAP_{75}^bAPmAP^mAP50mAP_{50}^mAP75mAP_{75}^mLatencyCkptLog
RepViT-M1.139.861.943.537.258.840.14.9msM1.1M1.1
RepViT-M1.541.663.245.338.660.541.56.4msM1.5M1.5
RepViT-M2.344.666.148.840.863.643.99.9msM2.3M2.3

Installation

Install mmcv-full and MMDetection v2.28.2, Later versions should work as well. The easiest way is to install via MIM

pip install -U openmim
mim install mmcv-full==1.7.1
mim install mmdet==2.28.2

Data preparation

Prepare COCO 2017 dataset according to the instructions in MMDetection. The dataset should be organized as

detection
├── data
│   ├── coco
│   │   ├── annotations
│   │   ├── train2017
│   │   ├── val2017
│   │   ├── test2017

Testing

We provide a multi-GPU testing script, specify config file, checkpoint, and number of GPUs to use:

./dist_test.sh config_file path/to/checkpoint #GPUs --eval bbox segm

For example, to test RepViT-M1.1 on COCO 2017 on an 8-GPU machine,

./dist_test.sh configs/mask_rcnn_repvit_m1_1_fpn_1x_coco.py path/to/repvit_m1_1_coco.pth 8 --eval bbox segm

Training

Download ImageNet-1K pretrained weights into ./pretrain

We provide PyTorch distributed data parallel (DDP) training script dist_train.sh, for example, to train RepViT-M1.1 on an 8-GPU machine:

./dist_train.sh configs/mask_rcnn_repvit_m1_1_fpn_1x_coco.py 8

Tips: specify configs and #GPUs!