• Stars
    star
    451
  • Rank 96,968 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Pytorch implementation of ReXNet (Rank eXpansion Network) with pretrained models

(NOTICE) All the ReXNet-lite's model files have been updated!

(NOTICE) Our paper has been accepted at CVPR 2021!! The paper has been updated at arxiv!

Rethinking Channel Dimensions for Efficient Model Design

Dongyoon Han, Sangdoo Yun, Byeongho Heo, and YoungJoon Yoo | Paper | Pretrained Models

NAVER AI Lab

Abstract

Designing an efficient model within the limited computational cost is challenging. We argue the accuracy of a lightweight model has been further limited by the design convention: a stage-wise configuration of the channel dimensions, which looks like a piecewise linear function of the network stage. In this paper, we study an effective channel dimension configuration towards better performance than the convention. To this end, we empirically study how to design a single layer properly by analyzing the rank of the output feature. We then investigate the channel configuration of a model by searching network architectures concerning the channel configuration under the computational cost restriction. Based on the investigation, we propose a simple yet effective channel configuration that can be parameterized by the layer index. As a result, our proposed model following the channel parameterization achieves remarkable performance on ImageNet classification and transfer learning tasks including COCO object detection, COCO instance segmentation, and fine-grained classifications.

Model performance

  • We first illustrate our models' top-acc. vs. computational costs graphs compared with EfficientNets

Performance comparison

ReXNets vs EfficientNets

  • The CPU latencies are tested on Xeon E5-2630_v4 with a single image and the GPU latencies are measured on a V100 GPU with the batchsize of 64.

  • EfficientNets' scores are taken form arxiv v3 of the paper.

    Model Input Res. Top-1 acc. Top-5 acc. FLOPs/params. CPU Lat./ GPU Lat.
    ReXNet_0.9 224x224 77.2 93.5 0.35B/4.1M 45ms/20ms
    EfficientNet-B0 224x224 77.3 93.5 0.39B/5.3M 47ms/23ms
    ReXNet_1.0 224x224 77.9 93.9 0.40B/4.8M 47ms/21ms
    EfficientNet-B1 240x240 79.2 94.5 0.70B/7.8M 70ms/37ms
    ReXNet_1.3 224x224 79.5 94.7 0.66B/7.6M 55ms/28ms
    EfficientNet-B2 260x260 80.3 95.0 1.0B/9.2M 77ms/48ms
    ReXNet_1.5 224x224 80.3 95.2 0.88B/9.7M 59ms/31ms
    EfficientNet-B3 300x300 81.7 95.6 1.8B/12M 100ms/78ms
    ReXNet_2.0 224x224 81.6 95.7 1.8B/19M 69ms/40ms

ReXNet-lites vs. EfficientNet-lites

  • ReXNet-lites do not use SE-net an SiLU activations aiming to faster training and inference speed.

  • We compare ReXNet-lites with EfficientNet-lites.

  • Here the GPU latencies are measured on two M40 GPUs, we will update the number run on a V100 GPU soon.

    Model Input Res. Top-1 acc. Top-5 acc. FLOPs/params CPU Lat./ GPU Lat.
    EfficientNet-lite0 224x224 75.1 - 0.41B/4.7M 30ms/49ms
    ReXNet-lite_1.0 224x224 76.2 92.8 0.41B/4.7M 31ms/49ms
    EfficientNet-lite1 240x240 76.7 - 0.63B/5.4M 44ms/73ms
    ReXNet-lite_1.3 224x224 77.8 93.8 0.65B/6.8M 36ms/61ms
    EfficientNet-lite2 260x260 77.6 - 0.90B/ 6.1M 48ms/93ms
    ReXNet-lite_1.5 224x224 78.6 94.2 0.84B/8.3M 39ms/68ms
    EfficientNet-lite3 280x280 79.8 - 1.4B/ 8.2M 60ms/131ms
    ReXNet-lite_2.0 224x224 80.2 95.0 1.5B/13M 49ms/90ms

ImageNet-1k Pretrained models

