Skip to content

CNN - Padding #104

@junxnone

Description

@junxnone

Reference

Brief

image

为什么需要 padding ?

  • 不 padding 会丢弃原图信息
  • 保持 feature map 与原图一致

Examples

Same Padding

在卷积核移动逐渐扫描整体图时候,因为步长的设置问题,可能导致剩下未扫描的空间不足以提供给卷积核,在图片周围尽量均匀的填充0
如下,允许滑动3次,但是需要补3个元素,左奇右偶,在左边补一个0,右边补2个0

               pad|                                      |pad
   inputs:      0 |1  2  3  4  5  6  7  8  9  10 11 12 13|0  0
               |________________|
                              |_________________|
                                             |________________|

Valid Padding

把不足以扫描的元素位置抛弃掉,就是valid方式。
如下,input_width=13,只允许滑动2次,多余的元素全部丢掉

 inputs:         1  2  3  4  5  6  7  8  9  10 11 (12 13)
                |________________|                dropped
                               |_________________|
Half Padding Full Padding
same_padding_no_strides full_padding_no_strides

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions