编程知识 cdmana.com

Problem reading imagefolder file of pytorch Tianchi platform

###### I use cd mv linux The command celeba The classification file is in /data Directory, but the file cannot be read

sh-4.2$ cd /data/

sh-4.2$ ls
celeba nas
sh-4.2$ cd celeba/
sh-4.2$ ls
img_align_celeba
sh-4.2$ cd img_align_celeba/
sh-4.2$ ls
000001.jpg
Notepad procedure :

dataroot = "/data/celeba"dataset = dset.ImageFolder(root=dataroot,                           transform=transforms.Compose([                               transforms.Resize(image_size),                               transforms.CenterCrop(image_size),                               transforms.ToTensor(),                               transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
                           transforms.CenterCrop(image_size),                           transforms.ToTensor(),                           transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),

FileNotFoundError: Found no valid file for the classes .ipynb_checkpoints. Supported extensions are: .jpg, .jpeg, .png, .ppm, .bmp, .pgm, .tif, .tiff, .webp
Later I tried to copy the code to l Under another folder , Use absolute path , But still not
dataroot = "data/nas/workspace/jupyter/jupyter/celeba"
FileNotFoundError: [Errno 2] No such file or directory: 'data/nas/workspace/jupyter/jupyter/celeba'

I've tried both methods, but neither , I tried to put the path ‘/’ Get rid of , But still not
dataroot = "data/celeba"
FileNotFoundError: [Errno 2] No such file or directory: 'data/celeba'

File reading is normal

```python

```

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/12/20211207173647387j.html

Scroll to Top