Last active
January 21, 2021 15:37
-
-
Save robopara/ccfeee3335feeafdb9c19c9407c69d32 to your computer and use it in GitHub Desktop.
MaixPy face detection example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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