@@ -53,6 +53,7 @@ message LabelMap {
repeated LabelMapItem item = 1;
}

/////// ssd 添加的数据预处理==================================
// Sample a bbox in the normalized space [0, 1] with provided constraints.
message Sampler {
// Minimum scale of the sampled bbox.
@@ -153,8 +154,10 @@ message AnnotatedDatum {
// Each group contains annotation for a particular class.
repeated AnnotationGroup annotation_group = 3;
}
/////// ssd 添加的数据预处理=================================


//////// 滤波器参数=========================================
message FillerParameter {
// The filler type.
optional string type = 1 [default = 'constant'];
@@ -176,6 +179,7 @@ message FillerParameter {
optional VarianceNorm variance_norm = 8 [default = FAN_IN];
}

//////////////// NET网络参数====================================
message NetParameter {
optional string name = 1; // consider giving the network a name
// DEPRECATED. See InputParameter. The input blobs to the network.
@@ -210,6 +214,8 @@ message NetParameter {
repeated V1LayerParameter layers = 2;
}


////////////////// solver 求解析参数 ============================
// NOTE
// Update the next available ID when you add a new SolverParameter field.
//
@@ -251,6 +257,7 @@ message SolverParameter {
repeated NetState test_state = 27;

// Evaluation type.
//////////////////// 评估检测网络相关 ===============================
optional string eval_type = 41 [default = "classification"];
// ap_version: different ways of computing Average Precision.
// Check https://sanchom.wordpress.com/tag/average-precision/ for details.
@@ -261,10 +268,13 @@ message SolverParameter {
// If true, display per class result.
optional bool show_per_class_result = 44 [default = false];


/////////////////// 测试 次数=============================
// The number of iterations for each test net.
repeated int32 test_iter = 3;

// The number of iterations between two testing phases.
// 测试间隔========================================
optional int32 test_interval = 4 [default = 0];
optional bool test_compute_loss = 19 [default = false];
// If true, run an initial test pass before the first iteration,
@@ -312,7 +322,12 @@ message SolverParameter {
repeated int32 stepvalue = 34;
// the stepsize for learning rate policy "plateau"
repeated int32 plateau_winsize = 43;


///////////////////////////////////////////////
// 新添加学习策略 ////////////////////////
//// for rate policy "multifixed"
//repeated float stagelr = 50;
//repeated int32 stageiter = 51;

// Set clip_gradients to >= 0 to clip parameter gradients to that L2 norm,
// whenever their actual L2 norm is larger.
@@ -322,12 +337,15 @@ message SolverParameter {
optional string snapshot_prefix = 15; // The prefix for the snapshot.
// whether to snapshot diff in the results or not. Snapshotting diff will help
// debugging but the final protocol buffer size will be much larger.
////////// 网络保存=================================
optional bool snapshot_diff = 16 [default = false];
enum SnapshotFormat {
HDF5 = 0;
BINARYPROTO = 1;
}
optional SnapshotFormat snapshot_format = 37 [default = BINARYPROTO];


// the mode solver will use: 0 for CPU and 1 for GPU. Use GPU in default.
enum SolverMode {
CPU = 0;
@@ -360,6 +378,7 @@ message SolverParameter {
// If false, don't save a snapshot after training finishes.
optional bool snapshot_after_train = 28 [default = true];

// 优化器类型=============================================
// DEPRECATED: old solver enum types, use string instead
enum SolverType {
SGD = 0;
@@ -383,6 +402,7 @@ message SolverState {
optional int32 iter_last_event = 6 [default = 0]; // The iteration when last lr-update or min_loss-update happend
}

// ================= 阶段==================
enum Phase {
TRAIN = 0;
TEST = 1;
@@ -414,6 +434,8 @@ message NetStateRule {

// Specifies training parameters (multipliers on global learning constants,
// and the name and other settings used for weight sharing).


message ParamSpec {
// The names of the parameter blobs -- useful for sharing parameters among
// layers, but never required otherwise. To share a parameter between two
@@ -442,6 +464,9 @@ message ParamSpec {
//
// LayerParameter next available layer-specific ID: 148 (last added:
// quantization_param)


/////////// Layer层参数======================================
message LayerParameter {
optional string name = 1; // the layer name
optional string type = 2; // the layer type
@@ -487,14 +512,39 @@ message LayerParameter {
// Parameters shared by loss layers.
optional LossParameter loss_param = 101;

///////// yolo 层参数 =========================================================

// Yolov1 =============================================================
// detection loss layer 损失函数层===========
//optional DetectionLossParameter detection_loss_param = 210;
// 检测评估======名字和 ssd重名,如需修改名字方可
// optional DetectionEvaluateParameter detection_evaluate_param = 211;
// 检测结果输出 ====================
// optional DetectionOutputParameter detection_output_param = 212;

// Yolo 9000 -- yolov2 ================================================
// 损失函数层======================
optional RegionLossParameter region_loss_param = 213;
// detection evaluation layer 检测评估=============
optional EvalDetectionParameter eval_detection_param = 214;
// yolo v2 新添加 一拆四层==========
optional ReorgParameter reorg_param = 215;

//////=============================================================================


// Layer type-specific parameters.
//
// Note: certain layers may have more than one computational engine
// for their implementation. These layers include an Engine type and
// engine parameter for selecting the implementation.
// The default for the engine is set by the ENGINE switch at compile-time.
optional AccuracyParameter accuracy_param = 102;

///////// ssd 新添加数据层 ===============================
optional AnnotatedDataParameter annotated_data_param = 200;
/////////=================================================

optional ArgMaxParameter argmax_param = 103;
optional BatchNormParameter batch_norm_param = 139;
optional BiasParameter bias_param = 141;
@@ -503,8 +553,12 @@ message LayerParameter {
optional ConvolutionParameter convolution_param = 106;
optional CropParameter crop_param = 144;
optional DataParameter data_param = 107;

/////////// ssd 新添加 检测评估 和 检测结果输出层==================
optional DetectionEvaluateParameter detection_evaluate_param = 205;
optional DetectionOutputParameter detection_output_param = 204;
/////////=========================================================

optional DropoutParameter dropout_param = 108;
optional DummyDataParameter dummy_data_param = 109;
optional EltwiseParameter eltwise_param = 110;
@@ -522,21 +576,44 @@ message LayerParameter {
optional LogParameter log_param = 134;
optional LRNParameter lrn_param = 118;
optional MemoryDataParameter memory_data_param = 119;

/////// ssd 新添加 多尺度边框损失层=======================
optional MultiBoxLossParameter multibox_loss_param = 201;
/////////=================================================

optional MVNParameter mvn_param = 120;

///////// 正则化层参数====================================
optional NormalizeParameter norm_param = 206;
/////////=================================================

optional ParameterParameter parameter_param = 145;

///////// Permute 参数====================================
optional PermuteParameter permute_param = 202;
/////////=================================================

optional PoolingParameter pooling_param = 121;
optional PowerParameter power_param = 122;
optional PReLUParameter prelu_param = 131;

/////////// 预设框========================================
optional PriorBoxParameter prior_box_param = 203;
///////////===============================================

optional PythonParameter python_param = 130;

/////////// 量化==========================================
optional QuantizationParameter quantization_param = 147;
///////////===============================================

optional RecurrentParameter recurrent_param = 146;
optional ReductionParameter reduction_param = 136;
optional ReLUParameter relu_param = 123;
optional ReshapeParameter reshape_param = 133;



optional ScaleParameter scale_param = 142;
optional SigmoidParameter sigmoid_param = 124;
optional SoftmaxParameter softmax_param = 125;
@@ -545,10 +622,115 @@ message LayerParameter {
optional TanHParameter tanh_param = 127;
optional ThresholdParameter threshold_param = 128;
optional TileParameter tile_param = 138;

// 视频数据=========================================
optional VideoDataParameter video_data_param = 207;

optional WindowDataParameter window_data_param = 129;
}




// yolo 新层参数============================================================
// yolov1==================================
//message DetectionLossParameter {
// Yolov1 损失层 和 ssd重名,如需修改名字方可===================
// optional uint32 side = 1 [default = 7];
// optional uint32 num_class = 2 [default = 20];
// optional uint32 num_object = 3 [default = 2];
// optional float object_scale = 4 [default = 1.0];
// optional float noobject_scale = 5 [default = 0.5];
// optional float class_scale = 6 [default = 1.0];
// optional float coord_scale = 7 [default = 5.0];
// optional bool sqrt = 8 [default = true];
// optional bool constriant = 9 [default = false];
//}

// Message that store parameters used by DetectionOutputLayer
//message DetectionOutputParameter {
// Yolov1 检测输出层=========================
// optional uint32 side = 1 [default = 13];
// optional uint32 num_classes = 2 [default = 20];
// optional uint32 num_box = 3 [default = 5];
// optional uint32 coords = 4 [default = 4];
// optional float confidence_threshold = 5 [default = 0.01];
// optional float nms_threshold = 6 [default = 0.45];
// repeated float biases = 7;
// optional string label_map_file = 8;
//}

// Message that store parameters used by DetectionEvaluateLayer
//message DetectionEvaluateParameter {
// Number of classes that are actually predicted. Required!
// optional uint32 num_classes = 1;
// // Threshold for deciding true/false positive.
// optional float overlap_threshold = 2 [default = 0.5];
// // A file which contains a list of names and sizes with same order
// // of the input DB. The file is in the following format:
// // name height width
// // ...
// // If provided, we will scale the prediction and ground truth NormalizedBBox
// // for evaluation.
// //optional string name_size_file = 5;
// // The resize parameter used in converting NormalizedBBox to original image.
// //optional ResizeParameter resize_param = 6;
//}

// yolov2======================================================
message RegionLossParameter{
//Yolov2 9000 损失层参数====================
optional uint32 side = 1 [default = 13];
optional uint32 num_class = 2 [default = 20];
optional uint32 bias_match = 3 [default = 1];
optional uint32 coords = 4 [default = 4];
optional uint32 num = 5 [default = 5];
optional uint32 softmax = 6 [default = 1];
optional float jitter = 7 [default = 0.2];
optional uint32 rescore = 8 [default = 1];

optional float object_scale = 9 [default = 1.0];
optional float class_scale = 10 [default = 1.0];
optional float noobject_scale = 11 [default = 0.5];
optional float coord_scale = 12 [default = 5.0];
optional uint32 absolute = 13 [default = 1];
optional float thresh = 14 [default = 0.2];
optional uint32 random = 15 [default = 1];
repeated float biases = 16;
optional string softmax_tree = 17;
optional string class_map = 18;
}

// Yolov2 9000 检测评估层=========================
message EvalDetectionParameter {
enum ScoreType {
OBJ = 0;
PROB = 1;
MULTIPLY = 2;
}
// Yolo detection evaluation layer
optional uint32 side = 1 [default = 7];
optional uint32 num_class = 2 [default = 20];
optional uint32 num_object = 3 [default = 2];
optional float threshold = 4 [default = 0.5];
optional bool sqrt = 5 [default = true];
optional bool constriant = 6 [default = true];
optional ScoreType score_type = 7 [default = MULTIPLY];
optional float nms = 8 [default = -1];
repeated float biases = 9;
}

message ReorgParameter {
// yolov2 一拆四层================================
optional uint32 stride = 1;
optional bool reverse = 2 [default = false];
}

//===============================================================



// 量化层层数==================================================
// Message for layers with reduced word with arithmetic
message QuantizationParameter{
enum Precision {
@@ -577,6 +759,7 @@ message QuantizationParameter{
optional int32 exp_max = 12 [default = -1];
}

// 数据转换 镜像变形等================================================
// Message that stores parameters used to apply transformation
// to the data layer's data
message TransformationParameter {
@@ -613,8 +796,7 @@ message TransformationParameter {
optional EmitConstraint emit_constraint = 10;

}


///// 变形========================================
// Message that stores parameters used by data transformer for resize policy
message ResizeParameter {
//Probability of using this resize policy
@@ -660,7 +842,7 @@ message SaltPepperParameter {
optional float fraction = 1 [default = 0];
repeated float value = 2;
}

// 噪声================================================
// Message that stores parameters used by data transformer for transformation
// policy
message NoiseParameter {
@@ -698,7 +880,7 @@ message NoiseParameter {
// Color space conversion
optional bool convert_to_lab = 13 [default = false];
}

// 亮度 对比度等================================================
// Message that stores parameters used by data transformer for distortion policy
message DistortionParameter {
// The probability of adjusting brightness.
@@ -730,7 +912,7 @@ message DistortionParameter {
// The probability of randomly order the image channels.
optional float random_order_prob = 11 [default = 0.0];
}

// 0扩展===========================================
// Message that stores parameters used by data transformer for expansion policy
message ExpansionParameter {
//Probability of using this expansion policy
@@ -741,7 +923,7 @@ message ExpansionParameter {
}



// 损失层参数======================================================
// Message that stores parameters shared by loss layers
message LossParameter {
// If specified, ignore instances with the given label.
@@ -772,6 +954,8 @@ message LossParameter {
// Messages that store parameters used by individual layer types follow, in
// alphabetical order.


// 准确度参数 这里没有考虑 分类网络和 检测网络==================================
message AccuracyParameter {
// When computing accuracy, count as correct by comparing the true label to
// the top k scoring classes. By default, only compare to the top scoring
@@ -789,7 +973,7 @@ message AccuracyParameter {
optional int32 ignore_label = 3;
}


//// ssd 新添加 数据层 参数=========================================
message AnnotatedDataParameter {
// Define the sampler.
repeated BatchSampler batch_sampler = 1;
@@ -800,7 +984,7 @@ message AnnotatedDataParameter {
optional AnnotatedDatum.AnnotationType anno_type = 3;
}


// 最大值===================
message ArgMaxParameter {
// If true produce pairs (argmax, maxval)
optional bool out_max_val = 1 [default = false];
@@ -811,7 +995,7 @@ message ArgMaxParameter {
// for each index of the first / num dimension.
optional int32 axis = 3;
}

// 连接层=================
message ConcatParameter {
// The axis along which to concatenate -- may be negative to index from the
// end (e.g., -1 for the last axis). Other axes must have the
@@ -822,7 +1006,7 @@ message ConcatParameter {
// DEPRECATED: alias for "axis" -- does not support negative indexing.
optional uint32 concat_dim = 1 [default = 1];
}

// BN归一化层==================
message BatchNormParameter {
// If false, accumulate global mean/variance values via a moving average. If
// true, use those accumulated values instead of computing mean/variance
@@ -950,6 +1134,7 @@ message CropParameter {
repeated uint32 offset = 2;
}

// 基本数据层================================================
message DataParameter {
enum DB {
LEVELDB = 0;
@@ -982,9 +1167,88 @@ message DataParameter {
// Prefetch queue (Number of batches to prefetch to host memory, increase if
// data access bandwidth varies).
optional uint32 prefetch = 10 [default = 4];

//// yolo 格子分割会用到, 但不确定代码中使用的地方======================
repeated uint32 side = 11;

}

/////////////////////ssd=====================================================
// ssd 多尺度预损失层======================================
// Message that store parameters used by MultiBoxLossLayer
message MultiBoxLossParameter {
// Localization loss type.
enum LocLossType {
L2 = 0;
SMOOTH_L1 = 1;
}
optional LocLossType loc_loss_type = 1 [default = SMOOTH_L1];
// Confidence loss type.
enum ConfLossType {
SOFTMAX = 0;
LOGISTIC = 1;
}
optional ConfLossType conf_loss_type = 2 [default = SOFTMAX];
// Weight for localization loss.
optional float loc_weight = 3 [default = 1.0];
// Number of classes to be predicted. Required!
optional uint32 num_classes = 4;
// If true, bounding box are shared among different classes.
optional bool share_location = 5 [default = true];
// Matching method during training.
enum MatchType {
BIPARTITE = 0;
PER_PREDICTION = 1;
}
optional MatchType match_type = 6 [default = PER_PREDICTION];
// If match_type is PER_PREDICTION, use overlap_threshold to
// determine the extra matching bboxes.
optional float overlap_threshold = 7 [default = 0.5];
// Use prior for matching.
optional bool use_prior_for_matching = 8 [default = true];
// Background label id.
optional uint32 background_label_id = 9 [default = 0];
// If true, also consider difficult ground truth.
optional bool use_difficult_gt = 10 [default = true];
// If true, perform negative mining.
// DEPRECATED: use mining_type instead.
optional bool do_neg_mining = 11;
// The negative/positive ratio.
optional float neg_pos_ratio = 12 [default = 3.0];
// The negative overlap upperbound for the unmatched predictions.
optional float neg_overlap = 13 [default = 0.5];
// Type of coding method for bbox.
optional PriorBoxParameter.CodeType code_type = 14 [default = CORNER];
// If true, encode the variance of prior box in the loc loss target instead of
// in bbox.
optional bool encode_variance_in_target = 16 [default = false];
// If true, map all object classes to agnostic class. It is useful for learning
// objectness detector.
optional bool map_object_to_agnostic = 17 [default = false];
// If true, ignore cross boundary bbox during matching.
// Cross boundary bbox is a bbox who is outside of the image region.
optional bool ignore_cross_boundary_bbox = 18 [default = false];
// If true, only backpropagate on corners which are inside of the image
// region when encode_type is CORNER or CORNER_SIZE.
optional bool bp_inside = 19 [default = false];
// Mining type during training.
// NONE : use all negatives.
// MAX_NEGATIVE : select negatives based on the score.
// HARD_EXAMPLE : select hard examples based on "Training Region-based Object Detectors with Online Hard Example Mining", Shrivastava et.al.
enum MiningType {
NONE = 0;
MAX_NEGATIVE = 1;
HARD_EXAMPLE = 2;
}
optional MiningType mining_type = 20 [default = MAX_NEGATIVE];
// Parameters used for non maximum suppression durig hard example mining.
optional NonMaximumSuppressionParameter nms_param = 21;
optional int32 sample_size = 22 [default = 64];
optional bool use_prior_for_nms = 23 [default = false];
}


// ssd 检测评估层==========================================================
// Message that store parameters used by DetectionEvaluateLayer
message DetectionEvaluateParameter {
// Number of classes that are actually predicted. Required!
@@ -1016,7 +1280,6 @@ message NonMaximumSuppressionParameter {
optional float eta = 3 [default = 1.0];
}


message SaveOutputParameter {
// Output directory. If not empty, we will save the results.
optional string output_directory = 1;
@@ -1043,7 +1306,7 @@ message SaveOutputParameter {
optional ResizeParameter resize_param = 7;
}


// ssd检测输出层=====================================================
// Message that store parameters used by DetectionOutputLayer
message DetectionOutputParameter {
// Number of classes to be predicted. Required!
@@ -1075,8 +1338,10 @@ message DetectionOutputParameter {
// If provided, save outputs to video file.
optional string save_file = 12;
}
// ==========================================================================


// 随机失活=====================
message DropoutParameter {
optional float dropout_ratio = 1 [default = 0.5]; // dropout ratio
}
@@ -1222,6 +1487,7 @@ message InfogainLossParameter {
optional string source = 1;
}

// 全连接层=========================================================
message InnerProductParameter {
optional uint32 num_output = 1; // The number of outputs for the layer
optional bool bias_term = 2 [default = true]; // whether to have bias terms
@@ -1283,79 +1549,6 @@ message MemoryDataParameter {
optional uint32 width = 4;
}

// Message that store parameters used by MultiBoxLossLayer
message MultiBoxLossParameter {
// Localization loss type.
enum LocLossType {
L2 = 0;
SMOOTH_L1 = 1;
}
optional LocLossType loc_loss_type = 1 [default = SMOOTH_L1];
// Confidence loss type.
enum ConfLossType {
SOFTMAX = 0;
LOGISTIC = 1;
}
optional ConfLossType conf_loss_type = 2 [default = SOFTMAX];
// Weight for localization loss.
optional float loc_weight = 3 [default = 1.0];
// Number of classes to be predicted. Required!
optional uint32 num_classes = 4;
// If true, bounding box are shared among different classes.
optional bool share_location = 5 [default = true];
// Matching method during training.
enum MatchType {
BIPARTITE = 0;
PER_PREDICTION = 1;
}
optional MatchType match_type = 6 [default = PER_PREDICTION];
// If match_type is PER_PREDICTION, use overlap_threshold to
// determine the extra matching bboxes.
optional float overlap_threshold = 7 [default = 0.5];
// Use prior for matching.
optional bool use_prior_for_matching = 8 [default = true];
// Background label id.
optional uint32 background_label_id = 9 [default = 0];
// If true, also consider difficult ground truth.
optional bool use_difficult_gt = 10 [default = true];
// If true, perform negative mining.
// DEPRECATED: use mining_type instead.
optional bool do_neg_mining = 11;
// The negative/positive ratio.
optional float neg_pos_ratio = 12 [default = 3.0];
// The negative overlap upperbound for the unmatched predictions.
optional float neg_overlap = 13 [default = 0.5];
// Type of coding method for bbox.
optional PriorBoxParameter.CodeType code_type = 14 [default = CORNER];
// If true, encode the variance of prior box in the loc loss target instead of
// in bbox.
optional bool encode_variance_in_target = 16 [default = false];
// If true, map all object classes to agnostic class. It is useful for learning
// objectness detector.
optional bool map_object_to_agnostic = 17 [default = false];
// If true, ignore cross boundary bbox during matching.
// Cross boundary bbox is a bbox who is outside of the image region.
optional bool ignore_cross_boundary_bbox = 18 [default = false];
// If true, only backpropagate on corners which are inside of the image
// region when encode_type is CORNER or CORNER_SIZE.
optional bool bp_inside = 19 [default = false];
// Mining type during training.
// NONE : use all negatives.
// MAX_NEGATIVE : select negatives based on the score.
// HARD_EXAMPLE : select hard examples based on "Training Region-based Object Detectors with Online Hard Example Mining", Shrivastava et.al.
enum MiningType {
NONE = 0;
MAX_NEGATIVE = 1;
HARD_EXAMPLE = 2;
}
optional MiningType mining_type = 20 [default = MAX_NEGATIVE];
// Parameters used for non maximum suppression durig hard example mining.
optional NonMaximumSuppressionParameter nms_param = 21;
optional int32 sample_size = 22 [default = 64];
optional bool use_prior_for_nms = 23 [default = false];
}


message MVNParameter {
// This parameter can be set to false to normalize mean only
optional bool normalize_variance = 1 [default = true];
@@ -1427,6 +1620,7 @@ message PowerParameter {
optional float shift = 3 [default = 0.0];
}

// 预设框=================================================
// Message that store parameters used by PriorBoxLayer
message PriorBoxParameter {
// Encode/decode type.
@@ -1483,6 +1677,7 @@ message PythonParameter {
optional bool share_in_parallel = 4 [default = false];
}

// 循环神经网络RNN层==========================================================
// Message that stores parameters used by RecurrentLayer
message RecurrentParameter {
// The dimension of the output (and usually hidden state) representation --
@@ -1768,6 +1963,8 @@ message SPPParameter {
optional Engine engine = 6 [default = DEFAULT];
}

////////////////////////////////////////////////////////////////////////////////////
// V0LayerParameter和V1LayerParameter是旧版caffe中的 已经废弃 现在使用LayerParameter
// DEPRECATED: use LayerParameter.
message V1LayerParameter {
repeated string bottom = 2;
@@ -1859,6 +2056,11 @@ message V1LayerParameter {
optional TransformationParameter transform_param = 36;
optional LossParameter loss_param = 42;
optional V0LayerParameter layer = 1;


//


}

// DEPRECATED: V0LayerParameter is the old way of specifying layer parameters