File size: 492 Bytes
49ae81b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Import necessary libraries for creating a dataset
from datasets import load_dataset

# Load your preprocessed data
data = np.load('preprocessed_data.npy', allow_pickle=True)

# Create a Hugging Face compatible dataset
dataset = {
    'image_path': [item['image_path'] for item in data],
    'label': [item['label'] for item in data],
    'image': [item['image'] for item in data]
}

# Create a Dataset object
khmer_ocr_dataset = load_dataset('your_custom_dataset_name', data_files=dataset)