Update load_viddiff_dataset.py
Browse files- load_viddiff_dataset.py +15 -2
load_viddiff_dataset.py
CHANGED
@@ -36,6 +36,18 @@ def load_viddiff_dataset(splits=["easy"], subset_mode="0"):
|
|
36 |
# dataset = dataset.map(_clean_annotations)
|
37 |
dataset = apply_subset_mode(dataset, subset_mode)
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return dataset
|
40 |
|
41 |
|
@@ -302,6 +314,7 @@ def get_n_differences(dataset, config_n_differences: int | str | Path):
|
|
302 |
|
303 |
|
304 |
if __name__ == "__main__":
|
305 |
-
|
306 |
-
dataset = load_viddiff_dataset(splits)
|
307 |
videos = load_all_videos(dataset)
|
|
|
|
36 |
# dataset = dataset.map(_clean_annotations)
|
37 |
dataset = apply_subset_mode(dataset, subset_mode)
|
38 |
|
39 |
+
dataset = _get_difficulty_splits(dataset)
|
40 |
+
|
41 |
+
return dataset
|
42 |
+
|
43 |
+
def _get_difficulty_splits(dataset):
|
44 |
+
with open("data/lookup_action_to_split.json", "r") as fp:
|
45 |
+
lookup_action_to_split = json.load(fp)
|
46 |
+
def add_split_difficulty(example):
|
47 |
+
example['split_difficulty'] = lookup_action_to_split[example['action']]
|
48 |
+
return example
|
49 |
+
|
50 |
+
dataset = dataset.map(add_split_difficulty)
|
51 |
return dataset
|
52 |
|
53 |
|
|
|
314 |
|
315 |
|
316 |
if __name__ == "__main__":
|
317 |
+
# these are the 3 data loading commands
|
318 |
+
dataset = load_viddiff_dataset(splits=['ballsports'])
|
319 |
videos = load_all_videos(dataset)
|
320 |
+
n_differences = lvd.get_n_differences(dataset, "data/n_differences.json")
|