×

签到

分享到微信

打开微信,使用扫一扫进入页面后,点击右上角菜单,

点击“发送给朋友”或“分享到朋友圈”完成分享

量化模型精度损失 已完结 陈叶飞2021-11-03 11:44:05 回复 1 查看 使用求助
量化模型精度损失
分享到:

环境: cambricon_pytorch_u16.04_v1.7.0_pt0.15.0.tar

背景:

UNet模型用于分割任务, 在量化时, 发现最后结果有一定差异, 根据官方pytorch文档使用dump_utils逐层dump结果, 得到以下数据.

问题: 

  1. 从逐层输出的差异来看, 是否可以确认是BN层引起的差异?

  2. 这属于使用问题还是算子量化的问题?


 _00000_ 1.0.conv1_in errRate = 0.0037525531370192766
 _00000_ 1.0.conv1_out errRate = 0.013088855892419815
 _00001_ 1.0.bn1_in errRate = 0.013088855892419815
 _00001_ 1.0.bn1_out errRate = 0.017539318650960922
 _00002_ 1.0.relu_in errRate = 0.017539318650960922
 _00002_ 1.0.relu_out errRate = 0.018641946837306023
 _00003_ 1.0.conv2_in errRate = 0.018641946837306023
 _00003_ 1.0.conv2_out errRate = 0.026660917326807976
 _00004_ 1.0.bn2_in errRate = 0.026660917326807976
 _00004_ 1.0.bn2_out errRate = 0.0341462679207325
 _00005_ 1.0.downsample.0_in errRate = 0.0037525531370192766
 _00005_ 1.0.downsample.0_out errRate = 0.013248566538095474
 _00006_ 1.0.downsample.1_in errRate = 0.013248566538095474
 _00006_ 1.0.downsample.1_out errRate = 0.01710827648639679
 _00007_ 1.0.relu_in errRate = 0.02975812368094921
 _00007_ 1.0.relu_out errRate = 0.031128061935305595
 _00008_ 1.1.conv1_in errRate = 0.031128061935305595
 _00008_ 1.1.conv1_out errRate = 0.05052230879664421
 _00009_ 1.1.bn1_in errRate = 0.05052230879664421
 _00009_ 1.1.bn1_out errRate = 0.06432941555976868
 _00010_ 1.1.relu_in errRate = 0.06432941555976868
 _00010_ 1.1.relu_out errRate = 0.06157730147242546
 _00011_ 1.1.conv2_in errRate = 0.06157730147242546
 _00011_ 1.1.conv2_out errRate = 0.07610540091991425
 _00012_ 1.1.bn2_in errRate = 0.07610540091991425
 _00012_ 1.1.bn2_out errRate = 0.088807612657547
 _00013_ 1.1.relu_in errRate = 0.06592924147844315
 _00013_ 1.1.relu_out errRate = 0.05876987800002098
 _00014_ 2.0.conv1_in errRate = 0.05876987800002098
 _00014_ 2.0.conv1_out errRate = 0.06823940575122833
 _00015_ 2.0.bn1_in errRate = 0.06823940575122833
 _00015_ 2.0.bn1_out errRate = 0.09449291229248047
 _00016_ 2.0.relu_in errRate = 0.09449291229248047
 _00016_ 2.0.relu_out errRate = 0.0994093045592308
 _00017_ 2.0.conv2_in errRate = 0.0994093045592308
 _00017_ 2.0.conv2_out errRate = 0.1016751155257225
 _00018_ 2.0.bn2_in errRate = 0.1016751155257225
 _00018_ 2.0.bn2_out errRate = 0.12491264194250107
 _00019_ 2.0.downsample.0_in errRate = 0.05876987800002098
 _00019_ 2.0.downsample.0_out errRate = 0.06935565173625946
 _00020_ 2.0.downsample.1_in errRate = 0.06935565173625946
 _00020_ 2.0.downsample.1_out errRate = 0.0953071191906929
 _00021_ 2.0.relu_in errRate = 0.1112576499581337
 _00021_ 2.0.relu_out errRate = 0.10760968178510666
 _00022_ 2.1.conv1_in errRate = 0.10760968178510666
 _00022_ 2.1.conv1_out errRate = 0.12161954492330551
 _00023_ 2.1.bn1_in errRate = 0.12161954492330551
 _00023_ 2.1.bn1_out errRate = 0.149844229221344
 _00024_ 2.1.relu_in errRate = 0.149844229221344
 _00024_ 2.1.relu_out errRate = 0.1467655748128891
 _00025_ 2.1.conv2_in errRate = 0.1467655748128891
 _00025_ 2.1.conv2_out errRate = 0.1631915271282196
 _00026_ 2.1.bn2_in errRate = 0.1631915271282196
 _00026_ 2.1.bn2_out errRate = 0.19003801047801971
 _00027_ 2.1.relu_in errRate = 0.1514744907617569
 _00027_ 2.1.relu_out errRate = 0.13444244861602783
 _00028_ 3.0.conv1_in errRate = 0.13444244861602783
 _00028_ 3.0.conv1_out errRate = 0.15132983028888702
 _00029_ 3.0.bn1_in errRate = 0.15132983028888702
 _00029_ 3.0.bn1_out errRate = 0.1939898133277893
 _00030_ 3.0.relu_in errRate = 0.1939898133277893
 _00030_ 3.0.relu_out errRate = 0.1948491930961609
 _00031_ 3.0.conv2_in errRate = 0.1948491930961609
 _00031_ 3.0.conv2_out errRate = 0.20783396065235138
 _00032_ 3.0.bn2_in errRate = 0.20783396065235138
 _00032_ 3.0.bn2_out errRate = 0.25121334195137024
 _00033_ 3.0.downsample.0_in errRate = 0.13444244861602783
 _00033_ 3.0.downsample.0_out errRate = 0.14449596405029297
 _00034_ 3.0.downsample.1_in errRate = 0.14449596405029297
 _00034_ 3.0.downsample.1_out errRate = 0.19246523082256317
 _00035_ 3.0.relu_in errRate = 0.22027139365673065
 _00035_ 3.0.relu_out errRate = 0.21942254900932312
 _00036_ 3.1.conv1_in errRate = 0.21942254900932312
 _00036_ 3.1.conv1_out errRate = 0.2183808833360672
 _00037_ 3.1.bn1_in errRate = 0.2183808833360672
 _00037_ 3.1.bn1_out errRate = 0.26192155480384827
 _00038_ 3.1.relu_in errRate = 0.26192155480384827
 _00038_ 3.1.relu_out errRate = 0.26256048679351807
 _00039_ 3.1.conv2_in errRate = 0.26256048679351807
 _00039_ 3.1.conv2_out errRate = 0.2696223556995392
 _00040_ 3.1.bn2_in errRate = 0.2696223556995392
 _00040_ 3.1.bn2_out errRate = 0.3138006627559662
 _00041_ 3.1.relu_in errRate = 0.2700217366218567
 _00041_ 3.1.relu_out errRate = 0.23995940387248993
 _00042_ 4.0.conv1_in errRate = 0.23995940387248993
 _00042_ 4.0.conv1_out errRate = 0.25094619393348694
 _00043_ 4.0.bn1_in errRate = 0.25094619393348694
 _00043_ 4.0.bn1_out errRate = 0.31458067893981934
 _00044_ 4.0.relu_in errRate = 0.31458067893981934
 _00044_ 4.0.relu_out errRate = 0.3183543086051941
 _00045_ 4.0.conv2_in errRate = 0.3183543086051941
 _00045_ 4.0.conv2_out errRate = 0.3262660503387451
 _00046_ 4.0.bn2_in errRate = 0.3262660503387451
 _00046_ 4.0.bn2_out errRate = 0.38016772270202637
 _00047_ 4.0.downsample.0_in errRate = 0.23995940387248993
 _00047_ 4.0.downsample.0_out errRate = 0.24140916764736176
 _00048_ 4.0.downsample.1_in errRate = 0.24140916764736176
 _00048_ 4.0.downsample.1_out errRate = 0.3190271258354187
 _00049_ 4.0.relu_in errRate = 0.3478679060935974
 _00049_ 4.0.relu_out errRate = 0.35211071372032166
 _00050_ 4.1.conv1_in errRate = 0.35211071372032166
 _00050_ 4.1.conv1_out errRate = 0.3489462733268738
 _00051_ 4.1.bn1_in errRate = 0.3489462733268738
 _00051_ 4.1.bn1_out errRate = 0.40637654066085815
 _00052_ 4.1.relu_in errRate = 0.40637654066085815
 _00052_ 4.1.relu_out errRate = 0.40399107336997986
 _00053_ 4.1.conv2_in errRate = 0.40399107336997986
 _00053_ 4.1.conv2_out errRate = 0.4024793803691864
 _00054_ 4.1.bn2_in errRate = 0.4024793803691864
 _00054_ 4.1.bn2_out errRate = 0.47079962491989136
 _00055_ 4.1.relu_in errRate = 0.4131106734275818
 _00055_ 4.1.relu_out errRate = 0.37025389075279236
 _00056_up1.up_in errRate = 0.37025389075279236
 _00056_up1.up_out errRate = 0.3204860985279083
 _00057_up1.conv.double_conv.0_in errRate = 0.2926936745643616
 _00057_up1.conv.double_conv.0_out errRate = 0.3043934106826782
 _00058_up1.conv.double_conv.1_in errRate = 0.3043934106826782
 _00058_up1.conv.double_conv.1_out errRate = 0.4010332226753235
 _00059_up1.conv.double_conv.2_in errRate = 0.4010332226753235
 _00059_up1.conv.double_conv.2_out errRate = 0.4012783467769623
 _00060_up1.conv.double_conv.3_in errRate = 0.4012783467769623
 _00060_up1.conv.double_conv.3_out errRate = 0.3816970884799957
 _00061_up1.conv.double_conv.4_in errRate = 0.3816970884799957
 _00061_up1.conv.double_conv.4_out errRate = 0.4565137028694153
 _00062_up1.conv.double_conv.5_in errRate = 0.4565137028694153
 _00062_up1.conv.double_conv.5_out errRate = 0.4541933238506317
 _00063_up2.up_in errRate = 0.4541933238506317
 _00063_up2.up_out errRate = 0.4256354868412018
 _00064_up2.conv.double_conv.0_in errRate = 0.26447153091430664
 _00064_up2.conv.double_conv.0_out errRate = 0.23553727567195892
 _00065_up2.conv.double_conv.1_in errRate = 0.23553727567195892
 _00065_up2.conv.double_conv.1_out errRate = 0.31906989216804504
 _00066_up2.conv.double_conv.2_in errRate = 0.31906989216804504
 _00066_up2.conv.double_conv.2_out errRate = 0.32121607661247253
 _00067_up2.conv.double_conv.3_in errRate = 0.32121607661247253
 _00067_up2.conv.double_conv.3_out errRate = 0.307621031999588
 _00068_up2.conv.double_conv.4_in errRate = 0.307621031999588
 _00068_up2.conv.double_conv.4_out errRate = 0.36907580494880676
 _00069_up2.conv.double_conv.5_in errRate = 0.36907580494880676
 _00069_up2.conv.double_conv.5_out errRate = 0.3802216649055481
 _00070_up3.up_in errRate = 0.3802216649055481
 _00070_up3.up_out errRate = 0.3672914206981659
 _00071_up3.conv.double_conv.0_in errRate = 0.18738088011741638
 _00071_up3.conv.double_conv.0_out errRate = 0.18433697521686554
 _00072_up3.conv.double_conv.1_in errRate = 0.18433697521686554
 _00072_up3.conv.double_conv.1_out errRate = 0.21873363852500916
 _00073_up3.conv.double_conv.2_in errRate = 0.21873363852500916
 _00073_up3.conv.double_conv.2_out errRate = 0.20668698847293854
 _00074_up3.conv.double_conv.3_in errRate = 0.20668698847293854
 _00074_up3.conv.double_conv.3_out errRate = 0.20921824872493744
 _00075_up3.conv.double_conv.4_in errRate = 0.20921824872493744
 _00075_up3.conv.double_conv.4_out errRate = 0.25048312544822693
 _00076_up3.conv.double_conv.5_in errRate = 0.25048312544822693
 _00076_up3.conv.double_conv.5_out errRate = 0.2546943128108978
 _00077_up4.up_in errRate = 0.2546943128108978
 _00077_up4.up_out errRate = 0.2466486543416977
 _00078_up4.conv.double_conv.0_in errRate = 0.09144531190395355
 _00078_up4.conv.double_conv.0_out errRate = 0.10355861485004425
 _00079_up4.conv.double_conv.1_in errRate = 0.10355861485004425
 _00079_up4.conv.double_conv.1_out errRate = 0.12308644503355026
 _00080_up4.conv.double_conv.2_in errRate = 0.12308644503355026
 _00080_up4.conv.double_conv.2_out errRate = 0.10969457775354385
 _00081_up4.conv.double_conv.3_in errRate = 0.10969457775354385
 _00081_up4.conv.double_conv.3_out errRate = 0.10458693653345108
 _00082_up4.conv.double_conv.4_in errRate = 0.10458693653345108
 _00082_up4.conv.double_conv.4_out errRate = 0.12041313201189041
 _00083_up4.conv.double_conv.5_in errRate = 0.12041313201189041
 _00083_up4.conv.double_conv.5_out errRate = 0.11157391220331192
 _00084_outc.conv_in errRate = 0.11157391220331192
 _00084_outc.conv_out errRate = 0.04279392957687378
 _00085_sigmoid_in errRate = 0.04279392957687378
 _00085_sigmoid_out errRate = 0.4959424138069153


版权所有 © 2024 寒武纪 Cambricon.com 备案/许可证号:京ICP备17003415号-1
关闭