用ImageNet的数据集训练SSD(Single Shot MultiBox Detector)

  1. 简介
    1. 资源
    2. 和Fast(er) R-CNN(python版)的代码结构不是一种风格,SSD构建的工作环境使得的文件组织略显复杂
    3. 介绍主要文件夹的用途
      • examples/ssd/,存放了训练,测试的脚本,是主要操作的脚本
      • data/,存放了训练、验证和测试所需的数据和代码
      • python/caffe/model_libs.py,存放了生成网络主体的代码
      • models/,存放了Proto文件,是由 examples/ssd/中的脚本生成
      • jobs/,存放了训练、测试文件,是由 examples/ssd/中的脚本生成
    4. 按照源码中的安装教程,设备合适的情况下,是可以很顺利的安装并运行的
  2. 按照源码中的安装教程,先用明白VOC数据集
  3. 开始
    1. 更换数据集篇(请看更新)
      • 阅读data/ILSVRC2016中的README.md
      • 按照SSD的data/ILSVRC2016中的create_list.py和create_data.sh代码来组织数据结构
      • SSD不支持单通道图片的训练(ILSVRC2014的训练集中存在单通道图片)
    2. 更换网络篇,以AlexNet为例
      • 方案一:
        • 按照SSD工程的组织结构,需要在python/caffe/model_libs.py中将AlexNet的Body用Python语言写好。
        • 删除example/ssd/ssd_pascal.py中的AddExtraLayers的函数。
        • 修改example/ssd/ssd_pascal.py中的参数。
      • 方案二:(本人采用的)
        • 将example/ssd/ssd_pascal.py中,生成train.prototxt、test.prototxt、solver.prototxt的代码片全部删除。只留下对/models文件的复制逻辑shutil.copy(test_net_file, job_dir)
        • 调整、删除或添加example/ssd/ssd_pascal.py中相关参数或变量
        • 在/models中创建AlexNet的路径以存放train.prototxt、test.prototxt、solver.prototxt
        • train.prototxt仅供参考
        • test.prototxt仅供参考
        • solver.prototxt参考VGGNet文件夹中的

2016年12月5日
Github上的SSD更新了ssd_ilsvrc.py,所以直接用ILSVRC(2016)的数据集啦。



这是gray2rgb的函数

function [ x ] = gray2rgb( path )
    I = imread(path);
    if(length(size(I))==2)
        III(:,:,1) = I;
        III(:,:,2) = I;
        III(:,:,3) = I;
        imwrite(III,path);
        x = '1';
    else
        x = '0';
    end
end


这是train.prototxt

