Datasets:
Tasks:
Image Segmentation
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
1K<n<10K
License:
File size: 1,215 Bytes
042e479 |
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 |
import os
import datasets
class VisionReasonerDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features({
"id": datasets.Value("string"),
"problem": datasets.Value("string"),
"solution": datasets.Value("string"),
"image": datasets.Image(), # Enables image previews
"img_height": datasets.Value("int32"),
}),
)
def _split_generators(self, dl_manager):
parquet_path = os.path.join(dl_manager.manual_dir, "visionreasoner_dataset.parquet")
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={"filepath": parquet_path}
),
]
def _generate_examples(self, filepath):
import pandas as pd
df = pd.read_parquet(filepath)
for idx, row in df.iterrows():
yield idx, {
"id": row["id"],
"problem": row["problem"],
"solution": row["solution"],
"image": row["image"]["path"],
"img_height": row["img_height"],
}
|