ImageNet classification results

  • Please refer the following pretrained models. Top-1 and top-5 accuraies are reported with the computational costs.

  • Note that all the models are trained and evaluated with 224x224 image size.

    Model Input Res. Top-1 acc. Top-5 acc. FLOPs/params
    ReXNet_1.0 224x224 77.9 93.9 0.40B/4.8M
    ReXNet_1.3 224x224 79.5 94.7 0.66B/7.6M
    ReXNet_1.5 224x224 80.3 95.2 0.88B/9.7M
    ReXNet_2.0 224x224 81.6 95.7 1.5B/16M
    ReXNet_3.0 224x224 82.8 96.2 3.4B/34M
    ReXNet-lite_1.0 224x224 76.2 92.8 0.41B/4.7M
    ReXNet-lite_1.3 224x224 77.8 93.8 0.65B/6.8M
    ReXNet-lite_1.5 224x224 78.6 94.2 0.84B/8.3M
    ReXNet-lite_2.0 224x224 80.2 95.0 1.5B/13M

Finetuning results

COCO Object detection

  • The following results are trained with Faster RCNN with FPN:

    Backbone Img. Size B_AP (%) B_AP_0.5 (%) B_AP_0.75 (%) Params. FLOPs Eval. set
    FBNet-C-FPN 1200x800 35.1 57.4 37.2 21.4M 119.0B val2017
    EfficientNetB0-FPN 1200x800 38.0 60.1 40.4 21.0M 123.0B val2017
    ReXNet_0.9-FPN 1200x800 38.0 60.6 40.8 20.1M 123.0B val2017
    ReXNet_1.0-FPN 1200x800 38.5 60.6 41.5 20.7M 124.1B val2017
    ResNet50-FPN 1200x800 37.6 58.2 40.9 41.8M 202.2B val2017
    ResNeXt-101-FPN 1200x800 40.3 62.1 44.1 60.4M 272.4B val2017
    ReXNet_2.2-FPN 1200x800 41.5 64.0 44.9 33.0M 153.8B val2017

COCO instance segmentation

  • The following results are trained with Mask RCNN with FPN, S_AP and B_AP denote segmentation AP and box AP, respectively:

    Backbone Img. Size S_AP (%) S_AP_0.5 (%) S_AP_0.75 (%) B_AP (%) B_AP_0.5 (%) B_AP_0.75 (%) Params. FLOPs Eval. set
    EfficientNetB0_FPN 1200x800 34.8 56.8 36.6 38.4 60.2 40.8 23.7M 123.0B val2017
    ReXNet_0.9-FPN 1200x800 35.2 57.4 37.1 38.7 60.8 41.6 22.8M 123.0B val2017
    ReXNet_1.0-FPN 1200x800 35.4 57.7 37.4 38.9 61.1 42.1 23.3M 124.1B val2017
    ResNet50-FPN 1200x800 34.6 55.9 36.8 38.5 59.0 41.6 44.2M 207B val2017
    ReXNet_2.2-FPN 1200x800 37.8 61.0 40.2 42.0 64.5 45.6 35.6M 153.8B val2017

Getting Started

Requirements

  • Python3
  • PyTorch (> 1.0)
  • Torchvision (> 0.2)
  • NumPy

Using the pretrained models

  • timm>=0.3.0 provides the wonderful wrap-up of ours models thanks to Ross Wightman. Otherwise, the models can be loaded as follows:

    • To use ReXNet on a GPU:
    import torch
    import rexnetv1
    
    model = rexnetv1.ReXNetV1(width_mult=1.0).cuda()
    model.load_state_dict(torch.load('./rexnetv1_1.0.pth'))
    model.eval()
    print(model(torch.randn(1, 3, 224, 224).cuda()))
    • To use ReXNet-lite on a CPU:
    import torch
    import rexnetv1_lite
    
    model = rexnetv1_lite.ReXNetV1_lite(multiplier=1.0)
    model.load_state_dict(torch.load('./rexnet_lite_1.0.pth', map_location=torch.device('cpu')))
    model.eval()
    print(model(torch.randn(1, 3, 224, 224)))

Training own ReXNet

ReXNet can be trained with any PyTorch training codes including ImageNet training in PyTorch with the model file and proper arguments. Since the provided model file is not complicated, we simply convert the model to train a ReXNet in other frameworks like MXNet. For MXNet, we recommend MXnet-gluoncv as a training code.

Using PyTorch, we trained ReXNets with one of the popular imagenet classification code, Ross Wightman's pytorch-image-models for more efficient training. After including ReXNet's model file into the training code, one can train ReXNet-1.0x with the following command line:

