zoukankan      html  css  js  c++  java
  • [Pytorch] 卷积尺寸计算

    公式来自官方文档,戳->(Conv3d — PyTorch master documentation
    本文仅作记录,顺便练习Latex语法

    2D

    (H_{out}=frac{H_{in}+2 imes padding[0]-dilation[0] imes(kernel\_size[0]-1)-1}{stride[1]}+1)
    (W_{out}=frac{W_{in}+2 imes padding[1]-dilation[1] imes(kernel\_size[1]-1)-1}{stride[2]}+1)

    如果默认dilation=1的话:

    (H_{out}=frac{H_{in}+2 imes padding[0]-kernel\_size[0]}{stride[1]}+1)
    (W_{out}=frac{W_{in}+2 imes padding[1]-kernel\_size[1]}{stride[2]}+1)

    如果默认dilation=1, stride=1的话:

    (H_{out}=H_{in}+2 imes padding[0]-kernel\_size[0]+1)
    (W_{out}=W_{in}+2 imes padding[1]-kernel\_size[1]+1)

    如果默认dilation=1, stride=1, padding=0的话:

    (H_{out}=H_{in}-kernel\_size[0]+1)
    (W_{out}=W_{in}-kernel\_size[1]+1)

    如果默认dilation=1, padding=0的话:

    (H_{out}=frac{H_{in}-kernel\_size[0]}{stride[1]}+1)
    (W_{out}=frac{W_{in}-kernel\_size[1]}{stride[2]}+1)

    3D

    (D_{out}=frac{D_{in}+2 imes padding[0]-dilation[0] imes(kernel\_size[0]-1)-1}{stride[0]}+1)
    (H_{out}=frac{H_{in}+2 imes padding[1]-dilation[1] imes(kernel\_size[1]-1)-1}{stride[1]}+1)
    (W_{out}=frac{W_{in}+2 imes padding[2]-dilation[2] imes(kernel\_size[2]-1)-1}{stride[2]}+1)

    如果默认dilation=1的话:

    (D_{out}=frac{D_{in}+2 imes padding[0]-kernel\_size[0]}{stride[0]}+1)
    (H_{out}=frac{H_{in}+2 imes padding[1]-kernel\_size[1]}{stride[1]}+1)
    (W_{out}=frac{W_{in}+2 imes padding[2]-kernel\_size[2]}{stride[2]}+1)

    如果默认dilation=1, stride=1的话:

    (D_{out}=D_{in}+2 imes padding[0]-kernel\_size[0]+1)
    (H_{out}=H_{in}+2 imes padding[1]-kernel\_size[1]+1)
    (W_{out}=W_{in}+2 imes padding[2]-kernel\_size[2]+1)

    如果默认dilation=1, stride=1, padding=0的话:
    (D_{out}=D_{in}-kernel\_size[0]+1)
    (H_{out}=H_{in}-kernel\_size[1]+1)
    (W_{out}=W_{in}-kernel\_size[2]+1)

    如果默认dilation=1, padding=0的话:

    (D_{out}=frac{D_{in}-kernel\_size[0]}{stride[1]}+1)
    (H_{out}=frac{H_{in}-kernel\_size[1]}{stride[1]}+1)
    (W_{out}=frac{W_{in}-kernel\_size[2]}{stride[2]}+1)

    附用法

    Parameters
    in_channels (int) – Number of channels in the input image
    out_channels (int) – Number of channels produced by the convolution
    kernel_size (int or tuple) – Size of the convolving kernel
    stride (int or tuple, optional) – Stride of the convolution. Default: 1
    padding (int or tuple, optional) – Zero-padding added to both sides of the input. Default: 0
    padding_mode (string, optional) – 'zeros', 'reflect', 'replicate' or 'circular'. Default: 'zeros'
    dilation (int or tuple, optional) – Spacing between kernel elements. Default: 1
    groups (int, optional) – Number of blocked connections from input channels to output channels. Default: 1
    bias (bool, optional) – If True, adds a learnable bias to the output. Default: True
    
  • 相关阅读:
    在vim中设置将tab自动转化为4个空格
    nginx1.4.6+php5.5.11+mysql5.6.17+mecache+opcache
    Centos7安装杀毒软件ClamAV
    网页中meta标记
    js刷新页面方法大全
    微信第三方登陆,无需注册一键登录,获取用户信息,PHP实现方法
    phpcms v9 如何实现用户登录
    web页面自适应手机屏幕宽度
    微信公共平台消息回复类
    自动回复微信消息
  • 原文地址:https://www.cnblogs.com/geoli/p/13019047.html
Copyright © 2011-2022 走看看