|
本帖最后由 Stuart 于 2021-9-24 10:40 编辑
yolov5使用的训练代码取自ultralytics/yolov5 master分支。
环境:PC ubuntu18.04 x86_64
rknn_tool v1.7.0
python3.6.9环境
tensorflow-gpu==1.14.0
torch==1.2.0
onnx==1.6
torchvision == 0.4.0
插入TB-RK1808S0
用yolov5 onnx轉檔rknn時, 設定如下
rknn.config(reorder_channel='0 1 2',
mean_values=[[0, 0, 0]],
std_values=[[255, 255, 255]],
optimization_level=3,
target_platform = 'rk1808',
output_optimize=1,
quantized_algorithm = 'mmse')
#mmse_epoch = 1,
batch_size=1)
#epochs=1000)
ret = rknn.build(do_quantization=QUANTIZE_ON, dataset=DATASET)
當dataset只有一張圖片時,可以正常轉檔
但是超過一張圖片時就會報錯, message 如下
MMSE Quant Step 0: 1%|▌ | 2/168 [00:00<00:08, 20.55it/s]
E Catch exception when building RKNN model!
E Traceback (most recent call last):
E File "rknn/base/RKNNlib/app/medusa/workspace.py", line 485, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.sparse_run
E File "rknn/base/RKNNlib/RKNN_session.py", line 37, in rknn.base.RKNNlib.RKNN_session.RKNNSession.run
E File "/home/fw/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run
E run_metadata_ptr)
E File "/home/fw/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1149, in _run
E str(subfeed_t.get_shape())))
E ValueError: Cannot feed value of shape (1, 320, 640, 3) for Tensor 'Placeholder:0', which has shape '(3, 320, 640, 3)'
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E File "rknn/api/rknn_base.py", line 616, in rknn.api.rknn_base.RKNNBase.build
E File "rknn/api/rknn_base.py", line 1523, in rknn.api.rknn_base.RKNNBase._quantize2
E File "rknn/base/RKNNlib/RK_nn.py", line 570, in rknn.base.RKNNlib.RK_nn.RKnn.quantize
E File "rknn/base/RKNNlib/app/medusa/quantization.py", line 145, in rknn.base.RKNNlib.app.medusa.quantization.Quantization.run
E File "rknn/base/RKNNlib/app/medusa/quantization.py", line 58, in rknn.base.RKNNlib.app.medusa.quantization.Quantization._run_quantization
E File "rknn/base/RKNNlib/app/medusa/workspace.py", line 488, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.sparse_run
E File "rknn/api/rknn_log.py", line 312, in rknn.api.rknn_log.RKNNLog.e
E ValueError: Run layer Slice_Slice_9_215 catch exception: Cannot feed value of shape (1, 320, 640, 3) for Tensor 'Placeholder:0', which has shape '(3, 320, 640, 3)'
Build model failed!
這一段 which has shape '(3, 320, 640, 3) 是因為我放了3張圖片
如果不用mmse , dataset 2000張 都不會出現錯誤,可以正常轉檔
|
|