Skip to content

Instantly share code, notes, and snippets.

@robopara
Last active January 21, 2021 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robopara/ccfeee3335feeafdb9c19c9407c69d32 to your computer and use it in GitHub Desktop.
Save robopara/ccfeee3335feeafdb9c19c9407c69d32 to your computer and use it in GitHub Desktop.
MaixPy face detection example
import sensor,image,lcd
import KPU as kpu
import utime
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_hmirror(0)
sensor.run(1)
anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437, 6.92275, 6.718375, 9.01025)
task = kpu.load(0x300000)
kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)
img_lcd=image.Image()
while(True):
img = sensor.snapshot()
objects = kpu.run_yolo2(task, img)
if objects:
for i in objects:
img.draw_rectangle(i.rect())
lcd.display(img)
kpu.deinit(task)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment