Git Product home page Git Product logo

mixup-generator's Introduction

yu4u's github stats

mixup-generator's People

Contributors

yu4u 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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixup-generator's Issues

[Enhancement] Making thread safe

Attempting to employ multithreading throws the warning/error
"UserWarning: Using a generator with use_multiprocessing=True and multiple workers may duplicate your data. Please consider using thekeras.utils.Sequence class. UserWarning('Using a generator with use_multiprocessing=True`'"

I've attempted to rewrite it a bit to bring it into line with the keras sequence class but I'm still getting that warning and am admittedly new to this generator.
https://keras.io/utils/#sequence

Before going further I wanted to ask the obvious question of whether there's a constraint somewhere that makes it hard to convert to thread safe? If not, I'd like to put it in as an enhancement request.

Got different results

I ran your code and got some different results,

Without mixup:
Test loss: 0.5639845668315887
Test accuracy: 0.9017000198364258

With mixup alpha = 0.2:
Test loss: 0.5545909198760987
Test accuracy: 0.90420001745224

There doesn't seem to be much difference between the two.Can you analyze the reason?

Reversing?

Is batch_ids[:self.batch_size] and batch_ids[self.batch_size:] trying to mirror each other?
However, batch_ids[self.batch_size:] should return an empty array.
a = [1,2,3,4,5]
a[:5] -> [1, 2, 3, 4, 5]
a[5:] -> []

Difference with the original paper

Hi @yu4u!
Thank you for your work!

After studying the repo, I still have one question about label processing.
In the original implementation , the processing of mixing up for labels happens at the time of loss computing:

def mixup_criterion(criterion, pred, y_a, y_b, lam):
    return lam * criterion(pred, y_a) + (1 - lam) * criterion(pred, y_b)

In your implementation, you're mixing up the labels:

y1 = self.y_train[batch_ids[:self.batch_size]]
y2 = self.y_train[batch_ids[self.batch_size:]]
y = y1 * y_l + y2 * (1 - y_l)

After inserting the resulting labels into the equation even for binary_cross_entropy, the resulting equation isn't the same.
So, the question is, what was the motivation for changing the place for performing the mixup for labels?

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.