-
Notifications
You must be signed in to change notification settings - Fork 45.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MixUp + Cutmix implementation is (badly!) incorrect #13490
Comments
Hi @dibyaghosh, Thanks for bringing out the issue and raising PR. I have reproduced the issue and observed the deviation between Please track the PR raised for this issue as well. Thank You |
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you. |
This issue was closed due to lack of activity after being marked stale for past 7 days. |
The function `_sample_from_beta(alpha, beta, shape)` in `MixupAndCutmix` class, is not having the same functionality as `numpy.random.beta`. So `tfm.vision.augment.MixupAndCutmix._sample_from_beta(0.2, 0.2, tf.shape( tf.range(10000))).numpy()` is also deviating as well. So suggesting the fix keeping `alpha=alpha, beta=1.0` in `_sample_from_beta`. The reproduced [gist](https://colab.sandbox.google.com/gist/LakshmiKalaKadali/06533824610d6e85ea4aa3c6399819e6/tf_model_13490.ipynb#scrollTo=zSlE-3YDjL91) also attached. This PR closes [#13490](#13490) Thank You
The code for sampling from a beta distribution in tfm.vision.augment.MixupAndCutmix._sample_from_beta is incorrect:
It should be
https://github.com/tensorflow/models/blob/8c5c79c27c4bb2843308bf8623daa24f4f3cbe62/official/vision/ops/augment.py#L2712C1-L2713C1
This results in very bad mixup samples:
The text was updated successfully, but these errors were encountered: