Upload CAPMIT1003.py
Browse files- CAPMIT1003.py +8 -12
CAPMIT1003.py
CHANGED
|
@@ -116,15 +116,12 @@ class CapMIT1003(datasets.GeneratorBasedBuilder):
|
|
| 116 |
features=datasets.Features(
|
| 117 |
{
|
| 118 |
"obs_uid": datasets.Value("string"),
|
| 119 |
-
|
| 120 |
-
# "start_time": datasets.Value("timestamp"),
|
| 121 |
"caption": datasets.Value("string"),
|
| 122 |
-
# "img_uid": datasets.Value("string"),
|
| 123 |
-
# "img_path": datasets.Value("string"),
|
| 124 |
"image": datasets.Image(),
|
| 125 |
-
|
| 126 |
"clicks_path": datasets.Sequence(datasets.Sequence(datasets.Value("int32"), length=2)),
|
| 127 |
-
|
| 128 |
}
|
| 129 |
),
|
| 130 |
# No default supervised_keys (as we have to pass both question
|
|
@@ -148,19 +145,18 @@ class CapMIT1003(datasets.GeneratorBasedBuilder):
|
|
| 148 |
with CapMIT1003DB(os.path.join(capmit1003_db_path[0]), os.path.join(mit1003_path[0], "ALLSTIMULI")) as db:
|
| 149 |
image_captions = db.get_captions()
|
| 150 |
for pair in image_captions.itertuples(index=False):
|
| 151 |
-
caption = pair.caption
|
| 152 |
obs_uid = pair.obs_uid
|
| 153 |
click_path = db.get_click_path(obs_uid)
|
| 154 |
xy_coordinates = click_path[['x', 'y']].values
|
| 155 |
-
|
| 156 |
-
# usr_uid = pair["usr_uid"].values
|
| 157 |
example = {
|
| 158 |
"obs_uid": obs_uid,
|
| 159 |
-
|
| 160 |
"image": pair.img_path,
|
| 161 |
-
"caption": caption,
|
|
|
|
| 162 |
"clicks_path": xy_coordinates,
|
| 163 |
-
|
| 164 |
}
|
| 165 |
|
| 166 |
yield obs_uid, example
|
|
|
|
| 116 |
features=datasets.Features(
|
| 117 |
{
|
| 118 |
"obs_uid": datasets.Value("string"),
|
| 119 |
+
"usr_uid": datasets.Value("string"),
|
|
|
|
| 120 |
"caption": datasets.Value("string"),
|
|
|
|
|
|
|
| 121 |
"image": datasets.Image(),
|
| 122 |
+
"start_time": datasets.Value("timestamp[s]"),
|
| 123 |
"clicks_path": datasets.Sequence(datasets.Sequence(datasets.Value("int32"), length=2)),
|
| 124 |
+
"clicks_time": datasets.Sequence(datasets.Value("timestamp[s]"))
|
| 125 |
}
|
| 126 |
),
|
| 127 |
# No default supervised_keys (as we have to pass both question
|
|
|
|
| 145 |
with CapMIT1003DB(os.path.join(capmit1003_db_path[0]), os.path.join(mit1003_path[0], "ALLSTIMULI")) as db:
|
| 146 |
image_captions = db.get_captions()
|
| 147 |
for pair in image_captions.itertuples(index=False):
|
|
|
|
| 148 |
obs_uid = pair.obs_uid
|
| 149 |
click_path = db.get_click_path(obs_uid)
|
| 150 |
xy_coordinates = click_path[['x', 'y']].values
|
| 151 |
+
clicks_time = click_path["time"].values
|
|
|
|
| 152 |
example = {
|
| 153 |
"obs_uid": obs_uid,
|
| 154 |
+
"usr_uid": pair.usr_uid,
|
| 155 |
"image": pair.img_path,
|
| 156 |
+
"caption": pair.caption,
|
| 157 |
+
"start_time": pair.start_time,
|
| 158 |
"clicks_path": xy_coordinates,
|
| 159 |
+
"clicks_time": clicks_time
|
| 160 |
}
|
| 161 |
|
| 162 |
yield obs_uid, example
|