How to use transform to preserve both original data object and a copy #8437
-
I have a graph for which nodes are described partially by their position in a 2-D coordinate system. What's more, the labels are invariant to symmetries. Therefore, I could easily generate more free data by reflecting nodes against x, y and xy. As a result, I have four copies of each input data object, and I want to retain all of them for training. I know the data augmentation can be done using transforms/pre-transforms. However, this usually keeps only the augmented data object, not the augmented and original objects together. I'm attaching my implementation for horizontal reflections below (vertical reflection is analogous, and horizontal-vertical one is just a composition of the two).
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
How about: dataset = torch.utils.data.ConcatDataset([
Dataset(...),
Dataset(..., transform=...),
Dataset(..., transform=...),
]) |
Beta Was this translation helpful? Give feedback.
-
Another option is to define a |
Beta Was this translation helpful? Give feedback.
How about: