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
    
  • 相关阅读:
    一点关于this的理解
    BFC引发的关于position的思考
    JS HTML标签尺寸距离位置定位计算
    JS获取网页宽高方法集合
    JSDOM之节点
    并发- synchronized,锁
    公共文件下载-结构设计
    订单模块-结构设计
    ES-update
    ES使用笔记
  • 原文地址:https://www.cnblogs.com/geoli/p/13019047.html
Copyright © 2011-2022 走看看