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
  • 相关阅读:
    建站始末——(转载)
    阿里云——大神建个人网站分享(转载)
    从零开始建设个人网站
    前端资料——书籍
    【python】*与** 参数问题
    【python】python异常类型
    【python】unittest中常用的assert语句
    【性能测试】性能测试总结<四>
    【性能测试】性能测试总结<三>
    【性能测试】性能测试总结<二>
  • 原文地址:https://www.cnblogs.com/dengdan890730/p/6223804.html
Copyright © 2011-2022 走看看