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. (1015.3 KB)


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:

Test Code

import sensor,image,lcd
import KPU as kpu
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 = 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)





I passed around a demo at an interest group meeting toinight.
2 demo modification: boot button starts 20 object recognition, camera detecting “Person” causes Face Detection demo to launch. Python code is on SD card, Face model in Flash, 20 objects model on SD card (The same binary works with both. demos)

Question: Is there code for Expression Recognition, shown in this photo?


we will release it this month


Could you do a writeup on how you trained and built this yolo2 model?