Advertisement
Guest User

Caffe.proto

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