CNN学习笔记-模型衡量参数
计算量
CNN的计算量通常用乘加数(Multi-Add)来表示,与输入输出图尺寸有关,通常卷积层的占比最大。
卷积层
假设kernel-size为\(k \times k \times C_{in}\),数量为\(C_{out}\)。输入feature map尺寸为\(H_{in} \times W_{in} \times C_{in}\),输出feature map尺寸为\(H_{out} \times W_{out} \times C_{out}\)
那么Multi-Add为\((k \times k \times C_{in} + k \times k \times C_{in}-1) \times (H_{out} \times W_{out} \times C_{out}) = (2 \times k \times k \times C_{in} -1) \times (H_{out} \times W_{out} \times C_{out})\) (不考虑bias的情况)
若考虑bias,则Multi-Add为\((k \times k \times C_{in} + k \times k \times C_{in}) \times (H_{out} \times W_{out} \times C_{out}) = (2 \times k \times k \times C_{in}) \times (H_{out} \times W_{out} \times C_{out})\)