卷积神经网络--padding

    1. 当padding 为VALID时:

             输出宽和高的公式代码为:

             output_width = (input_width - filter_width + 1) / strides_width;        (结果向上取整)

             output_height = (input_height - filter_height + 1) / strides_height;      (结果向上取整)

    2.当padding 为SAME时:

             输出宽和高与filter的宽高没有关系,只与步长的宽高有关系:

             output_width = input_width / strides_width;      (结果向上取整)

             output_height = input_height / strides_height;      (结果向上取整)

     3. 补零规则:

              pad_height = max((output_height - 1) * strides_height + filter_height - in_height , 0);

              pad_width = max((out_width - 1) * strides_width +filter_width - in_width, 0);

      pad_top = pad_height / 2;

              pad_bottom = pad_height - pad_top;

              pad_left = pad_width / 2;

              pad_right = pad_width - pad_left;

    pad_top,pad_bottom,pad_left,pad_right为补零的行数和列数。

或者:最简公式 

             valid: [(n-f)/s + 1]  x [(n-f)/s + 1];    该公式向下取整

             same: [(n + 2p -f)/s +1] x [(n + 2p -f)/s +1];  该公式向下取整

原文地址:https://www.cnblogs.com/zxj9487/p/10405648.html