Home

Awesome

AS-MLP for Object Detection

This repo contains the supported code and configuration files to reproduce object detection results of AS-MLP. It is based on Swin Transformer.

Results and Models

Mask R-CNN

BackbonePretrainLr Schdbox mAPmask mAPParamsFLOPsconfigmodel
AS-MLP-TImageNet-1K1x44.040.048M260Gconfigonedrive
AS-MLP-TImageNet-1K3x46.041.548M260Gconfig
AS-MLP-SImageNet-1K1x46.742.069M346Gconfig
AS-MLP-SImageNet-1K3x47.842.969M346Gconfig

Cascade Mask R-CNN

BackbonePretrainLr Schdbox mAPmask mAPParamsFLOPsconfigmodel
AS-MLP-TImageNet-1K1x48.442.086M739Gconfigonedrive
AS-MLP-TImageNet-1K3x50.143.586M739Gconfig
AS-MLP-SImageNet-1K1x50.543.7107M824Gconfig
AS-MLP-SImageNet-1K3x51.144.2107M824Gconfig
AS-MLP-BImageNet-1K1x51.144.2145M961Gconfig
AS-MLP-BImageNet-1K3x51.544.7145M961Gconfig

Notes:

Usage

Installation

Please refer to get_started.md for installation and dataset preparation.

Inference

# single-gpu testing
python tools/test.py <CONFIG_FILE> <DET_CHECKPOINT_FILE> --eval bbox segm

# multi-gpu testing
tools/dist_test.sh <CONFIG_FILE> <DET_CHECKPOINT_FILE> <GPU_NUM> --eval bbox segm

Training

To train a detector with pre-trained models, run:

# single-gpu training
python tools/train.py <CONFIG_FILE> --cfg-options model.pretrained=<PRETRAIN_MODEL> [model.backbone.use_checkpoint=True] [other optional arguments]

# multi-gpu training
tools/dist_train.sh <CONFIG_FILE> <GPU_NUM> --cfg-options model.pretrained=<PRETRAIN_MODEL> [model.backbone.use_checkpoint=True] [other optional arguments] 

For example, to train a Mask R-CNN model with a AS-MLP-T backbone and 8 gpus, run:

tools/dist_train.sh configs/asmlp/mask_rcnn_asmlp_tiny_patch4_shift5_mstrain_480-800_adamw_3x_coco.py 8 --cfg-options model.pretrained=<PRETRAIN_MODEL> 

Note: use_checkpoint is used to save GPU memory. Please refer to this page for more details.

Apex (optional):

We use apex for mixed precision training by default. To install apex, run:

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Citation

@article{Lian_2021_ASMLP,
  author = {Lian, Dongze and Yu, Zehao and Sun, Xing and Gao, Shenghua},
  title = {AS-MLP: An Axial Shifted MLP Architecture for Vision},
  journal={ICLR},
  year = {2022}
}

Other Links

Image Classification: See AS-MLP for Image Classification.