- img = img_preprocess(imgBGR)
- print('--> load rknn model')
- ret = rknn.load_rknn('./rknn/efficient_b2.rknn')
- if ret != 0:
- print('load rknn failed')
- exit(ret)
- print('done')
- print('--> Init runtime environment')
- ret = rknn.init_runtime()
- if ret != 0:
- print('Init runtime environment failed')
- exit(ret)
- print('done')
- ########## warm up
- ########## warm up
- # sdk_version = rknn.get_sdk_version()
- # print(sdk_version)
- # Inference
- start = time.time()
- #print('--> Running model ')
- outputs = rknn.inference(inputs=[img])
- #show_outputs(outputs)
- #print(outputs)
- end = time.time()
- print('rknn only %.f ms' % ((end - start) * 1000))
- # Inference
- start = time.time()
- #print('--> Running model ')
- outputs = rknn.inference(inputs=[img])
- # show_outputs(outputs)
- # print(outputs)
- end = time.time()
- print('rknn only %.f ms' % ((end - start) * 1000))
- out = get_multi_detect(anchors,outputs[2],outputs[0],outputs[1])
- end = time.time()
- print('total %.f ms' % ((end - start) * 1000))
- #print(out)
- #imshow_boxes_p8(imgBGR,out)
- #perf
- print('--> Begin evaluate model performance')
- perf_results = rknn.eval_perf(inputs=[img])
- print('done')
- rknn.release()
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |