RuntimeError: Found 0 files in subfolders of: /home/akb/pytorch_learning/dogsandcats/all/train/ Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif

username: Aakash_Bhatia
cooked: <p>for t in [‘train’,‘valid’]:<br>
for folder in [‘dog/’,‘cat/’]:<br>
os.mkdir(os.path.join(path,t,folder))</p>
<pre><code>    for i in shuffle[:2000]:
        #shutil.copyfile(files[i],'../chapter3/dogsandcats/valid/')
        folder = files[i].split('/')[-1].split('.')[0]
        image = files[i].split('/')[-1]
        os.rename(files[i],os.path.join(path,'valid',folder,image))
</code></pre>
<p>for i in shuffle[2000:]:<br>
<span class="hashtag">#shutil</span>.copyfile(files[i],’/dogsandcats/all/valid/’)<br>
folder = files[i].split(’/’)[-1].split(’.’)[0]<br>
image = files[i].split(’/’)[-1]<br>
os.rename(files[i],os.path.join(path,‘train’,folder,image))</p>
<p>if torch.cuda.is_available():<br>
is_cuda = True</p>
<p>simple_transform=transforms.Compose([transforms.Resize((224,224)),<br>
transforms.ToTensor(),<br>
transforms.Normalize([0.485, 0.456,<br>
0.406,],[0.229, 0.224, 0.225])])</p>
<p>train = ImageFolder(’/home/akb/pytorch_learning/dogsandcats/all/train/’,simple_transform)<br>
valid = ImageFolder(’/home/akb/pytorch_learning/dogsandcats/all/valid/’,simple_transform)</p>
<p>i am working on kaggle dogs vs cats data sets. but getting this error, can anyone help me out. thanks in advance</p>

username: ptrblck
cooked: <p>Could you just validate the paths in your terminal with:</p>
<pre><code class="lang-auto">ls /home/akb/pytorch_learning/dogsandcats/all/train/
ls /home/akb/pytorch_learning/dogsandcats/all/valid/
</code></pre>

username: Aakash_Bhatia
cooked: <p>have images in Train folder<br>
no images in valid folder</p>

username: mathematics
cooked: <p>Help!!<br>
Similar problem is happening to me when<br>
I used directory <code>processed_celeba/</code> when loading images from folder.</p>
<p>but surprisingly , when i used the original celeba dataset and unzipped in same folder as directory as</p>
<pre><code class="lang-auto">
- processed_celeba/
      - celeba
</code></pre>
<p>It works finely,</p>
<p>but when i used my own celebrity dataset images and stored in <code>processed_celeba/celeba/</code><br>
Started throwing error as above.<br>
Thanks for help <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"> .</p>
<pre><code class="lang-auto">
def get_dataloader(batch_size, image_size, data_dir='processed_celeba_small/'):
    transformed = transforms.Compose([
    transforms.Resize(image_size),
    transforms.ToTensor(),
    ])
    data = datasets.ImageFolder(data_dir, transform=transformed)  
    dataloader = torch.utils.data.DataLoader(data, batch_size=batch_size,  shuffle=True, num_workers=0)
    return dataloader

</code></pre>

username: ptrblck
cooked: <p>Based on your description you’ve stored your images in <code>processed_celeba/celeba</code> while you are passing <code>processed_celeba_small</code> as the path to the <code>ImageFolder</code>.<br>
I’m not sure if it is just a copy-paste error, but you should provide the same path.</p>

username: mathematics
cooked: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> ,Sorry but I found it was my silly mistake. It was not accepting my images but accepting that unzipped images.<br>
After debugging, I found that there is no extensions in my images.<br>
<code>processed_celeba_small/</code> worked well after adding .jpg ext inside to images.</p>