-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_statistics.py
37 lines (27 loc) · 1.09 KB
/
generate_statistics.py
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
import argparse
import os
from omegaconf import OmegaConf
from tqdm import tqdm
from Dataset.Scripts.utils.stats import Stats
# create an argument parser
parser = argparse.ArgumentParser(description="Adver-City dataset annotation statistics generator.")
# add arguments to the parser
parser.add_argument('-p', "--path", type=str,
help='Path of run to have its annotation statistics generated. Eg: '
'data_dumping/2024_06_14_12_47_41')
# parse the arguments and return the result
opt = parser.parse_args()
run_path = opt.path
simulation_folders = os.listdir(run_path)
statistics_path = os.path.join(run_path, "stats/")
if not os.path.exists(statistics_path):
os.makedirs(statistics_path)
stats = Stats(statistics_path)
print("Reading summary data...")
for simulation_folder in tqdm(simulation_folders):
if simulation_folder == "stats":
continue
simulation_summary = OmegaConf.load(os.path.join(run_path, simulation_folder, "summary.yaml"))
stats.read_summary_data(simulation_summary)
print("Generating charts...")
stats.generate_charts()