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
  • 相关阅读:
    Mysql 小技巧
    关于提交form不刷新的问题
    取消超链接点击默认事件
    JS获取地址栏参数
    Maven 手动添加 JAR 包到本地仓库
    Mysql函数instr、locate、position VS like
    阿里巴巴常考面试题及汇总答案
    JS跳转action
    Struts2使用ModelDriven后JSON数据返回不正确
    简单的使用AngularJS的解析JSON
  • 原文地址:https://www.cnblogs.com/dengdan890730/p/6223804.html
Copyright © 2011-2022 走看看