File size: 1,024 Bytes
df9abf4
 
 
 
 
 
 
 
 
 
 
 
 
8c31b90
 
df9abf4
8c31b90
df9abf4
 
8c31b90
 
 
 
 
 
 
 
 
 
 
 
0d0ab89
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import glob
import json
from pathlib import Path
from collections import OrderedDict


def read_json(fname):
    fname = Path(fname)
    with fname.open('rt') as handle:
        return json.load(handle, object_hook=OrderedDict)


def get_configs(base_path, filename_pattern="*.json"):
    configs = []
    glob_pattern = os.path.join(base_path, filename_pattern)
    file_paths = sorted(glob.glob(glob_pattern))
    for file_path in file_paths:
        file_name = Path(file_path).stem
        config = read_json(file_path)
        config['name'] = file_name
        configs.append(config)
    return configs


def get_display_names(configs):
    display_names = []
    for config in configs:
        display_names.append(config['display_name'])
    return display_names


def get_path_for_viz(base_path, dataset, sequence, model, viz):
    dat_seq = "_".join([dataset["name"], sequence])
    video_path = os.path.join(base_path, model['model_id'], dat_seq, "videos", viz["name"] + ".mp4")
    return video_path