Home

Awesome

RLA-Net: Recurrent Layer Aggregation

Recurrence along Depth: Deep Networks with Recurrent Layer Aggregation

This is an implementation of RLA-Net (accept by NeurIPS-2021, paper).

RLANet

Introduction

This paper introduces a concept of layer aggregation to describe how information from previous layers can be reused to better extract features at the current layer. While DenseNet is a typical example of the layer aggregation mechanism, its redundancy has been commonly criticized in the literature. This motivates us to propose a very light-weighted module, called recurrent layer aggregation (RLA), by making use of the sequential structure of layers in a deep CNN. Our RLA module is compatible with many mainstream deep CNNs, including ResNets, Xception and MobileNetV2, and its effectiveness is verified by our extensive experiments on image classification, object detection and instance segmentation tasks. Specifically, improvements can be uniformly observed on CIFAR, ImageNet and MS COCO datasets, and the corresponding RLA-Nets can surprisingly boost the performances by 2-3% on the object detection task. This evidences the power of our RLA module in helping main CNNs better learn structural information in images.

RLA module

<img src="figures/rla_module.png" width="300" alt="RLA_module"/><br/>

Changelog

Installation

Requirements

Our environments

Please refer to get_started.md for more details about installation.

Quick Start

Train with ResNet

- Use single node or multi node with multiple GPUs

Use multi-processing distributed training to launch N processes per node, which has N GPUs. This is the fastest way to use PyTorch for either single node or multi node data parallel training.

python train.py -a {model_name} --b {batch_size} --multiprocessing-distributed --world-size 1 --rank 0 {imagenet-folder with train and val folders}

- Specify single GPU or multiple GPUs

CUDA_VISIBLE_DEVICES={device_ids} python train.py -a {model_name} --b {batch_size} --multiprocessing-distributed --world-size 1 --rank 0 {imagenet-folder with train and val folders}

Testing

To evaluate the best model

python train.py -a {model_name} --b {batch_size} --multiprocessing-distributed --world-size 1 --rank 0 --resume {path to the best model} -e {imagenet-folder with train and val folders}

Visualizing the training result

To generate acc_plot, loss_plot

python eval_visual.py --log-dir {log_folder}

Train with MobileNet_v2

It is same with above ResNet replace train.py by train_light.py.

Compute the parameters and FLOPs

If you have install thop, you can paras_flops.py to compute the parameters and FLOPs of our models. The usage is below:

python paras_flops.py -a {model_name}

More examples are shown in examples.md.

MMDetection

After installing MMDetection (see get_started.md), then do the following steps:

Note that the config files of the latest version of MMDetection are a little different, please modify the config files according to the latest format.

Experiments

ImageNet

ModelParam.FLOPsTop-1 err.(%)Top-5 err.(%)BaiduDrive(models)Extract codeGoogleDrive
RLA-ResNet5024.67M4.17G22.836.58resnet50_rla_22835lf1resnet50_rla_2283
RLA-ECANet5024.67M4.18G22.156.11ecanet50_rla_2215xrfoecanet50_rla_2215
RLA-ResNet10142.92M7.79G21.485.80resnet101_rla_2148zrv5resnet101_rla_2148
RLA-ECANet10142.92M7.80G21.005.51ecanet101_rla_2100vhpyecanet101_rla_2100
RLA-MobileNetV23.46M351.8M27.629.18dsrla_mobilenetv2_k32_2762g1pmdsrla_mobilenetv2_k32_2762
RLA-ECA-MobileNetV23.46M352.4M27.078.89dsrla_mobilenetv2_k32_eca_27079orldsrla_mobilenetv2_k32_eca_2707

COCO 2017

ModelAPAP_50AP_75BaiduDrive(models)Extract codeGoogleDrive
Fast_R-CNN_resnet50_rla38.859.642.0faster_rcnn_r50rla_fpn_1x_coco_388q5c8faster_rcnn_r50rla_fpn_1x_coco_388
Fast_R-CNN_ecanet50_rla39.861.243.2faster_rcnn_r50rlaeca_fpn_1x_coco_398f5xsfaster_rcnn_r50rlaeca_fpn_1x_coco_398
Fast_R-CNN_resnet101_rla41.261.844.9faster_rcnn_r101rla_fpn_1x_coco_4120ri3faster_rcnn_r101rla_fpn_1x_coco_412
Fast_R-CNN_ecanet101_rla42.163.346.1faster_rcnn_r101rlaeca_fpn_1x_coco_421cpugfaster_rcnn_r101rlaeca_fpn_1x_coco_421
RetinaNet_resnet50_rla37.957.040.8retinanet_r50rla_fpn_1x_coco_379lahjretinanet_r50rla_fpn_1x_coco_379
RetinaNet_ecanet50_rla39.058.741.7retinanet_r50rlaeca_fpn_1x_coco_390adydretinanet_r50rlaeca_fpn_1x_coco_390
RetinaNet_resnet101_rla40.359.843.5retinanet_r101rla_fpn_1x_coco_403p8y0retinanet_r101rla_fpn_1x_coco_403
RetinaNet_ecanet101_rla41.561.644.4retinanet_r101rlaeca_fpn_1x_coco_415hdqxretinanet_r101rlaeca_fpn_1x_coco_415
Mask_R-CNN_resnet50_rla39.560.143.3mask_rcnn_r50rla_fpn_1x_coco_395j1x6mask_rcnn_r50rla_fpn_1x_coco_395
Mask_R-CNN_ecanet50_rla40.661.844.0mask_rcnn_r50rlaeca_fpn_1x_coco_406c08rmask_rcnn_r50rlaeca_fpn_1x_coco_406
Mask_R-CNN_resnet101_rla41.862.346.2mask_rcnn_r101rla_fpn_1x_coco_4188bsnmask_rcnn_r101rla_fpn_1x_coco_418
Mask_R-CNN_ecanet101_rla42.963.646.9mask_rcnn_r101rlaeca_fpn_1x_coco_4293kmzmask_rcnn_r101rlaeca_fpn_1x_coco_429

Citation

@misc{zhao2021recurrence,
      title={Recurrence along Depth: Deep Convolutional Neural Networks with Recurrent Layer Aggregation}, 
      author={Jingyu Zhao and Yanwen Fang and Guodong Li},
      year={2021},
      eprint={2110.11852},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Questions

Please contact 'u3545683@connect.hku.hk' or 'gladys17@connect.hku.hk'.