• Stars
    star
    329
  • Rank 127,287 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

Tensorflow implementation of "Compounding the Performance Improvements of Assembled Techniques in a Convolutional Neural Network"

Compounding the Performance Improvements of Assembled Techniques in a Convolutional Neural Network

What's New

July 11, 2020

  • We reimplemented assemble-resnet with tensorflow 2.1. If you want to see the code with better readability, refer to this branch.

paper v2 | pretrained model

Official Tensorflow implementation

Jungkyu Lee, Taeryun Won, Tae Kwan Lee, Hyemin Lee, Geonmo Gu, Kiho Hong
@NAVER/LINE Vision

Abstract

Recent studies in image classification have demonstrated a variety of techniques for improving the performance of Convolutional Neural Networks (CNNs). However, attempts to combine existing techniques to create a practical model are still uncommon. In this study, we carry out extensive experiments to validate that carefully assembling these techniques and applying them to basic CNN models (e.g., ResNet and MobileNet) can improve the accuracy and robustness of the models while minimizing the loss of throughput. Our proposed assembled ResNet-50 shows improvements in top-1 accuracy from 76.3% to 82.78%, mCE from 76.0% to 48.9% and mFR from 57.7% to 32.3% on ILSVRC2012 validation set. With these improvements, inference throughput only decreases from 536 to 312. To verify the performance improvement in transfer learning, fine grained classification and image retrieval tasks were tested on several public datasets and showed that the improvement to backbone network performance boosted transfer learning performance significantly. Our approach achieved 1st place in the iFood Competition Fine-Grained Visual Recognition at CVPR 2019

Main Results

Summary of key results

Ablation Study

Transfer learning

Honor

Related links

Thankfully some people have written testimonial and posts related to our paper.

Tutorial: Fine-Tuning on Oxford-flower102

As first try, you can fine-tune your flower classifier in colab.

Open In Colab

Getting Started

  • This work was tested with Tensorflow 1.14.0, CUDA 10.0, python 3.6.

Requirements

pip install Pillow sklearn requests Wand tqdm

Data preparation

We assume you already have the following data:

  • ImageNet2012 raw images and tfrecord. For this data, please refer to here
  • For knowledge distillation, you need to add the teacher's logits to the TFRecord according to here
  • For transfer learing datasets, refer to scripts in here
  • To download pretrained model, visit here
  • To make mCE evaluation dataset. refer to here

Reproduce Results

First, download pretrained models from here.

For Assemble-ResNet50,

DATA_DIR=/path/to/imagenet2012/tfrecord
MODEL_DIR=/path/Assemble-ResNet50/checkpoint
CUDA_VISIBLE_DEVICES=1 python main_classification.py \
--eval_only=True \
--dataset_name=imagenet \
--data_dir=${DATA_DIR} \
--model_dir=${MODEL_DIR} \
--preprocessing_type=imagenet_224_256 \
--resnet_version=2 \
--resnet_size=50 \
--use_sk_block=True \
--use_resnet_d==False \
--anti_alias_type=sconv \
--anti_alias_filter_size=3 

Note that use_resnet_d==False. We have implemented BigLittleNet with reference to the official implementation of BigLittleNet We found that BigLittleNet's official implementation already includes the concept of resnet-d. that is, in both resnet_d_projection_shortcut and bl_projection_shortcut, a average pooling layer has been added with a stride of 2 before the convolution(except pooling size is different). So we described it in the paper as D + BL. However, when using BL, we did not use tweak that replaces 7x7 convolution with three 3x3 conv(so it become use_resnet_d=False) because it made training unstable. I thought it was a little tricky. We will further explain it in the v2 version of our paper.

For Assemble-ResNet152,

DATA_DIR=/path/to/imagenet2012/tfrecord
MODEL_DIR=/path/Assemble-ResNet152/checkpoint
CUDA_VISIBLE_DEVICES=1 python main_classification.py \
--eval_only=True \
--dataset_name=imagenet \
--data_dir=${DATA_DIR} \
--model_dir=${MODEL_DIR} \
--preprocessing_type=imagenet_224_256a \
--resnet_version=2 \
--resnet_size=152 \
--bl_alpha=1 \
--bl_beta=2 \
--use_sk_block=True \
--anti_alias_type=sconv \
--anti_alias_filter_size=3 

For Assemble-ResNet 152, preprocessing_type=imagenet_224_256a(resize the shorter size of each image to 257 pixels while the aspect ratio is maintained. Next, we center crop the image to the 256x256 size) performed better.

The expected final output is`

...
| accuracy:   0.841860 |
...

Training a model from scratch.

For training parameter information, refer to here

Train vanila ResNet50 on ImageNet from scratch.

$ ./scripts/train_vanila_from_scratch.sh

Train all-assemble ResNet50 on ImageNet from scratch.

$ ./scripts/train_assemble_from_scratch.sh

Fine-tuning the model.

In the previous section, you train the pretrained model from scratch. You can also download pretrained model to finetune from here.

Fine-tune vanila ResNet50 on Food101.

$ ./scripts/finetuning_vanila_on_food101.sh

Train all-assemble ResNet50 on Food101.

$ ./scripts/finetuning_assemble_on_food101.sh

mCE evaluation

You can calculate mCE on the trained model as follows:

$ ./eval_assemble_mCE_on_imagenet.sh

Acknowledgements

This implementation is based on these repository:

Contact

Feel free to create a issue or contact me if there is any question (Jungkyu Lee [email protected]).

Citation

@misc{lee2020compounding,
    title={Compounding the Performance Improvements of Assembled Techniques in a Convolutional Neural Network},
    author={Jungkyu Lee, Taeryun Won, Tae Kwan Lee, Hyemin Lee, Geonmo Gu, Kiho Hong},
    year={2020},
    eprint={2001.06268v2},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

License

   Copyright 2020-present NAVER Corp.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

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,459
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,012
star
7

WCT2

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

synthtiger

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

tunit

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

rexnet

Official Pytorch implementation of ReXNet (Rank eXpansion Network) with pretrained models
Python
451
star
11

AdamP

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

overhaul-distillation

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

cord

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

cutblur

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

wsolevaluation

Evaluating Weakly Supervised Object Localization Methods Right (CVPR 2020)
Python
331
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
199
star
20

EXTD_Pytorch

Official EXTD Pytorch code
Python
187
star
21

stargan-v2-tensorflow

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

CLEval

CLEval: Character-Level Evaluation for Text Detection and Recognition Tasks
Python
184
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

SATRN

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

bros

Python
156
star
27

lffont

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

aasist

Official PyTorch implementation of "AASIST: Audio Anti-Spoofing using Integrated Spectro-Temporal Graph Attention Networks"
Python
151
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
147
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
117
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

EResFD

Lightweight Face Detector from CLOVA
Python
44
star
50

puridiver

Official PyTorch Implementation of PuriDivER CVPR 2022.
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