Home

Awesome

Do Better ImageNet Models Transfer Better?

Hi! We provide simple Tensorflow 2.0 implementations for paper "Do Better Imagnet models Transfer Better?". There are 3 transfer-learning tasks in this implementations.

How to use

Enviroment

pip install tensorflow-datasets
conda install tensorflow-gpu

You can install tensorflow-gpu & datasets!

Parameter Setting

You need to change the parameters according to the data set in main.py or Implementation.ipynb. (NUM_TRAIN_SAMPLES, IMG_SHAPE, NUM_CLASSES). You can use 2 models & 6 datasets in this implementation or more.

NUM_GPUS = 4
BS_PER_GPU = 64  # Batchsize = 4x64
NUM_EPOCHS = 200
TASK=2  # Task 1 : Logistic Regression, Task2 : Transfer learning, Task3 : Random Initialization(Scratch Training)
MODEL = "mobilenet_v2"  # mobilenet_v1, mobilenet_v2
DATASET = "cifar10"  # food101, cifar10, cifar100, sun397, oxford_flowers102, caltech101
learning_rate = 0.01

Model Summary

ParameterFeaturesImage SizeTop-1acc / RetrainedTop-1acc / Paper
MobileNet v13.2M102422472.470.4
MobileNet v22.2M128022471.672.0

Result

Paper

The higher the accuracy in ImageNet, the higher the performance in transfer learning.

DatasetMetricClassesSize(train/test)
food101top-110175750/25250
cifar10top-11050000/10000
cifar100top-110050000/10000
sun397top-139719850/19850
oxford_flowers102mean acc1022040/6149
caltech101mean acc1023060/6084

Task 1. Logistic Regression.

Datasetmobilenet v1mobilenet v2
food101win!
cifar10win!
cifar100win!
sun397win!
oxford_flowers102win!
caltech101win!

Task 2. Fine-Tuned

Datasetmobilenet v1mobilenet v2
food101win!
cifar10win!
cifar100win!
sun397win!
oxford_flowers102win!
caltech101win!

Task 3. Trained from Random Initialization

Datasetmobilenet v1mobilenet v2
food101win!
cifar10win!
cifar100win!
sun397win!
oxford_flowers102win!
caltech101win!

My Result.

1. Tensorflow 2.0

Setting

Mobilenet v1 vs v2 - acc

DatasetTask1 v1Task1 v2Task2 v1Task2 v2Task3 v1Task3 v2
food101------
cifar100.21850.28680.82570.81640.77880.7635
cifar1000.05610.09360.57520.54140.30150.2861
sun397------
oxford_flowers102--0.55720.5250--
caltech101--0.86640.86160.53030.5408

Statistical Methods - log odds

DatasetTask1 v1Task1 v2Task2 v1Task2 v2Task3 v1Task3 v2
food101------
cifar10-1.2744-0.91091.55541.49211.25861.1719
cifar100-2.8224-2.27040.30300.1659-0.8401-0.9144
sun397------
oxford_flowers102--0.22980.1000--
caltech101--1.86941.82860.12130.1635

2. Pytorch

Setting

Mobilenet v1 vs v2 - acc

DatasetTask1 v1Task1 v2Task2 v1Task2 v2Task3 v1Task3 v2
food101------
cifar10---0.92000.89100.8670
cifar100---0.88000.66000.7100
sun397------
oxford_flowers102------
caltech101------