add metadata
Browse files- README.md +20 -3
- __pycache__/populate_drama_x.cpython-312.pyc +0 -0
- drama_x_annotated.jsonl +0 -0
- populate_drama_x.py +53 -0
README.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-4.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
---
|
4 |
+
|
5 |
+
|
6 |
+
1. Request access to the original DRAMA dataset at
|
7 |
+
https://usa.honda-ri.com/drama#Downloadthedataset
|
8 |
+
|
9 |
+
2. Download the ZIP and extract the file
|
10 |
+
`integrated_output_v2.json`
|
11 |
+
|
12 |
+
3. Ensure you have your existing
|
13 |
+
`drama_x_annotations.json` (with empty `image_path`/`video_path` fields) in the same folder.
|
14 |
+
|
15 |
+
4. Run the population script:
|
16 |
+
```bash
|
17 |
+
python populate_drama_x.py \
|
18 |
+
drama_x_annotated.json \
|
19 |
+
integrated_output_v2.json \
|
20 |
+
-o drama_x_annotations_populated.json
|
__pycache__/populate_drama_x.cpython-312.pyc
ADDED
Binary file (2.65 kB). View file
|
|
drama_x_annotated.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
populate_drama_x.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
import argparse
|
4 |
+
|
5 |
+
def populate_paths(annotations_file: str, integrated_file: str, output_file: str):
|
6 |
+
# Load existing annotations
|
7 |
+
with open(annotations_file, 'r', encoding='utf-8') as f:
|
8 |
+
annotations = json.load(f)
|
9 |
+
|
10 |
+
# Load integrated_output_v2 entries
|
11 |
+
with open(integrated_file, 'r', encoding='utf-8') as f:
|
12 |
+
integrated = json.load(f)
|
13 |
+
|
14 |
+
# Update paths
|
15 |
+
for item in integrated:
|
16 |
+
img = item.get('s3_fileUrl', '')
|
17 |
+
vid = item.get('s3_instructionReference', '')
|
18 |
+
parts = img.rstrip('/').split('/')
|
19 |
+
if len(parts) < 2:
|
20 |
+
continue
|
21 |
+
clip_id = parts[-2] # e.g. 'clip_305_000786'
|
22 |
+
frame_file = parts[-1] # e.g. 'frame_000786.png'
|
23 |
+
frame_id = os.path.splitext(frame_file)[0]
|
24 |
+
key = f"{clip_id}_{frame_id}" # matches your JSON key
|
25 |
+
|
26 |
+
if key in annotations:
|
27 |
+
annotations[key]['image_path'] = img
|
28 |
+
annotations[key]['video_path'] = vid
|
29 |
+
|
30 |
+
# Write back
|
31 |
+
with open(output_file, 'w', encoding='utf-8') as f:
|
32 |
+
json.dump(annotations, f, indent=4, ensure_ascii=False)
|
33 |
+
print(f"Updated file written to {output_file}")
|
34 |
+
|
35 |
+
if __name__ == "__main__":
|
36 |
+
parser = argparse.ArgumentParser(
|
37 |
+
description="Populate image_path and video_path in drama_x_annotations.json"
|
38 |
+
)
|
39 |
+
parser.add_argument(
|
40 |
+
"annotations",
|
41 |
+
help="Path to existing drama_x_annotations.json"
|
42 |
+
)
|
43 |
+
parser.add_argument(
|
44 |
+
"integrated",
|
45 |
+
help="Path to integrated_output_v2.json"
|
46 |
+
)
|
47 |
+
parser.add_argument(
|
48 |
+
"-o", "--output",
|
49 |
+
default="drama_x_annotations_populated.json",
|
50 |
+
help="Where to save the updated annotations"
|
51 |
+
)
|
52 |
+
args = parser.parse_args()
|
53 |
+
populate_paths(args.annotations, args.integrated, args.output)
|