How to extract the files of ImageNet-1K dataset for each class separately?

293 views Asked by At

I have downloaded the ImageNet1K data from https://huggingface.co/datasets/imagenet-1k/tree/main/data . However, the tar files include images with the filenames ILSVRC2012_val_00000009_n03794056.JPEG . Is there any script to contract the files in the following format (each class have a folder in train and validation folder)?

│imagenet/
├──train/
│  ├── n01440764
│  │   ├── n01440764_10026.JPEG
│  │   ├── n01440764_10027.JPEG
│  │   ├── ......
│  ├── ......
├──val/
│  ├── n01440764
│  │   ├── ILSVRC2012_val_00000293.JPEG
│  │   ├── ILSVRC2012_val_00002138.JPEG
│  │   ├── ......
│  ├── ......
0

There are 0 answers