Giter VIP home page Giter VIP logo

mixup's Introduction

MixUp

This is an implement and Improvement  on mixup: Beyond Empirical Risk Minimization https://arxiv.org/abs/1710.09412

The improvement

  1. add backward
  2. add mix rate

Two scenes:

image

The detail design of MixUp layer:

image

The results:

The symbol of resnet50 is writen by mxnet https://github.com/apache/incubator-mxnet/tree/master/example/image-classification/symbols, there have many versions. And i havenot do any optimizion for it. All the results are based on this baseline.

        cifar10              alpha        mix_rate test Acc initial learning rate batch size
(ERM)resnet50 90epoch - - 0.87900390625 0.05 256
(ERM)resnet50 200epoch - - 0.89365234375 0.05 256
(ERM)resnet50 300epoch - - 0.8931640625 0.05 256
(mixup)resnet50 90epoch 0.2 0.7 0.8609375 0.7 256
(mixup)resnet50 200epoch 0.2 0.7 0.91611328125 0.7 256
(mixup)resnet50 300epoch 0.2 0.7 0.9224609375 0.7 256
mixup in feature maps(resnet50 head conv)90epoch     0.2     0.7         0.8544921875 0.7 256
mixup in feature maps(resnet50 head conv)200epoch     0.2     0.7         0.91796875 0.7 256
mixup in feature maps(resnet50 head conv)300epoch     0.2     0.7         0.91845703125 0.7 256

MixUp

image

Mixup in feature map (resnet50 head conv)

image

ERM

image

Usage

install mxnet0.12 The mixup is in:symbols/mixup.py you can use it in your codes like:

data ,label = mx.sym.Custom(data= data,label = label,alpha = 0.2,num_classes = num_classes,batch_size = batch_size,mix_rate =0.7,op_type = 'MixUp')

label is the vector like [4,8,...9]

download the dataset

http://data.mxnet.io/data/cifar10/cifar10_val.rec

http://data.mxnet.io/data/cifar10/cifar10_train.rec

train & test:

./train.sh
./test.sh

Reference

Zhang H, Cisse M, Dauphin Y N, et al. mixup: Beyond Empirical Risk Minimization[J]. arXiv preprint arXiv:1710.09412, 2017.

mixup's People

Contributors

unsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixup's Issues

how to set is_train in resent_mixup when eval on validation set?

Hi, this is a very nice interpretation of mixup using mxnet, I have a question about the "is_train" in resnet_mixup, I think the mixed data and labels are used only in training process, when eval accuracy the data is not mixed.
But in this code, I don't know where set the "is_train" false when get test acc in training. Thx if providing some more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.