Upload CAPMIT1003.py
Browse files- CAPMIT1003.py +1 -9
CAPMIT1003.py
CHANGED
|
@@ -123,7 +123,7 @@ class CapMIT1003(datasets.GeneratorBasedBuilder):
|
|
| 123 |
# "img_path": datasets.Value("string"),
|
| 124 |
"image": datasets.Image(),
|
| 125 |
#"click_id": datasets.Value("int32"),
|
| 126 |
-
"clicks_path": datasets.Value("
|
| 127 |
# "click_time": datasets.Value("timestamp")
|
| 128 |
}
|
| 129 |
),
|
|
@@ -145,21 +145,13 @@ class CapMIT1003(datasets.GeneratorBasedBuilder):
|
|
| 145 |
|
| 146 |
|
| 147 |
def _generate_examples(self, mit1003_path, capmit1003_db_path):
|
| 148 |
-
#CapMIT1003DB.download_images()
|
| 149 |
-
logger.warning(f"filepath is: {mit1003_path}")
|
| 150 |
-
logger.warning(f"db is: {capmit1003_db_path}")
|
| 151 |
-
logger.warning(f"filepath is: {mit1003_path[0]}")
|
| 152 |
with CapMIT1003DB(os.path.join(capmit1003_db_path[0]), os.path.join(mit1003_path[0], "ALLSTIMULI")) as db:
|
| 153 |
-
logger.warning("inside")
|
| 154 |
image_captions = db.get_captions()
|
| 155 |
-
logger.warning(f"captions: {image_captions}")
|
| 156 |
for pair in image_captions.itertuples(index=False):
|
| 157 |
-
logger.info(f"{pair.caption}")
|
| 158 |
caption = pair.caption
|
| 159 |
obs_uid = pair.obs_uid
|
| 160 |
click_path = db.get_click_path(obs_uid)
|
| 161 |
xy_coordinates = click_path[['x', 'y']].values
|
| 162 |
-
logger.info(xy_coordinates)
|
| 163 |
#click_times = click_path["click_time"].values
|
| 164 |
# usr_uid = pair["usr_uid"].values
|
| 165 |
example = {
|
|
|
|
| 123 |
# "img_path": datasets.Value("string"),
|
| 124 |
"image": datasets.Image(),
|
| 125 |
#"click_id": datasets.Value("int32"),
|
| 126 |
+
"clicks_path": datasets.Sequence(datasets.Sequence(datasets.Value("int32"), length=2)),
|
| 127 |
# "click_time": datasets.Value("timestamp")
|
| 128 |
}
|
| 129 |
),
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
def _generate_examples(self, mit1003_path, capmit1003_db_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
#click_times = click_path["click_time"].values
|
| 156 |
# usr_uid = pair["usr_uid"].values
|
| 157 |
example = {
|