-1

I'm trying to use a load a local dataset I have with huggingfaces dataloaders (as shown here https://huggingface.co/docs/datasets/v2.4.0/en/image_load) and I can only seem to get the images to show and not the labels/captions.

My data is stored in my google drive as so: /content/content/Train_Data/ with a csv file inside to store the captions of my images and a file with said images also inside this file.

data_files = {"train": "/content/content/Train_Data/**", "test": "/content/content/Test_Data/**"}
dataset = load_dataset("imagefolder", data_files=data_files)
dataset

which outputs

DatasetDict({
    train: Dataset({
        features: ['image', 'label'],
        num_rows: 113
    })
    test: Dataset({
        features: ['image', 'label'],
        num_rows: 66
    })
})

When I inspect the image column I can see the images, however when I try to see inside the caption/label nothing appears

dataset['train'][0]["label"]

How can I resolve this issue?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Josh
  • 1
  • 2

0 Answers0