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
Cached augmentation in segmentation tutorial - this does not increase dataset size #47755
Comments
(Happy to contribute change to tutorial, if we agree that this is a problem) |
@jameshfisher I think the tutorial should probably mention the advantages and disadvantages. Image augmentation quickly becomes the bottleneck, and depending on your goals both ways can be useful. |
@RobertBiehl what are the advantages of the current approach (cached augmentation) vs no augmentation? As far as I can see, there aren't any, but I might be missing something ...? |
FYI, this post was popular a few days ago, about what seems to be an identical issue with PyTorch tutorials. |
Thanks @jameshfisher, your suggestion is much better. Caching right before augmentation will give most of the benefits of caching, while still allowing augmentation to be re-applied each epoch, so that the model gets to train on a wider variety of inputs. If you're still interested in submitting a change, I'd be happy to review. |
I guess it is an edge case. E.g. if for some reason the fact that you augment changes the input data distribution in a way you want, and for performance reasons you accept the fact that the augmentation is frozen for the rest of the training. (e.g. if the reason for augmentation is not just producing more training data but changing the input in some way). For the tutorial you suggestion definitely makes sense. |
Thank you for the awesome feedback @jameshfisher @RobertBiehl @aaudiber 👍 We'll check this out cc @MarkDaoust |
URL(s) with the issue:
https://www.tensorflow.org/tutorials/images/segmentation
Description of issue (what needs changing):
Augmentation, to increase the size of the dataset, has to convert one source datapoint into many augmented datapoints. But in this tutorial, augmentation is applied once to each datapoint - effectively keeping the dataset size the same. The root cause is that augmentation is applied before a
Dataset.cache()
.These are the relevant lines of the tutorial:
I believe this should look more like (untested):
The text was updated successfully, but these errors were encountered: