-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathload_data.py
More file actions
33 lines (29 loc) · 778 Bytes
/
load_data.py
File metadata and controls
33 lines (29 loc) · 778 Bytes
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
import gzip
import numpy as np
import matplotlib.pyplot as plt
import pickle
def summarize(fname):
with gzip.open(fname, 'rb',9) as f:
brakes = []
peds = []
pedbrakes = []
while True:
try:
d=pickle.load(f)
peds.append(len(d['peds']))
brakes.append(d['brake'])
pedbrakes.append(peds[-1]*brakes[-1])
except EOFError:
break
plt.title("Pedestrians")
plt.hist(peds)
plt.savefig("ped_hist")
plt.close()
plt.title("Brakes")
plt.hist(brakes)
plt.savefig("brake_hist")
plt.close()
def show_frame(buff):
img = np.frombuffer(buff, dtype=np.uint8).reshape(160,320,3)
plt.imshow(img)
plt.savefig("lol")