-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-clips.py
38 lines (32 loc) · 917 Bytes
/
test-clips.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
import gc
from random import random
from SimpleSeer import models as M
RATE=24.0
@core.state('start')
def start(state):
core = state.core
core.set_rate(RATE)
return state.core.state('run')
@core.state('run')
def run(state):
core = state.core
while True:
if random() < 0.01:
gc.collect()
frames = core.capture()
@core.on('run', 'rate.')
def set_rate(state, name, data):
state.core.set_rate(data['rate'])
state.transition('run')
def process(frame):
frame.features = []
frame.results = []
for inspection in M.Inspection.objects:
if inspection.parent:
return
if inspection.camera and inspection.camera != frame.camera:
return
results = inspection.execute(frame.image)
frame.features += results
for m in inspection.measurements:
frame.results += m.execute(frame, results)