I’d like to do data augmentation and feature extraction on the fly. However, this is computationally expensive. Is there a way to pre-compute a minibatch (data augmentation + feature extraction) on the CPU while the previous minibatch is being used to train the model on the GPU?
Yes, by setting num_workers>=1
in the DataLoader
multiple processes will be spawned which will preload the batches in the background.
1 Like