forked from PaulKMueller/llama_traffic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount.py
52 lines (40 loc) · 1.05 KB
/
count.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import numpy as np
import json
# with open("output/turnaround_combined.json") as data:
# data = json.load(data)
# keys = list(data.keys())
# count = 0
# for key in keys:
# count += data[key]
# print(count)
# print(468108 - count)
# output = {}
# with open("output/intersection_combined_parsed.json") as turnarounds:
# turnaround_data = json.load(turnarounds)
# with open("output/with_turnaround.json") as input:
# data = json.load(input)
# for key, value in data.items():
# item = data[key]
# item.append(turnaround_data[key])
# output[key] = item
features = [
"vehicle",
"pedestrian",
"cyclist",
"freeway",
"surface_street",
"bike_lane",
"stop_sign",
"crosswalk",
"driveway",
"parking_lot",
"turnaround",
"intersection",
]
with open("output/scenario_features.json") as data_file:
data = np.array(list(json.load(data_file).values()))
print(data.shape)
np.set_printoptions(threshold=sys.maxsize)
counts = data.sum(axis=0)
print(dict(zip(features, counts)))