ImageFolder dataset builder for HF Hub dataset

I’ve been using load_dataset("imagefolder", data_dir="...") to load a local dataset of images and assign a series of labels from an included metadata.csv file for multi-label image classification.

However, I uploaded that dataset to the Hub and now load it in using load_dataset("hf_name",data_dir="...") but since I have to specify the Hub directory name instead of “imagefolder” for the path parameter, the labels in metadata.csv aren’t being assigned anymore.

Is there a way to fix this?

Hi,

If loading from the hub, you don’t need to specify data_dir anymore.

Ah thanks for the suggestion. Still having trouble with labels being assigned using the metadata.csv though.

This is explained in detail here: Create an image dataset.

The issue was that I had an extra image in the Hub directory that wasn’t included in the metadata.csv file. Removed the image and labels are being assigned now!