Update xd-violence.py
Browse files- xd-violence.py +3 -2
xd-violence.py
CHANGED
@@ -286,7 +286,7 @@ class XDViolence(datasets.GeneratorBasedBuilder):
|
|
286 |
]
|
287 |
|
288 |
id2frame_annotation[id] = frame_annotation
|
289 |
-
|
290 |
else:
|
291 |
with open(frame_annotation_path, "r") as f:
|
292 |
for line in f:
|
@@ -301,8 +301,9 @@ class XDViolence(datasets.GeneratorBasedBuilder):
|
|
301 |
id2frame_annotation[id] = frame_annotation
|
302 |
print(id2frame_annotation)
|
303 |
print(file_list.head())
|
|
|
304 |
file_list["frame_annotations"] = file_list["id"].apply(
|
305 |
-
lambda x: id2frame_annotation[x]
|
306 |
)
|
307 |
print(file_list.head())
|
308 |
|
|
|
286 |
]
|
287 |
|
288 |
id2frame_annotation[id] = frame_annotation
|
289 |
+
|
290 |
else:
|
291 |
with open(frame_annotation_path, "r") as f:
|
292 |
for line in f:
|
|
|
301 |
id2frame_annotation[id] = frame_annotation
|
302 |
print(id2frame_annotation)
|
303 |
print(file_list.head())
|
304 |
+
|
305 |
file_list["frame_annotations"] = file_list["id"].apply(
|
306 |
+
lambda x: id2frame_annotation[x] if x in id2frame_annotation else []
|
307 |
)
|
308 |
print(file_list.head())
|
309 |
|