Deva8 commited on
Commit
900e46a
·
verified ·
1 Parent(s): 4b8d639

Delete Generative-VQA-V2-Curated.py

Browse files
Files changed (1) hide show
  1. Generative-VQA-V2-Curated.py +0 -95
Generative-VQA-V2-Curated.py DELETED
@@ -1,95 +0,0 @@
1
- # Generative-VQA-V2-Curated.py
2
- """Custom loading script for Generative VQA V2 Curated dataset."""
3
-
4
- import datasets
5
- import pandas as pd
6
- import os
7
- from pathlib import Path
8
-
9
- _CITATION = """\
10
- @misc{devarajan_genvqa_2026,
11
- author = {Devarajan},
12
- title = {Generative-VQA-V2-Curated: A Balanced Dataset for Open-Ended Generative VQA},
13
- year = {2026},
14
- publisher = {Hugging Face},
15
- howpublished = {\\url{https://huggingface.co/datasets/Deva8/Generative-VQA-V2-Curated}}
16
- }
17
- """
18
-
19
- _DESCRIPTION = """\
20
- A curated, balanced, and cleaned version of the VQA v2 dataset specifically optimized for Generative Visual Question Answering.
21
- """
22
-
23
- _HOMEPAGE = "https://huggingface.co/datasets/Deva8/Generative-VQA-V2-Curated"
24
-
25
- _LICENSE = "MIT"
26
-
27
- _URLS = {
28
- "metadata": "main_metadata.csv",
29
- "images": "gen_vqa_v2-images.zip",
30
- }
31
-
32
-
33
- class GenerativeVQAV2Curated(datasets.GeneratorBasedBuilder):
34
- """Generative VQA V2 Curated dataset."""
35
-
36
- VERSION = datasets.Version("1.0.0")
37
-
38
- def _info(self):
39
- features = datasets.Features(
40
- {
41
- "image_id": datasets.Value("int64"),
42
- "question_id": datasets.Value("int64"),
43
- "question": datasets.Value("string"),
44
- "answer": datasets.Value("string"),
45
- "image": datasets.Image(),
46
- }
47
- )
48
- return datasets.DatasetInfo(
49
- description=_DESCRIPTION,
50
- features=features,
51
- homepage=_HOMEPAGE,
52
- license=_LICENSE,
53
- citation=_CITATION,
54
- )
55
-
56
- def _split_generators(self, dl_manager):
57
- """Returns SplitGenerators."""
58
- urls_to_download = _URLS
59
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
60
-
61
- return [
62
- datasets.SplitGenerator(
63
- name=datasets.Split.TRAIN,
64
- gen_kwargs={
65
- "metadata_path": downloaded_files["metadata"],
66
- "images_dir": downloaded_files["images"],
67
- },
68
- ),
69
- ]
70
-
71
- def _generate_examples(self, metadata_path, images_dir):
72
- """Yields examples."""
73
- # Read metadata
74
- df = pd.read_csv(metadata_path)
75
-
76
- for idx, row in df.iterrows():
77
- # Construct image path
78
- # file_name format: gen_vqa_v2-images/gen_vqa_v22/images/COCO_train2014_000000429568.jpg
79
- image_path = os.path.join(images_dir, row["file_name"])
80
-
81
- # Handle case where extraction created nested folder
82
- if not os.path.exists(image_path):
83
- # Try alternative path
84
- alt_path = os.path.join(images_dir, "gen_vqa_v22", "images",
85
- os.path.basename(row["file_name"]))
86
- if os.path.exists(alt_path):
87
- image_path = alt_path
88
-
89
- yield idx, {
90
- "image_id": row["image_id"],
91
- "question_id": row["question_id"],
92
- "question": row["question"],
93
- "answer": row["answer"],
94
- "image": image_path,
95
- }