SSD网络结构
阅读原文时间:2023年07月10日阅读:3

SSD算法,其英文全名是Single Shot MultiBox Detector。

SSD的网络结构流程如下图所示
SSD总共11个block,相比较于之前的VGG16,改变了第5个block的第4层,第6、7、8卷积层全部去掉,分别增加了红框、黑框、黄框、蓝框。

其tensorflow代码如下:

with tf.variable\_scope(scope, 'ssd\_300\_vgg', \[inputs\], reuse=reuse):  
    # Original VGG-16 blocks.  
    net = slim.repeat(inputs, 2, slim.conv2d, 64, \[3, 3\], scope='conv1')  
    end\_points\['block1'\] = net  
    net = slim.max\_pool2d(net, \[2, 2\], scope='pool1')  
    # Block 2.  
    net = slim.repeat(net, 2, slim.conv2d, 128, \[3, 3\], scope='conv2')  
    end\_points\['block2'\] = net  
    net = slim.max\_pool2d(net, \[2, 2\], scope='pool2')  
    # Block 3.  
    net = slim.repeat(net, 3, slim.conv2d, 256, \[3, 3\], scope='conv3')  
    end\_points\['block3'\] = net  
    net = slim.max\_pool2d(net, \[2, 2\], scope='pool3')  
    # Block 4.  
    net = slim.repeat(net, 3, slim.conv2d, 512, \[3, 3\], scope='conv4')  
    end\_points\['block4'\] = net  
    net = slim.max\_pool2d(net, \[2, 2\], scope='pool4')  
    # Block 5.  
    net = slim.repeat(net, 3, slim.conv2d, 512, \[3, 3\], scope='conv5')  
    end\_points\['block5'\] = net  
    #注意处  
    net = slim.max\_pool2d(net, \[3, 3\], stride=1, scope='pool5')

    # Additional SSD blocks.  
    # Block 6: let's dilate the hell out of it!  
    #注意处  
    net = slim.conv2d(net, 1024, \[3, 3\], rate=6, scope='conv6')  
    end\_points\['block6'\] = net  
    net = tf.layers.dropout(net, rate=dropout\_keep\_prob, training=is\_training)  
    # Block 7: 1x1 conv. Because the fuck.  
    #注意处  
    net = slim.conv2d(net, 1024, \[1, 1\], scope='conv7')  
    end\_points\['block7'\] = net  
    net = tf.layers.dropout(net, rate=dropout\_keep\_prob, training=is\_training)

    # Block 8/9/10/11: 1x1 and 3x3 convolutions stride 2 (except lasts).  
    end\_point = 'block8'  
    with tf.variable\_scope(end\_point):  
        net = slim.conv2d(net, 256, \[1, 1\], scope='conv1x1')  
        #注意点:实际上相当于下面的卷积操作进行padding了  
        net = custom\_layers.pad2d(net, pad=(1, 1))  
        net = slim.conv2d(net, 512, \[3, 3\], stride=2, scope='conv3x3', padding='VALID')  
    end\_points\[end\_point\] = net  
    end\_point = 'block9'  
    with tf.variable\_scope(end\_point):  
        net = slim.conv2d(net, 128, \[1, 1\], scope='conv1x1')  
        #注意点:实际上相当于下面的卷积操作进行padding了  
        net = custom\_layers.pad2d(net, pad=(1, 1))  
        net = slim.conv2d(net, 256, \[3, 3\], stride=2, scope='conv3x3', padding='VALID')  
    end\_points\[end\_point\] = net  
    end\_point = 'block10'  
    with tf.variable\_scope(end\_point):  
        net = slim.conv2d(net, 128, \[1, 1\], scope='conv1x1')  
        net = slim.conv2d(net, 256, \[3, 3\], scope='conv3x3', padding='VALID')  
    end\_points\[end\_point\] = net  
    end\_point = 'block11'  
    with tf.variable\_scope(end\_point):  
        net = slim.conv2d(net, 128, \[1, 1\], scope='conv1x1')  
        net = slim.conv2d(net, 256, \[3, 3\], scope='conv3x3', padding='VALID')  
    end\_points\[end\_point\] = net

设计理念

参考博客:

目标检测算法之SSD

彻底搞懂SSD网络结构

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章