0% found this document useful (0 votes)
49 views3 pages

MaixPy Run Face Detection

Uploaded by

gprodan2002a2948
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

MaixPy Run Face Detection

Uploaded by

gprodan2002a2948
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MaixPy run face detection (tiny yolo v2)

MaixPy run face detect (tiny yolo v2)


Today we use MaixPy to run face detection, here is the frimware and model.
maixpy_yolo2.zip (1015.3 KB)

## API
kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)
input args:
* kpu_net: kpu net obj
* threshold: prop gate
* nms_value: box_iou gate
* anchor_num: anchor number
* anchor: anchor args

code = kpu.run_yolo2(task, img)


input args:
* kpu_net: kpu_net obj
* image_t: image from sensor

return value:
* {"x":140, "y":46, "w":82, "h":111, "value":3.169619, "classid":0,
"index":0, "objnum":3}: all face windows coordinate and size
API details refer to: https://maixpy.sipeed.com/zh/libs/Maix/kpu.html

Test Code
import sensor,image,lcd
import KPU as kpu
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_hmirror(0)
sensor.run(1)
task = kpu.load(0x300000)
anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437,
6.92275, 6.718375, 9.01025)
a = kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)
img_lcd=image.Image()
while(True):
img = sensor.snapshot()
code = kpu.run_yolo2(task, img)
if code:
for i in code:
a = img.draw_rectangle(i.rect())
a = lcd.display(img)
a = kpu.deinit(task)

Result

You might also like