31
JSAI Cup 2018 Yk Aizawa Laboratory University of Tokyo

JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

JSAI Cup 2018

Yk

Aizawa Laboratory

University of Tokyo

Page 2: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Self-introduction

• Name: 郁 (Yu) 青 (Qing)

• Hometown: Shanghai, China

• Affiliation: Aizawa Laboratory, University of Tokyo

• Grade: M1

2

Page 3: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Task

• Image Classification (55 Classes)

3

Page 4: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Dataset

4

• 55 classes of food ingredient images provided by cookpad

Page 5: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Dataset

• 55 classes of food ingredient images provided by cookpad

• Train: 11,995 images (labeled)

• Test: 3,937 images (unlabeled)

5

Page 6: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Rule

• Ensemble

• K-fold ensemble

• Pseudo labeling

• Test time augmentation

• Pretrained model

• Model evaluation: Accuracy

6

Page 7: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Problem

• Pretrained model

• Small dataset

• Overfitting

7

Page 8: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method: Semi-supervised Learning

• Train: 11,195 images (labeled) + 3,937 images (unlabeled)

• Test: 3,937 images (unlabeled)

• Semi-supervised Learning: Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results [Tarvainen, NIPS 2017]

• Implemented in PyTorch

8

Page 9: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

9

labeled

CNN

0.1 0.3 0.6 0.3

0 0 1 0

softmax cross entropy loss

back prop

randomaugmentation

Groundtruth Label

Page 10: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

10

CNN

0.4 0.6 0.2 0.2

randomaugmentation

unlabeled

Page 11: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

11

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

Page 12: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

12

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

Page 13: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

13

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

MSE loss

back prop

Page 14: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

14

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

MSE loss

back prop

How to generate teacher CNN?

Page 15: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

15

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

samestructure

Page 16: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

16

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

unlabeled

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

exponential moving average

of past iterations

𝜃 𝜃′

Parameters of CNN

Page 17: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

17

CNN

0.1 0.3 0.6 0.3

randomaugmentation1

0.1 0.2 0.8 0.3

randomaugmentation2

TeacherCNN

More accurate result

labeled batch

MSE loss

back prop

0 1 0 0

softmax cross entropy loss

back prop

Groundtruth Label

Train:

Page 18: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

18

CNN

0.4 0.6 0.2 0.2

randomaugmentation1

0.2 0.9 0.1 0.1

randomaugmentation2

TeacherCNN

More accurate result

MSE loss

back prop

Train:unlabeled batch

Page 19: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

19

CNN TeacherCNN

Train:

𝜃𝑡

𝜃𝑡′ = 𝜃𝑡−1

′ × α + 𝜃𝑡 × 1 − α

𝜃𝑡′

α = 0.999

Page 20: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Method

20

CNN

0.8 0.4 0.1 0.2 0.9 0.3 0.1 0.1

test timeaugmentation

TeacherCNN

Test:

unlabeled

result

Page 21: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Data Augmentation

• Train:

21

RandomRotation,RandomCrop,RandomHorizontalFlip,ColorJitter,RandomErasing,Mixup(Size 224 x 224)

Page 22: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Data Augmentation

• Train:

22

RandomRotation,RandomCrop,RandomHorizontalFlip,ColorJitter,RandomErasing,Mixup(Size 224 x 224)

[Zhong, arXiv:1708.04896]

Page 23: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Data Augmentation

• Train:

23

RandomRotation,RandomCrop,RandomHorizontalFlip,ColorJitter,RandomErasing,Mixup(Size 224 x 224)

dog

cat

Page 24: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Data Augmentation

• Train:

24

RandomRotation,RandomCrop,RandomHorizontalFlip,ColorJitter,RandomErasing,Mixup(Size 224 x 224) 0.7 * dog + 0.3 * cat

[Zhang, ICLR 2018]

Page 25: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Data Augmentation

• Train:

• Test:

25

RandomRotation,RandomCrop,RandomHorizontalFlip,ColorJitter,RandomErasing,Mixup(Size 224 x 224)

144 Crop (Size: 320 x 320)

Page 26: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

144 Crop

26

h

w

340

Resize x4

380 410 450

380

Crop x3

380 380 380

380

Crop x5 + Resize x1

380

320

380

320

320

HorizontalFlip x1 + Original x1

320

320

320

320

Sum = 4 x 3 x 6 x 2 = 144 [Szegedy, CVPR 2015]

380

Page 27: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

CNN

• SE-ResNet-50 [Hu, CVPR 2018]

27

Squeeze-and-Excitation block

Page 28: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Hyperparameter

• Optimizer: SGD with Nesterov Momentum

• Learning rate: cosine annealing from 0.1

• Momentum: 0.9

• Weight decay: 1e-3

• Epoch: 300

• Batch size: 300

• Labeled batch size: 280

• Training needs 3 days on 4 Titan Xp

• Spent one month on hyperparameter tuning

28

Page 29: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Result

29

0.905

0.915

0.925

0.935

0.945

0.955

0.965

0.975

0.985

Sco

re

Date

Page 30: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Result

30

Date Score Method

2018/2/7 0.91071 ResNet-34 + Random Erasing

2018/2/8 0.92593 + Mixup

2018/2/12 0.96093 + Mean Teacher

2018/2/14 0.97210 + Test image size 320

2018/2/15 0.97869 ResNet-34 -> SE-ResNet-50

2018/2/22 0.97971 + 144 crop

2018/3/29 0.98326 + Hyperparameter tuning

Score: 0.98326 Final score: 0.98118

Page 31: JSAI Cup 2018 - SIGNATE...Method 16 CNN 0.4 0.6 0.2 0.2 random augmentation1 unlabeled 0.2 0.9 0.1 0.1 random augmentation2 Teacher CNN More accurate result exponential moving average

Summary

• Semi-supervised learning is awesome.

• Data augmentation is important.

• Hyperparameter tuning is arduous but indispensable.

31