Hello I want to know about this error how to resolve it

H_M_Ahmed: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/6/3614329ede7d2cd72004c228545826bfff2a6fd0.png" data-download-href="https://discuss.pytorch.org/uploads/default/3614329ede7d2cd72004c228545826bfff2a6fd0" title="Error"><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/6/3614329ede7d2cd72004c228545826bfff2a6fd0.png" alt="Error" data-base62-sha1="7Ip3wyfbhcyEtBpOBhMp4Fgc7Qs" width="690" height="316" data-dominant-color="F3F2F4"><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">Error</span><span class="informations">1033×474 30.1 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><br>
File not found error i want to access dataset from my google drive to compose resize and normalize dataset</p>

khushi-411: <p>Hi, The error suggests your path is not correct. Please check you have specified the right path. Also, you need to mount google drive first before accessing the files. You can mount that using these commands:</p>
<pre><code class="lang-python">from google.colab import drive
drive.mount('/content/drive')
</code></pre>
<p>Thanks!</p>

H_M_Ahmed: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/4/04b5030691be6f7c6248bc16b5fa211862f7ffae.png" data-download-href="https://discuss.pytorch.org/uploads/default/04b5030691be6f7c6248bc16b5fa211862f7ffae" title="1"><img src="https://discuss.pytorch.org/uploads/default/original/3X/0/4/04b5030691be6f7c6248bc16b5fa211862f7ffae.png" alt="1" data-base62-sha1="FDJ0pXL8JIDhO1eqhrUAAZoNdQ" width="690" height="169" data-dominant-color="F1F0F0"><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">1</span><span class="informations">1029×253 16.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><br>
I have done this mount my GDRIVE but when i want to transform this error occur</p>

H_M_Ahmed: <p>Images are loaded here from GDRIVE but when i try to transform dataset this above error occur</p>

H_M_Ahmed: <p>how i give right path here is there any reference?</p>

H_M_Ahmed: <aside class="quote no-group" data-username="khushi-411" data-post="2" data-topic="167091">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/khushi-411/48/51391_2.png" class="avatar"> khushi-411:</div>
<blockquote>
<pre><code class="lang-auto">from google.colab import drive
drive.mount('/content/drive')
</code></pre>
</blockquote>
</aside>
<p>now i get this error<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/e/4e6af30566560f0ac3173aab2aef5f114417dc7d.png" data-download-href="https://discuss.pytorch.org/uploads/default/4e6af30566560f0ac3173aab2aef5f114417dc7d" title="2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/e/4e6af30566560f0ac3173aab2aef5f114417dc7d_2_690x179.png" alt="2" data-base62-sha1="bbInAHBAFl24mtGbVgoWglGJa7b" width="690" height="179" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/e/4e6af30566560f0ac3173aab2aef5f114417dc7d_2_690x179.png, https://discuss.pytorch.org/uploads/default/optimized/3X/4/e/4e6af30566560f0ac3173aab2aef5f114417dc7d_2_1035x268.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/4/e/4e6af30566560f0ac3173aab2aef5f114417dc7d.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">2</span><span class="informations">1323×344 23.1 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>

khushi-411: <aside class="quote no-group" data-username="H_M_Ahmed" data-post="6" data-topic="167091">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/h_m_ahmed/48/51760_2.png" class="avatar"> H_M_Ahmed:</div>
<blockquote>
<p>now i get this error</p>
</blockquote>
</aside>
<p>It throws a not defined error, meaning you haven’t defined that. Use this:</p>
<pre data-code-wrap="python"><code class="lang-python">from torchvision.datasets import ImageFolder
</code></pre>
<p>This will help. Let me know if get caught in some other error after importing.</p>

H_M_Ahmed: <aside class="quote no-group" data-username="khushi-411" data-post="7" data-topic="167091">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/khushi-411/48/51391_2.png" class="avatar"> khushi-411:</div>
<blockquote>
<p><code>from torchvision.datasets import ImageFolder</code></p>
</blockquote>
</aside>
<p>i already import this above same error is occur i have a dataset on drive where there is a main folder then there is another subfolder where i place my images data can u guide me a right way to access data from drive</p>

H_M_Ahmed: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/6/3614329ede7d2cd72004c228545826bfff2a6fd0.png" data-download-href="https://discuss.pytorch.org/uploads/default/3614329ede7d2cd72004c228545826bfff2a6fd0" title="Error"><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/6/3614329ede7d2cd72004c228545826bfff2a6fd0.png" alt="Error" data-base62-sha1="7Ip3wyfbhcyEtBpOBhMp4Fgc7Qs" width="690" height="316" data-dominant-color="F3F2F4"><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">Error</span><span class="informations">1033×474 30.1 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><br>
now this error is occur</p>

H_M_Ahmed: <p>i can easily access my images after mount drive but below when i transform cant access this</p>

khushi-411: <p>Ah, I got this. I checkout ImageFolder <a href="https://pytorch.org/vision/0.8/datasets.html#imagefolder" rel="noopener nofollow ugc">documentation</a>. It assumes the images are accessed in this format:</p>
<pre><code class="lang-auto">root/dog/xxx.png
root/dog/xxy.png
root/dog/xxz.png

root/cat/123.png
root/cat/nsdf3.png
root/cat/asd932_.png
</code></pre>
<p>So, I think you need to provide the root path instead of the <code>withglassclasses</code> folder.</p>

H_M_Ahmed: <p>i didn’t get it how to give root path means ?</p>

H_M_Ahmed: <p>where i do this while accessing dataset ? or while transform?</p>

khushi-411: <aside class="quote no-group" data-username="H_M_Ahmed" data-post="12" data-topic="167091" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/h_m_ahmed/48/51760_2.png" class="avatar"> H_M_Ahmed:</div>
<blockquote>
<p>i didn’t get it how to give root path means ?</p>
</blockquote>
</aside>
<p>Please observe the example I posted. In your case arrange the data in the following order:</p>
<ul>
<li>Folder
<ul>
<li>train data
<ul>
<li>with glass</li>
<li>without glass</li>
</ul>
</li>
<li>test data
<ul>
<li>with glass</li>
<li>without glass</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Update path, something like… <code>/content/.....(path here)....../Folder/</code>. This will work I think.</p>

H_M_Ahmed: <p>i will try this … Thanks Alot !</p>

H_M_Ahmed: <p>I want to know is this the hierarchy of folders? like i have main folder then there is subfolder train then i put images here ? then give path ? Am i right?</p>