小知识-卷积后特征图的大小计算

2046-孙同学

发表文章数:47

首页 » 数据科学库 » 正文

整理不易,有条件的点个关注、点个赞呗!感恩各位大哥!

计算公式

以特征图的高举例

o

u

t

_

h

e

i

g

h

t

=

i

n

_

h

e

i

g

h

t

+

2

p

a

d

c

o

n

v

_

h

e

i

g

h

t

s

t

r

i

d

e

s

+

1

(1)

/bm{out/_height=/frac{in/_height+2*pad-conv/_height}{strides}+1}/tag{1}

out_height=stridesin_height+2padconv_height+1(1)
其中:

  • o

    u

    t

    _

    h

    e

    i

    g

    h

    t

    out/_height

    out_height:表示输出的特征图的高。

  • i

    n

    _

    h

    e

    i

    g

    h

    t

    in/_height

    in_height:表示输入的特征图的高。

  • p

    a

    d

    pad

    pad:表示padding的大小。

  • c

    o

    n

    v

    _

    h

    e

    i

    g

    h

    t

    conv/_height

    conv_height:卷积核的高度。

  • s

    t

    r

    i

    d

    e

    s

    strides

    strides:表示卷积核移动的步长(跨度)。

举例

如何将24243的特征图卷积到11211268?
选择卷积核大小为3*3,strides设置为1,则需要的padding为:

      p


      a


      d


      =




        (


        o


        u


        t


        _


        h


        e


        i


        g


        h


        t


        −


        1


        )


        ∗


        s


        t


        r


        i


        d


        e


        s


        −


        i


        n


        _


        h


        e


        i


        g


        h


        t


        +


        c


        o


        n


        v


        _


        h


        e


        i


        g


        h


        t



       2



      =




        (


        112


        −


        1


        )


        ∗


        1


        −


        24


        +


        3



       2



      =


      45




    /bm{pad=/frac{(out/_height-1)*strides-in/_height+conv/_height}{2}=/frac{(112-1)*1-24+3}{2}=45}


 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 2.136em; vertical-align: -0.686em;"></span><span class="mord"><span class="mord"><span class="mord boldsymbol">p</span><span class="mord boldsymbol">a</span><span class="mord boldsymbol">d</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel mathbf">&#61;</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 1.45em;"><span class="" style="top: -2.314em;"><span class="pstrut" style="height: 3em;"></span><span class="mord"><span class="mord mathbf">2</span></span></span><span class="" style="top: -3.23em;"><span class="pstrut" style="height: 3em;"></span><span class="frac-line" style="border-bottom-width: 0.04em;"></span></span><span class="" style="top: -3.7em;"><span class="pstrut" style="height: 3em;"></span><span class="mord"><span class="mopen mathbf">(</span><span class="mord boldsymbol">o</span><span class="mord boldsymbol">u</span><span class="mord boldsymbol">t</span><span class="mord mathbf" style="margin-right: 0.03194em;">_</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">e</span><span class="mord boldsymbol">i</span><span class="mord boldsymbol" style="margin-right: 0.03704em;">g</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">t</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">−</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord mathbf">1</span><span class="mclose mathbf">)</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord boldsymbol">s</span><span class="mord boldsymbol">t</span><span class="mord boldsymbol" style="margin-right: 0.03194em;">r</span><span class="mord boldsymbol">i</span><span class="mord boldsymbol">d</span><span class="mord boldsymbol">e</span><span class="mord boldsymbol">s</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">−</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord boldsymbol">i</span><span class="mord boldsymbol">n</span><span class="mord mathbf" style="margin-right: 0.03194em;">_</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">e</span><span class="mord boldsymbol">i</span><span class="mord boldsymbol" style="margin-right: 0.03704em;">g</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">t</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">+</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord boldsymbol">c</span><span class="mord boldsymbol">o</span><span class="mord boldsymbol">n</span><span class="mord boldsymbol" style="margin-right: 0.03704em;">v</span><span class="mord mathbf" style="margin-right: 0.03194em;">_</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">e</span><span class="mord boldsymbol">i</span><span class="mord boldsymbol" style="margin-right: 0.03704em;">g</span><span class="mord boldsymbol">h</span><span class="mord boldsymbol">t</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.686em;"><span class=""></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel mathbf">&#61;</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 1.427em;"><span class="" style="top: -2.314em;"><span class="pstrut" style="height: 3em;"></span><span class="mord"><span class="mord mathbf">2</span></span></span><span class="" style="top: -3.23em;"><span class="pstrut" style="height: 3em;"></span><span class="frac-line" style="border-bottom-width: 0.04em;"></span></span><span class="" style="top: -3.677em;"><span class="pstrut" style="height: 3em;"></span><span class="mord"><span class="mopen mathbf">(</span><span class="mord mathbf">1</span><span class="mord mathbf">1</span><span class="mord mathbf">2</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">−</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord mathbf">1</span><span class="mclose mathbf">)</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord mathbf">1</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">−</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord mathbf">2</span><span class="mord mathbf">4</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin mathbf">+</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mord mathbf">3</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.686em;"><span class=""></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel mathbf">&#61;</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mord mathbf">4</span><span class="mord mathbf">5</span></span></span></span></span></span></span></span>

未经允许不得转载:作者:2046-孙同学, 转载或复制请以 超链接形式 并注明出处 拜师资源博客
原文地址:《小知识-卷积后特征图的大小计算》 发布于2021-10-13

分享到:
赞(0) 打赏

评论 抢沙发

评论前必须登录!

  注册



长按图片转发给朋友

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

Vieu3.3主题
专业打造轻量级个人企业风格博客主题!专注于前端开发,全站响应式布局自适应模板。

登录

忘记密码 ?

您也可以使用第三方帐号快捷登录

Q Q 登 录
微 博 登 录