|
本帖最后由 zhanggdguodong@ 于 2022-2-8 21:50 编辑
使用的rk3399proX,用python的rknn api进行推理时,实际测速结果与rknn.eval_perf接口打印的时间不符。
环境:
--> Init runtime environment
I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:51)
D RKNNAPI: ==============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI: API: 1.7.1 (566a9b6 build: 2021-10-28 14:56:17)
D RKNNAPI: DRV: 1.7.0 (7880361 build: 2021-08-16 16:16:21)
D RKNNAPI: ==============================================
api接口打印的时间:
--> Evaluate model performance
W When performing performance evaluation, inputs can be set to None to use fake inputs.
========================================================================
Performance
========================================================================
Average inference Time(us): 89973.0
FPS: 11.11
========================================================================
实际用python time.time()模块测试的,推理时间:
for i in range(10):
reference_start = time.time()
outputs = rknn.inference(inputs=[img])
reference_end = time.time()
print("reference {}, total times {} s".format(i, reference_end - reference_start))
--> Running model
reference 0, total times 0.30838799476623535 s
reference 1, total times 0.2834658622741699 s
reference 2, total times 0.27978014945983887 s
reference 3, total times 0.27437877655029297 s
reference 4, total times 0.2727236747741699 s
reference 5, total times 0.2691068649291992 s
reference 6, total times 0.2714500427246094 s
reference 7, total times 0.2870669364929199 s
reference 8, total times 0.264754056930542 s
reference 9, total times 0.2696266174316406 s
两者打印的时间差距较大,请问这个是怎么回事呢?如何使得推理性能接近 rknn.eval_perf 打印的时间呢?
|
|