Datasets:
Tasks:
Image Segmentation
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
1K<n<10K
License:
Srushti Hirve
commited on
Commit
·
5cf62e2
1
Parent(s):
fdd9f7b
WIP: preparing to sync with remote
Browse files- .DS_Store +0 -0
- view_dataset.py +7 -0
- visionreasoner_demo.py +0 -36
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
view_dataset.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import load_dataset
|
| 2 |
+
|
| 3 |
+
# Use the custom dataset script from the remote repo
|
| 4 |
+
ds = load_dataset("shirve13/Demo", data_dir=".", download_mode="force_redownload", trust_remote_code=True)
|
| 5 |
+
|
| 6 |
+
# Print a sample
|
| 7 |
+
print(ds["train"][0])
|
visionreasoner_demo.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import datasets
|
| 3 |
-
|
| 4 |
-
class VisionReasonerDataset(datasets.GeneratorBasedBuilder):
|
| 5 |
-
def _info(self):
|
| 6 |
-
return datasets.DatasetInfo(
|
| 7 |
-
features=datasets.Features({
|
| 8 |
-
"id": datasets.Value("string"),
|
| 9 |
-
"problem": datasets.Value("string"),
|
| 10 |
-
"solution": datasets.Value("string"),
|
| 11 |
-
"image": datasets.Image(), # Enables image previews
|
| 12 |
-
"img_height": datasets.Value("int32"),
|
| 13 |
-
}),
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
def _split_generators(self, dl_manager):
|
| 17 |
-
parquet_path = os.path.join(dl_manager.manual_dir, "visionreasoner_dataset.parquet")
|
| 18 |
-
return [
|
| 19 |
-
datasets.SplitGenerator(
|
| 20 |
-
name=datasets.Split.TRAIN,
|
| 21 |
-
gen_kwargs={"filepath": parquet_path}
|
| 22 |
-
),
|
| 23 |
-
]
|
| 24 |
-
|
| 25 |
-
def _generate_examples(self, filepath):
|
| 26 |
-
import pandas as pd
|
| 27 |
-
df = pd.read_parquet(filepath)
|
| 28 |
-
for idx, row in df.iterrows():
|
| 29 |
-
yield idx, {
|
| 30 |
-
"id": row["id"],
|
| 31 |
-
"problem": row["problem"],
|
| 32 |
-
"solution": row["solution"],
|
| 33 |
-
"image": row["image"]["path"],
|
| 34 |
-
"img_height": row["img_height"],
|
| 35 |
-
}
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|