Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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