name: "AlexNet"
layer{
    name: "data"
    type: "AnnotatedData"
    top: "data"
    top: "label"
    include{
        phase: TRAIN
    }
    transform_param{
        mirror: true
        mean_value: 104
        mean_value: 117
        mean_value: 123
        resize_param{
            prob: 1
            resize_mode: WARP
            height: 300
            width: 300
            interp_mode: LINEAR
            interp_mode: AREA
            interp_mode: NEAREST
            interp_mode: CUBIC
            interp_mode: LANCZOS4
        }
        emit_constraint{
            emit_type: CENTER
        }
    }
    data_param{
        source: "data/VOCdevkit/VOC0712/lmdb/VOC0712_trainval_lmdb"
        batch_size: 16
        backend: LMDB
    }
    annotated_data_param{
        batch_sampler{
            max_sample: 1
            max_trials: 1
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                min_jaccard_overlap: 0.1
                }
            max_sample: 1
            max_trials: 50
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                min_jaccard_overlap: 0.3
                }
            max_sample: 1
            max_trials: 50
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                min_jaccard_overlap: 0.5
                }
            max_sample: 1
            max_trials: 50
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                min_jaccard_overlap: 0.7
                }
            max_sample: 1
            max_trials: 50
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                min_jaccard_overlap: 0.9
                }
            max_sample: 1
            max_trials: 50
        }
        batch_sampler{
            sampler{
                min_scale: 0.3
                max_scale: 1.0
                min_aspect_ratio: 0.5
                max_aspect_ratio: 2.0
                }
            sample_constraint{
                max_jaccard_overlap: 1.0
                }
            max_sample: 1
            max_trials: 50
        }
        label_map_file: "caffe-ssd/data/VOC0712/labelmap_voc.prototxt"
    }
}
layer{
    name: "conv1"
    type: "Convolution"
    bottom: "data"
    top: "conv1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 96
        kernel_size: 11
        stride: 4
        pad: 5
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "relu1"
    type: "ReLU"
    bottom: "conv1"
    top: "conv1"
}
layer{
    name: "norm1"
    type: "LRN"
    bottom: "conv1"
    top: "norm1"
    lrn_param{
        local_size: 5
        alpha: 0.0001
        beta: 0.75
    }
}
layer{
    name: "pool1"
    type: "Pooling"
    bottom: "norm1"
    top: "pool1"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 2
        pad: 1
    }
}
layer{
    name: "conv2"
    type: "Convolution"
    bottom: "pool1"
    top: "conv2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 2
        group: 2
        kernel_size: 5
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu2"
    type: "ReLU"
    bottom: "conv2"
    top: "conv2"
}
layer{
    name: "norm2"
    type: "LRN"
    bottom: "conv2"
    top: "norm2"
    lrn_param{
        local_size: 5
        alpha: 0.0001
        beta: 0.75
    }
}

