[MaixHub] Dima's santa classifier


#1

Editing

import sensor, image, lcd, time
import KPU as kpu
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((128, 128))
sensor.set_vflip(1)
sensor.run(1)
lcd.clear()
task = kpu.load(0x400000) 
clock = time.clock()
names=['Arduino UDO','Santa']
while(True):
    img = sensor.snapshot()
    clock.tick()
    fmap = kpu.forward(task, img)
    fps=clock.fps()
    plist=fmap[:]
    pmax=max(plist)	
    max_index=plist.index(pmax)
    a = lcd.display(img, oft=(0,0))
    lcd.draw_string(0, 128, "%s           "%(names[max_index].strip()))
a = kpu.deinit(task)