Open songjmcn opened 8 years ago
What do you mean you cannot train the model successfully? Does the loss diverge or become nan?
I can train the model ,and the loss can descent。But when I test the model,the arruracy became 0
Do you see the mAP during training? You can search "detection_eval = " in the .log file. I am guessing you miss some layers or didn't do it right somewhere..
I also think。But I don‘t know where is wrong。
You can send me your train.prototxt and test.prototxt. I can take a look.
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: "/home/song/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: "/home/song/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
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 } }
This is my train file 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: "/home/song/data/VOCdevkit/VOC0712/lmdb/VOC0712_test_lmdb" batch_size: 1 backend: LMDB } annotated_data_param { batch_sampler { } label_map_file: "/home/song/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: "/home/song/data/VOCdevkit/results/VOC2007/SSD_300x300/Main" output_name_prefix: "comp4_dettest" output_format: "VOC" label_map_file: "/home/song/caffe-ssd/data/VOC0712/labelmap_voc.prototxt" name_size_file: "/home/song/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: "/home/song/caffe-ssd/data/VOC0712/test_name_size.txt" } } this is my test file
Hmm, you have labelmap_coco.prototxt in your test.prototxt. You should change it to VOC.
What’s wrong withe model struct? I think there is something wrong in the network
You should change "/home/song/caffe-ssd/data/coco/labelmap_coco.prototxt" to "/home/song/caffe-ssd/data/VOC0712/labelmap_voc.prototxt" in your AnnotatedDataLayer in test.prototxt.
Thanks,I test it。
@songjmcn could you share the code of "def AlexNetBody" , thank you .
@songjmcn Hi, what's your detection eval? I can only get 0.45 detection accuracy using alexnet after about 60000 iteration with batchsize 32.
I get 0.51 detection accuray using alexnet after 100000 iteraion with batchsize 16.
@songjmcn Could you share your slover of AlexNet?
Why did I run the code you gave above and got an error:
Cannot copy param 0 weights from layer 'conv4_3_norm'; shape mismatch. Source param shape is 512(512);target param shape is 384 (384).
While I change num_output to 512,There is another error:
Cannot copy param 0 weights from layer 'conv4'; shape mismatch. Source param shape is 384 192 3 3 (663552);target param shape is 512 192 3 3 (884736).
And while I change con4 to conv4_3,There is another error:
Cannot copy param 0 weights from layer shape is 512 512 3 3 (2359296); target param shape is 384 192 3 3 (663552).
I don't know whether my method is correct.I use 2 caffemodels to fine-tuning the network.
I want to train SSD on other model,such as Alexnet. And I also try to do this. But I can not train the model successful. How can I train SSD with ALexnet?