Datasets:
Tasks:
Image Classification
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
1K - 10K
Tags:
art
License:
File size: 820 Bytes
dcd93ac 84a3fbf dcd93ac f3f157e dcd93ac 41dd085 dcd93ac 84a3fbf dcd93ac 84a3fbf 41dd085 84a3fbf dcd93ac d109e5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import pandas as pd
from datasets import Dataset, DatasetDict, concatenate_datasets
import os
def load_data(csv_file):
df = pd.read_csv(csv_file)
# Update the image_path column to include the full path
df['label'] = df['label'].astype(int)
dataset = Dataset.from_pandas(df)
return dataset
def load_dataset():
# Define CSV files
train_csv = 'train_labels.csv'
test_csv = 'test_labels.csv'
# Load datasets
train_dataset = load_data(train_csv)
# Combine datasets for training
test_dataset = load_data(test_csv)
# Create DatasetDict
dataset_dict = DatasetDict({
'train': train_dataset,
'test': test_dataset
})
return dataset_dict
if __name__ == "__main__":
dataset = load_dataset()
print(dataset)
|