Elffuss BraidHub

kikocis/ncnn public

master · 66.4 KiBRawPermalink
1syntax = "proto2";
2
3package caffe;
4
5// Specifies the shape (dimensions) of a Blob.
6message BlobShape {
7 repeated int64 dim = 1 [packed = true];
8}
9
10message BlobProto {
11 optional BlobShape shape = 7;
12 repeated float data = 5 [packed = true];
13 repeated float diff = 6 [packed = true];
14 repeated double double_data = 8 [packed = true];
15 repeated double double_diff = 9 [packed = true];
16
17 // 4D dimensions -- deprecated. Use "shape" instead.
18 optional int32 num = 1 [default = 0];
19 optional int32 channels = 2 [default = 0];
20 optional int32 height = 3 [default = 0];
21 optional int32 width = 4 [default = 0];
22}
23
24// The BlobProtoVector is simply a way to pass multiple blobproto instances
25// around.
26message BlobProtoVector {
27 repeated BlobProto blobs = 1;
28}
29
30message Datum {
31 optional int32 channels = 1;
32 optional int32 height = 2;
33 optional int32 width = 3;
34 // the actual image data, in bytes
35 optional bytes data = 4;
36 optional int32 label = 5;
37 // Optionally, the datum could also hold float data.
38 repeated float float_data = 6;
39 // If true data contains an encoded image that need to be decoded
40 optional bool encoded = 7 [default = false];
41}
42
43message FillerParameter {
44 // The filler type.
45 optional string type = 1 [default = 'constant'];
46 optional float value = 2 [default = 0]; // the value in constant filler
47 optional float min = 3 [default = 0]; // the min value in uniform filler
48 optional float max = 4 [default = 1]; // the max value in uniform filler
49 optional float mean = 5 [default = 0]; // the mean value in Gaussian filler
50 optional float std = 6 [default = 1]; // the std value in Gaussian filler
51 // The expected number of non-zero output weights for a given input in
52 // Gaussian filler -- the default -1 means don't perform sparsification.
53 optional int32 sparse = 7 [default = -1];
54 // Normalize the filler variance by fan_in, fan_out, or their average.
55 // Applies to 'xavier' and 'msra' fillers.
56 enum VarianceNorm {
57 FAN_IN = 0;
58 FAN_OUT = 1;
59 AVERAGE = 2;
60 }
61 optional VarianceNorm variance_norm = 8 [default = FAN_IN];
62}
63
64message NetParameter {
65 optional string name = 1; // consider giving the network a name
66 // DEPRECATED. See InputParameter. The input blobs to the network.
67 repeated string input = 3;
68 // DEPRECATED. See InputParameter. The shape of the input blobs.
69 repeated BlobShape input_shape = 8;
70
71 // 4D input dimensions -- deprecated. Use "input_shape" instead.
72 // If specified, for each input blob there should be four
73 // values specifying the num, channels, height and width of the input blob.
74 // Thus, there should be a total of (4 * #input) numbers.
75 repeated int32 input_dim = 4;
76
77 // Whether the network will force every layer to carry out backward operation.
78 // If set False, then whether to carry out backward is determined
79 // automatically according to the net structure and learning rates.
80 optional bool force_backward = 5 [default = false];
81 // The current "state" of the network, including the phase, level, and stage.
82 // Some layers may be included/excluded depending on this state and the states
83 // specified in the layers' include and exclude fields.
84 optional NetState state = 6;
85
86 // Print debugging information about results while running Net::Forward,
87 // Net::Backward, and Net::Update.
88 optional bool debug_info = 7 [default = false];
89
90 // The layers that make up the net. Each of their configurations, including
91 // connectivity and behavior, is specified as a LayerParameter.
92 repeated LayerParameter layer = 100; // ID 100 so layers are printed last.
93
94 // DEPRECATED: use 'layer' instead.
95 repeated V1LayerParameter layers = 2;
96}
97
98// NOTE
99// Update the next available ID when you add a new SolverParameter field.
100//
101// SolverParameter next available ID: 41 (last added: type)
102message SolverParameter {
103 //////////////////////////////////////////////////////////////////////////////
104 // Specifying the train and test networks
105 //
106 // Exactly one train net must be specified using one of the following fields:
107 // train_net_param, train_net, net_param, net
108 // One or more test nets may be specified using any of the following fields:
109 // test_net_param, test_net, net_param, net
110 // If more than one test net field is specified (e.g., both net and
111 // test_net are specified), they will be evaluated in the field order given
112 // above: (1) test_net_param, (2) test_net, (3) net_param/net.
113 // A test_iter must be specified for each test_net.
114 // A test_level and/or a test_stage may also be specified for each test_net.
115 //////////////////////////////////////////////////////////////////////////////
116
117 // Proto filename for the train net, possibly combined with one or more
118 // test nets.
119 optional string net = 24;
120 // Inline train net param, possibly combined with one or more test nets.
121 optional NetParameter net_param = 25;
122
123 optional string train_net = 1; // Proto filename for the train net.
124 repeated string test_net = 2; // Proto filenames for the test nets.
125 optional NetParameter train_net_param = 21; // Inline train net params.
126 repeated NetParameter test_net_param = 22; // Inline test net params.
127
128 // The states for the train/test nets. Must be unspecified or
129 // specified once per net.
130 //
131 // By default, all states will have solver = true;
132 // train_state will have phase = TRAIN,
133 // and all test_state's will have phase = TEST.
134 // Other defaults are set according to the NetState defaults.
135 optional NetState train_state = 26;
136 repeated NetState test_state = 27;
137
138 // The number of iterations for each test net.
139 repeated int32 test_iter = 3;
140
141 // The number of iterations between two testing phases.
142 optional int32 test_interval = 4 [default = 0];
143 optional bool test_compute_loss = 19 [default = false];
144 // If true, run an initial test pass before the first iteration,
145 // ensuring memory availability and printing the starting value of the loss.
146 optional bool test_initialization = 32 [default = true];
147 optional float base_lr = 5; // The base learning rate
148 // the number of iterations between displaying info. If display = 0, no info
149 // will be displayed.
150 optional int32 display = 6;
151 // Display the loss averaged over the last average_loss iterations
152 optional int32 average_loss = 33 [default = 1];
153 optional int32 max_iter = 7; // the maximum number of iterations
154 // accumulate gradients over `iter_size` x `batch_size` instances
155 optional int32 iter_size = 36 [default = 1];
156
157 // The learning rate decay policy. The currently implemented learning rate
158 // policies are as follows:
159 // - fixed: always return base_lr.
160 // - step: return base_lr * gamma ^ (floor(iter / step))
161 // - exp: return base_lr * gamma ^ iter
162 // - inv: return base_lr * (1 + gamma * iter) ^ (- power)
163 // - multistep: similar to step but it allows non uniform steps defined by
164 // stepvalue
165 // - poly: the effective learning rate follows a polynomial decay, to be
166 // zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power)
167 // - sigmoid: the effective learning rate follows a sigmod decay
168 // return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize))))
169 //
170 // where base_lr, max_iter, gamma, step, stepvalue and power are defined
171 // in the solver parameter protocol buffer, and iter is the current iteration.
172 optional string lr_policy = 8;
173 optional float gamma = 9; // The parameter to compute the learning rate.
174 optional float power = 10; // The parameter to compute the learning rate.
175 optional float momentum = 11; // The momentum value.
176 optional float weight_decay = 12; // The weight decay.
177 // regularization types supported: L1 and L2
178 // controlled by weight_decay
179 optional string regularization_type = 29 [default = "L2"];
180 // the stepsize for learning rate policy "step"
181 optional int32 stepsize = 13;
182 // the stepsize for learning rate policy "multistep"
183 repeated int32 stepvalue = 34;
184
185 // Set clip_gradients to >= 0 to clip parameter gradients to that L2 norm,
186 // whenever their actual L2 norm is larger.
187 optional float clip_gradients = 35 [default = -1];
188
189 optional int32 snapshot = 14 [default = 0]; // The snapshot interval
190 optional string snapshot_prefix = 15; // The prefix for the snapshot.
191 // whether to snapshot diff in the results or not. Snapshotting diff will help
192 // debugging but the final protocol buffer size will be much larger.
193 optional bool snapshot_diff = 16 [default = false];
194 enum SnapshotFormat {
195 HDF5 = 0;
196 BINARYPROTO = 1;
197 }
198 optional SnapshotFormat snapshot_format = 37 [default = BINARYPROTO];
199 // the mode solver will use: 0 for CPU and 1 for GPU. Use GPU in default.
200 enum SolverMode {
201 CPU = 0;
202 GPU = 1;
203 }
204 optional SolverMode solver_mode = 17 [default = GPU];
205 // the device_id will that be used in GPU mode. Use device_id = 0 in default.
206 optional int32 device_id = 18 [default = 0];
207 // If non-negative, the seed with which the Solver will initialize the Caffe
208 // random number generator -- useful for reproducible results. Otherwise,
209 // (and by default) initialize using a seed derived from the system clock.
210 optional int64 random_seed = 20 [default = -1];
211
212 // type of the solver
213 optional string type = 40 [default = "SGD"];
214
215 // numerical stability for RMSProp, AdaGrad and AdaDelta and Adam
216 optional float delta = 31 [default = 1e-8];
217 // parameters for the Adam solver
218 optional float momentum2 = 39 [default = 0.999];
219
220 // RMSProp decay value
221 // MeanSquare(t) = rms_decay*MeanSquare(t-1) + (1-rms_decay)*SquareGradient(t)
222 optional float rms_decay = 38;
223
224 // If true, print information about the state of the net that may help with
225 // debugging learning problems.
226 optional bool debug_info = 23 [default = false];
227
228 // If false, don't save a snapshot after training finishes.
229 optional bool snapshot_after_train = 28 [default = true];
230
231 // DEPRECATED: old solver enum types, use string instead
232 enum SolverType {
233 SGD = 0;
234 NESTEROV = 1;
235 ADAGRAD = 2;
236 RMSPROP = 3;
237 ADADELTA = 4;
238 ADAM = 5;
239 }
240 // DEPRECATED: use type instead of solver_type
241 optional SolverType solver_type = 30 [default = SGD];
242}
243
244// A message that stores the solver snapshots
245message SolverState {
246 optional int32 iter = 1; // The current iteration
247 optional string learned_net = 2; // The file that stores the learned net.
248 repeated BlobProto history = 3; // The history for sgd solvers
249 optional int32 current_step = 4 [default = 0]; // The current step for learning rate
250}
251
252enum Phase {
253 TRAIN = 0;
254 TEST = 1;
255}
256
257message NetState {
258 optional Phase phase = 1 [default = TEST];
259 optional int32 level = 2 [default = 0];
260 repeated string stage = 3;
261}
262
263message NetStateRule {
264 // Set phase to require the NetState have a particular phase (TRAIN or TEST)
265 // to meet this rule.
266 optional Phase phase = 1;
267
268 // Set the minimum and/or maximum levels in which the layer should be used.
269 // Leave undefined to meet the rule regardless of level.
270 optional int32 min_level = 2;
271 optional int32 max_level = 3;
272
273 // Customizable sets of stages to include or exclude.
274 // The net must have ALL of the specified stages and NONE of the specified
275 // "not_stage"s to meet the rule.
276 // (Use multiple NetStateRules to specify conjunctions of stages.)
277 repeated string stage = 4;
278 repeated string not_stage = 5;
279}
280
281// Specifies training parameters (multipliers on global learning constants,
282// and the name and other settings used for weight sharing).
283message ParamSpec {
284 // The names of the parameter blobs -- useful for sharing parameters among
285 // layers, but never required otherwise. To share a parameter between two
286 // layers, give it a (non-empty) name.
287 optional string name = 1;
288
289 // Whether to require shared weights to have the same shape, or just the same
290 // count -- defaults to STRICT if unspecified.
291 optional DimCheckMode share_mode = 2;
292 enum DimCheckMode {
293 // STRICT (default) requires that num, channels, height, width each match.
294 STRICT = 0;
295 // PERMISSIVE requires only the count (num*channels*height*width) to match.
296 PERMISSIVE = 1;
297 }
298
299 // The multiplier on the global learning rate for this parameter.
300 optional float lr_mult = 3 [default = 1.0];
301
302 // The multiplier on the global weight decay for this parameter.
303 optional float decay_mult = 4 [default = 1.0];
304}
305
306// NOTE
307// Update the next available ID when you add a new LayerParameter field.
308//
309// LayerParameter next available layer-specific ID: 146 (last added: shuffle_channel_param)
310message LayerParameter {
311 optional string name = 1; // the layer name
312 optional string type = 2; // the layer type
313 repeated string bottom = 3; // the name of each bottom blob
314 repeated string top = 4; // the name of each top blob
315
316 // The train / test phase for computation.
317 optional Phase phase = 10;
318
319 // The amount of weight to assign each top blob in the objective.
320 // Each layer assigns a default value, usually of either 0 or 1,
321 // to each top blob.
322 repeated float loss_weight = 5;
323
324 // Specifies training parameters (multipliers on global learning constants,
325 // and the name and other settings used for weight sharing).
326 repeated ParamSpec param = 6;
327
328 // The blobs containing the numeric parameters of the layer.
329 repeated BlobProto blobs = 7;
330
331 // Specifies whether to backpropagate to each bottom. If unspecified,
332 // Caffe will automatically infer whether each input needs backpropagation
333 // to compute parameter gradients. If set to true for some inputs,
334 // backpropagation to those inputs is forced; if set false for some inputs,
335 // backpropagation to those inputs is skipped.
336 //
337 // The size must be either 0 or equal to the number of bottoms.
338 repeated bool propagate_down = 11;
339
340 // Rules controlling whether and when a layer is included in the network,
341 // based on the current NetState. You may specify a non-zero number of rules
342 // to include OR exclude, but not both. If no include or exclude rules are
343 // specified, the layer is always included. If the current NetState meets
344 // ANY (i.e., one or more) of the specified rules, the layer is
345 // included/excluded.
346 repeated NetStateRule include = 8;
347 repeated NetStateRule exclude = 9;
348
349 // Parameters for data pre-processing.
350 optional TransformationParameter transform_param = 100;
351
352 // Parameters shared by loss layers.
353 optional LossParameter loss_param = 101;
354
355 // Layer type-specific parameters.
356 //
357 // Note: certain layers may have more than one computational engine
358 // for their implementation. These layers include an Engine type and
359 // engine parameter for selecting the implementation.
360 // The default for the engine is set by the ENGINE switch at compile-time.
361 optional AccuracyParameter accuracy_param = 102;
362 optional ArgMaxParameter argmax_param = 103;
363 optional BatchNormParameter batch_norm_param = 139;
364 optional BiasParameter bias_param = 141;
365 optional BNParameter bn_param = 45;
366 optional ConcatParameter concat_param = 104;
367 optional ContrastiveLossParameter contrastive_loss_param = 105;
368 optional ConvolutionParameter convolution_param = 106;
369 optional CropParameter crop_param = 144;
370 optional DataParameter data_param = 107;
371 optional DetectionOutputParameter detection_output_param = 204;
372 optional YoloDetectionOutputParameter yolo_detection_output_param = 601;
373 optional Yolov3DetectionOutputParameter yolov3_detection_output_param = 603;
374 optional DropoutParameter dropout_param = 108;
375 optional DummyDataParameter dummy_data_param = 109;
376 optional EltwiseParameter eltwise_param = 110;
377 optional ELUParameter elu_param = 140;
378 optional EmbedParameter embed_param = 137;
379 optional ExpParameter exp_param = 111;
380 optional FlattenParameter flatten_param = 135;
381 optional HDF5DataParameter hdf5_data_param = 112;
382 optional HDF5OutputParameter hdf5_output_param = 113;
383 optional HingeLossParameter hinge_loss_param = 114;
384 optional ImageDataParameter image_data_param = 115;
385 optional InfogainLossParameter infogain_loss_param = 116;
386 optional InnerProductParameter inner_product_param = 117;
387 optional InputParameter input_param = 143;
388 optional InterpParameter interp_param = 205;
389 optional LogParameter log_param = 134;
390 optional LRNParameter lrn_param = 118;
391 optional MemoryDataParameter memory_data_param = 119;
392 optional MVNParameter mvn_param = 120;
393 optional NormalizeParameter norm_param = 206;
394 optional PoolingParameter pooling_param = 121;
395 optional PermuteParameter permute_param = 202;
396 optional PowerParameter power_param = 122;
397 optional PReLUParameter prelu_param = 131;
398 optional PriorBoxParameter prior_box_param = 203;
399 optional PSROIPoolingParameter psroi_pooling_param = 149;
400 optional PythonParameter python_param = 130;
401 optional RecurrentParameter recurrent_param = 146;
402 optional ReductionParameter reduction_param = 136;
403 optional ReLUParameter relu_param = 123;
404 optional ReorgParameter reorg_param = 147;
405 optional ReshapeParameter reshape_param = 133;
406 optional ROIAlignParameter roi_align_param = 148;
407 optional ROIPoolingParameter roi_pooling_param = 8266711;
408 optional ScaleParameter scale_param = 142;
409 optional ShuffleChannelParameter shuffle_channel_param = 145;
410 optional SigmoidParameter sigmoid_param = 124;
411 optional SmoothL1LossParameter smooth_l1_loss_param = 8266712;
412 optional SoftmaxParameter softmax_param = 125;
413 optional SPPParameter spp_param = 132;
414 optional SliceParameter slice_param = 126;
415 optional TanHParameter tanh_param = 127;
416 optional ThresholdParameter threshold_param = 128;
417 optional TileParameter tile_param = 138;
418 optional WindowDataParameter window_data_param = 129;
419}
420
421// Message that stores parameters used to apply transformation
422// to the data layer's data
423message TransformationParameter {
424 // For data pre-processing, we can do simple scaling and subtracting the
425 // data mean, if provided. Note that the mean subtraction is always carried
426 // out before scaling.
427 optional float scale = 1 [default = 1];
428 // Specify if we want to randomly mirror data.
429 optional bool mirror = 2 [default = false];
430 // Specify if we would like to randomly crop an image.
431 optional uint32 crop_size = 3 [default = 0];
432 // mean_file and mean_value cannot be specified at the same time
433 optional string mean_file = 4;
434 // if specified can be repeated once (would substract it from all the channels)
435 // or can be repeated the same number of times as channels
436 // (would subtract them from the corresponding channel)
437 repeated float mean_value = 5;
438 // Force the decoded image to have 3 color channels.
439 optional bool force_color = 6 [default = false];
440 // Force the decoded image to have 1 color channels.
441 optional bool force_gray = 7 [default = false];
442}
443
444// Message that stores parameters used by data transformer for resize policy
445message ResizeParameter {
446 //Probability of using this resize policy
447 optional float prob = 1 [default = 1];
448
449 enum Resize_mode {
450 WARP = 1;
451 FIT_SMALL_SIZE = 2;
452 FIT_LARGE_SIZE_AND_PAD = 3;
453 }
454 optional Resize_mode resize_mode = 2 [default = WARP];
455 optional uint32 height = 3 [default = 0];
456 optional uint32 width = 4 [default = 0];
457 // A parameter used to update bbox in FIT_SMALL_SIZE mode.
458 optional uint32 height_scale = 8 [default = 0];
459 optional uint32 width_scale = 9 [default = 0];
460
461 enum Pad_mode {
462 CONSTANT = 1;
463 MIRRORED = 2;
464 REPEAT_NEAREST = 3;
465 }
466 // Padding mode for BE_SMALL_SIZE_AND_PAD mode and object centering
467 optional Pad_mode pad_mode = 5 [default = CONSTANT];
468 // if specified can be repeated once (would fill all the channels)
469 // or can be repeated the same number of times as channels
470 // (would use it them to the corresponding channel)
471 repeated float pad_value = 6;
472
473 enum Interp_mode { //Same as in OpenCV
474 LINEAR = 1;
475 AREA = 2;
476 NEAREST = 3;
477 CUBIC = 4;
478 LANCZOS4 = 5;
479 }
480 //interpolation for for resizing
481 repeated Interp_mode interp_mode = 7;
482}
483
484// Message that stores parameters shared by loss layers
485message LossParameter {
486 // If specified, ignore instances with the given label.
487 optional int32 ignore_label = 1;
488 // How to normalize the loss for loss layers that aggregate across batches,
489 // spatial dimensions, or other dimensions. Currently only implemented in
490 // SoftmaxWithLoss layer.
491 enum NormalizationMode {
492 // Divide by the number of examples in the batch times spatial dimensions.
493 // Outputs that receive the ignore label will NOT be ignored in computing
494 // the normalization factor.
495 FULL = 0;
496 // Divide by the total number of output locations that do not take the
497 // ignore_label. If ignore_label is not set, this behaves like FULL.
498 VALID = 1;
499 // Divide by the batch size.
500 BATCH_SIZE = 2;
501 // Do not normalize the loss.
502 NONE = 3;
503 }
504 optional NormalizationMode normalization = 3 [default = VALID];
505 // Deprecated. Ignored if normalization is specified. If normalization
506 // is not specified, then setting this to false will be equivalent to
507 // normalization = BATCH_SIZE to be consistent with previous behavior.
508 optional bool normalize = 2;
509}
510
511// Messages that store parameters used by individual layer types follow, in
512// alphabetical order.
513
514message AccuracyParameter {
515 // When computing accuracy, count as correct by comparing the true label to
516 // the top k scoring classes. By default, only compare to the top scoring
517 // class (i.e. argmax).
518 optional uint32 top_k = 1 [default = 1];
519
520 // The "label" axis of the prediction blob, whose argmax corresponds to the
521 // predicted label -- may be negative to index from the end (e.g., -1 for the
522 // last axis). For example, if axis == 1 and the predictions are
523 // (N x C x H x W), the label blob is expected to contain N*H*W ground truth
524 // labels with integer values in {0, 1, ..., C-1}.
525 optional int32 axis = 2 [default = 1];
526
527 // If specified, ignore instances with the given label.
528 optional int32 ignore_label = 3;
529}
530
531message ArgMaxParameter {
532 // If true produce pairs (argmax, maxval)
533 optional bool out_max_val = 1 [default = false];
534 optional uint32 top_k = 2 [default = 1];
535 // The axis along which to maximise -- may be negative to index from the
536 // end (e.g., -1 for the last axis).
537 // By default ArgMaxLayer maximizes over the flattened trailing dimensions
538 // for each index of the first / num dimension.
539 optional int32 axis = 3;
540}
541
542message ConcatParameter {
543 // The axis along which to concatenate -- may be negative to index from the
544 // end (e.g., -1 for the last axis). Other axes must have the
545 // same dimension for all the bottom blobs.
546 // By default, ConcatLayer concatenates blobs along the "channels" axis (1).
547 optional int32 axis = 2 [default = 1];
548
549 // DEPRECATED: alias for "axis" -- does not support negative indexing.
550 optional uint32 concat_dim = 1 [default = 1];
551}
552
553message BatchNormParameter {
554 // If false, accumulate global mean/variance values via a moving average. If
555 // true, use those accumulated values instead of computing mean/variance
556 // across the batch.
557 optional bool use_global_stats = 1;
558 // How much does the moving average decay each iteration?
559 optional float moving_average_fraction = 2 [default = .999];
560 // Small value to add to the variance estimate so that we don't divide by
561 // zero.
562 optional float eps = 3 [default = 1e-5];
563}
564
565message BiasParameter {
566 // The first axis of bottom[0] (the first input Blob) along which to apply
567 // bottom[1] (the second input Blob). May be negative to index from the end
568 // (e.g., -1 for the last axis).
569 //
570 // For example, if bottom[0] is 4D with shape 100x3x40x60, the output
571 // top[0] will have the same shape, and bottom[1] may have any of the
572 // following shapes (for the given value of axis):
573 // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60
574 // (axis == 1 == -3) 3; 3x40; 3x40x60
575 // (axis == 2 == -2) 40; 40x60
576 // (axis == 3 == -1) 60
577 // Furthermore, bottom[1] may have the empty shape (regardless of the value of
578 // "axis") -- a scalar bias.
579 optional int32 axis = 1 [default = 1];
580
581 // (num_axes is ignored unless just one bottom is given and the bias is
582 // a learned parameter of the layer. Otherwise, num_axes is determined by the
583 // number of axes by the second bottom.)
584 // The number of axes of the input (bottom[0]) covered by the bias
585 // parameter, or -1 to cover all axes of bottom[0] starting from `axis`.
586 // Set num_axes := 0, to add a zero-axis Blob: a scalar.
587 optional int32 num_axes = 2 [default = 1];
588
589 // (filler is ignored unless just one bottom is given and the bias is
590 // a learned parameter of the layer.)
591 // The initialization for the learned bias parameter.
592 // Default is the zero (0) initialization, resulting in the BiasLayer
593 // initially performing the identity operation.
594 optional FillerParameter filler = 3;
595}
596
597// Message that stores parameters used by BN (Batch Normalization) layer
598message BNParameter {
599 enum BNMode {
600 LEARN = 0;
601 INFERENCE = 1;
602 }
603 optional BNMode bn_mode = 3 [default = LEARN];
604 optional FillerParameter scale_filler = 1; // The filler for the scale
605 optional FillerParameter shift_filler = 2; // The filler for the shift
606}
607
608message ContrastiveLossParameter {
609 // margin for dissimilar pair
610 optional float margin = 1 [default = 1.0];
611 // The first implementation of this cost did not exactly match the cost of
612 // Hadsell et al 2006 -- using (margin - d^2) instead of (margin - d)^2.
613 // legacy_version = false (the default) uses (margin - d)^2 as proposed in the
614 // Hadsell paper. New models should probably use this version.
615 // legacy_version = true uses (margin - d^2). This is kept to support /
616 // reproduce existing models and results
617 optional bool legacy_version = 2 [default = false];
618}
619
620message ConvolutionParameter {
621 optional uint32 num_output = 1; // The number of outputs for the layer
622 optional bool bias_term = 2 [default = true]; // whether to have bias terms
623
624 // Pad, kernel size, and stride are all given as a single value for equal
625 // dimensions in all spatial dimensions, or once per spatial dimension.
626 repeated uint32 pad = 3; // The padding size; defaults to 0
627 repeated uint32 kernel_size = 4; // The kernel size
628 repeated uint32 stride = 6; // The stride; defaults to 1
629 // Factor used to dilate the kernel, (implicitly) zero-filling the resulting
630 // holes. (Kernel dilation is sometimes referred to by its use in the
631 // algorithme à trous from Holschneider et al. 1987.)
632 repeated uint32 dilation = 18; // The dilation; defaults to 1
633
634 // For 2D convolution only, the *_h and *_w versions may also be used to
635 // specify both spatial dimensions.
636 optional uint32 pad_h = 9 [default = 0]; // The padding height (2D only)
637 optional uint32 pad_w = 10 [default = 0]; // The padding width (2D only)
638 optional uint32 kernel_h = 11; // The kernel height (2D only)
639 optional uint32 kernel_w = 12; // The kernel width (2D only)
640 optional uint32 stride_h = 13; // The stride height (2D only)
641 optional uint32 stride_w = 14; // The stride width (2D only)
642
643 optional uint32 group = 5 [default = 1]; // The group size for group conv
644
645 optional FillerParameter weight_filler = 7; // The filler for the weight
646 optional FillerParameter bias_filler = 8; // The filler for the bias
647 enum Engine {
648 DEFAULT = 0;
649 CAFFE = 1;
650 CUDNN = 2;
651 }
652 optional Engine engine = 15 [default = DEFAULT];
653
654 // The axis to interpret as "channels" when performing convolution.
655 // Preceding dimensions are treated as independent inputs;
656 // succeeding dimensions are treated as "spatial".
657 // With (N, C, H, W) inputs, and axis == 1 (the default), we perform
658 // N independent 2D convolutions, sliding C-channel (or (C/g)-channels, for
659 // groups g>1) filters across the spatial axes (H, W) of the input.
660 // With (N, C, D, H, W) inputs, and axis == 1, we perform
661 // N independent 3D convolutions, sliding (C/g)-channels
662 // filters across the spatial axes (D, H, W) of the input.
663 optional int32 axis = 16 [default = 1];
664
665 // Whether to force use of the general ND convolution, even if a specific
666 // implementation for blobs of the appropriate number of spatial dimensions
667 // is available. (Currently, there is only a 2D-specific convolution
668 // implementation; for input blobs with num_axes != 2, this option is
669 // ignored and the ND implementation will be used.)
670 optional bool force_nd_im2col = 17 [default = false];
671}
672
673message CropParameter {
674 // To crop, elements of the first bottom are selected to fit the dimensions
675 // of the second, reference bottom. The crop is configured by
676 // - the crop `axis` to pick the dimensions for cropping
677 // - the crop `offset` to set the shift for all/each dimension
678 // to align the cropped bottom with the reference bottom.
679 // All dimensions up to but excluding `axis` are preserved, while
680 // the dimensions including and trailing `axis` are cropped.
681 // If only one `offset` is set, then all dimensions are offset by this amount.
682 // Otherwise, the number of offsets must equal the number of cropped axes to
683 // shift the crop in each dimension accordingly.
684 // Note: standard dimensions are N,C,H,W so the default is a spatial crop,
685 // and `axis` may be negative to index from the end (e.g., -1 for the last
686 // axis).
687 optional int32 axis = 1 [default = 2];
688 repeated uint32 offset = 2;
689}
690
691message DataParameter {
692 enum DB {
693 LEVELDB = 0;
694 LMDB = 1;
695 }
696 // Specify the data source.
697 optional string source = 1;
698 // Specify the batch size.
699 optional uint32 batch_size = 4;
700 // The rand_skip variable is for the data layer to skip a few data points
701 // to avoid all asynchronous sgd clients to start at the same point. The skip
702 // point would be set as rand_skip * rand(0,1). Note that rand_skip should not
703 // be larger than the number of keys in the database.
704 // DEPRECATED. Each solver accesses a different subset of the database.
705 optional uint32 rand_skip = 7 [default = 0];
706 optional DB backend = 8 [default = LEVELDB];
707 // DEPRECATED. See TransformationParameter. For data pre-processing, we can do
708 // simple scaling and subtracting the data mean, if provided. Note that the
709 // mean subtraction is always carried out before scaling.
710 optional float scale = 2 [default = 1];
711 optional string mean_file = 3;
712 // DEPRECATED. See TransformationParameter. Specify if we would like to randomly
713 // crop an image.
714 optional uint32 crop_size = 5 [default = 0];
715 // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror
716 // data.
717 optional bool mirror = 6 [default = false];
718 // Force the encoded image to have 3 color channels
719 optional bool force_encoded_color = 9 [default = false];
720 // Prefetch queue (Number of batches to prefetch to host memory, increase if
721 // data access bandwidth varies).
722 optional uint32 prefetch = 10 [default = 4];
723}
724
725message NonMaximumSuppressionParameter {
726 // Threshold to be used in nms.
727 optional float nms_threshold = 1 [default = 0.3];
728 // Maximum number of results to be kept.
729 optional int32 top_k = 2;
730 // Parameter for adaptive nms.
731 optional float eta = 3 [default = 1.0];
732}
733
734message SaveOutputParameter {
735 // Output directory. If not empty, we will save the results.
736 optional string output_directory = 1;
737 // Output name prefix.
738 optional string output_name_prefix = 2;
739 // Output format.
740 // VOC - PASCAL VOC output format.
741 // COCO - MS COCO output format.
742 optional string output_format = 3;
743 // If you want to output results, must also provide the following two files.
744 // Otherwise, we will ignore saving results.
745 // label map file.
746 optional string label_map_file = 4;
747 // A file which contains a list of names and sizes with same order
748 // of the input DB. The file is in the following format:
749 // name height width
750 // ...
751 optional string name_size_file = 5;
752 // Number of test images. It can be less than the lines specified in
753 // name_size_file. For example, when we only want to evaluate on part
754 // of the test images.
755 optional uint32 num_test_image = 6;
756 // The resize parameter used in saving the data.
757 optional ResizeParameter resize_param = 7;
758}
759
760// Message that store parameters used by DetectionOutputLayer
761message DetectionOutputParameter {
762 // Number of classes to be predicted. Required!
763 optional uint32 num_classes = 1;
764 // If true, bounding box are shared among different classes.
765 optional bool share_location = 2 [default = true];
766 // Background label id. If there is no background class,
767 // set it as -1.
768 optional int32 background_label_id = 3 [default = 0];
769 // Parameters used for non maximum suppression.
770 optional NonMaximumSuppressionParameter nms_param = 4;
771 // Parameters used for saving detection results.
772 optional SaveOutputParameter save_output_param = 5;
773 // Type of coding method for bbox.
774 optional PriorBoxParameter.CodeType code_type = 6 [default = CORNER];
775 // If true, variance is encoded in target; otherwise we need to adjust the
776 // predicted offset accordingly.
777 optional bool variance_encoded_in_target = 8 [default = false];
778 // Number of total bboxes to be kept per image after nms step.
779 // -1 means keeping all bboxes after nms step.
780 optional int32 keep_top_k = 7 [default = -1];
781 // Only consider detections whose confidences are larger than a threshold.
782 // If not provided, consider all boxes.
783 optional float confidence_threshold = 9;
784 // If true, visualize the detection results.
785 optional bool visualize = 10 [default = false];
786 // The threshold used to visualize the detection results.
787 optional float visualize_threshold = 11;
788 // If provided, save outputs to video file.
789 optional string save_file = 12;
790}
791
792message YoloDetectionOutputParameter {
793 // Yolo detection output layer
794 optional uint32 side = 1 [default = 13];
795 optional uint32 num_classes = 2 [default = 20];
796 optional uint32 num_box = 3 [default = 5];
797 optional uint32 coords = 4 [default = 4];
798 optional float confidence_threshold = 5 [default = 0.01];
799 optional float nms_threshold = 6 [default = 0.45];
800 repeated float biases = 7;
801 optional string label_map_file = 8;
802}
803message Yolov3DetectionOutputParameter {
804 // Yolov3 detection output layer
805 // Yolo detection output layer
806 optional uint32 num_classes = 1 [default = 20];
807 optional uint32 num_box = 2 [default = 3];
808 optional float confidence_threshold = 3 [default = 0.01];
809 optional float nms_threshold = 4 [default = 0.45];
810 repeated float biases = 5;
811 repeated uint32 anchors_scale = 6 ;
812 optional uint32 mask_group_num = 7 [default = 2];
813 repeated uint32 mask = 8;
814}
815message DropoutParameter {
816 optional float dropout_ratio = 1 [default = 0.5]; // dropout ratio
817 optional bool scale_train = 2 [default = true]; // scale train or test phase
818}
819
820// DummyDataLayer fills any number of arbitrarily shaped blobs with random
821// (or constant) data generated by "Fillers" (see "message FillerParameter").
822message DummyDataParameter {
823 // This layer produces N >= 1 top blobs. DummyDataParameter must specify 1 or N
824 // shape fields, and 0, 1 or N data_fillers.
825 //
826 // If 0 data_fillers are specified, ConstantFiller with a value of 0 is used.
827 // If 1 data_filler is specified, it is applied to all top blobs. If N are
828 // specified, the ith is applied to the ith top blob.
829 repeated FillerParameter data_filler = 1;
830 repeated BlobShape shape = 6;
831
832 // 4D dimensions -- deprecated. Use "shape" instead.
833 repeated uint32 num = 2;
834 repeated uint32 channels = 3;
835 repeated uint32 height = 4;
836 repeated uint32 width = 5;
837}
838
839message EltwiseParameter {
840 enum EltwiseOp {
841 PROD = 0;
842 SUM = 1;
843 MAX = 2;
844 }
845 optional EltwiseOp operation = 1 [default = SUM]; // element-wise operation
846 repeated float coeff = 2; // blob-wise coefficient for SUM operation
847
848 // Whether to use an asymptotically slower (for >2 inputs) but stabler method
849 // of computing the gradient for the PROD operation. (No effect for SUM op.)
850 optional bool stable_prod_grad = 3 [default = true];
851}
852
853// Message that stores parameters used by ELULayer
854message ELUParameter {
855 // Described in:
856 // Clevert, D.-A., Unterthiner, T., & Hochreiter, S. (2015). Fast and Accurate
857 // Deep Network Learning by Exponential Linear Units (ELUs). arXiv
858 optional float alpha = 1 [default = 1];
859}
860
861// Message that stores parameters used by EmbedLayer
862message EmbedParameter {
863 optional uint32 num_output = 1; // The number of outputs for the layer
864 // The input is given as integers to be interpreted as one-hot
865 // vector indices with dimension num_input. Hence num_input should be
866 // 1 greater than the maximum possible input value.
867 optional uint32 input_dim = 2;
868
869 optional bool bias_term = 3 [default = true]; // Whether to use a bias term
870 optional FillerParameter weight_filler = 4; // The filler for the weight
871 optional FillerParameter bias_filler = 5; // The filler for the bias
872
873}
874
875// Message that stores parameters used by ExpLayer
876message ExpParameter {
877 // ExpLayer computes outputs y = base ^ (shift + scale * x), for base > 0.
878 // Or if base is set to the default (-1), base is set to e,
879 // so y = exp(shift + scale * x).
880 optional float base = 1 [default = -1.0];
881 optional float scale = 2 [default = 1.0];
882 optional float shift = 3 [default = 0.0];
883}
884
885/// Message that stores parameters used by FlattenLayer
886message FlattenParameter {
887 // The first axis to flatten: all preceding axes are retained in the output.
888 // May be negative to index from the end (e.g., -1 for the last axis).
889 optional int32 axis = 1 [default = 1];
890
891 // The last axis to flatten: all following axes are retained in the output.
892 // May be negative to index from the end (e.g., the default -1 for the last
893 // axis).
894 optional int32 end_axis = 2 [default = -1];
895}
896
897// Message that stores parameters used by HDF5DataLayer
898message HDF5DataParameter {
899 // Specify the data source.
900 optional string source = 1;
901 // Specify the batch size.
902 optional uint32 batch_size = 2;
903
904 // Specify whether to shuffle the data.
905 // If shuffle == true, the ordering of the HDF5 files is shuffled,
906 // and the ordering of data within any given HDF5 file is shuffled,
907 // but data between different files are not interleaved; all of a file's
908 // data are output (in a random order) before moving onto another file.
909 optional bool shuffle = 3 [default = false];
910}
911
912message HDF5OutputParameter {
913 optional string file_name = 1;
914}
915
916message HingeLossParameter {
917 enum Norm {
918 L1 = 1;
919 L2 = 2;
920 }
921 // Specify the Norm to use L1 or L2
922 optional Norm norm = 1 [default = L1];
923}
924
925message ImageDataParameter {
926 // Specify the data source.
927 optional string source = 1;
928 // Specify the batch size.
929 optional uint32 batch_size = 4 [default = 1];
930 // The rand_skip variable is for the data layer to skip a few data points
931 // to avoid all asynchronous sgd clients to start at the same point. The skip
932 // point would be set as rand_skip * rand(0,1). Note that rand_skip should not
933 // be larger than the number of keys in the database.
934 optional uint32 rand_skip = 7 [default = 0];
935 // Whether or not ImageLayer should shuffle the list of files at every epoch.
936 optional bool shuffle = 8 [default = false];
937 // It will also resize images if new_height or new_width are not zero.
938 optional uint32 new_height = 9 [default = 0];
939 optional uint32 new_width = 10 [default = 0];
940 // Specify if the images are color or gray
941 optional bool is_color = 11 [default = true];
942 // DEPRECATED. See TransformationParameter. For data pre-processing, we can do
943 // simple scaling and subtracting the data mean, if provided. Note that the
944 // mean subtraction is always carried out before scaling.
945 optional float scale = 2 [default = 1];
946 optional string mean_file = 3;
947 // DEPRECATED. See TransformationParameter. Specify if we would like to randomly
948 // crop an image.
949 optional uint32 crop_size = 5 [default = 0];
950 // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror
951 // data.
952 optional bool mirror = 6 [default = false];
953 optional string root_folder = 12 [default = ""];
954}
955
956message InfogainLossParameter {
957 // Specify the infogain matrix source.
958 optional string source = 1;
959}
960
961message InnerProductParameter {
962 optional uint32 num_output = 1; // The number of outputs for the layer
963 optional bool bias_term = 2 [default = true]; // whether to have bias terms
964 optional FillerParameter weight_filler = 3; // The filler for the weight
965 optional FillerParameter bias_filler = 4; // The filler for the bias
966
967 // The first axis to be lumped into a single inner product computation;
968 // all preceding axes are retained in the output.
969 // May be negative to index from the end (e.g., -1 for the last axis).
970 optional int32 axis = 5 [default = 1];
971 // Specify whether to transpose the weight matrix or not.
972 // If transpose == true, any operations will be performed on the transpose
973 // of the weight matrix. The weight matrix itself is not going to be transposed
974 // but rather the transfer flag of operations will be toggled accordingly.
975 optional bool transpose = 6 [default = false];
976}
977
978message InputParameter {
979 // This layer produces N >= 1 top blob(s) to be assigned manually.
980 // Define N shapes to set a shape for each top.
981 // Define 1 shape to set the same shape for every top.
982 // Define no shape to defer to reshaping manually.
983 repeated BlobShape shape = 1;
984}
985message InterpParameter {
986 optional int32 height = 1 [default = 0]; // Height of output
987 optional int32 width = 2 [default = 0]; // Width of output
988 optional int32 zoom_factor = 3 [default = 1]; // zoom factor
989 optional int32 shrink_factor = 4 [default = 1]; // shrink factor
990 optional int32 pad_beg = 5 [default = 0]; // padding at begin of input
991 optional int32 pad_end = 6 [default = 0]; // padding at end of input
992}
993// Message that stores parameters used by LogLayer
994message LogParameter {
995 // LogLayer computes outputs y = log_base(shift + scale * x), for base > 0.
996 // Or if base is set to the default (-1), base is set to e,
997 // so y = ln(shift + scale * x) = log_e(shift + scale * x)
998 optional float base = 1 [default = -1.0];
999 optional float scale = 2 [default = 1.0];
1000 optional float shift = 3 [default = 0.0];
1001}
1002
1003// Message that stores parameters used by LRNLayer
1004message LRNParameter {
1005 optional uint32 local_size = 1 [default = 5];
1006 optional float alpha = 2 [default = 1.];
1007 optional float beta = 3 [default = 0.75];
1008 enum NormRegion {
1009 ACROSS_CHANNELS = 0;
1010 WITHIN_CHANNEL = 1;
1011 }
1012 optional NormRegion norm_region = 4 [default = ACROSS_CHANNELS];
1013 optional float k = 5 [default = 1.];
1014 enum Engine {
1015 DEFAULT = 0;
1016 CAFFE = 1;
1017 CUDNN = 2;
1018 }
1019 optional Engine engine = 6 [default = DEFAULT];
1020}
1021
1022message MemoryDataParameter {
1023 optional uint32 batch_size = 1;
1024 optional uint32 channels = 2;
1025 optional uint32 height = 3;
1026 optional uint32 width = 4;
1027}
1028
1029message MVNParameter {
1030 // This parameter can be set to false to normalize mean only
1031 optional bool normalize_variance = 1 [default = true];
1032
1033 // This parameter can be set to true to perform DNN-like MVN
1034 optional bool across_channels = 2 [default = false];
1035
1036 // Epsilon for not dividing by zero while normalizing variance
1037 optional float eps = 3 [default = 1e-9];
1038}
1039
1040// Message that stores parameters used by NormalizeLayer
1041message NormalizeParameter {
1042 optional bool across_spatial = 1 [default = true];
1043 // Initial value of scale. Default is 1.0 for all
1044 optional FillerParameter scale_filler = 2;
1045 // Whether or not scale parameters are shared across channels.
1046 optional bool channel_shared = 3 [default = true];
1047 // Epsilon for not dividing by zero while normalizing variance
1048 optional float eps = 4 [default = 1e-10];
1049}
1050
1051message PermuteParameter {
1052 // The new orders of the axes of data. Notice it should be with
1053 // in the same range as the input data, and it starts from 0.
1054 // Do not provide repeated order.
1055 repeated uint32 order = 1;
1056}
1057
1058message PoolingParameter {
1059 enum PoolMethod {
1060 MAX = 0;
1061 AVE = 1;
1062 STOCHASTIC = 2;
1063 }
1064 optional PoolMethod pool = 1 [default = MAX]; // The pooling method
1065 // Pad, kernel size, and stride are all given as a single value for equal
1066 // dimensions in height and width or as Y, X pairs.
1067 optional uint32 pad = 4 [default = 0]; // The padding size (equal in Y, X)
1068 optional uint32 pad_h = 9 [default = 0]; // The padding height
1069 optional uint32 pad_w = 10 [default = 0]; // The padding width
1070 optional uint32 kernel_size = 2; // The kernel size (square)
1071 optional uint32 kernel_h = 5; // The kernel height
1072 optional uint32 kernel_w = 6; // The kernel width
1073 optional uint32 stride = 3 [default = 1]; // The stride (equal in Y, X)
1074 optional uint32 stride_h = 7; // The stride height
1075 optional uint32 stride_w = 8; // The stride width
1076 enum Engine {
1077 DEFAULT = 0;
1078 CAFFE = 1;
1079 CUDNN = 2;
1080 }
1081 optional Engine engine = 11 [default = DEFAULT];
1082 // If global_pooling then it will pool over the size of the bottom by doing
1083 // kernel_h = bottom->height and kernel_w = bottom->width
1084 optional bool global_pooling = 12 [default = false];
1085}
1086
1087message PowerParameter {
1088 // PowerLayer computes outputs y = (shift + scale * x) ^ power.
1089 optional float power = 1 [default = 1.0];
1090 optional float scale = 2 [default = 1.0];
1091 optional float shift = 3 [default = 0.0];
1092}
1093
1094// Message that store parameters used by PriorBoxLayer
1095message PriorBoxParameter {
1096 // Encode/decode type.
1097 enum CodeType {
1098 CORNER = 1;
1099 CENTER_SIZE = 2;
1100 CORNER_SIZE = 3;
1101 }
1102 // Minimum box size (in pixels). Required!
1103 repeated float min_size = 1;
1104 // Maximum box size (in pixels). Required!
1105 repeated float max_size = 2;
1106 // Various of aspect ratios. Duplicate ratios will be ignored.
1107 // If none is provided, we use default ratio 1.
1108 repeated float aspect_ratio = 3;
1109 // If true, will flip each aspect ratio.
1110 // For example, if there is aspect ratio "r",
1111 // we will generate aspect ratio "1.0/r" as well.
1112 optional bool flip = 4 [default = true];
1113 // If true, will clip the prior so that it is within [0, 1]
1114 optional bool clip = 5 [default = false];
1115 // Variance for adjusting the prior bboxes.
1116 repeated float variance = 6;
1117 // By default, we calculate img_height, img_width, step_x, step_y based on
1118 // bottom[0] (feat) and bottom[1] (img). Unless these values are explicitly
1119 // provided.
1120 // Explicitly provide the img_size.
1121 optional uint32 img_size = 7;
1122 // Either img_size or img_h/img_w should be specified; not both.
1123 optional uint32 img_h = 8;
1124 optional uint32 img_w = 9;
1125
1126 // Explicitly provide the step size.
1127 optional float step = 10;
1128 // Either step or step_h/step_w should be specified; not both.
1129 optional float step_h = 11;
1130 optional float step_w = 12;
1131
1132 // Offset to the top left corner of each cell.
1133 optional float offset = 13 [default = 0.5];
1134}
1135
1136message PSROIPoolingParameter {
1137 required float spatial_scale = 1;
1138 required int32 output_dim = 2; // output channel number
1139 required int32 group_size = 3; // number of groups to encode position-sensitive score maps
1140}
1141
1142message PythonParameter {
1143 optional string module = 1;
1144 optional string layer = 2;
1145 // This value is set to the attribute `param_str` of the `PythonLayer` object
1146 // in Python before calling the `setup()` method. This could be a number,
1147 // string, dictionary in Python dict format, JSON, etc. You may parse this
1148 // string in `setup` method and use it in `forward` and `backward`.
1149 optional string param_str = 3 [default = ''];
1150 // Whether this PythonLayer is shared among worker solvers during data parallelism.
1151 // If true, each worker solver sequentially run forward from this layer.
1152 // This value should be set true if you are using it as a data layer.
1153 optional bool share_in_parallel = 4 [default = false];
1154}
1155
1156// Message that stores parameters used by RecurrentLayer
1157message RecurrentParameter {
1158 // The dimension of the output (and usually hidden state) representation --
1159 // must be explicitly set to non-zero.
1160 optional uint32 num_output = 1 [default = 0];
1161
1162 optional FillerParameter weight_filler = 2; // The filler for the weight
1163 optional FillerParameter bias_filler = 3; // The filler for the bias
1164
1165 // Whether to enable displaying debug_info in the unrolled recurrent net.
1166 optional bool debug_info = 4 [default = false];
1167
1168 // Whether to add as additional inputs (bottoms) the initial hidden state
1169 // blobs, and add as additional outputs (tops) the final timestep hidden state
1170 // blobs. The number of additional bottom/top blobs required depends on the
1171 // recurrent architecture -- e.g., 1 for RNNs, 2 for LSTMs.
1172 optional bool expose_hidden = 5 [default = false];
1173}
1174
1175// Message that stores parameters used by ReductionLayer
1176message ReductionParameter {
1177 enum ReductionOp {
1178 SUM = 1;
1179 ASUM = 2;
1180 SUMSQ = 3;
1181 MEAN = 4;
1182 }
1183
1184 optional ReductionOp operation = 1 [default = SUM]; // reduction operation
1185
1186 // The first axis to reduce to a scalar -- may be negative to index from the
1187 // end (e.g., -1 for the last axis).
1188 // (Currently, only reduction along ALL "tail" axes is supported; reduction
1189 // of axis M through N, where N < num_axes - 1, is unsupported.)
1190 // Suppose we have an n-axis bottom Blob with shape:
1191 // (d0, d1, d2, ..., d(m-1), dm, d(m+1), ..., d(n-1)).
1192 // If axis == m, the output Blob will have shape
1193 // (d0, d1, d2, ..., d(m-1)),
1194 // and the ReductionOp operation is performed (d0 * d1 * d2 * ... * d(m-1))
1195 // times, each including (dm * d(m+1) * ... * d(n-1)) individual data.
1196 // If axis == 0 (the default), the output Blob always has the empty shape
1197 // (count 1), performing reduction across the entire input --
1198 // often useful for creating new loss functions.
1199 optional int32 axis = 2 [default = 0];
1200
1201 optional float coeff = 3 [default = 1.0]; // coefficient for output
1202}
1203
1204// Message that stores parameters used by ReLULayer
1205message ReLUParameter {
1206 // Allow non-zero slope for negative inputs to speed up optimization
1207 // Described in:
1208 // Maas, A. L., Hannun, A. Y., & Ng, A. Y. (2013). Rectifier nonlinearities
1209 // improve neural network acoustic models. In ICML Workshop on Deep Learning
1210 // for Audio, Speech, and Language Processing.
1211 optional float negative_slope = 1 [default = 0];
1212 enum Engine {
1213 DEFAULT = 0;
1214 CAFFE = 1;
1215 CUDNN = 2;
1216 }
1217 optional Engine engine = 2 [default = DEFAULT];
1218}
1219
1220message ReorgParameter {
1221 optional uint32 stride = 1;
1222 optional bool reverse = 2 [default = false];
1223}
1224
1225message ReshapeParameter {
1226 // Specify the output dimensions. If some of the dimensions are set to 0,
1227 // the corresponding dimension from the bottom layer is used (unchanged).
1228 // Exactly one dimension may be set to -1, in which case its value is
1229 // inferred from the count of the bottom blob and the remaining dimensions.
1230 // For example, suppose we want to reshape a 2D blob "input" with shape 2 x 8:
1231 //
1232 // layer {
1233 // type: "Reshape" bottom: "input" top: "output"
1234 // reshape_param { ... }
1235 // }
1236 //
1237 // If "input" is 2D with shape 2 x 8, then the following reshape_param
1238 // specifications are all equivalent, producing a 3D blob "output" with shape
1239 // 2 x 2 x 4:
1240 //
1241 // reshape_param { shape { dim: 2 dim: 2 dim: 4 } }
1242 // reshape_param { shape { dim: 0 dim: 2 dim: 4 } }
1243 // reshape_param { shape { dim: 0 dim: 2 dim: -1 } }
1244 // reshape_param { shape { dim: -1 dim: 0 dim: 2 } }
1245 //
1246 optional BlobShape shape = 1;
1247
1248 // axis and num_axes control the portion of the bottom blob's shape that are
1249 // replaced by (included in) the reshape. By default (axis == 0 and
1250 // num_axes == -1), the entire bottom blob shape is included in the reshape,
1251 // and hence the shape field must specify the entire output shape.
1252 //
1253 // axis may be non-zero to retain some portion of the beginning of the input
1254 // shape (and may be negative to index from the end; e.g., -1 to begin the
1255 // reshape after the last axis, including nothing in the reshape,
1256 // -2 to include only the last axis, etc.).
1257 //
1258 // For example, suppose "input" is a 2D blob with shape 2 x 8.
1259 // Then the following ReshapeLayer specifications are all equivalent,
1260 // producing a blob "output" with shape 2 x 2 x 4:
1261 //
1262 // reshape_param { shape { dim: 2 dim: 2 dim: 4 } }
1263 // reshape_param { shape { dim: 2 dim: 4 } axis: 1 }
1264 // reshape_param { shape { dim: 2 dim: 4 } axis: -3 }
1265 //
1266 // num_axes specifies the extent of the reshape.
1267 // If num_axes >= 0 (and axis >= 0), the reshape will be performed only on
1268 // input axes in the range [axis, axis+num_axes].
1269 // num_axes may also be -1, the default, to include all remaining axes
1270 // (starting from axis).
1271 //
1272 // For example, suppose "input" is a 2D blob with shape 2 x 8.
1273 // Then the following ReshapeLayer specifications are equivalent,
1274 // producing a blob "output" with shape 1 x 2 x 8.
1275 //
1276 // reshape_param { shape { dim: 1 dim: 2 dim: 8 } }
1277 // reshape_param { shape { dim: 1 dim: 2 } num_axes: 1 }
1278 // reshape_param { shape { dim: 1 } num_axes: 0 }
1279 //
1280 // On the other hand, these would produce output blob shape 2 x 1 x 8:
1281 //
1282 // reshape_param { shape { dim: 2 dim: 1 dim: 8 } }
1283 // reshape_param { shape { dim: 1 } axis: 1 num_axes: 0 }
1284 //
1285 optional int32 axis = 2 [default = 0];
1286 optional int32 num_axes = 3 [default = -1];
1287}
1288
1289message ROIAlignParameter {
1290 // Pad, kernel size, and stride are all given as a single value for equal
1291 // dimensions in height and width or as Y, X pairs.
1292 optional uint32 pooled_h = 1 [default = 0]; // The pooled output height
1293 optional uint32 pooled_w = 2 [default = 0]; // The pooled output width
1294 // Multiplicative spatial scale factor to translate ROI coords from their
1295 // input scale to the scale used when pooling
1296 optional float spatial_scale = 3 [default = 1];
1297}
1298
1299// Message that stores parameters used by ROIPoolingLayer
1300message ROIPoolingParameter {
1301 // Pad, kernel size, and stride are all given as a single value for equal
1302 // dimensions in height and width or as Y, X pairs.
1303 optional uint32 pooled_h = 1 [default = 0]; // The pooled output height
1304 optional uint32 pooled_w = 2 [default = 0]; // The pooled output width
1305 // Multiplicative spatial scale factor to translate ROI coords from their
1306 // input scale to the scale used when pooling
1307 optional float spatial_scale = 3 [default = 1];
1308}
1309
1310message ScaleParameter {
1311 // The first axis of bottom[0] (the first input Blob) along which to apply
1312 // bottom[1] (the second input Blob). May be negative to index from the end
1313 // (e.g., -1 for the last axis).
1314 //
1315 // For example, if bottom[0] is 4D with shape 100x3x40x60, the output
1316 // top[0] will have the same shape, and bottom[1] may have any of the
1317 // following shapes (for the given value of axis):
1318 // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60
1319 // (axis == 1 == -3) 3; 3x40; 3x40x60
1320 // (axis == 2 == -2) 40; 40x60
1321 // (axis == 3 == -1) 60
1322 // Furthermore, bottom[1] may have the empty shape (regardless of the value of
1323 // "axis") -- a scalar multiplier.
1324 optional int32 axis = 1 [default = 1];
1325
1326 // (num_axes is ignored unless just one bottom is given and the scale is
1327 // a learned parameter of the layer. Otherwise, num_axes is determined by the
1328 // number of axes by the second bottom.)
1329 // The number of axes of the input (bottom[0]) covered by the scale
1330 // parameter, or -1 to cover all axes of bottom[0] starting from `axis`.
1331 // Set num_axes := 0, to multiply with a zero-axis Blob: a scalar.
1332 optional int32 num_axes = 2 [default = 1];
1333
1334 // (filler is ignored unless just one bottom is given and the scale is
1335 // a learned parameter of the layer.)
1336 // The initialization for the learned scale parameter.
1337 // Default is the unit (1) initialization, resulting in the ScaleLayer
1338 // initially performing the identity operation.
1339 optional FillerParameter filler = 3;
1340
1341 // Whether to also learn a bias (equivalent to a ScaleLayer+BiasLayer, but
1342 // may be more efficient). Initialized with bias_filler (defaults to 0).
1343 optional bool bias_term = 4 [default = false];
1344 optional FillerParameter bias_filler = 5;
1345}
1346
1347message ShuffleChannelParameter {
1348 // first introduced by
1349 // "ShuffleNet: An Extremely Efficient Convolutional Neural Network
1350 // for Mobile Devices"
1351 optional uint32 group = 1[default = 1]; // The number of group
1352}
1353
1354message SigmoidParameter {
1355 enum Engine {
1356 DEFAULT = 0;
1357 CAFFE = 1;
1358 CUDNN = 2;
1359 }
1360 optional Engine engine = 1 [default = DEFAULT];
1361}
1362
1363message SmoothL1LossParameter {
1364 // SmoothL1Loss(x) =
1365 // 0.5 * (sigma * x) ** 2 -- if x < 1.0 / sigma / sigma
1366 // |x| - 0.5 / sigma / sigma -- otherwise
1367 optional float sigma = 1 [default = 1];
1368}
1369
1370message SliceParameter {
1371 // The axis along which to slice -- may be negative to index from the end
1372 // (e.g., -1 for the last axis).
1373 // By default, SliceLayer concatenates blobs along the "channels" axis (1).
1374 optional int32 axis = 3 [default = 1];
1375 repeated uint32 slice_point = 2;
1376
1377 // DEPRECATED: alias for "axis" -- does not support negative indexing.
1378 optional uint32 slice_dim = 1 [default = 1];
1379}
1380
1381// Message that stores parameters used by SoftmaxLayer, SoftmaxWithLossLayer
1382message SoftmaxParameter {
1383 enum Engine {
1384 DEFAULT = 0;
1385 CAFFE = 1;
1386 CUDNN = 2;
1387 }
1388 optional Engine engine = 1 [default = DEFAULT];
1389
1390 // The axis along which to perform the softmax -- may be negative to index
1391 // from the end (e.g., -1 for the last axis).
1392 // Any other axes will be evaluated as independent softmaxes.
1393 optional int32 axis = 2 [default = 1];
1394}
1395
1396message TanHParameter {
1397 enum Engine {
1398 DEFAULT = 0;
1399 CAFFE = 1;
1400 CUDNN = 2;
1401 }
1402 optional Engine engine = 1 [default = DEFAULT];
1403}
1404
1405// Message that stores parameters used by TileLayer
1406message TileParameter {
1407 // The index of the axis to tile.
1408 optional int32 axis = 1 [default = 1];
1409
1410 // The number of copies (tiles) of the blob to output.
1411 optional int32 tiles = 2;
1412}
1413
1414// Message that stores parameters used by ThresholdLayer
1415message ThresholdParameter {
1416 optional float threshold = 1 [default = 0]; // Strictly positive values
1417}
1418
1419message WindowDataParameter {
1420 // Specify the data source.
1421 optional string source = 1;
1422 // For data pre-processing, we can do simple scaling and subtracting the
1423 // data mean, if provided. Note that the mean subtraction is always carried
1424 // out before scaling.
1425 optional float scale = 2 [default = 1];
1426 optional string mean_file = 3;
1427 // Specify the batch size.
1428 optional uint32 batch_size = 4;
1429 // Specify if we would like to randomly crop an image.
1430 optional uint32 crop_size = 5 [default = 0];
1431 // Specify if we want to randomly mirror data.
1432 optional bool mirror = 6 [default = false];
1433 // Foreground (object) overlap threshold
1434 optional float fg_threshold = 7 [default = 0.5];
1435 // Background (non-object) overlap threshold
1436 optional float bg_threshold = 8 [default = 0.5];
1437 // Fraction of batch that should be foreground objects
1438 optional float fg_fraction = 9 [default = 0.25];
1439 // Amount of contextual padding to add around a window
1440 // (used only by the window_data_layer)
1441 optional uint32 context_pad = 10 [default = 0];
1442 // Mode for cropping out a detection window
1443 // warp: cropped window is warped to a fixed size and aspect ratio
1444 // square: the tightest square around the window is cropped
1445 optional string crop_mode = 11 [default = "warp"];
1446 // cache_images: will load all images in memory for faster access
1447 optional bool cache_images = 12 [default = false];
1448 // append root_folder to locate images
1449 optional string root_folder = 13 [default = ""];
1450}
1451
1452message SPPParameter {
1453 enum PoolMethod {
1454 MAX = 0;
1455 AVE = 1;
1456 STOCHASTIC = 2;
1457 }
1458 optional uint32 pyramid_height = 1;
1459 optional PoolMethod pool = 2 [default = MAX]; // The pooling method
1460 enum Engine {
1461 DEFAULT = 0;
1462 CAFFE = 1;
1463 CUDNN = 2;
1464 }
1465 optional Engine engine = 6 [default = DEFAULT];
1466}
1467
1468// DEPRECATED: use LayerParameter.
1469message V1LayerParameter {
1470 repeated string bottom = 2;
1471 repeated string top = 3;
1472 optional string name = 4;
1473 repeated NetStateRule include = 32;
1474 repeated NetStateRule exclude = 33;
1475 enum LayerType {
1476 NONE = 0;
1477 ABSVAL = 35;
1478 ACCURACY = 1;
1479 ARGMAX = 30;
1480 BNLL = 2;
1481 CONCAT = 3;
1482 CONTRASTIVE_LOSS = 37;
1483 CONVOLUTION = 4;
1484 DATA = 5;
1485 DECONVOLUTION = 39;
1486 DROPOUT = 6;
1487 DUMMY_DATA = 32;
1488 EUCLIDEAN_LOSS = 7;
1489 ELTWISE = 25;
1490 EXP = 38;
1491 FLATTEN = 8;
1492 HDF5_DATA = 9;
1493 HDF5_OUTPUT = 10;
1494 HINGE_LOSS = 28;
1495 IM2COL = 11;
1496 IMAGE_DATA = 12;
1497 INFOGAIN_LOSS = 13;
1498 INNER_PRODUCT = 14;
1499 LRN = 15;
1500 MEMORY_DATA = 29;
1501 MULTINOMIAL_LOGISTIC_LOSS = 16;
1502 MVN = 34;
1503 POOLING = 17;
1504 POWER = 26;
1505 RELU = 18;
1506 SIGMOID = 19;
1507 SIGMOID_CROSS_ENTROPY_LOSS = 27;
1508 SILENCE = 36;
1509 SOFTMAX = 20;
1510 SOFTMAX_LOSS = 21;
1511 SPLIT = 22;
1512 SLICE = 33;
1513 TANH = 23;
1514 WINDOW_DATA = 24;
1515 THRESHOLD = 31;
1516 }
1517 optional LayerType type = 5;
1518 repeated BlobProto blobs = 6;
1519 repeated string param = 1001;
1520 repeated DimCheckMode blob_share_mode = 1002;
1521 enum DimCheckMode {
1522 STRICT = 0;
1523 PERMISSIVE = 1;
1524 }
1525 repeated float blobs_lr = 7;
1526 repeated float weight_decay = 8;
1527 repeated float loss_weight = 35;
1528 optional AccuracyParameter accuracy_param = 27;
1529 optional ArgMaxParameter argmax_param = 23;
1530 optional ConcatParameter concat_param = 9;
1531 optional ContrastiveLossParameter contrastive_loss_param = 40;
1532 optional ConvolutionParameter convolution_param = 10;
1533 optional DataParameter data_param = 11;
1534 optional DropoutParameter dropout_param = 12;
1535 optional DummyDataParameter dummy_data_param = 26;
1536 optional EltwiseParameter eltwise_param = 24;
1537 optional ExpParameter exp_param = 41;
1538 optional HDF5DataParameter hdf5_data_param = 13;
1539 optional HDF5OutputParameter hdf5_output_param = 14;
1540 optional HingeLossParameter hinge_loss_param = 29;
1541 optional ImageDataParameter image_data_param = 15;
1542 optional InfogainLossParameter infogain_loss_param = 16;
1543 optional InnerProductParameter inner_product_param = 17;
1544 optional LRNParameter lrn_param = 18;
1545 optional MemoryDataParameter memory_data_param = 22;
1546 optional MVNParameter mvn_param = 34;
1547 optional PoolingParameter pooling_param = 19;
1548 optional PowerParameter power_param = 21;
1549 optional ReLUParameter relu_param = 30;
1550 optional SigmoidParameter sigmoid_param = 38;
1551 optional SoftmaxParameter softmax_param = 39;
1552 optional SliceParameter slice_param = 31;
1553 optional TanHParameter tanh_param = 37;
1554 optional ThresholdParameter threshold_param = 25;
1555 optional WindowDataParameter window_data_param = 20;
1556 optional TransformationParameter transform_param = 36;
1557 optional LossParameter loss_param = 42;
1558 optional V0LayerParameter layer = 1;
1559}
1560
1561// DEPRECATED: V0LayerParameter is the old way of specifying layer parameters
1562// in Caffe. We keep this message type around for legacy support.
1563message V0LayerParameter {
1564 optional string name = 1; // the layer name
1565 optional string type = 2; // the string to specify the layer type
1566
1567 // Parameters to specify layers with inner products.
1568 optional uint32 num_output = 3; // The number of outputs for the layer
1569 optional bool biasterm = 4 [default = true]; // whether to have bias terms
1570 optional FillerParameter weight_filler = 5; // The filler for the weight
1571 optional FillerParameter bias_filler = 6; // The filler for the bias
1572
1573 optional uint32 pad = 7 [default = 0]; // The padding size
1574 optional uint32 kernelsize = 8; // The kernel size
1575 optional uint32 group = 9 [default = 1]; // The group size for group conv
1576 optional uint32 stride = 10 [default = 1]; // The stride
1577 enum PoolMethod {
1578 MAX = 0;
1579 AVE = 1;
1580 STOCHASTIC = 2;
1581 }
1582 optional PoolMethod pool = 11 [default = MAX]; // The pooling method
1583 optional float dropout_ratio = 12 [default = 0.5]; // dropout ratio
1584
1585 optional uint32 local_size = 13 [default = 5]; // for local response norm
1586 optional float alpha = 14 [default = 1.]; // for local response norm
1587 optional float beta = 15 [default = 0.75]; // for local response norm
1588 optional float k = 22 [default = 1.];
1589
1590 // For data layers, specify the data source
1591 optional string source = 16;
1592 // For data pre-processing, we can do simple scaling and subtracting the
1593 // data mean, if provided. Note that the mean subtraction is always carried
1594 // out before scaling.
1595 optional float scale = 17 [default = 1];
1596 optional string meanfile = 18;
1597 // For data layers, specify the batch size.
1598 optional uint32 batchsize = 19;
1599 // For data layers, specify if we would like to randomly crop an image.
1600 optional uint32 cropsize = 20 [default = 0];
1601 // For data layers, specify if we want to randomly mirror data.
1602 optional bool mirror = 21 [default = false];
1603
1604 // The blobs containing the numeric parameters of the layer
1605 repeated BlobProto blobs = 50;
1606 // The ratio that is multiplied on the global learning rate. If you want to
1607 // set the learning ratio for one blob, you need to set it for all blobs.
1608 repeated float blobs_lr = 51;
1609 // The weight decay that is multiplied on the global weight decay.
1610 repeated float weight_decay = 52;
1611
1612 // The rand_skip variable is for the data layer to skip a few data points
1613 // to avoid all asynchronous sgd clients to start at the same point. The skip
1614 // point would be set as rand_skip * rand(0,1). Note that rand_skip should not
1615 // be larger than the number of keys in the database.
1616 optional uint32 rand_skip = 53 [default = 0];
1617
1618 // Fields related to detection (det_*)
1619 // foreground (object) overlap threshold
1620 optional float det_fg_threshold = 54 [default = 0.5];
1621 // background (non-object) overlap threshold
1622 optional float det_bg_threshold = 55 [default = 0.5];
1623 // Fraction of batch that should be foreground objects
1624 optional float det_fg_fraction = 56 [default = 0.25];
1625
1626 // optional bool OBSOLETE_can_clobber = 57 [default = true];
1627
1628 // Amount of contextual padding to add around a window
1629 // (used only by the window_data_layer)
1630 optional uint32 det_context_pad = 58 [default = 0];
1631
1632 // Mode for cropping out a detection window
1633 // warp: cropped window is warped to a fixed size and aspect ratio
1634 // square: the tightest square around the window is cropped
1635 optional string det_crop_mode = 59 [default = "warp"];
1636
1637 // For ReshapeLayer, one needs to specify the new dimensions.
1638 optional int32 new_num = 60 [default = 0];
1639 optional int32 new_channels = 61 [default = 0];
1640 optional int32 new_height = 62 [default = 0];
1641 optional int32 new_width = 63 [default = 0];
1642
1643 // Whether or not ImageLayer should shuffle the list of files at every epoch.
1644 // It will also resize images if new_height or new_width are not zero.
1645 optional bool shuffle_images = 64 [default = false];
1646
1647 // For ConcatLayer, one needs to specify the dimension for concatenation, and
1648 // the other dimensions must be the same for all the bottom blobs.
1649 // By default it will concatenate blobs along the channels dimension.
1650 optional uint32 concat_dim = 65 [default = 1];
1651
1652 optional HDF5OutputParameter hdf5_output_param = 1001;
1653}
1654
1655message PReLUParameter {
1656 // Parametric ReLU described in K. He et al, Delving Deep into Rectifiers:
1657 // Surpassing Human-Level Performance on ImageNet Classification, 2015.
1658
1659 // Initial value of a_i. Default is a_i=0.25 for all i.
1660 optional FillerParameter filler = 1;
1661 // Whether or not slope parameters are shared across channels.
1662 optional bool channel_shared = 2 [default = false];
1663}