tanluren / yolov3-channel-and-layer-pruning

yolov3 yolov4 channel and layer pruning, Knowledge Distillation 层剪枝,通道剪枝,知识蒸馏
Apache License 2.0
1.5k stars 446 forks source link

激活值的特殊处理 #39

Closed ZiQiangXie closed 4 years ago

ZiQiangXie commented 4 years ago

在prune_utils.py中,对激活值的处理中,这一句next_bn.runningmean.data.sub(offset),这里为什么用的是sub,这里有点不明白?running_mean不应该是对数据统计的均值吗?

tanluren commented 4 years ago

mean的确是统计来的,但这里只是暂时拿来存放偏移值,让计算结果偏差减小,但在后面的微调中整个权重和统计的均值方差都会变化,适应新的状态;之所以是sub,是因为bn层的操作是减去均值,而均值sub偏差,最终就是加上偏差了。

ZiQiangXie commented 4 years ago

明白了,感谢感谢!