yu4u / mixup-generator Goto Github PK
View Code? Open in Web Editor NEWAn implementation of "mixup: Beyond Empirical Risk Minimization"
License: MIT License
An implementation of "mixup: Beyond Empirical Risk Minimization"
License: MIT License
why the training accuracy goes done when I add mixup?
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.
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?
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:] -> []
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?
hello I wonder if it can be implemented in pytorch ?
how to change the source code to fix detection, about two image size and box label add.
can it support keras Sequence, make the data generator to multi-processes version?
thank you for this!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.