zoukankan      html  css  js  c++  java
  • Theano conv2d的border_mode

    文档是这么写的:

        border_mode: str, int or tuple of two int
        Either of the following:
        
        ``'valid'``: apply filter wherever it completely overlaps with the
        input. Generates output of shape: input shape - filter shape + 1
        ``'full'``: apply filter wherever it partly overlaps with the input.
        Generates output of shape: input shape + filter shape - 1
        ``'half'``: pad input with a symmetric border of ``filter rows // 2``
        rows and ``filter columns // 2`` columns, then perform a valid
        convolution. For filters with an odd number of rows and columns, this
        leads to the output shape being equal to the input shape.
        ``int``: pad input with a symmetric border of zeros of the given
        width, then perform a valid convolution.
        ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows
        and ``int2`` columns, then perform a valid convolution.
    

    首先, 这几种模式对应的padding都是zero-padding.

    • int, (int1, int2): 它们最容易理解的: 手动指定行和列方向上的padding数量.
    • valid: 其实就是不padding, 即(border\_mode = (0, 0))
    • full: 它的padding为:(border\_mode=(k_h-1, k_w-1)), 其中(k)为kernel的行数(高)与列数(宽). 若(k_h=k_w=3), conv操作会全方位覆盖所有的((3, 3)), ((3, 1)), ((2,1)), ((1, 1))区域. 这也是它叫full的原因.
    • half: (border\_mode = (frac {(k-1)}{2}, frac{k-1}{2})). 注意, (k)一般都是奇数. full模式的padding得到的conv输出比输入要大, 而half的输出形状与输入相同. 也有叫same的.

    * 原始图片来源: https://github.com/vdumoulin/conv_arithmetic * Reference: http://deeplearning.net/software/theano_versions/dev/tutorial/conv_arithmetic.html
  • 相关阅读:
    javascript闭包的理解
    关于打印
    CozyShark开发日志 3章节
    CozyShark开发日志 2章节
    CozyShark开发日志 1.5章节
    CozyShark开发日志 1章节
    CozyShark开发日志 0章节
    WPF:设置DataGrid中DataGridColumn列的普通样式和编辑样式
    Windows Phone开发学习笔记(1)---------自定义弹框
    一个简单的ASP.NEW MVC4网站(二)
  • 原文地址:https://www.cnblogs.com/dengdan890730/p/6223804.html
Copyright © 2011-2022 走看看