Datasets:
Tasks:
Image Segmentation
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
1K<n<10K
License:
| import os | |
| import datasets | |
| class Demo(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): | |
| # Access the file directly from the root of the repo | |
| parquet_path = "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"], # assuming this is already like "images/xyz.webp" | |
| "img_height": row["img_height"], | |
| } | |