本章节说明DFMBPSROIAlign、DetectionOutputSSD、BBoxReg三个算子的prototxt使用,很多参数都依据开源网络设置,均为固定值,算子详细参数规格请参考《支持Caffe&TensorFlow&ONNX算子清单》>支持Caffe算子清单中的DFMBPSROIAlign~RPNProposalSSD算子,注意:caffe.proto的LayerParameter中已经添加了对应的参数层信息,用户只需要根据模型的具体参数规格修改网络模型prototxt中的参数。
message LayerParameter { ... optional DFMBPSROIAlignParameter dfmb_psroi_pooling_param = 231; optional DetectionOutputSSDParameter detection_output_ssd_param = 1510; optional BBoxRegParameter bbox_reg_param = 1511; ... }
message DFMBPSROIAlignParameter { optional uint32 class_num = 1 [default = 10]; optional uint32 group_height = 2 [default = 7]; optional uint32 group_width = 3 [default = 7]; optional uint32 pooled_height = 4 [default = 7]; optional uint32 pooled_width = 5 [default = 7]; optional uint32 sample_per_part = 6 [default = 4]; optional float heat_map_a = 7; }
message DetectionOutputSSDParameter{ enum MIN_SIZE_MODE { HEIGHT_AND_WIDTH = 0; HEIGHT_OR_WIDTH = 1; } optional NMSSSDParameter nms_param = 1; repeated float threshold = 2; optional uint32 channel_per_scale = 3 [default = 5]; optional string class_name_list = 4 ; optional uint32 num_class = 5 [default = 1]; optional bool refine_out_of_map_bbox = 6 [default = false]; repeated uint32 class_indexes = 7; repeated float heat_map_a = 8; repeated float heat_map_b = 13; optional float threshold_objectness = 9 [default = 0.0]; repeated float proposal_min_sqrt_area = 10; repeated float proposal_max_sqrt_area = 11; optional bool bg_as_one_of_softmax = 12 [default = false]; optional bool use_target_type_rcnn = 14 [default = true]; optional float im_width = 15 [default = 0]; optional float im_height = 16 [default = 0]; optional bool rpn_proposal_output_score = 17 [default = false]; optional bool regress_agnostic = 18 [default = true]; optional GenerateAnchorParameter gen_anchor_param = 19; optional float allow_border = 20 [default = -1.0]; optional float allow_border_ratio = 21 [default = -1.0]; optional bool bbox_size_add_one = 22 [default = true]; optional float read_width_scale = 29 [default = 1.0]; optional float read_height_scale = 30 [default = 1.0]; optional uint32 read_height_offset = 31 [default = 0]; optional float min_size_h = 32 [default = 2.0]; optional float min_size_w = 33 [default = 2.0]; optional MIN_SIZE_MODE min_size_mode = 34 [default = HEIGHT_AND_WIDTH]; optional KPTSParameter kpts_param = 35; optional ATRSParameter atrs_param = 36; optional FTRSParameter ftrs_param = 37; optional SPMPParameter spmp_param = 38; optional Cam3dParameter cam3d_param = 39; }
message BBoxRegParameter { repeated float bbox_mean = 1; repeated float bbox_std = 2; } message NMSSSDParameter{ optional bool need_nms = 1 [default = true]; repeated float overlap_ratio = 2 ; repeated uint32 top_n = 3 ; optional bool add_score = 4 [default = false]; repeated int32 max_candidate_n = 5; repeated bool use_soft_nms = 6; optional bool nms_among_classes = 7 [default = false]; repeated bool voting = 8; repeated float vote_iou = 9; optional int32 nms_gpu_max_n_per_time = 12 [default = -1]; } message GenerateAnchorParameter{ optional float base_size = 1 [default = 16]; repeated float ratios = 2; repeated float scales = 3; repeated float anchor_width = 4; repeated float anchor_height = 5; repeated float anchor_x1 = 6; repeated float anchor_y1 = 7; repeated float anchor_x2 = 8; repeated float anchor_y2 = 9; optional bool zero_anchor_center = 10 [default = true]; } message KPTSParameter{ required uint32 kpts_exist_bottom_idx = 1; required uint32 kpts_reg_bottom_idx = 2; optional bool kpts_reg_as_classify = 3 [default = false]; optional uint32 kpts_classify_width = 4; optional uint32 kpts_classify_height = 5; optional int32 kpts_reg_norm_idx_st = 6; repeated int32 kpts_st_for_each_class = 7; repeated int32 kpts_ed_for_each_class = 8; optional float kpts_classify_pad_ratio = 9 [default = 0.0]; } message ATRSParameter{ enum NormType { NONE = 0; WIDTH = 1; HEIGHT = 2; WIDTH_LOG = 3; HEIGHT_LOG = 4; } required uint32 atrs_reg_bottom_idx = 1; optional int32 atrs_reg_norm_idx_st = 2; repeated NormType atrs_norm_type = 3; } message FTRSParameter{ required uint32 ftrs_bottom_idx = 1; } message SPMPParameter{ required uint32 spmp_bottom_idx = 1; repeated bool spmp_class_aware = 2; repeated uint32 spmp_label_width = 3; repeated uint32 spmp_label_height = 4; repeated float spmp_pad_ratio = 5; } message Cam3dParameter{ required uint32 cam3d_bottom_idx = 1; }
input: "ft_add_left_right" input: "rois" input_shape { dim: 1 dim: 490 dim: 32 dim: 32 } input_shape { dim: 1 dim: 300 dim: 8 dim: 1 } layer { type: 'DFMBPSROIAlign' name: 'psroi_rois' bottom: 'ft_add_left_right' bottom: 'rois' top: 'psroi_rois' dfmb_psroi_pooling_param { heat_map_a: 8 output_dim: 10 group_height: 7 group_width: 7 pooled_height: 7 pooled_width: 7 pad_ratio: 0.000000 sample_per_part: 4 } }
input: "rpn_cls_prob_reshape" input_shape { dim: 1 dim: 30 dim: 32 dim: 32 } input: "rpn_bbox_pred" input_shape { dim: 1 dim: 60 dim: 32 dim: 32 } input: "im_info" input_shape { dim: 1 dim: 6 dim: 1 dim: 1 } layer { type: 'RPNProposalSSD' name: 'proposal' bottom: 'rpn_cls_prob_reshape' bottom: 'rpn_bbox_pred' bottom: 'im_info' top: 'rois' bbox_reg_param { bbox_mean: 0.000437 bbox_mean: 0.002586 bbox_mean: -0.123953 bbox_mean: -0.081469 bbox_std: 0.126770 bbox_std: 0.095741 bbox_std: 0.317300 bbox_std: 0.281042 } detection_output_ssd_param { heat_map_a: 8 min_size_h: 6.160560 min_size_w: 6.160560 min_size_mode: HEIGHT_OR_WIDTH threshold_objectness: 0.200000 gen_anchor_param { anchor_width: 9.232984 anchor_height: 27.726680 anchor_width: 16.000000 anchor_height: 16.000000 anchor_width: 27.712813 anchor_height: 9.237604 anchor_width: 18.465969 anchor_height: 55.453359 anchor_width: 32.000000 anchor_height: 32.000000 anchor_width: 55.425626 anchor_height: 18.475209 anchor_width: 36.931937 anchor_height: 110.906719 anchor_width: 64.000000 anchor_height: 64.000000 anchor_width: 110.851252 anchor_height: 36.950417 anchor_width: 73.863875 anchor_height: 221.813438 anchor_width: 128.000000 anchor_height: 128.000000 anchor_width: 221.702503 anchor_height: 73.900834 anchor_width: 147.727750 anchor_height: 443.626876 anchor_width: 256.000000 anchor_height: 256.000000 anchor_width: 443.405007 anchor_height: 147.801669 } refine_out_of_map_bbox: true nms_param { overlap_ratio: 0.700000 top_n: 300 max_candidate_n: 3000 use_soft_nms: false voting: false vote_iou: 0.700000 } } }
input: "cls_score_softmax" input_shape { dim: 300 dim: 4 dim: 1 dim: 1 } input: "bbox_pred" input_shape { dim: 300 dim: 16 dim: 1 dim: 1 } input: "rois" input_shape { dim: 1 dim: 300 dim: 8 dim: 1 } input: "im_info" input_shape { dim: 1 dim: 6 dim: 1 dim: 1 } layer { type: 'RCNNProposal' name: 'rcnn_proposal' bottom: 'cls_score_softmax' bottom: 'bbox_pred' bottom: 'rois' bottom: 'im_info' top: 'bboxes' bbox_reg_param { bbox_mean: 0.000000 bbox_mean: 0.000000 bbox_mean: 0.000000 bbox_mean: 0.000000 bbox_std: 0.100000 bbox_std: 0.100000 bbox_std: 0.200000 bbox_std: 0.200000 } detection_output_ssd_param { num_class: 3 rpn_proposal_output_score: true regress_agnostic: false min_size_h: 8.800800 min_size_w: 8.800800 min_size_mode: HEIGHT_OR_WIDTH threshold_objectness: 0.100000 threshold: 0.100000 threshold: 0.100000 threshold: 0.100000 refine_out_of_map_bbox: true nms_param { overlap_ratio: 0.500000 top_n: 5 max_candidate_n: 300 use_soft_nms: false voting: false vote_iou: 0.600000 } } }