File size: 451 Bytes
a99072f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import csv
import json
import os

import datasets
import pandas as pd
import numpy as np

ds = datasets.load_dataset('./coco_dataset_script.py', data_dir='/home/33611/caption/')
ds = ds['train']


def transform(example):

    example['pixel_values'] = np.load(example['pixels_file'])
    return example


# ds = ds.map(transform)

n = 0
for x in ds:
    n += 1
    assert os.path.isfile(x['image_file'])
    if n == 10:
        print(x)
        break