1 // Copyright 2013 Yangqing Jia
3 package caffe;
5 message BlobProto {
6 optional int32 num = 1 [default = 0];
7 optional int32 channels = 2 [default = 0];
8 optional int32 height = 3 [default = 0];
9 optional int32 width = 4 [default = 0];
10 repeated float data = 5 [packed=true];
11 repeated float diff = 6 [packed=true];
12 }
14 message Datum {
15 optional int32 channels = 1;
16 optional int32 height = 2;
17 optional int32 width = 3;
18 // the actual image data, in bytes
19 optional bytes data = 4;
20 optional int32 label = 5;
21 // Optionally, the datum could also hold float data.
22 repeated float float_data = 6;
23 }
25 message FillerParameter {
26 // The filler type.
27 optional string type = 1 [default = 'constant'];
28 optional float value = 2 [default = 0]; // the value in constant filler
29 optional float min = 3 [default = 0]; // the min value in uniform filler
30 optional float max = 4 [default = 1]; // the max value in uniform filler
31 optional float mean = 5 [default = 0]; // the mean value in gaussian filler
32 optional float std = 6 [default = 1]; // the std value in gaussian filler
33 }
35 message LayerParameter {
36 optional string name = 1; // the layer name
37 optional string type = 2; // the string to specify the layer type
39 // Parameters to specify layers with inner products.
40 optional uint32 num_output = 3; // The number of outputs for the layer
41 optional bool biasterm = 4 [default = true]; // whether to have bias terms
42 optional FillerParameter weight_filler = 5; // The filler for the weight
43 optional FillerParameter bias_filler = 6; // The filler for the bias
45 optional uint32 pad = 7 [default = 0]; // The padding size
46 optional uint32 kernelsize = 8; // The kernel size
47 optional uint32 group = 9 [default = 1]; // The group size for group conv
48 optional uint32 stride = 10 [default = 1]; // The stride
49 enum PoolMethod {
50 MAX = 0;
51 AVE = 1;
52 }
53 optional PoolMethod pool = 11 [default = MAX]; // The pooling method
54 optional float dropout_ratio = 12 [default = 0.5]; // dropout ratio
56 optional uint32 local_size = 13 [default = 5]; // for local response norm
57 optional float alpha = 14 [default = 1.]; // for local response norm
58 optional float beta = 15 [default = 0.75]; // for local response norm
60 // For data layers, specify the data source
61 optional string source = 16;
62 // For data pre-processing, we can do simple scaling and subtracting the
63 // data mean, if provided. Note that the mean subtraction is always carried
64 // out before scaling.
65 optional float scale = 17 [ default = 1 ];
66 optional string meanfile = 18;
67 // For data layers, specify the batch size.
68 optional uint32 batchsize = 19;
69 // For data layers, specify if we would like to randomly crop an image.
70 optional uint32 cropsize = 20 [default = 0];
71 // For data layers, specify if we want to randomly mirror data.
72 optional bool mirror = 21 [default = false];
74 // The blobs containing the numeric parameters of the layer
75 repeated BlobProto blobs = 50;
76 // The ratio that is multiplied on the global learning rate. If you want to set
77 // the learning ratio for one blob, you need to set it for all blobs.
78 repeated float blobs_lr = 51;
79 // The weight decay that is multiplied on the global weight decay.
80 repeated float weight_decay = 52;
81 }
83 message LayerConnection {
84 optional LayerParameter layer = 1; // the layer parameter
85 repeated string bottom = 2; // the name of the bottom blobs
86 repeated string top = 3; // the name of the top blobs
87 }
89 message NetParameter {
90 optional string name = 1; // consider giving the network a name
91 repeated LayerConnection layers = 2; // a bunch of layers.
92 repeated string input = 3; // The input to the network
93 }
95 message SolverParameter {
96 optional float base_lr = 1; // The base learning rate
97 // the number of iterations between displaying info. If display = 0, no info
98 // will be displayed.
99 optional int32 display = 2;
100 optional int32 max_iter = 3; // the maximum number of iterations
101 optional int32 snapshot = 4 [default = 0]; // The snapshot interval
102 optional string lr_policy = 5; // The learning rate decay policy.
103 optional float min_lr = 6 [default = 0]; // The mininum learning rate
104 optional float max_lr = 7 [default = 1e10]; // The maximum learning rate
105 optional float gamma = 8; // The parameter to compute the learning rate.
106 optional float power = 9; // The parameter to compute the learning rate.
107 optional float momentum = 10; // The momentum value.
108 optional float weight_decay = 11; // The weight decay.
109 optional float stepsize = 12; // the stepsize for learning rate policy "step"
111 optional string snapshot_prefix = 13; // The prefix for the snapshot.
112 // whether to snapshot diff in the results or not. Snapshotting diff will help
113 // debugging but the final protocol buffer size will be much larger.
114 optional bool snapshot_diff = 14 [ default = false];
115 // Adagrad solver parameters
116 // For Adagrad, we will first run normal sgd using the sgd parameters above
117 // for adagrad_skip iterations, and then kick in the adagrad algorithm, with
118 // the learning rate being adagrad_gamma * adagrad_skip. Note that the adagrad
119 // algorithm will NOT use the learning rate multiplier that is specified in
120 // the layer parameter specifications, as it will adjust the learning rate
121 // of individual parameters in a data-dependent way.
122 // WORK IN PROGRESS: not actually implemented yet.
123 optional float adagrad_gamma = 15; // adagrad learning rate multiplier
124 optional float adagrad_skip = 16; // the steps to skip before adagrad kicks in
125 }
127 // A message that stores the solver snapshots
128 message SolverState {
129 optional int32 iter = 1; // The current iteration
130 optional string learned_net = 2; // The file that stores the learned net.
131 repeated BlobProto history = 3; // The history for sgd solvers
132 }