Prepare dataloader

rjrohit996: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/f/1/f151db9a0723730157bb504a0f659750c3a2959f.png" alt="image" data-base62-sha1="yqOrTASSf3yg4LmWpwTM6zuCuhV" width="476" height="497"></p>
<ul>
<li>every image contains exactly two labels out of possible 35 labels</li>
<li>img1 to img 30 in each folder are the frames of a particular video</li>
</ul>
<p>How do I build a pytorch dataloader for this dataset?</p>

arundasan91: <p>You should be looking at Torchvision’s ImageFolder: <a href="https://pytorch.org/vision/0.8/datasets.html#imagefolder" class="inline-onebox" rel="noopener nofollow ugc">torchvision.datasets — Torchvision 0.8.1 documentation</a></p>

Valerio_Biscione: <p>The user case is different, as each image contains <em>two</em> <em>labels!</em> But I agree that a good starting point would be checking out the insides of ImageFolder <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"><br>
<a class="mention" href="/u/rjrohit996">@rjrohit996</a> how are the labels specified? Generally the labels are built from the folder structure, but in your case you have two labels. Where do they come from?</p>

rjrohit996: <p>I am trying to do kind of video captioning but not exactly that.<br>
In my dataset, each image has exactly two objects and one relationship among them.<br>
For example:- person-ride-bicycle i.e. each image contains following pair: object1-relationship-object2</p>
<p>object 1 and object 2 have 35 classes/labels to choose from<br>
relationship have 85 classes/labels to choose from</p>
<p>More about dataset-<br>
let’s consider first folder 0000. It has 30 images, these are frames of a same video (all will have same relationship let’s say: person-ride-bicycle)</p>
<p>i have annotations corresponding to each the folder. for eg,<br>
for the folder 0000, i have annotation 12-45-7 (object1-relationship-object2)<br>
for the folder 0001, i have annotation 22-54-30<br>
and so on…</p>
<p>Architecture looks something like this…<br>
relationship below is dog-plays-frisbee<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/6/166f4e846dce69e5b13d69754f252452e1b709c2.png" data-download-href="https://discuss.pytorch.org/uploads/default/166f4e846dce69e5b13d69754f252452e1b709c2" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/6/166f4e846dce69e5b13d69754f252452e1b709c2_2_690x330.png" alt="image" data-base62-sha1="3csYCWmRkyvqChr0V7PQJViqpRo" width="690" height="330" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/6/166f4e846dce69e5b13d69754f252452e1b709c2_2_690x330.png, https://discuss.pytorch.org/uploads/default/original/3X/1/6/166f4e846dce69e5b13d69754f252452e1b709c2.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/6/166f4e846dce69e5b13d69754f252452e1b709c2.png 2x" data-dominant-color="D6CFC7"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">927×444 97.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

rjrohit996: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> can you help? how can i load frames of a particular video as a single batch. all frames have same label</p>