Batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'NoneType'>

Ayush_Singh: <p>I am making use of DataLoader but it is giving me an error, I have attracted my code at this gist:- <a href="https://gist.github.com/ayush714/855c4a0000e6f33ee8efb867f2dc29b3" class="inline-onebox" rel="noopener nofollow ugc">dataset.py · GitHub</a></p>
<p>You can check there, below is my folder directory:-<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/8/08bae8566ae0a04fce486267754bdcf3eb81fedd.png" data-download-href="https://discuss.pytorch.org/uploads/default/08bae8566ae0a04fce486267754bdcf3eb81fedd" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/0/8/08bae8566ae0a04fce486267754bdcf3eb81fedd.png" alt="image" data-base62-sha1="1fegzOK62wx3dE3zSm3BC5VnSbz" width="690" height="194" data-dominant-color="FAFAFA"><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">784×221 9.08 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>
and going inside train folder:-<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/0/30c451bc4ab65468cfb0481cc47e3378e6699cfa.png" data-download-href="https://discuss.pytorch.org/uploads/default/30c451bc4ab65468cfb0481cc47e3378e6699cfa" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/0/30c451bc4ab65468cfb0481cc47e3378e6699cfa.png" alt="image" data-base62-sha1="6XpwU07ZI9oBNUfyNPMwy2JcSmu" width="690" height="364" data-dominant-color="F9F9F8"><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">839×443 28.6 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>
and going one of the folder inse train folder:-<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/f/afc26b04f34a5c47e2e8df08d55e3af66ef8f30a.png" data-download-href="https://discuss.pytorch.org/uploads/default/afc26b04f34a5c47e2e8df08d55e3af66ef8f30a" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/a/f/afc26b04f34a5c47e2e8df08d55e3af66ef8f30a.png" alt="image" data-base62-sha1="p4Q5Xhym2R1fiewCEjMpXLdkiWC" width="690" height="162" data-dominant-color="FBFBFC"><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">924×218 6.53 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 am debugging from hours, let me know if you can help me in this!!</p>

L-Reichardt: <p>I’ve looked over your code, but haven’t found anything at first glance. Only thing that comes to mind is if your loader is not actually accessing an image.</p>
<p>Did you check if your <code>glob.glob</code> is actually finding a filepath? It could return empty lists. If yes, check if your <code>img_path = self.filenames[index]</code> actually gets a correct file name.</p>