Datasets:
michelecafagna26
commited on
Commit
•
43fd754
1
Parent(s):
12d0b6c
Update hl.py
Browse files
hl.py
CHANGED
@@ -116,15 +116,16 @@ class HL(datasets.GeneratorBasedBuilder):
|
|
116 |
# Annotation files come first, then the images.
|
117 |
for img_file_path, img_obj in images:
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
116 |
# Annotation files come first, then the images.
|
117 |
for img_file_path, img_obj in images:
|
118 |
|
119 |
+
if img_file_path in metadata:
|
120 |
+
file_name = Path(img_file_path).name
|
121 |
+
|
122 |
+
yield idx, {
|
123 |
+
"file_name": file_name,
|
124 |
+
"image": {"path": img_file_path, "bytes": img_obj.read()},
|
125 |
+
"scene": metadata[file_name]['captions']['scene'],
|
126 |
+
"action": metadata[file_name]['captions']['action'],
|
127 |
+
"rationale": metadata[file_name]['captions']['rationale'],
|
128 |
+
"object": metadata[file_name]['captions']['object'],
|
129 |
+
"confidence": metadata[file_name]['confidence'],
|
130 |
+
}
|
131 |
+
idx += 1
|