Toybrick

标题: "division by zero" for mobilenet_v1 and mobilenet_v2 examples [打印本页]

作者: chuyee    时间: 2019-2-9 03:42
标题: "division by zero" for mobilenet_v1 and mobilenet_v2 examples
[toybrick@localhost mobilenet_v2]$ python test.py
/usr/lib64/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
--> config model
done
--> Loading model
done
--> Building model
done
--> Export RKNN model
done
--> Init runtime environment
done
--> Running model
mobilenet_v2
-----TOP 5-----
[282 285]: 0.126953125
[282 285]: 0.126953125
[281]: 0.1129150390625
[186]: 0.09466552734375
[277 278]: 0.0665283203125

done
--> Begin evaluate model performance
Catch exception when evaluating model performance!
Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/rknn/api/rknn.py", line 284, in eval_perf
    print(self.rknn_base.format_perf_detail(detail=perfs))
  File "rknn/api/rknn_base.py", line 924, in rknn.api.rknn_base.RKNNBase.format_perf_detail
ZeroDivisionError: division by zero

done


作者: chuyee    时间: 2019-2-9 03:47
diff --git a/rknn-toolkit/example/mobilenet_v2/test.py b/rknn-toolkit/example/mobilenet_v2/test.py
index 9859a33..d3ff789 100644
--- a/rknn-toolkit/example/mobilenet_v2/test.py
+++ b/rknn-toolkit/example/mobilenet_v2/test.py
@@ -60,7 +60,8 @@ if __name__ == '__main__':
     img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

     print('--> Init runtime environment')
-    ret = rknn.init_runtime()
+    #ret = rknn.init_runtime()
+    ret = rknn.init_runtime(host='rk3399pro')
     if ret != 0:
         print('Init runtime environment failed')
         exit(ret)
作者: chuyee    时间: 2019-2-9 03:50
I used mobilenet_v2 as an example here. The same is also true for mobilenet_v1. Sorry I type English here. I haven't figured out how to input Chinese on Fedora...
作者: chuyee    时间: 2019-2-14 14:23
这个问题没有人遇见过吗?一运行就会出现的啊,怎么没有回复呢?
作者: 程子    时间: 2019-2-14 14:38
本帖最后由 程子 于 2019-2-14 14:43 编辑

没跑过官方mobilenet,但是如果你要评估运行时间,在初始化的时候要加参数
rknn.init_runtime(target='rk3399pro', perf_debug=True)
Edit:
RKNN 0.9.8 用 target='rk3399pro'
RKNN 0.9.7 用 host='rk3399pro'

作者: chuyee    时间: 2019-2-15 07:53
程子 发表于 2019-2-14 14:38
没跑过官方mobilenet,但是如果你要评估运行时间,在初始化的时候要加参数
rknn.init_runtime(target='rk33 ...

So true! "perf_debug=True" solves the problem for me. Thanks!




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3