def get_feature(task): count = 20 print('get_feature 1') for i in range(3): print('get_feature 2-' + str(3 - i)) br.play_sound("/sd/voice/" + str(3 - i) + "s.wav", vol) for j in range(count): img = sensor.snapshot() if j < (count >> 1): img.draw_rectangle(1, 46, 222, 132, color=br.get_color(255, 0, 0), thickness=3) lcd.display(img) # print('get_feature 2') # time.sleep(1.0) print('get_feature 3') feature = kpu.forward(task, img) print('get_feature 4') return np.array(feature[:])
clock = time.clock() try: while(True): img = sensor.snapshot() # QR Code check res = img.find_qrcodes() if len(res) > 0: name = res[0].payload() if name=="*reset": feature_list = [] feature_0 = [] feature_100 = [] save(feature_file, feature_list) br.play_sound("/sd/reset.wav") else: br.play_sound("/sd/camera.wav") feature = get_feature(task) feature_list.append([name,feature[:]]) if name=='0': feature_0.append([name,feature[:]]) if name=='100': feature_100.append([name,feature[:]]) save(feature_file, feature_list) br.play_sound("/sd/set.wav") gc.collect() # print(gc.mem_free()) kpu.fmap_free(feature) print("[QR]: " + name) continue
clock = time.clock() try: while (True): img = sensor.snapshot() # QR Code check res = img.find_qrcodes() if len(res) > 0: name = res[0].payload() if name == "*reset": feature_list = [] feature_0 = [] feature_100 = [] save(feature_file, feature_list) br.play_sound("/sd/reset.wav") else: br.play_sound("/sd/camera.wav") feature = get_feature(task) feature_list.append([name, feature]) if name == '0': feature_0.append([name, feature]) if name == '100': feature_100.append([name, feature]) save(feature_file, feature_list) br.play_sound("/sd/set.wav") gc.collect() # print(gc.mem_free()) kpu.fmap_free(feature) print("[QR]: " + name) continue
clock = time.clock() try: while (True): img = sensor.snapshot() # QR Code check res = img.find_qrcodes() if len(res) > 0: name = res[0].payload() if name == "*reset": feature_list = [] feature_0 = [] feature_100 = [] save(feature_file, feature_list) br.play_sound("/sd/system/reset.wav") elif name[0] == "{": br.play_sound("/sd/system/setting.wav") send_packet(name) continue else: br.play_sound("/sd/system/camera.wav") feature = get_feature(task) feature_list.append([name, feature]) if name == '0': feature_0.append([name, feature]) if name == '100': feature_100.append([name, feature]) save(feature_file, feature_list) br.play_sound("/sd/system/set.wav") gc.collect()
info = kpu.netinfo(task) #a=kpu.set_layers(task,29) old_name = '' marker_0_100 = 0 clock = time.clock() try: while (True): but = br.check_but() if but == 'A': if vol < 100: # 最大100 vol = vol + 10 print('@@@ inc vol:' + str(vol)) br.play_sound("/sd/logo.wav", vol) if but == 'B': if vol > 0: vol = vol - 10 print('@@@ dec vol:' + str(vol)) br.play_sound("/sd/logo.wav", vol) img = sensor.snapshot() # QR Code check res = img.find_qrcodes() if len(res) > 0: name = res[0].payload() if name == "*reset": print('@@@ reset') feature_list = [] feature_0 = []