Problem reading imagefolder file of pytorch Tianchi platform

CSDN Q & A 2022-01-15 02:35:55

###### 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

```


thank
Similar articles

2022-01-15

2022-01-15