I am using pytorch to build DCGAN which i aim to train on custom dataset.

I have already posted a question on training DCGAN on small dataset, and of course answer was data augmentation.

But i have a problem. I am coding in PyTorch and i want to perform several different transfomrations on existing ImageFolder object which represents my loaded dataset.

Idea was to perform, lets say around 5 different transformations, and after performing each transformation i want to expand my dataset by adding the newly transformed images to it. Here is pseudo code:

list_of_transformations = ['random_crop','center_crop','color_jitter','mirror','grayscale']
dataset = ImageFolder('path_to_dataset')
for t in list_of_transformations
       dataset += dataset.t()

I am guessing this might not be the best idea, or is even considered 'stupid', but i am new to Deep Learning and Python in general. Any help would be appreciated! Thank you in advance!


1 Answer 1


I've just found out about the class torch.utils.data.ConcatDataset([datasets]) . Its easy to use and documentation is here : http://pytorch.org/docs/master/data.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.