Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yolov5s在RKNN3588上以FP16推理时的精度问题 #324

Open
blueWatermelonFri opened this issue Jul 15, 2024 · 0 comments
Open

yolov5s在RKNN3588上以FP16推理时的精度问题 #324

blueWatermelonFri opened this issue Jul 15, 2024 · 0 comments

Comments

@blueWatermelonFri
Copy link

blueWatermelonFri commented Jul 15, 2024

通过本地的ubuntu服务器对yolov5s模型进行连板调试时,fp16的精度下降了4个点,请问这个现象正常吗?

rknntoolkit2的版本如下:
rknn-toolkit2 version: 2.0.0b0+9bab5682
rk3588的驱动版本如下:

D RKNNAPI:   API: 2.0.0b0 (18eacd0 build@2024-03-22T06:07:59)
D RKNNAPI:   DRV: rknn_server: 2.0.0b0 (18eacd0 build@2024-03-22T14:07:19)
D RKNNAPI:   DRV: rknnrt: 2.0.0b0 (35a6907d79@2024-03-24T10:31:14)

rknn.config的参数如下:

rknn.config(mean_values=[[0, 0, 0]], 
                std_values=[[255, 255, 255]], 
                target_platform="rk3588")

精度分析结果如下:

rknn convert start!
I rknn-toolkit2 version: 2.0.0b0+9bab5682
--> Config model
done
--> Loading model
I It is recommended onnx opset 19, but your onnx model opset is 13!
I Model converted from pytorch, 'opset_version' should be set 19 in torch.onnx.export for successful convert!
I Loading : 100%|██████████████████████████████████████████████| 121/121 [00:00<00:00, 39667.87it/s]
done
--> Building model
W build: The dataset='calibrate_dataset.txt' is ignored because do_quantization = False!
I rknn building ...
I rknn buiding done.
done
--> Export rknn model
done
--> Accuracy analysis
adb: unable to connect for root: closed
I target set by user is: rk3588
I Get hardware info: target_platform = rk3588, os = Linux, aarch = aarch64
I Check RK3588 board npu runtime version
I Starting ntp or adb, target is RK3588
I Start adb...
I Connect to Device success!
I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36)
D RKNNAPI: ==============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI:   API: 2.0.0b0 (18eacd0 build@2024-03-22T06:07:59)
D RKNNAPI:   DRV: rknn_server: 2.0.0b0 (18eacd0 build@2024-03-22T14:07:19)
D RKNNAPI:   DRV: rknnrt: 2.0.0b0 (35a6907d79@2024-03-24T10:31:14)
D RKNNAPI: ==============================================
D RKNNAPI: Input tensors:
D RKNNAPI:   index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=2457600, w_stride = 0, size_with_stride = 0, fmt=NHWC, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI: Output tensors:
D RKNNAPI:   index=0, name=output1, n_dims=4, dims=[1, 18, 20, 20], n_elems=7200, size=14400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI:   index=1, name=output2, n_dims=4, dims=[1, 18, 40, 40], n_elems=28800, size=57600, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI:   index=2, name=output3, n_dims=4, dims=[1, 18, 80, 80], n_elems=115200, size=230400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
adb: unable to connect for root: closed
/userdata/dumps/: 89 files pulled. 4.2 MB/s (149901680 bytes in 33.662s)
I Save Tensors to txt: 100%|████████████████████████████████████████| 89/89 [00:03<00:00, 27.86it/s]
I GraphPreparing : 100%|███████████████████████████████████████| 145/145 [00:00<00:00, 15836.22it/s]
I AccuracyAnalysing : 100%|███████████████████████████████████████| 145/145 [00:16<00:00,  8.98it/s]

# simulator_error: calculate the output error of each layer of the simulator (compared to the 'golden' value).
#              entire: output error of each layer between 'golden' and 'simulator', these errors will accumulate layer by layer.
#              single: single-layer output error between 'golden' and 'simulator', can better reflect the single-layer accuracy of the simulator.
# runtime_error: calculate the output error of each layer of the runtime.
#              entire: output error of each layer between 'golden' and 'runtime', these errors will accumulate layer by layer.
#              single_sim: single-layer output error between 'simulator' and 'runtime', can better reflect the single-layer accuracy of runtime.

layer_name                                                  simulator_error                             runtime_error                    
                                                        entire              single                  entire           single_sim          
                                                     cos      euc        cos      euc            cos      euc        cos      euc        
-----------------------------------------------------------------------------------------------------------------------------------
[Input] images                                     1.00000 | 0.0       1.00000 | 0.0           1.00000 | 0.1180    1.00000 | 0.1180      
[Conv] /model.0/conv/Conv_output_0                 1.00000 | 2.4982    1.00000 | 2.4982
[exSwish] /model.0/act/Mul_output_0                1.00000 | 1.9841    1.00000 | 1.3346        1.00000 | 10.165    1.00000 | 10.132      
[Conv] /model.1/conv/Conv_output_0                 1.00000 | 2.4134    1.00000 | 1.8541
[exSwish] /model.1/act/Mul_output_0                1.00000 | 1.9273    1.00000 | 1.0880        1.00000 | 13.101    1.00000 | 8.1516      
[Conv] /model.2/cv1/conv/Conv_output_0             1.00000 | 0.8336    1.00000 | 0.5864
[exSwish] /model.2/cv1/act/Mul_output_0            1.00000 | 0.4872    1.00000 | 0.3146        1.00000 | 3.0559    1.00000 | 1.9833      
[Conv] /model.2/m/m.0/cv1/conv/Conv_output_0       1.00000 | 1.3587    1.00000 | 0.8088
[exSwish] /model.2/m/m.0/cv1/act/Mul_output_0      1.00000 | 0.8585    1.00000 | 0.3834        1.00000 | 4.1053    1.00000 | 1.7504      
[Conv] /model.2/m/m.0/cv2/conv/Conv_output_0       1.00000 | 2.4838    1.00000 | 1.0474
[exSwish] /model.2/m/m.0/cv2/act/Mul_output_0      1.00000 | 2.1420    1.00000 | 0.5897        1.00000 | 6.9511    1.00000 | 2.0777      
[Add] /model.2/m/m.0/Add_output_0                  1.00000 | 2.2869    1.00000 | 0.7157        1.00000 | 7.7536    1.00000 | 0.0         
[Conv] /model.2/cv2/conv/Conv_output_0             1.00000 | 1.5840    1.00000 | 1.0400
[exSwish] /model.2/cv2/act/Mul_output_0            1.00000 | 1.0642    1.00000 | 0.5301        1.00000 | 6.9092    1.00000 | 3.4345      
[Concat] /model.2/Concat_output_0                  1.00000 | 2.5224    1.00000 | 0.6349        1.00000 | 10.385    1.00000 | 0.0         
[Conv] /model.2/cv3/conv/Conv_output_0             1.00000 | 3.0151    1.00000 | 1.0589
[exSwish] /model.2/cv3/act/Mul_output_0            1.00000 | 1.7501    1.00000 | 0.4406        0.99999 | 6.0663    1.00000 | 1.6735      
[Conv] /model.3/conv/Conv_output_0                 1.00000 | 1.1325    1.00000 | 0.3195
[exSwish] /model.3/act/Mul_output_0                1.00000 | 0.5785    1.00000 | 0.1652        0.99999 | 2.2395    1.00000 | 0.3982      
[Conv] /model.4/cv1/conv/Conv_output_0             1.00000 | 0.3326    1.00000 | 0.1160
[exSwish] /model.4/cv1/act/Mul_output_0            1.00000 | 0.1531    1.00000 | 0.0573        1.00000 | 0.5484    1.00000 | 0.1548      
[Conv] /model.4/m/m.0/cv1/conv/Conv_output_0       1.00000 | 0.7294    1.00000 | 0.2583
[exSwish] /model.4/m/m.0/cv1/act/Mul_output_0      1.00000 | 0.4092    1.00000 | 0.1448        1.00000 | 1.4311    1.00000 | 0.3293      
[Conv] /model.4/m/m.0/cv2/conv/Conv_output_0       1.00000 | 0.5763    1.00000 | 0.1975
[exSwish] /model.4/m/m.0/cv2/act/Mul_output_0      1.00000 | 0.2526    1.00000 | 0.0820        1.00000 | 0.8956    1.00000 | 0.2005      
[Add] /model.4/m/m.0/Add_output_0                  1.00000 | 0.3054    1.00000 | 0.0972        1.00000 | 1.0543    1.00000 | 0.0         
[Conv] /model.4/m/m.1/cv1/conv/Conv_output_0       1.00000 | 0.8030    1.00000 | 0.2504
[exSwish] /model.4/m/m.1/cv1/act/Mul_output_0      1.00000 | 0.3734    1.00000 | 0.0868        0.99999 | 1.2211    1.00000 | 0.2090      
[Conv] /model.4/m/m.1/cv2/conv/Conv_output_0       1.00000 | 0.9418    1.00000 | 0.2373
[exSwish] /model.4/m/m.1/cv2/act/Mul_output_0      1.00000 | 0.6107    1.00000 | 0.1805        0.99999 | 1.9182    1.00000 | 0.4279      
[Add] /model.4/m/m.1/Add_output_0                  1.00000 | 0.7068    1.00000 | 0.2072        1.00000 | 2.2366    1.00000 | 0.0         
[Conv] /model.4/cv2/conv/Conv_output_0             1.00000 | 0.9380    1.00000 | 0.2877
[exSwish] /model.4/cv2/act/Mul_output_0            1.00000 | 0.6277    1.00000 | 0.1712        0.99999 | 2.7682    1.00000 | 0.4022      
[Concat] /model.4/Concat_output_0                  1.00000 | 0.9453    1.00000 | 0.1837        0.99999 | 3.5589    1.00000 | 0.0         
[Conv] /model.4/cv3/conv/Conv_output_0             1.00000 | 1.0833    1.00000 | 0.3435
[exSwish] /model.4/cv3/act/Mul_output_0            1.00000 | 0.4307    1.00000 | 0.1062        0.99999 | 1.6902    1.00000 | 0.2590      
[Conv] /model.5/conv/Conv_output_0                 1.00000 | 0.7330    1.00000 | 0.1894
[exSwish] /model.5/act/Mul_output_0                1.00000 | 0.3233    1.00000 | 0.0738        0.99998 | 1.6541    1.00000 | 0.2039      
[Conv] /model.6/cv1/conv/Conv_output_0             1.00000 | 0.2583    1.00000 | 0.0809
[exSwish] /model.6/cv1/act/Mul_output_0            1.00000 | 0.1132    1.00000 | 0.0361        0.99999 | 0.5547    1.00000 | 0.0952      
[Conv] /model.6/m/m.0/cv1/conv/Conv_output_0       1.00000 | 0.5540    1.00000 | 0.1694
[exSwish] /model.6/m/m.0/cv1/act/Mul_output_0      1.00000 | 0.2677    1.00000 | 0.0821        0.99999 | 1.2722    1.00000 | 0.1834      
[Conv] /model.6/m/m.0/cv2/conv/Conv_output_0       1.00000 | 0.3577    1.00000 | 0.1134
[exSwish] /model.6/m/m.0/cv2/act/Mul_output_0      1.00000 | 0.1338    1.00000 | 0.0329        0.99998 | 0.6488    1.00000 | 0.0815      
[Add] /model.6/m/m.0/Add_output_0                  1.00000 | 0.1792    1.00000 | 0.0528        0.99999 | 0.8114    1.00000 | 0.0         
[Conv] /model.6/m/m.1/cv1/conv/Conv_output_0       1.00000 | 0.5771    1.00000 | 0.1766
[exSwish] /model.6/m/m.1/cv1/act/Mul_output_0      1.00000 | 0.2299    1.00000 | 0.0546        0.99998 | 1.0036    1.00000 | 0.1380      
[Conv] /model.6/m/m.1/cv2/conv/Conv_output_0       1.00000 | 0.4603    1.00000 | 0.1238
[exSwish] /model.6/m/m.1/cv2/act/Mul_output_0      1.00000 | 0.2284    1.00000 | 0.0528        0.99998 | 1.0113    1.00000 | 0.1356      
[Add] /model.6/m/m.1/Add_output_0                  1.00000 | 0.2980    1.00000 | 0.0734        0.99999 | 1.3001    1.00000 | 0.0         
[Conv] /model.6/m/m.2/cv1/conv/Conv_output_0       1.00000 | 0.5523    1.00000 | 0.1619
[exSwish] /model.6/m/m.2/cv1/act/Mul_output_0      1.00000 | 0.2044    1.00000 | 0.0524        0.99999 | 0.8724    1.00000 | 0.1243      
[Conv] /model.6/m/m.2/cv2/conv/Conv_output_0       1.00000 | 0.6084    1.00000 | 0.1569
[exSwish] /model.6/m/m.2/cv2/act/Mul_output_0      1.00000 | 0.3599    1.00000 | 0.0859        0.99998 | 1.5912    1.00000 | 0.2535      
[Add] /model.6/m/m.2/Add_output_0                  1.00000 | 0.4789    1.00000 | 0.1097        0.99998 | 2.1075    1.00000 | 0.0         
[Conv] /model.6/cv2/conv/Conv_output_0             1.00000 | 0.6856    1.00000 | 0.1651
[exSwish] /model.6/cv2/act/Mul_output_0            1.00000 | 0.4227    1.00000 | 0.0984        0.99997 | 2.6074    1.00000 | 0.2393      
[Concat] /model.6/Concat_output_0                  1.00000 | 0.6388    1.00000 | 0.0984        0.99998 | 3.3526    1.00000 | 0.0         
[Conv] /model.6/cv3/conv/Conv_output_0             1.00000 | 0.8111    1.00000 | 0.2263
[exSwish] /model.6/cv3/act/Mul_output_0            1.00000 | 0.3316    1.00000 | 0.0756        0.99997 | 1.9800    1.00000 | 0.1875      
[Conv] /model.7/conv/Conv_output_0                 1.00000 | 0.5560    1.00000 | 0.1404
[exSwish] /model.7/act/Mul_output_0                1.00000 | 0.2298    1.00000 | 0.0507        0.99994 | 1.8461    1.00000 | 0.1214      
[Conv] /model.8/cv1/conv/Conv_output_0             1.00000 | 0.2673    1.00000 | 0.0892
[exSwish] /model.8/cv1/act/Mul_output_0            1.00000 | 0.0746    1.00000 | 0.0210        0.99997 | 0.6137    1.00000 | 0.0458      
[Conv] /model.8/m/m.0/cv1/conv/Conv_output_0       1.00000 | 0.4261    1.00000 | 0.1309
[exSwish] /model.8/m/m.0/cv1/act/Mul_output_0      1.00000 | 0.2042    1.00000 | 0.0467        0.99995 | 1.5758    1.00000 | 0.1170      
[Conv] /model.8/m/m.0/cv2/conv/Conv_output_0       1.00000 | 0.5180    1.00000 | 0.1237
[exSwish] /model.8/m/m.0/cv2/act/Mul_output_0      1.00000 | 0.2913    1.00000 | 0.0669        0.99994 | 2.5182    1.00000 | 0.1759      
[Add] /model.8/m/m.0/Add_output_0                  1.00000 | 0.3065    1.00000 | 0.0670        0.99993 | 2.6031    1.00000 | 0.0         
[Conv] /model.8/cv2/conv/Conv_output_0             1.00000 | 0.4653    1.00000 | 0.1089
[exSwish] /model.8/cv2/act/Mul_output_0            1.00000 | 0.2483    1.00000 | 0.0540        0.99993 | 2.1787    1.00000 | 0.1265      
[Concat] /model.8/Concat_output_0                  1.00000 | 0.3945    1.00000 | 0.0571        0.99993 | 3.3945    1.00000 | 0.0         
[Conv] /model.8/cv3/conv/Conv_output_0             1.00000 | 0.6968    1.00000 | 0.1682
[exSwish] /model.8/cv3/act/Mul_output_0            1.00000 | 0.3261    1.00000 | 0.0670        0.99991 | 2.8786    1.00000 | 0.1646      
[Conv] /model.9/cv1/conv/Conv_output_0             1.00000 | 0.3497    1.00000 | 0.0960
[exSwish] /model.9/cv1/act/Mul_output_0            1.00000 | 0.3225    1.00000 | 0.1103        0.99997 | 2.6514    1.00000 | 0.2577      
[MaxPool] /model.9/m/MaxPool_output_0              1.00000 | 0.4414    1.00000 | 0.1297        0.99999 | 3.4128    1.00000 | 0.0         
[MaxPool] /model.9/m_1/MaxPool_output_0            1.00000 | 0.4784    1.00000 | 0.1560        0.99999 | 3.6140    1.00000 | 0.0         
[MaxPool] /model.9/m_2/MaxPool_output_0            1.00000 | 0.4955    1.00000 | 0.1723        0.99999 | 3.6602    1.00000 | 0.0         
[Concat] /model.9/Concat_output_0                  1.00000 | 0.8794    1.00000 | 0.2754        0.99999 | 6.7183    1.00000 | 0.0         
[Conv] /model.9/cv2/conv/Conv_output_0             1.00000 | 0.6059    1.00000 | 0.2436
[exSwish] /model.9/cv2/act/Mul_output_0            1.00000 | 0.1914    1.00000 | 0.0398        0.99992 | 1.6811    1.00000 | 0.0925      
[Conv] /model.10/conv/Conv_output_0                1.00000 | 0.4219    1.00000 | 0.1043
[exSwish] /model.10/act/Mul_output_0               1.00000 | 0.1706    1.00000 | 0.0341        0.99991 | 1.4851    1.00000 | 0.0814      
[Resize] /model.11/Resize_output_0                 1.00000 | 0.3412    1.00000 | 0.0475        0.99991 | 2.9703    1.00000 | 0.0         
[Concat] /model.12/Concat_output_0                 1.00000 | 0.4758    1.00000 | 0.0701        0.99994 | 3.5698    1.00000 | 0.0         
[Conv] /model.13/cv1/conv/Conv_output_0            1.00000 | 0.4899    1.00000 | 0.1309
[exSwish] /model.13/cv1/act/Mul_output_0           1.00000 | 0.1896    1.00000 | 0.0595        0.99997 | 1.3748    1.00000 | 0.1441      
[Conv] /model.13/m/m.0/cv1/conv/Conv_output_0      1.00000 | 0.5131    1.00000 | 0.1695
[exSwish] /model.13/m/m.0/cv1/act/Mul_output_0     1.00000 | 0.2320    1.00000 | 0.0631        0.99996 | 1.6936    1.00000 | 0.1499      
[Conv] /model.13/m/m.0/cv2/conv/Conv_output_0      1.00000 | 0.5625    1.00000 | 0.1369
[exSwish] /model.13/m/m.0/cv2/act/Mul_output_0     1.00000 | 0.2800    1.00000 | 0.0610        0.99993 | 2.2030    1.00000 | 0.1513      
[Conv] /model.13/cv2/conv/Conv_output_0            1.00000 | 0.5349    1.00000 | 0.1256
[exSwish] /model.13/cv2/act/Mul_output_0           1.00000 | 0.2531    1.00000 | 0.0567        0.99994 | 1.9512    1.00000 | 0.1389      
[Concat] /model.13/Concat_output_0                 1.00000 | 0.3775    1.00000 | 0.0559        0.99994 | 2.9429    1.00000 | 0.0         
[Conv] /model.13/cv3/conv/Conv_output_0            1.00000 | 0.8536    1.00000 | 0.1991
[exSwish] /model.13/cv3/act/Mul_output_0           1.00000 | 0.4066    1.00000 | 0.0833        0.99992 | 3.2888    1.00000 | 0.2034      
[Conv] /model.14/conv/Conv_output_0                1.00000 | 0.4692    1.00000 | 0.1020
[exSwish] /model.14/act/Mul_output_0               1.00000 | 0.2757    1.00000 | 0.0680        0.99994 | 2.3128    1.00000 | 0.1682      
[Resize] /model.15/Resize_output_0                 1.00000 | 0.5514    1.00000 | 0.0886        0.99994 | 4.6257    1.00000 | 0.0         
[Concat] /model.16/Concat_output_0                 1.00000 | 0.6997    1.00000 | 0.1145        0.99996 | 4.9248    1.00000 | 0.0         
[Conv] /model.17/cv1/conv/Conv_output_0            1.00000 | 0.5299    1.00000 | 0.1643
[exSwish] /model.17/cv1/act/Mul_output_0           1.00000 | 0.2125    1.00000 | 0.0811        0.99998 | 1.4724    1.00000 | 0.1977      
[Conv] /model.17/m/m.0/cv1/conv/Conv_output_0      1.00000 | 0.5593    1.00000 | 0.2251
[exSwish] /model.17/m/m.0/cv1/act/Mul_output_0     1.00000 | 0.2300    1.00000 | 0.0934        0.99998 | 1.5433    1.00000 | 0.2135      
[Conv] /model.17/m/m.0/cv2/conv/Conv_output_0      1.00000 | 0.8545    1.00000 | 0.2604
[exSwish] /model.17/m/m.0/cv2/act/Mul_output_0     1.00000 | 0.5550    1.00000 | 0.1444        0.99996 | 3.8579    1.00000 | 0.3635      
[Conv] /model.17/cv2/conv/Conv_output_0            1.00000 | 0.5023    1.00000 | 0.1378
[exSwish] /model.17/cv2/act/Mul_output_0           1.00000 | 0.3705    1.00000 | 0.1101        0.99995 | 3.3247    1.00000 | 0.2729      
[Concat] /model.17/Concat_output_0                 1.00000 | 0.6673    1.00000 | 0.1171        0.99996 | 5.0929    1.00000 | 0.0         
[Conv] /model.17/cv3/conv/Conv_output_0            1.00000 | 2.2759    1.00000 | 0.5792
[exSwish] /model.17/cv3/act/Mul_output_0           1.00000 | 1.4949    1.00000 | 0.3410        0.99994 | 11.339    1.00000 | 1.0927      
[Conv] /model.18/conv/Conv_output_0                1.00000 | 0.7697    1.00000 | 0.1473
[exSwish] /model.18/act/Mul_output_0               1.00000 | 0.4751    1.00000 | 0.0723        0.99986 | 3.8054    1.00000 | 0.1805      
[Concat] /model.19/Concat_output_0                 1.00000 | 0.5493    1.00000 | 0.0650        0.99990 | 4.4532    1.00000 | 0.0         
[Conv] /model.20/cv1/conv/Conv_output_0            1.00000 | 0.7051    1.00000 | 0.1141
[exSwish] /model.20/cv1/act/Mul_output_0           1.00000 | 0.3838    1.00000 | 0.0557        0.99984 | 3.1648    1.00000 | 0.1376      
[Conv] /model.20/m/m.0/cv1/conv/Conv_output_0      1.00000 | 0.6564    1.00000 | 0.1113
[exSwish] /model.20/m/m.0/cv1/act/Mul_output_0     1.00000 | 0.3043    1.00000 | 0.0461        0.99986 | 2.5376    1.00000 | 0.1101      
[Conv] /model.20/m/m.0/cv2/conv/Conv_output_0      1.00000 | 0.9716    1.00000 | 0.1299
[exSwish] /model.20/m/m.0/cv2/act/Mul_output_0     1.00000 | 0.6093    1.00000 | 0.0851        0.99981 | 5.2704    1.00000 | 0.2502      
[Conv] /model.20/cv2/conv/Conv_output_0            1.00000 | 0.5102    1.00000 | 0.0828
[exSwish] /model.20/cv2/act/Mul_output_0           1.00000 | 0.3326    1.00000 | 0.0576        0.99985 | 3.2475    1.00000 | 0.1576      
[Concat] /model.20/Concat_output_0                 1.00000 | 0.6942    1.00000 | 0.0676        0.99982 | 6.1906    1.00000 | 0.0         
[Conv] /model.20/cv3/conv/Conv_output_0            1.00000 | 1.5858    1.00000 | 0.2464
[exSwish] /model.20/cv3/act/Mul_output_0           1.00000 | 0.9009    1.00000 | 0.1510        0.99986 | 8.1236    1.00000 | 0.5544      
[Conv] /model.21/conv/Conv_output_0                1.00000 | 0.6364    1.00000 | 0.0815
[exSwish] /model.21/act/Mul_output_0               1.00000 | 0.3965    1.00000 | 0.0494        0.99974 | 3.5894    1.00000 | 0.1256      
[Concat] /model.22/Concat_output_0                 1.00000 | 0.4317    1.00000 | 0.0406        0.99980 | 3.8845    1.00000 | 0.0         
[Conv] /model.23/cv1/conv/Conv_output_0            1.00000 | 0.6592    1.00000 | 0.0848
[exSwish] /model.23/cv1/act/Mul_output_0           1.00000 | 0.3573    1.00000 | 0.0428        0.99974 | 3.1069    1.00000 | 0.1259      
[Conv] /model.23/m/m.0/cv1/conv/Conv_output_0      1.00000 | 0.7364    1.00000 | 0.0879
[exSwish] /model.23/m/m.0/cv1/act/Mul_output_0     0.99999 | 0.4095    1.00000 | 0.0404        0.99964 | 3.4908    1.00000 | 0.1387      
[Conv] /model.23/m/m.0/cv2/conv/Conv_output_0      1.00000 | 0.8693    1.00000 | 0.0855
[exSwish] /model.23/m/m.0/cv2/act/Mul_output_0     1.00000 | 0.5731    1.00000 | 0.0634        0.99970 | 4.9156    1.00000 | 0.1682      
[Conv] /model.23/cv2/conv/Conv_output_0            1.00000 | 0.5111    1.00000 | 0.0647
[exSwish] /model.23/cv2/act/Mul_output_0           1.00000 | 0.3930    1.00000 | 0.0593        0.99980 | 3.8416    1.00000 | 0.1424      
[Concat] /model.23/Concat_output_0                 1.00000 | 0.6949    1.00000 | 0.0571        0.99975 | 6.2387    1.00000 | 0.0         
[Conv] /model.23/cv3/conv/Conv_output_0            1.00000 | 0.9849    1.00000 | 0.1291
[exSwish] /model.23/cv3/act/Mul_output_0           1.00000 | 0.4929    1.00000 | 0.0801        0.99983 | 4.6763    1.00000 | 0.3220      
[Conv] /model.24/m.2/Conv_output_0                 1.00000 | 0.2135    1.00000 | 0.1117
[Sigmoid] output1                                  1.00000 | 0.0289    1.00000 | 0.0074        0.99999 | 0.2542    1.00000 | 0.0921      
[Conv] /model.24/m.1/Conv_output_0                 1.00000 | 0.4433    1.00000 | 0.2245
[Sigmoid] output2                                  1.00000 | 0.0470    1.00000 | 0.0160        0.99999 | 0.4188    1.00000 | 0.1851      
[Conv] /model.24/m.0/Conv_output_0                 1.00000 | 0.9307    1.00000 | 0.5451
[Sigmoid] output3                                  1.00000 | 0.0790    1.00000 | 0.0359        1.00000 | 0.6391    1.00000 | 0.3722      
I The error analysis results save to: ./snapshot/error_analysis.txt
W accuracy_analysis: The mapping of layer_name & file_name save to: ./snapshot/map_name_to_file.txt
done
--> Init runtime environment
adb: unable to connect for root: closed
I target set by user is: rk3588
I Get hardware info: target_platform = rk3588, os = Linux, aarch = aarch64
I Check RK3588 board npu runtime version
I Starting ntp or adb, target is RK3588
I Start adb...
I Connect to Device success!
I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36)
D RKNNAPI: ==============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI:   API: 2.0.0b0 (18eacd0 build@2024-03-22T06:07:59)
D RKNNAPI:   DRV: rknn_server: 2.0.0b0 (18eacd0 build@2024-03-22T14:07:19)
D RKNNAPI:   DRV: rknnrt: 2.0.0b0 (35a6907d79@2024-03-24T10:31:14)
D RKNNAPI: ==============================================
D RKNNAPI: Input tensors:
D RKNNAPI:   index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=2457600, w_stride = 0, size_with_stride = 0, fmt=NHWC, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI: Output tensors:
D RKNNAPI:   index=0, name=output1, n_dims=4, dims=[1, 18, 20, 20], n_elems=7200, size=14400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI:   index=1, name=output2, n_dims=4, dims=[1, 18, 40, 40], n_elems=28800, size=57600, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
D RKNNAPI:   index=2, name=output3, n_dims=4, dims=[1, 18, 80, 80], n_elems=115200, size=230400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=FP16, qnt_type=NONE, zp=0, scale=1.000000
done

我的yolov5s模型是在自制训练集上训练得到的,在pytorch的fp32推理精度是81.8,fp16的推理精度是77.5,我翻阅了官方文档,没有找到解释这个现象的原因。所以fp16相较于fp32在rk3588上通过adb连板推理掉了4个点这个现象正常吗?

@blueWatermelonFri blueWatermelonFri changed the title 在RKNN3588上模型以FP16推理时的精度问题 yolov5s在RKNN3588上以FP16推理时的精度问题 Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant