首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Google Net上计算Inception模块的接受域?

如何在Google Net上计算Inception模块的接受域?
EN

Stack Overflow用户
提问于 2018-04-16 13:37:43
回答 1查看 465关注 0票数 3

映像中附加了GoogleNet的一个初始模块。我们如何计算这个初始模块的接受域?我们能只计算一个卷积分支吗?

编辑:

我有这个程序的接受场大小计算。

代码语言:javascript
复制
import math
convnet =   [[7,2,3],[1,1,0],[3,2,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[3,2,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[3,2,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[5,3,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[5,3,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[3,2,1],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[1,1,0],[1,1,0],[3,1,1],[1,1,0],[7,1,1]]
layer_names = ["conv1/7x7_s2","conv1/relu_7x7","pool1/3x3_s2","pool1/norm1","conv2/3x3_reduce","conv2/relu_3x3_reduce","conv2/3x3","conv2/relu_3x3","pool2/3x3_s2","inception_3a/3x3_reduce","inception_3a/relu_3x3_reduce","inception_3a/3x3","inception_3a/relu_3x3","inception_3b/3x3_reduce","inception_3b/relu_3x3_reduce","inception_3b/3x3","inception_3b/relu_3x3","pool3/3x3_s2","inception_4a/3x3_reduce","inception_4a/relu_3x3_reduce","inception_4a/3x3","inception_4a/relu_3x3","loss1/ave_pool","inception_4b/3x3_reduce","inception_4b/relu_3x3_reduce","inception_4b/3x3","inception_4b/relu_3x3","inception_4c/3x3_reduce","inception_4c/relu_3x3_reduce","inception_4c/3x3","inception_4c/relu_3x3","inception_4d/3x3_reduce","inception_4d/relu_3x3_reduce","inception_4d/3x3","inception_4d/relu_3x3","loss2/ave_pool","inception_4e/3x3_reduce","inception_4e/relu_3x3_reduce","inception_4e/3x3","inception_4e/relu_3x3","pool4/3x3_s2","inception_5a/3x3_reduce","inception_5a/relu_3x3_reduce","inception_5a/3x3","inception_5a/relu_3x3","inception_5b/3x3_reduce","inception_5b/relu_3x3_reduce","inception_5b/3x3","inception_5b/relu_3x3","pool5/7x7_s1"]
imsize = 720
def outFromIn(isz, layernum, net = convnet):
    if layernum>len(net): layernum=len(net)

    totstride = 1
    insize = isz
    #for layerparams in net:
    for layer in range(layernum):
        fsize, stride, pad = net[layer]
        outsize = (insize - fsize + 2*pad) / stride + 1
        insize = outsize
        totstride = totstride * stride
    return outsize, totstride

def inFromOut( layernum, net = convnet):
    if layernum>len(net): layernum=len(net)
    outsize = 1
    #for layerparams in net:
    for layer in reversed(range(layernum)):
        fsize, stride, pad = net[layer]
        outsize = ((outsize -1)* stride) + fsize
    RFsize = outsize
    return RFsize

if __name__ == '__main__':

    print "layer output sizes given image = %dx%d" % (imsize, imsize)
    for i in range(len(convnet)):
        p = outFromIn(imsize,i+1)
        rf = inFromOut(i+1)
        print "Layer Name = %s, Output size = %3d, Stride = % 3d, RF size = %3d" % (layer_names[i], p[0], p[1], rf)

我设置的图像大小是720。pool5/7x7_s1层的接收场大小比原始图像大得多。这个计算有什么问题呢?

代码语言:javascript
复制
layer output sizes given image = 224x224
Layer Name = conv1/7x7_s2, Output size = 112, Stride =   2, RF size =   7
Layer Name = conv1/relu_7x7, Output size = 112, Stride =   2, RF size =   7
Layer Name = pool1/3x3_s2, Output size =  55, Stride =   4, RF size =  11
Layer Name = pool1/norm1, Output size =  55, Stride =   4, RF size =  11
Layer Name = conv2/3x3_reduce, Output size =  55, Stride =   4, RF size =  11
Layer Name = conv2/relu_3x3_reduce, Output size =  55, Stride =   4, RF size =  11
Layer Name = conv2/3x3, Output size =  55, Stride =   4, RF size =  19
Layer Name = conv2/relu_3x3, Output size =  55, Stride =   4, RF size =  19
Layer Name = pool2/3x3_s2, Output size =  27, Stride =   8, RF size =  27
Layer Name = inception_3a/3x3_reduce, Output size =  27, Stride =   8, RF size =  27
Layer Name = inception_3a/relu_3x3_reduce, Output size =  27, Stride =   8, RF size =  27
Layer Name = inception_3a/3x3, Output size =  27, Stride =   8, RF size =  43
Layer Name = inception_3a/relu_3x3, Output size =  27, Stride =   8, RF size =  43
Layer Name = inception_3b/3x3_reduce, Output size =  27, Stride =   8, RF size =  43
Layer Name = inception_3b/relu_3x3_reduce, Output size =  27, Stride =   8, RF size =  43
Layer Name = inception_3b/3x3, Output size =  27, Stride =   8, RF size =  59
Layer Name = inception_3b/relu_3x3, Output size =  27, Stride =   8, RF size =  59
Layer Name = pool3/3x3_s2, Output size =  13, Stride =  16, RF size =  75
Layer Name = inception_4a/3x3_reduce, Output size =  13, Stride =  16, RF size =  75
Layer Name = inception_4a/relu_3x3_reduce, Output size =  13, Stride =  16, RF size =  75
Layer Name = inception_4a/3x3, Output size =  13, Stride =  16, RF size = 107
Layer Name = inception_4a/relu_3x3, Output size =  13, Stride =  16, RF size = 107
Layer Name = inception_4b/3x3_reduce, Output size =  13, Stride =  16, RF size = 107
Layer Name = inception_4b/relu_3x3_reduce, Output size =  13, Stride =  16, RF size = 107
Layer Name = inception_4b/3x3, Output size =  13, Stride =  16, RF size = 139
Layer Name = inception_4b/relu_3x3, Output size =  13, Stride =  16, RF size = 139
Layer Name = inception_4c/3x3_reduce, Output size =  13, Stride =  16, RF size = 139
Layer Name = inception_4c/relu_3x3_reduce, Output size =  13, Stride =  16, RF size = 139
Layer Name = inception_4c/3x3, Output size =  13, Stride =  16, RF size = 171
Layer Name = inception_4c/relu_3x3, Output size =  13, Stride =  16, RF size = 171
Layer Name = inception_4d/3x3_reduce, Output size =  13, Stride =  16, RF size = 171
Layer Name = inception_4d/relu_3x3_reduce, Output size =  13, Stride =  16, RF size = 171
Layer Name = inception_4d/3x3, Output size =  13, Stride =  16, RF size = 203
Layer Name = inception_4d/relu_3x3, Output size =  13, Stride =  16, RF size = 203
Layer Name = inception_4e/3x3_reduce, Output size =  13, Stride =  16, RF size = 203
Layer Name = inception_4e/relu_3x3_reduce, Output size =  13, Stride =  16, RF size = 203
Layer Name = inception_4e/3x3, Output size =  13, Stride =  16, RF size = 235
Layer Name = inception_4e/relu_3x3, Output size =  13, Stride =  16, RF size = 235
Layer Name = pool4/3x3_s2, Output size =   7, Stride =  32, RF size = 267
Layer Name = inception_5a/3x3_reduce, Output size =   7, Stride =  32, RF size = 267
Layer Name = inception_5a/relu_3x3_reduce, Output size =   7, Stride =  32, RF size = 267
Layer Name = inception_5a/3x3, Output size =   7, Stride =  32, RF size = 331
Layer Name = inception_5a/relu_3x3, Output size =   7, Stride =  32, RF size = 331
Layer Name = inception_5b/3x3_reduce, Output size =   7, Stride =  32, RF size = 331
Layer Name = inception_5b/relu_3x3_reduce, Output size =   7, Stride =  32, RF size = 331
Layer Name = inception_5b/3x3, Output size =   7, Stride =  32, RF size = 395
Layer Name = inception_5b/relu_3x3, Output size =   7, Stride =  32, RF size = 395
Layer Name = pool5/7x7_s1, Output size =   3, Stride =  32, RF size = 587
EN

回答 1

Stack Overflow用户

发布于 2018-04-16 14:01:22

你应该计算每条路径(你有四条),然后取最大的感受野。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49850230

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档