- ori_img = cv2.imread('./street.jpg')
- img = cv2.cvtColor(ori_img, cv2.COLOR_BGR2RGB)
- #ret = rknn_lite.init_runtime()
- #ret = rknn_lite.init_runtime(core_mask=RKNNLite.NPU_CORE_0)
- ret = rknn_lite.init_runtime(core_mask=RKNNLite.NPU_CORE_AUTO)
- img, scale_factor, correction = letterbox(img)
- # Inference
- print('--> Running model')
- for i in range(200):
- start = time.perf_counter()
- outputs = rknn_lite.inference(inputs=[img])
- #outputs = rknn_lite.inference(inputs=[img], data_format="nchw")[0]
- end = time.perf_counter()
- print('运行时间为:{}秒'.format(end - start))
-
- print('done')
- rknn_lite.release()
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |