|
pytorch模型转rknn,transform和inference都能成功跑通,但我验证了下模型的输出结果,发现转换前后模型的输出有所差异。
我想请问下我这个是哪出了问题吗?
下面是transform代码和输出结果
rknn = RKNN()
rknn.config(channel_mean_value='0 0 0 255', reorder_channel='0 1 2')
print('--> Loading model')
rknn.load_pytorch(model= "./best0429_rknn.pt",input_size_list = [[3, 192, 192]])
print('done')
print('--> Building model')
rknn.build(do_quantization=False)
print('done')
# 导出保存rknn模型文件
rknn.export_rknn('./best0429_1.rknn')
rknn.release()
rknn输出结果:
[[ 1.9600000e+04 -1.2528000e+04 2.8140000e+03 4.2880000e+03
-6.5504000e+04 4.0546875e+00]
[ 1.7600000e+04 -4.1280000e+04 2.0384000e+04 5.1280000e+03
-6.5504000e+04 4.0546875e+00]
[-1.0704000e+04 -3.1888000e+04 1.5120000e+04 1.1696000e+04
-6.5504000e+04 4.0546875e+00]
...
[ 4.2400000e+04 -3.1344000e+04 3.1104000e+04 1.4616000e+04
-6.5504000e+04 4.0546875e+00]
[ 3.1552000e+04 -4.5120000e+04 1.5688000e+04 1.1848000e+04
-5.2768000e+04 4.0546875e+00]
[-5.1320000e+03 -2.0784000e+04 1.1990000e+03 7.4640000e+03
-4.9792000e+04 4.0546875e+00]]]]]
pt模型输出结果:
[[ 0.40062 -1.4997 -0.52211 -0.97928 -12.937 4.0547]
[ 1.3687 -1.548 -0.23681 -1.0195 -9.7809 4.0547]
[ -0.065701 -1.7728 -0.40013 -0.98662 -7.6914 4.0547]
...
[ -0.42156 -1.6976 0.0032967 -0.99554 -9.3549 4.0547]
[ 0.20921 -1.4682 -0.031657 -0.99961 -10.976 4.0547]
[ -0.22729 -1.6746 -0.60021 -0.96069 -10.715 4.0547]]]]]
|
|