Have question about torchvision ImageFolder

Yolkandwhite: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00.png" data-download-href="https://discuss.pytorch.org/uploads/default/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00" title="brainMRI1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/f/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00_2_457x500.png" alt="brainMRI1" data-base62-sha1="950J4ucjn7vOVRMmyu2Av00d6mY" width="457" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/f/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00_2_457x500.png, https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fa498b304c008cd3f14f3c4b7dbb5a5c0e64a00.png 2x" data-dominant-color="EAEBEC"><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">brainMRI1</span><span class="informations">611×668 242 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>
<p>As you can see in this picture above there are lots of image files in that directory.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/c/2cf70bae46bda84b98314b2839d00ab43dab0c42.png" data-download-href="https://discuss.pytorch.org/uploads/default/2cf70bae46bda84b98314b2839d00ab43dab0c42" title="brainMRI2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2cf70bae46bda84b98314b2839d00ab43dab0c42_2_690x308.png" alt="brainMRI2" data-base62-sha1="6pMiH1RA2FSeKe4Deq8HR6zVc6S" width="690" height="308" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2cf70bae46bda84b98314b2839d00ab43dab0c42_2_690x308.png, https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2cf70bae46bda84b98314b2839d00ab43dab0c42_2_1035x462.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/2/c/2cf70bae46bda84b98314b2839d00ab43dab0c42.png 2x" data-dominant-color="F1F1F2"><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">brainMRI2</span><span class="informations">1245×557 235 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>
<p>I don’t know why the number of datapoints is 2</p>
<p>doesn’t it mean the imagefolder reads 2 imagefiles?</p>
<p>I have no idea why ImageFolder doesn’t reads the whole imagefiles I have in that directory.</p>
<hr>
<h3><a name="edited-1" class="anchor" href="#edited-1"></a>edited</h3>
<p>just found another weird thing.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/d/6da3f2d3a13b3f7622196a60bf434cac9c9e0863.png" data-download-href="https://discuss.pytorch.org/uploads/default/6da3f2d3a13b3f7622196a60bf434cac9c9e0863" title="brainmri3"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/d/6da3f2d3a13b3f7622196a60bf434cac9c9e0863_2_690x397.png" alt="brainmri3" data-base62-sha1="fDViKsFDLfR22Oujnuef7ivuHE7" width="690" height="397" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/d/6da3f2d3a13b3f7622196a60bf434cac9c9e0863_2_690x397.png, https://discuss.pytorch.org/uploads/default/original/3X/6/d/6da3f2d3a13b3f7622196a60bf434cac9c9e0863.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/6/d/6da3f2d3a13b3f7622196a60bf434cac9c9e0863.png 2x" data-dominant-color="F4F3F3"><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">brainmri3</span><span class="informations">865×498 168 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>
<p>why in the mask directory gets 4 image data???</p>
<p>all the files have same name but mask folder with mask on the back.<br>
just like this</p>
<blockquote>
<p>MRI folder —&gt;  TCGS_CS_4941.tif<br>
Mask folder —&gt; TCGS_CS_4941_mask.tif</p>
</blockquote>

tom: <p>As per the documentation <a href="https://pytorch.org/docs/stable/torchvision/datasets.html#torchvision.datasets.ImageFolder" rel="nofollow noopener">documentation</a>, ImageFolder expects images to be organized as <code>class/instance.tif</code> with class subfolders.</p>
<p>Best regards</p>
<p>Thomas</p>

Yolkandwhite: <p><a class="mention" href="/u/tom">@tom</a><br>
hmm but I still don’t get it.<br>
Even if I do what I did,<br>
I think It needs to get the whole image files with 1 class which is ‘BrainMRI_train’ in my case.</p>

tom: <p>No, it’s not in a subfolder? You would need to create a dummy subfolder of <code>MRI</code> and move the tifs to that.</p>
<p>Best regards</p>
<p>Thomas</p>

Yolkandwhite: <p><a class="mention" href="/u/tom">@tom</a></p>
<p>Thank you for the replies.<br>
I created subfolders but now I’m getting only 1 datapoint each…</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fb432c34efca8a9989dfe8174cde679e0184b16.png" data-download-href="https://discuss.pytorch.org/uploads/default/3fb432c34efca8a9989dfe8174cde679e0184b16" title="brainmri4"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/f/3fb432c34efca8a9989dfe8174cde679e0184b16_2_690x375.png" alt="brainmri4" data-base62-sha1="95y9wOXJPhODefT11O98yiSz7Lg" width="690" height="375" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/f/3fb432c34efca8a9989dfe8174cde679e0184b16_2_690x375.png, https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fb432c34efca8a9989dfe8174cde679e0184b16.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/3/f/3fb432c34efca8a9989dfe8174cde679e0184b16.png 2x" data-dominant-color="F4F3F4"><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">brainmri4</span><span class="informations">916×498 173 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>
<hr>
<h2><a name="edited-1" class="anchor" href="#edited-1"></a>Edited</h2>
<p>oh nevermind I think I figured it out<br>
I didn’t need to change the root directory all the way to subdirectory.</p>
<p>thank you very much!!</p>
<p>Best regards<br>
Yoonho</p>