mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
Update example scripts
This commit is contained in:
parent
b320334efd
commit
9a0d65b527
@ -15,8 +15,7 @@ sensor.set_windowing((240, 240)) # Set 240x240 window.
|
||||
sensor.skip_frames(time=2000) # Let the camera adjust.
|
||||
|
||||
# Load the built-in person detection network (the network is in your OpenMV Cam's firmware).
|
||||
net = tf.load('person_detection')
|
||||
labels = ['person', 'no_person']
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
|
||||
clock = time.clock()
|
||||
while(True):
|
||||
|
@ -15,8 +15,7 @@ sensor.set_windowing((240, 240)) # Set 240x240 window.
|
||||
sensor.skip_frames(time=2000) # Let the camera adjust.
|
||||
|
||||
# Load the built-in person detection network (the network is in your OpenMV Cam's firmware).
|
||||
net = tf.load('person_detection')
|
||||
labels = ['person', 'no_person']
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
|
||||
clock = time.clock()
|
||||
while(True):
|
||||
|
@ -115,11 +115,13 @@ def face_detection(data):
|
||||
# When called returns if there's a "person" or "no_person" within view.
|
||||
#
|
||||
# data is unused
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
def person_detection(data):
|
||||
global net
|
||||
sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
sensor.set_framesize(sensor.QVGA)
|
||||
scores = tf.classify("person_detection", sensor.snapshot())[0].output()
|
||||
return ['person', 'no_person'][scores.index(max(scores))].encode()
|
||||
scores = net.classify(sensor.snapshot())[0].output()
|
||||
return labels[scores.index(max(scores))].encode()
|
||||
|
||||
# When called returns the payload string for the largest qrcode
|
||||
# within the OpenMV Cam's field-of-view.
|
||||
|
@ -15,8 +15,7 @@ sensor.set_windowing((240, 240)) # Set 240x240 window.
|
||||
sensor.skip_frames(time=2000) # Let the camera adjust.
|
||||
|
||||
# Load the built-in person detection network (the network is in your OpenMV Cam's firmware).
|
||||
net = tf.load('person_detection')
|
||||
labels = ['person', 'no_person']
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
|
||||
clock = time.clock()
|
||||
while(True):
|
||||
|
@ -15,8 +15,7 @@ sensor.set_windowing((240, 240)) # Set 240x240 window.
|
||||
sensor.skip_frames(time=2000) # Let the camera adjust.
|
||||
|
||||
# Load the built-in person detection network (the network is in your OpenMV Cam's firmware).
|
||||
net = tf.load('person_detection')
|
||||
labels = ['person', 'no_person']
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
|
||||
clock = time.clock()
|
||||
while(True):
|
||||
|
@ -115,11 +115,13 @@ def face_detection(data):
|
||||
# When called returns if there's a "person" or "no_person" within view.
|
||||
#
|
||||
# data is unused
|
||||
labels, net = tf.load_builtin_model('person_detection')
|
||||
def person_detection(data):
|
||||
global net
|
||||
sensor.set_pixformat(sensor.RGB565)
|
||||
sensor.set_framesize(sensor.QVGA)
|
||||
scores = tf.classify("person_detection", sensor.snapshot())[0].output()
|
||||
return ['person', 'no_person'][scores.index(max(scores))].encode()
|
||||
scores = net.classify(sensor.snapshot())[0].output()
|
||||
return labels[scores.index(max(scores))].encode()
|
||||
|
||||
# When called returns the payload string for the largest qrcode
|
||||
# within the OpenMV Cam's field-of-view.
|
||||
|
Loading…
Reference in New Issue
Block a user