Can not correctly parse the classes with imagefolder
NONE
I found that the problem arises because the image files in my folder are actually symbolic links (for my own reasons).  After modifications, the classes can now be correctly parsed. Therefore, I close this issue.
2022-03-25T09:27:56Z
https://github.com/huggingface/datasets/issues/4015#issuecomment-1078821835
https://api.github.com/repos/huggingface/datasets/issues/4015
IC_kwDODunzps5ATYPL
https://api.github.com/repos/huggingface/datasets/issues/comments/1078821835/reactions
2022-03-25T09:27:56Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1078821835
https://avatars.githubusercontent.com/u/21264909?v=4
https://api.github.com/users/YiSyuanChen/events{/privacy}
https://api.github.com/users/YiSyuanChen/followers
https://api.github.com/users/YiSyuanChen/following{/other_user}
https://api.github.com/users/YiSyuanChen/gists{/gist_id}
https://github.com/YiSyuanChen
YiSyuanChen
MDQ6VXNlcjIxMjY0OTA5
https://api.github.com/users/YiSyuanChen/orgs
https://api.github.com/users/YiSyuanChen/received_events
https://api.github.com/users/YiSyuanChen/repos
https://api.github.com/users/YiSyuanChen/starred{/owner}{/repo}
https://api.github.com/users/YiSyuanChen/subscriptions
User
https://api.github.com/users/YiSyuanChen
public
NONE
HI, I have a question. How much time did you load the ImageNet data files? 
2022-03-28T01:02:03Z
https://github.com/huggingface/datasets/issues/4015#issuecomment-1080071710
https://api.github.com/repos/huggingface/datasets/issues/4015
IC_kwDODunzps5AYJYe
https://api.github.com/repos/huggingface/datasets/issues/comments/1080071710/reactions
2022-03-28T01:02:03Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1080071710
https://avatars.githubusercontent.com/u/60869411?v=4
https://api.github.com/users/TXacs/events{/privacy}
https://api.github.com/users/TXacs/followers
https://api.github.com/users/TXacs/following{/other_user}
https://api.github.com/users/TXacs/gists{/gist_id}
https://github.com/TXacs
TXacs
MDQ6VXNlcjYwODY5NDEx
https://api.github.com/users/TXacs/orgs
https://api.github.com/users/TXacs/received_events
https://api.github.com/users/TXacs/repos
https://api.github.com/users/TXacs/starred{/owner}{/repo}
https://api.github.com/users/TXacs/subscriptions
User
https://api.github.com/users/TXacs
public
## Describe the bug
I try to load my own image dataset with imagefolder, but the parsing of classes is incorrect.

## Steps to reproduce the bug
I organized my dataset (ImageNet) in the following structure:
```
  - imagenet/
      - train/
          - n01440764/
              - ILSVRC2012_val_00000293.jpg
              - ...... 
          - n01695060/
          - ......
      - val/ 
          - n01440764/
          - n01695060/
          - ......
```

At first, I followed the instructions from the Huggingface [example](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification#using-your-own-data) to load my data as:
```
from datasets import load_dataset
data_files = {'train': 'imagenet/train', 'val': 'imagenet/val'}
ds = load_dataset("nateraw/image-folder", data_files=data_files, task="image-classification")
```
but it resulted following error (I mask my personal path as <PERSONAL_PATH>):
```
FileNotFoundError: Unable to find 'https://huggingface.co/datasets/nateraw/image-folder/resolve/main/imagenet/train' at <PERSONAL_PATH>/ImageNet/https:/huggingface.co/datasets/nateraw/image-folder/resolve/main
```

Next, I followed a recent issue #3960 to load data as:
```
from datasets import load_dataset
data_files = {'train': ['imagenet/train/**'], 'val': ['imagenet/val/**']}
ds = load_dataset("imagefolder", data_files=data_files, task="image-classification")
```
and the data can be loaded without error as: (I copy val folder to train folder for illustration)
```
>>> ds
DatasetDict({
    train: Dataset({
        features: ['image', 'labels'],
        num_rows: 50000
    })
    val: Dataset({
        features: ['image', 'labels'],
        num_rows: 50000
    })
})
```
However, the parsed classes is wrong (should be 1000 classes):
```
>>> ds["train"].features
{'image': Image(decode=True, id=None), 'labels': ClassLabel(num_classes=1, names=['val'], id=None)}
```

## Expected results
I expect that the "labels" in ds["train"].features should contain 1000 classes.

## Actual results
The "labels" in ds["train"].features contains only 1 wrong class.

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
- `datasets` version: 2.0.0
- Platform: Ubuntu 18.04
- Python version: Python 3.7.12
- PyArrow version: 7.0.0