./distributed_train.sh 4 /imagenet/ --model rexnetv1 --rex-width-mult 1.0 --opt sgd --amp \
 --lr 0.5 --weight-decay 1e-5 \
 --batch-size 128 --epochs 400 --sched cosine \
 --remode pixel --reprob 0.2 --drop 0.2 --aa rand-m9-mstd0.5 

Using droppath or MixUP may need to train a bigger model.

License

This project is distributed under MIT license.

How to cite

@misc{han2021rethinking,
      title={Rethinking Channel Dimensions for Efficient Model Design}, 
      author={Dongyoon Han and Sangdoo Yun and Byeongho Heo and YoungJoon Yoo},
      year={2021},
      eprint={2007.00992},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

More Repositories

1

donut

Official Implementation of OCR-free Document Understanding Transformer (Donut) and Synthetic Document Generator (SynthDoG), ECCV 2022
Python
5,573
star
2

deep-text-recognition-benchmark

Text recognition (optical character recognition) with deep learning methods, ICCV 2019
Jupyter Notebook
3,692
star
3

stargan-v2

StarGAN v2 - Official PyTorch Implementation (CVPR 2020)
Python
3,478
star
4

CRAFT-pytorch

Official implementation of Character Region Awareness for Text Detection (CRAFT)
Python
3,024
star
5

CutMix-PyTorch

Official Pytorch implementation of CutMix regularizer
Python
1,211
star
6

voxceleb_trainer

In defence of metric learning for speaker recognition
Python
1,029
star
7

WCT2

Software that can perform photorealistic style transfer without the need of any post-processing steps.
Python
869
star
8

synthtiger

Official Implementation of SynthTIGER (Synthetic Text Image Generator), ICDAR 2021
Python
482
star
9

tunit

Rethinking the Truly Unsupervised Image-to-Image Translation - Official PyTorch Implementation (ICCV 2021)
Python
452
star
10

AdamP

AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights (ICLR 2021)
Python
411
star
11

overhaul-distillation

Official PyTorch implementation of "A Comprehensive Overhaul of Feature Distillation" (ICCV 2019)
Python
409
star
12

cord

CORD: A Consolidated Receipt Dataset for Post-OCR Parsing
384
star
13

cutblur

Rethinking Data Augmentation for Image Super-resolution (CVPR 2020)
Jupyter Notebook
379
star
14

wsolevaluation

Evaluating Weakly Supervised Object Localization Methods Right (CVPR 2020)
Python
331
star
15

assembled-cnn

Tensorflow implementation of "Compounding the Performance Improvements of Assembled Techniques in a Convolutional Neural Network"
Python
329
star
16

generative-evaluation-prdc

Code base for the precision, recall, density, and coverage metrics for generative models. ICML 2020.
Python
239
star
17

ext_portrait_segmentation

Python
238
star
18

ClovaCall

ClovaCall dataset and Pytorch LAS baseline code (Interspeech 2020)
Python
218
star
19

fewshot-font-generation

The unified repository for few-shot font generation methods. This repository includes FUNIT (ICCV'19), DM-Font (ECCV'20), LF-Font (AAAI'21) and MX-Font (ICCV'21).
Python
203
star
20

stargan-v2-tensorflow

StarGAN v2 - Official Tensorflow Implementation (CVPR 2020)
Python
187
star
21

EXTD_Pytorch

Official EXTD Pytorch code
Python
187
star
22

CLEval

CLEval: Character-Level Evaluation for Text Detection and Recognition Tasks
Python
185
star
23

TedEval

TedEval: A Fair Evaluation Metric for Scene Text Detectors
Python
176
star
24

rebias

Official Pytorch implementation of ReBias (Learning De-biased Representations with Biased Representations), ICML 2020
Python
168
star
25

aasist

Official PyTorch implementation of "AASIST: Audio Anti-Spoofing using Integrated Spectro-Temporal Graph Attention Networks"
Python
167
star
26

SATRN

Official Tensorflow Implementation of SATRN (CVPR Workshop WTDDLE 2020)
Python
162
star
27

lffont

Official PyTorch implementation of LF-Font (Few-shot Font Generation with Localized Style Representations and Factorization) AAAI 2021
Python
156
star
28

bros

Python
156
star
29

som-dst

SOM-DST: Efficient Dialogue State Tracking by Selectively Overwriting Memory (ACL 2020)
Python
150
star
30

mxfont

Official PyTorch implementation of MX-Font (Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Experts) ICCV 2021
Python
148
star
31

dmfont

Official PyTorch implementation of DM-Font (ECCV 2020)
Python
133
star
32

rainbow-memory

Official pytorch implementation of Rainbow Memory (CVPR 2021)
Python
119
star
33

FocusSeq2Seq

[EMNLP 2019] Mixture Content Selection for Diverse Sequence Generation (Question Generation / Abstractive Summarization)
Python
113
star
34

attention-feature-distillation

Official implementation for (Show, Attend and Distill: Knowledge Distillation via Attention-based Feature Matching, AAAI-2021)
Python
111
star
35

frostnet

FrostNet: Towards Quantization-Aware Network Architecture Search
Python
106
star
36

webvicob

Official Implementation of Web-based Visual Corpus Builder (Webvicob), ICDAR 2023
Python
101
star
37

length-adaptive-transformer

Official Pytorch Implementation of Length-Adaptive Transformer (ACL 2021)
Python
99
star
38

spade

Python
81
star
39

embedding-expansion

Official MXNet implementation of "Embedding Expansion: Augmentation in Embedding Space for Deep Metric Learning" (CVPR 2020)
Python
76
star
40

symmetrical-synthesis

Official Tensorflow implementation of "Symmetrical Synthesis for Deep Metric Learning" (AAAI 2020)
Python
71
star
41

units

Python
70
star
42

lookwhostalking

Look Who’s Talking: Active Speaker Detection in the Wild
Python
70
star
43

subword-qac

Subword Language Model for Query Auto-Completion
Python
67
star
44

ssmix

Official PyTorch Implementation of SSMix (Findings of ACL 2021)
Python
60
star
45

SSUL

[NeurIPS 2021] SSUL: Semantic Segmentation with Unknown Label for Exemplar-based Class-Incremental Learning
Python
59
star
46

BESTIE

[CVPR 2022] Beyond Semantic to Instance Segmentation: Weakly-Supervised Instance Segmentation via Semantic Knowledge Transfer and Self-Refinement
Python
55
star
47

PointWSSIS

[CVPR2023] The Devil is in the Points: Weakly Semi-Supervised Instance Segmentation via Point-Guided Mask Representation
Python
55
star
48

c3_sinet

Python
52
star
49

puridiver

Official PyTorch Implementation of PuriDivER CVPR 2022.
Python
45
star
50

EResFD

Lightweight Face Detector from CLOVA
Python
44
star
51

minimal-rnr-qa

[NAACL 2021] Designing a Minimal Retrieve-and-Read System for Open-Domain Question Answering
Python
36
star
52

ECLIPSE

(CVPR 2024) ECLIPSE: Efficient Continual Learning in Panoptic Segmentation with Visual Prompt Tuning
Python
34
star
53

group-transformer

Official code for Group-Transformer (Scale down Transformer by Grouping Features for a Lightweight Character-level Language Model, COLING-2020).
Python
25
star
54

ProxyDet

Official implementation of the paper "ProxyDet: Synthesizing Proxy Novel Classes via Classwise Mixup for Open-Vocabulary Object Detection"
Python
22
star
55

GeNAS

Official pytorch implementation for GeNAS: Neural Architecture Search with Better Generalization
Python
15
star
56

meev

Python
12
star
57

pkm-transformers

Official implementation of PKM-augmented language models (Findings of EMNLP 2020)
9
star
58

DCutMix

DCutMix official repo
Python
8
star
59

TVQ-VAE

Official pytorch implementation for TVQ-VAE
Jupyter Notebook
8
star
60

textual-kd-slu

Official Implementation of Textual KD SLU (ICASSP 2021)
Python
6
star
61

vat-d

Official Implementation of VAT-D
Python
5
star
62

ActiveASR_AugCR

Repositoty for Efficient Active Learning for Automatic Speech Recognition via Augmented Consistency Regularization
3
star
63

WSSS-BED

Rethinking Saliency-Guided Weakly-Supervised Semantic Segmentation
Python
1
star