# Use two imagefolders in dataset

**URL:** <https://discuss.pytorch.org/t/use-two-imagefolders-in-dataset/44314>\
**Category:** Uncategorized\
**Created:** [May 3, 2019, 9:08pm UTC](https://discuss.pytorch.org/t/use-two-imagefolders-in-dataset/44314 "2019-05-03T21:08:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vali\_Calinescu](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/vali_calinescu/32/11026_2.png) [@Vali\_Calinescu](https://discuss.pytorch.org/u/Vali_Calinescu)\
**Post date:** [May 3, 2019, 9:08pm UTC](https://discuss.pytorch.org/t/use-two-imagefolders-in-dataset/44314/1 "2019-05-03T21:08:49Z")

</div>

I am trying to create a dataset with an imagefolder as input and another imagefolder to use as labels. Is there any way I can have them both in the same DataLoader?

My code is as follows:

```auto
dataset = torchvision.datasets.ImageFolder(root=TRAIN_DATA_PATH, transform=TRANSFORM_IMG)
dataset_labels = torchvision.datasets.ImageFolder(root=TRAIN_LABELS_PATH, transform=TRANSFORM_IMG)

```

I would like to be able to integrate `dataset_labels` into `dataset`, so that I can then just create a DataLoader from `dataset`.

---

<div class="post-metadata">

**Author:** ![AlbertZhang](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/albertzhang/32/16377_2.png) [@AlbertZhang](https://discuss.pytorch.org/u/AlbertZhang)\
**Post date:** [May 3, 2019, 9:18pm UTC](https://discuss.pytorch.org/t/use-two-imagefolders-in-dataset/44314/2 "2019-05-03T21:18:49Z")

</div>

use `torch.utils.data.ConcatDataset`