layer{
    name: "conv3"
    type: "Convolution"
    bottom: "norm2"
    top: "conv3"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 384
        pad: 1
        kernel_size: 3
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "relu3"
    type: "ReLU"
    bottom: "conv3"
    top: "conv3"
}
layer{
    name: "conv4"
    type: "Convolution"
    bottom: "conv3"
    top: "conv4_3"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 384
        pad: 1
        kernel_size: 3
        group: 2
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu4"
    type: "ReLU"
    bottom: "conv4_3"
    top: "conv4_3"
}
layer{
    name: "pool2"
    type: "Pooling"
    bottom: "conv4_3"
    top: "pool2"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 2
    }
}
layer{
    name: "conv5"
    type: "Convolution"
    bottom: "pool2"
    top: "conv5"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        group: 2
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu5"
    type: "ReLU"
    bottom: "conv5"
    top: "conv5"
}
layer{
    name: "pool5"
    type: "Pooling"
    bottom: "conv5"
    top: "pool5"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 1
        pad: 1
    }
}
layer{
    name: "fc6-conv"
    type: "Convolution"
    bottom: "pool5"
    top: "fc6"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 1024
        kernel_size: 3
        #dilation: 3
        pad: 6
        dilation: 6
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu6"
    type: "ReLU"
    bottom: "fc6"
    top: "fc6"
}
layer{
    name: "drop6"
    type: "Dropout"
    bottom: "fc6"
    top: "fc6"
    dropout_param{
        dropout_ratio: 0.5
    }
}
layer{
    name: "fc7-conv"
    type: "Convolution"
    bottom: "fc6"
    top: "fc7"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 1024
        kernel_size: 1
        weight_filler{
            type: "gaussian"
            std: 0.005
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu7"
    type: "ReLU"
    bottom: "fc7"
    top: "fc7"
}
layer{
    name: "drop7"
    type: "Dropout"
    bottom: "fc7"
    top: "fc7"
    dropout_param{
        dropout_ratio: 0.5
    }
}
layer{
    name: "conv6_1"
    type: "Convolution"
    bottom: "fc7"
    top: "conv6_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_1_relu"
    type: "ReLU"
    bottom: "conv6_1"
    top: "conv6_1"
}
layer{
    name: "conv6_2"
    type: "Convolution"
    bottom: "conv6_1"
    top: "conv6_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 512
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_relu"
    type: "ReLU"
    bottom: "conv6_2"
    top: "conv6_2"
}
layer{
    name: "conv7_1"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv7_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 128
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_1_relu"
    type: "ReLU"
    bottom: "conv7_1"
    top: "conv7_1"
}
layer{
    name: "conv7_2"
    type: "Convolution"
    bottom: "conv7_1"
    top: "conv7_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_relu"
    type: "ReLU"
    bottom: "conv7_2"
    top: "conv7_2"
}
layer{
    name: "conv8_1"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv8_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 128
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_1_relu"
    type: "ReLU"
    bottom: "conv8_1"
    top: "conv8_1"
}
layer{
    name: "conv8_2"
    type: "Convolution"
    bottom: "conv8_1"
    top: "conv8_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_relu"
    type: "ReLU"
    bottom: "conv8_2"
    top: "conv8_2"
}
layer{
    name: "pool6"
    type: "Pooling"
    bottom: "conv8_2"
    top: "pool6"
    pooling_param{
        pool: AVE
        global_pooling: true
    }
}
layer{
    name: "conv4_3_norm"
    type: "Normalize"
    bottom: "conv4_3"
    top: "conv4_3_norm"
    norm_param{
        across_spatial: false
        scale_filler{
            type: "constant"
            value: 20
        }
        channel_shared: false
    }
}
layer{
    name: "conv4_3_norm_mbox_loc"
    type: "Convolution"
    bottom: "conv4_3_norm"
    top: "conv4_3_norm_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 12
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv4_3_norm_mbox_loc_perm"
    type: "Permute"
    bottom: "conv4_3_norm_mbox_loc"
    top: "conv4_3_norm_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv4_3_norm_mbox_loc_perm"
    top: "conv4_3_norm_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_conf"
    type: "Convolution"
    bottom: "conv4_3_norm"
    top: "conv4_3_norm_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 63
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv4_3_norm_mbox_conf_perm"
    type: "Permute"
    bottom: "conv4_3_norm_mbox_conf"
    top: "conv4_3_norm_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv4_3_norm_mbox_conf_perm"
    top: "conv4_3_norm_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv4_3_norm"
    bottom: "data"
    top: "conv4_3_norm_mbox_priorbox"
    prior_box_param{
        min_size: 30.0
        aspect_ratio: 2
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "fc7_mbox_loc"
    type: "Convolution"
    bottom: "fc7"
    top: "fc7_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "fc7_mbox_loc_perm"
    type: "Permute"
    bottom: "fc7_mbox_loc"
    top: "fc7_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "fc7_mbox_loc_flat"
    type: "Flatten"
    bottom: "fc7_mbox_loc_perm"
    top: "fc7_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "fc7_mbox_conf"
    type: "Convolution"
    bottom: "fc7"
    top: "fc7_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "fc7_mbox_conf_perm"
    type: "Permute"
    bottom: "fc7_mbox_conf"
    top: "fc7_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "fc7_mbox_conf_flat"
    type: "Flatten"
    bottom: "fc7_mbox_conf_perm"
    top: "fc7_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "fc7_mbox_priorbox"
    type: "PriorBox"
    bottom: "fc7"
    bottom: "data"
    top: "fc7_mbox_priorbox"
    prior_box_param{
        min_size: 60.0
        max_size: 114.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv6_2_mbox_loc"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv6_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv6_2_mbox_loc"
    top: "conv6_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv6_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv6_2_mbox_loc_perm"
    top: "conv6_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv6_2_mbox_conf"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv6_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv6_2_mbox_conf"
    top: "conv6_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv6_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv6_2_mbox_conf_perm"
    top: "conv6_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv6_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv6_2"
    bottom: "data"
    top: "conv6_2_mbox_priorbox"
    prior_box_param{
        min_size: 114.0
        max_size: 168.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv7_2_mbox_loc"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv7_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv7_2_mbox_loc"
    top: "conv7_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv7_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv7_2_mbox_loc_perm"
    top: "conv7_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv7_2_mbox_conf"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv7_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv7_2_mbox_conf"
    top: "conv7_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv7_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv7_2_mbox_conf_perm"
    top: "conv7_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv7_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv7_2"
    bottom: "data"
    top: "conv7_2_mbox_priorbox"
    prior_box_param{
        min_size: 168.0
        max_size: 222.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv8_2_mbox_loc"
    type: "Convolution"
    bottom: "conv8_2"
    top: "conv8_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv8_2_mbox_loc"
    top: "conv8_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv8_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv8_2_mbox_loc_perm"
    top: "conv8_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv8_2_mbox_conf"
    type: "Convolution"
    bottom: "conv8_2"
    top: "conv8_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv8_2_mbox_conf"
    top: "conv8_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv8_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv8_2_mbox_conf_perm"
    top: "conv8_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv8_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv8_2"
    bottom: "data"
    top: "conv8_2_mbox_priorbox"
    prior_box_param{
        min_size: 222.0
        max_size: 276.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "pool6_mbox_loc"
    type: "Convolution"
    bottom: "pool6"
    top: "pool6_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "pool6_mbox_loc_perm"
    type: "Permute"
    bottom: "pool6_mbox_loc"
    top: "pool6_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "pool6_mbox_loc_flat"
    type: "Flatten"
    bottom: "pool6_mbox_loc_perm"
    top: "pool6_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "pool6_mbox_conf"
    type: "Convolution"
    bottom: "pool6"
    top: "pool6_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "pool6_mbox_conf_perm"
    type: "Permute"
    bottom: "pool6_mbox_conf"
    top: "pool6_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "pool6_mbox_conf_flat"
    type: "Flatten"
    bottom: "pool6_mbox_conf_perm"
    top: "pool6_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "pool6_mbox_priorbox"
    type: "PriorBox"
    bottom: "pool6"
    bottom: "data"
    top: "pool6_mbox_priorbox"
    prior_box_param{
        min_size: 276.0
        max_size: 330.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "mbox_loc"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_loc_flat"
    bottom: "fc7_mbox_loc_flat"
    bottom: "conv6_2_mbox_loc_flat"
    bottom: "conv7_2_mbox_loc_flat"
    bottom: "conv8_2_mbox_loc_flat"
    bottom: "pool6_mbox_loc_flat"
    top: "mbox_loc"
    concat_param{
        axis: 1
    }
}
layer{
    name: "mbox_conf"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_conf_flat"
    bottom: "fc7_mbox_conf_flat"
    bottom: "conv6_2_mbox_conf_flat"
    bottom: "conv7_2_mbox_conf_flat"
    bottom: "conv8_2_mbox_conf_flat"
    bottom: "pool6_mbox_conf_flat"
    top: "mbox_conf"
    concat_param{
        axis: 1
    }
}
layer{
    name: "mbox_priorbox"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_priorbox"
    bottom: "fc7_mbox_priorbox"
    bottom: "conv6_2_mbox_priorbox"
    bottom: "conv7_2_mbox_priorbox"
    bottom: "conv8_2_mbox_priorbox"
    bottom: "pool6_mbox_priorbox"
    top: "mbox_priorbox"
    concat_param{
        axis: 2
    }
}
layer{
    name: "mbox_loss"
    type: "MultiBoxLoss"
    bottom: "mbox_loc"
    bottom: "mbox_conf"
    bottom: "mbox_priorbox"
    bottom: "label"
    top: "mbox_loss"
    include{
        phase: TRAIN
    }
    propagate_down: true
    propagate_down: true
    propagate_down: false
    propagate_down: false
    loss_param{
        normalization: VALID
    }
    multibox_loss_param{
        loc_loss_type: SMOOTH_L1
        conf_loss_type: SOFTMAX
        loc_weight: 1.0
        num_classes: 21
        share_location: true
        match_type: PER_PREDICTION
        overlap_threshold: 0.5
        use_prior_for_matching: true
        background_label_id: 0
        use_difficult_gt: true
        do_neg_mining: true
        neg_pos_ratio: 3.0
        neg_overlap: 0.5
        code_type: CENTER_SIZE
    }
}


这是test.prototxt

name: "AlexNet"
layer{
    name: "data"
    type: "AnnotatedData"
    top: "data"
    top: "label"
    include{
        phase: TEST
    }
    transform_param{
        mean_value: 104
        mean_value: 117
        mean_value: 123
        resize_param{
            prob: 1
            resize_mode: WARP
            height: 300
            width: 300
            interp_mode: LINEAR
        }
    }
    data_param{
        source: "data/VOCdevkit/VOC0712/lmdb/VOC0712_test_lmdb"
        batch_size: 1
        backend: LMDB
    }
    annotated_data_param{
        batch_sampler{
        }
        label_map_file: "caffe-ssd/data/coco/labelmap_coco.prototxt"
    }
}
layer{
    name: "conv1"
    type: "Convolution"
    bottom: "data"
    top: "conv1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 96
        kernel_size: 11
        stride: 4
        pad: 5
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "relu1"
    type: "ReLU"
    bottom: "conv1"
    top: "conv1"
}
layer{
    name: "norm1"
    type: "LRN"
    bottom: "conv1"
    top: "norm1"
    lrn_param{
        local_size: 5
        alpha: 0.0001
        beta: 0.75
    }
}
layer{
    name: "pool1"
    type: "Pooling"
    bottom: "norm1"
    top: "pool1"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 2
        pad: 1
    }
}
layer{
    name: "conv2"
    type: "Convolution"
    bottom: "pool1"
    top: "conv2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 2
        group: 2
        kernel_size: 5
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu2"
    type: "ReLU"
    bottom: "conv2"
    top: "conv2"
}
layer{
    name: "norm2"
    type: "LRN"
    bottom: "conv2"
    top: "norm2"
    lrn_param{
        local_size: 5
        alpha: 0.0001
        beta: 0.75
    }
}

layer{
    name: "conv3"
    type: "Convolution"
    bottom: "norm2"
    top: "conv3"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 384
        pad: 1
        kernel_size: 3
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "relu3"
    type: "ReLU"
    bottom: "conv3"
    top: "conv3"
}
layer{
    name: "conv4"
    type: "Convolution"
    bottom: "conv3"
    top: "conv4_3"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 384
        pad: 1
        group: 2
        kernel_size: 3
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}

layer{
    name: "relu4"
    type: "ReLU"
    bottom: "conv4_3"
    top: "conv4_3"
}
layer{
    name: "pool2"
    type: "Pooling"
    bottom: "conv4_3"
    top: "pool2"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 2
    }
}
layer{
    name: "conv5"
    type: "Convolution"
    bottom: "pool2"
    top: "conv5"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        group: 2
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu5"
    type: "ReLU"
    bottom: "conv5"
    top: "conv5"
}
layer{
    name: "pool5"
    type: "Pooling"
    bottom: "conv5"
    top: "pool5"
    pooling_param{
        pool: MAX
        kernel_size: 3
        stride: 1
        pad: 1
    }
}
layer{
    name: "fc6-conv"
    type: "Convolution"
    bottom: "pool5"
    top: "fc6"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 1024
        kernel_size: 3
        dilation: 6
        pad: 6
        weight_filler{
            type: "gaussian"
            std: 0.01
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu6"
    type: "ReLU"
    bottom: "fc6"
    top: "fc6"
}
layer{
    name: "drop6"
    type: "Dropout"
    bottom: "fc6"
    top: "fc6"
    dropout_param{
        dropout_ratio: 0.5
    }
}
layer{
    name: "fc7-conv"
    type: "Convolution"
    bottom: "fc6"
    top: "fc7"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 1024
        kernel_size: 1
        weight_filler{
            type: "gaussian"
            std: 0.005
        }
        bias_filler{
            type: "constant"
            value: 0.1
        }
    }
}
layer{
    name: "relu7"
    type: "ReLU"
    bottom: "fc7"
    top: "fc7"
}
layer{
    name: "drop7"
    type: "Dropout"
    bottom: "fc7"
    top: "fc7"
    dropout_param{
        dropout_ratio: 0.5
    }
}
layer{
    name: "conv6_1"
    type: "Convolution"
    bottom: "fc7"
    top: "conv6_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_1_relu"
    type: "ReLU"
    bottom: "conv6_1"
    top: "conv6_1"
}
layer{
    name: "conv6_2"
    type: "Convolution"
    bottom: "conv6_1"
    top: "conv6_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 512
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_relu"
    type: "ReLU"
    bottom: "conv6_2"
    top: "conv6_2"
}
layer{
    name: "conv7_1"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv7_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 128
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_1_relu"
    type: "ReLU"
    bottom: "conv7_1"
    top: "conv7_1"
}
layer{
    name: "conv7_2"
    type: "Convolution"
    bottom: "conv7_1"
    top: "conv7_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_relu"
    type: "ReLU"
    bottom: "conv7_2"
    top: "conv7_2"
}
layer{
    name: "conv8_1"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv8_1"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 128
        pad: 0
        kernel_size: 1
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_1_relu"
    type: "ReLU"
    bottom: "conv8_1"
    top: "conv8_1"
}
layer{
    name: "conv8_2"
    type: "Convolution"
    bottom: "conv8_1"
    top: "conv8_2"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 256
        pad: 1
        kernel_size: 3
        stride: 2
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_relu"
    type: "ReLU"
    bottom: "conv8_2"
    top: "conv8_2"
}
layer{
    name: "pool6"
    type: "Pooling"
    bottom: "conv8_2"
    top: "pool6"
    pooling_param{
        pool: AVE
        global_pooling: true
    }
}
layer{
    name: "conv4_3_norm"
    type: "Normalize"
    bottom: "conv4_3"
    top: "conv4_3_norm"
    norm_param{
        across_spatial: false
        scale_filler{
            type: "constant"
            value: 20
        }
        channel_shared: false
    }
}
layer{
    name: "conv4_3_norm_mbox_loc"
    type: "Convolution"
    bottom: "conv4_3_norm"
    top: "conv4_3_norm_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 12
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv4_3_norm_mbox_loc_perm"
    type: "Permute"
    bottom: "conv4_3_norm_mbox_loc"
    top: "conv4_3_norm_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv4_3_norm_mbox_loc_perm"
    top: "conv4_3_norm_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_conf"
    type: "Convolution"
    bottom: "conv4_3_norm"
    top: "conv4_3_norm_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 63
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv4_3_norm_mbox_conf_perm"
    type: "Permute"
    bottom: "conv4_3_norm_mbox_conf"
    top: "conv4_3_norm_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv4_3_norm_mbox_conf_perm"
    top: "conv4_3_norm_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv4_3_norm_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv4_3_norm"
    bottom: "data"
    top: "conv4_3_norm_mbox_priorbox"
    prior_box_param{
        min_size: 30.0
        aspect_ratio: 2
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "fc7_mbox_loc"
    type: "Convolution"
    bottom: "fc7"
    top: "fc7_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "fc7_mbox_loc_perm"
    type: "Permute"
    bottom: "fc7_mbox_loc"
    top: "fc7_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "fc7_mbox_loc_flat"
    type: "Flatten"
    bottom: "fc7_mbox_loc_perm"
    top: "fc7_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "fc7_mbox_conf"
    type: "Convolution"
    bottom: "fc7"
    top: "fc7_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "fc7_mbox_conf_perm"
    type: "Permute"
    bottom: "fc7_mbox_conf"
    top: "fc7_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "fc7_mbox_conf_flat"
    type: "Flatten"
    bottom: "fc7_mbox_conf_perm"
    top: "fc7_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "fc7_mbox_priorbox"
    type: "PriorBox"
    bottom: "fc7"
    bottom: "data"
    top: "fc7_mbox_priorbox"
    prior_box_param{
        min_size: 60.0
        max_size: 114.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv6_2_mbox_loc"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv6_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv6_2_mbox_loc"
    top: "conv6_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv6_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv6_2_mbox_loc_perm"
    top: "conv6_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv6_2_mbox_conf"
    type: "Convolution"
    bottom: "conv6_2"
    top: "conv6_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv6_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv6_2_mbox_conf"
    top: "conv6_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv6_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv6_2_mbox_conf_perm"
    top: "conv6_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv6_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv6_2"
    bottom: "data"
    top: "conv6_2_mbox_priorbox"
    prior_box_param{
        min_size: 114.0
        max_size: 168.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv7_2_mbox_loc"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv7_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv7_2_mbox_loc"
    top: "conv7_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv7_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv7_2_mbox_loc_perm"
    top: "conv7_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv7_2_mbox_conf"
    type: "Convolution"
    bottom: "conv7_2"
    top: "conv7_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv7_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv7_2_mbox_conf"
    top: "conv7_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv7_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv7_2_mbox_conf_perm"
    top: "conv7_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv7_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv7_2"
    bottom: "data"
    top: "conv7_2_mbox_priorbox"
    prior_box_param{
        min_size: 168.0
        max_size: 222.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "conv8_2_mbox_loc"
    type: "Convolution"
    bottom: "conv8_2"
    top: "conv8_2_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_mbox_loc_perm"
    type: "Permute"
    bottom: "conv8_2_mbox_loc"
    top: "conv8_2_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv8_2_mbox_loc_flat"
    type: "Flatten"
    bottom: "conv8_2_mbox_loc_perm"
    top: "conv8_2_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv8_2_mbox_conf"
    type: "Convolution"
    bottom: "conv8_2"
    top: "conv8_2_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "conv8_2_mbox_conf_perm"
    type: "Permute"
    bottom: "conv8_2_mbox_conf"
    top: "conv8_2_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "conv8_2_mbox_conf_flat"
    type: "Flatten"
    bottom: "conv8_2_mbox_conf_perm"
    top: "conv8_2_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "conv8_2_mbox_priorbox"
    type: "PriorBox"
    bottom: "conv8_2"
    bottom: "data"
    top: "conv8_2_mbox_priorbox"
    prior_box_param{
        min_size: 222.0
        max_size: 276.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "pool6_mbox_loc"
    type: "Convolution"
    bottom: "pool6"
    top: "pool6_mbox_loc"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 24
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "pool6_mbox_loc_perm"
    type: "Permute"
    bottom: "pool6_mbox_loc"
    top: "pool6_mbox_loc_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "pool6_mbox_loc_flat"
    type: "Flatten"
    bottom: "pool6_mbox_loc_perm"
    top: "pool6_mbox_loc_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "pool6_mbox_conf"
    type: "Convolution"
    bottom: "pool6"
    top: "pool6_mbox_conf"
    param{
        lr_mult: 1
        decay_mult: 1
    }
    param{
        lr_mult: 2
        decay_mult: 0
    }
    convolution_param{
        num_output: 126
        pad: 1
        kernel_size: 3
        stride: 1
        weight_filler{
            type: "xavier"
        }
        bias_filler{
            type: "constant"
            value: 0
        }
    }
}
layer{
    name: "pool6_mbox_conf_perm"
    type: "Permute"
    bottom: "pool6_mbox_conf"
    top: "pool6_mbox_conf_perm"
    permute_param{
        order: 0
        order: 2
        order: 3
        order: 1
    }
}
layer{
    name: "pool6_mbox_conf_flat"
    type: "Flatten"
    bottom: "pool6_mbox_conf_perm"
    top: "pool6_mbox_conf_flat"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "pool6_mbox_priorbox"
    type: "PriorBox"
    bottom: "pool6"
    bottom: "data"
    top: "pool6_mbox_priorbox"
    prior_box_param{
        min_size: 276.0
        max_size: 330.0
        aspect_ratio: 2
        aspect_ratio: 3
        flip: true
        clip: true
        variance: 0.1
        variance: 0.1
        variance: 0.2
        variance: 0.2
    }
}
layer{
    name: "mbox_loc"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_loc_flat"
    bottom: "fc7_mbox_loc_flat"
    bottom: "conv6_2_mbox_loc_flat"
    bottom: "conv7_2_mbox_loc_flat"
    bottom: "conv8_2_mbox_loc_flat"
    bottom: "pool6_mbox_loc_flat"
    top: "mbox_loc"
    concat_param{
        axis: 1
    }
}
layer{
    name: "mbox_conf"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_conf_flat"
    bottom: "fc7_mbox_conf_flat"
    bottom: "conv6_2_mbox_conf_flat"
    bottom: "conv7_2_mbox_conf_flat"
    bottom: "conv8_2_mbox_conf_flat"
    bottom: "pool6_mbox_conf_flat"
    top: "mbox_conf"
    concat_param{
        axis: 1
    }
}
layer{
    name: "mbox_priorbox"
    type: "Concat"
    bottom: "conv4_3_norm_mbox_priorbox"
    bottom: "fc7_mbox_priorbox"
    bottom: "conv6_2_mbox_priorbox"
    bottom: "conv7_2_mbox_priorbox"
    bottom: "conv8_2_mbox_priorbox"
    bottom: "pool6_mbox_priorbox"
    top: "mbox_priorbox"
    concat_param{
        axis: 2
    }
}
layer{
    name: "mbox_conf_reshape"
    type: "Reshape"
    bottom: "mbox_conf"
    top: "mbox_conf_reshape"
    reshape_param{
        shape{
            dim: 0
            dim: -1
            dim: 21
        }
    }
}
layer{
    name: "mbox_conf_softmax"
    type: "Softmax"
    bottom: "mbox_conf_reshape"
    top: "mbox_conf_softmax"
    softmax_param{
        axis: 2
    }
}
layer{
    name: "mbox_conf_flatten"
    type: "Flatten"
    bottom: "mbox_conf_softmax"
    top: "mbox_conf_flatten"
    flatten_param{
        axis: 1
    }
}
layer{
    name: "detection_out"
    type: "DetectionOutput"
    bottom: "mbox_loc"
    bottom: "mbox_conf_flatten"
    bottom: "mbox_priorbox"
    top: "detection_out"
    include{
        phase: TEST
    }
    detection_output_param{
        num_classes: 21
        share_location: true
        background_label_id: 0
        nms_param{
            nms_threshold: 0.45
            top_k: 400
        }
        save_output_param{
            output_directory: "data/VOCdevkit/results/VOC2007/SSD_300x300/Main"
            output_name_prefix: "comp4_det_test_"
            output_format: "VOC"
            label_map_file: "caffe-ssd/data/VOC0712/labelmap_voc.prototxt"
            name_size_file: "caffe-ssd/data/VOC0712/test_name_size.txt"
            num_test_image: 4952
        }
        code_type: CENTER_SIZE
        keep_top_k: 200
        confidence_threshold: 0.01
    }
}
layer{
    name: "detection_eval"
    type: "DetectionEvaluate"
    bottom: "detection_out"
    bottom: "label"
    top: "detection_eval"
    include{
        phase: TEST
    }
    detection_evaluate_param{
        num_classes: 21
        background_label_id: 0
        overlap_threshold: 0.5
        evaluate_difficult_gt: false
        name_size_file: "caffe-ssd/data/VOC0712/test_name_size.txt"
    }
}
  • 4
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 77
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 77
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值