harshj94
(Harsh Kumar Jain)
September 18, 2019, 3:07pm
#1
I am having a dataset with multiple classes with each class having multiple images.
While running the loop over data loader I want to get two images from each class in every iteration.
I would like to have an iterator like
for image1, image2, label in dataloader:
Please let me know how can I achieve this.
Blockquote
https://pytorch.org/tutorials/beginner/data_loading_tutorial.html\
Look this official tutorial. You should rewrite the getitem method for your custom dataset which inherite from torch.utils.data.Dataset module.
1 Like
harshj94
(Harsh Kumar Jain)
September 19, 2019, 3:45pm
#4
@Nathan_Drake Thanks. Its done.
Hello,
The link seems to be broken.
@harshj94 Can you please share how you did that ?
Were u able to use torchvision.datasets.ImageFolder in some way ?
harshj94
(Harsh Kumar Jain)
December 17, 2019, 3:56pm
#6
The updated link is: Data Loading Tutorial
You need to override the _len_ and _getitem_ function.
You can do one-time processing needed in the init function.
Thanks a lot !
I got it and finally manage to build a multi-inputs network (2 images and 1 vector of custom features).