mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
scripts/examples: Fix fomo example.
This commit is contained in:
parent
74faef3a8e
commit
ce18e680b2
@ -9,7 +9,7 @@
|
||||
import sensor
|
||||
import time
|
||||
import ml
|
||||
from ml.postprocessing import fomo_postprocess
|
||||
from ml.postprocessing.edgeimpulse import Fomo
|
||||
import math
|
||||
|
||||
sensor.reset() # Reset and initialize the sensor.
|
||||
@ -19,7 +19,7 @@ sensor.set_windowing((240, 240)) # Set 240x240 window.
|
||||
sensor.skip_frames(time=2000) # Let the camera adjust.
|
||||
|
||||
# Load built-in FOMO face detection model
|
||||
model = ml.Model("/rom/fomo_face_detection.tflite")
|
||||
model = ml.Model("/rom/fomo_face_detection.tflite", postprocess=Fomo(threshold=0.4))
|
||||
print(model)
|
||||
|
||||
# Alternatively, models can be loaded from the filesystem storage.
|
||||
@ -39,10 +39,9 @@ colors = [ # Add more colors if you are detecting more than 7 types of classes
|
||||
clock = time.clock()
|
||||
while True:
|
||||
clock.tick()
|
||||
|
||||
img = sensor.snapshot()
|
||||
|
||||
for i, detection_list in enumerate(model.predict([img], callback=fomo_postprocess())):
|
||||
for i, detection_list in enumerate(model.predict([img])):
|
||||
if i == 0:
|
||||
continue # background class
|
||||
if len(detection_list) == 0:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user