caffe 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ #include "net.hpp"
2
+ #include "common.hpp"
3
+ #include "blob.hpp"
4
+ #include "util.hpp"
5
+ #include <rice/Data_Type.hpp>
6
+ #include <rice/Constructor.hpp>
7
+ #include <rice/Module.hpp>
8
+ #include <rice/String.hpp>
9
+ #include <rice/Array.hpp>
10
+
11
+ using namespace Rice;
12
+
13
+ static Array getInputs(Object self) {
14
+ Net *net = from_ruby<Net *>(self);
15
+ const std::vector<Blob *> &vec = net -> input_blobs();
16
+ return mapArray(vec.begin(), vec.end(), objectNoGC<Blob>);
17
+ }
18
+
19
+ static Array getOutputs(Object self) {
20
+ Net *net = from_ruby<Net *>(self);
21
+ const std::vector<Blob *> &vec = net -> output_blobs();
22
+ return mapArray(vec.begin(), vec.end(), objectNoGC<Blob>);
23
+ }
24
+
25
+ static Object getBlobByName(Object self, String name) {
26
+ Net *net = from_ruby<Net *>(self);
27
+ Blob *blob = net -> blob_by_name(from_ruby<std::string>(name)).get();
28
+
29
+ if (blob) {
30
+ return objectNoGC(blob);
31
+ } else {
32
+ return Qnil;
33
+ }
34
+ }
35
+
36
+ static Object forward(Object self) {
37
+ Net *net = from_ruby<Net *>(self);
38
+ float loss = .0;
39
+ net -> Forward(NULL);
40
+ return to_ruby(loss);
41
+ }
42
+
43
+ void Init_net() {
44
+ Module rb_mCaffe = define_module("Caffe");
45
+
46
+ Data_Type<Net> rb_cNet = rb_mCaffe
47
+ .define_class<Net>("Net")
48
+ .define_constructor(Constructor<Net, std::string, caffe::Phase>())
49
+ .define_method("inputs", &getInputs)
50
+ .define_method("outputs", &getOutputs)
51
+ .define_method("blob", &getBlobByName)
52
+ .define_method("reshape!", &Net::Reshape)
53
+ .define_method("load_trained!", &Net::CopyTrainedLayersFromBinaryProto)
54
+ .define_method("forward!", &forward);
55
+ }
@@ -0,0 +1,10 @@
1
+ #ifndef __NET
2
+ #define __NET
3
+
4
+ #include <caffe/caffe.hpp>
5
+
6
+ typedef caffe::Net<float> Net;
7
+
8
+ void Init_net(void);
9
+
10
+ #endif
@@ -0,0 +1,39 @@
1
+ #ifndef __UTIL
2
+ #define __UTIL
3
+
4
+ #include <rice/Data_Type.hpp>
5
+ #include <rice/Array.hpp>
6
+ #include <vector>
7
+
8
+ template<typename T>
9
+ struct EmptyFreeFunction {
10
+ static void free(T *obj) {}
11
+ };
12
+
13
+ template<typename T>
14
+ Rice::Data_Object<T> objectNoGC(T *obj) {
15
+ return Rice::Data_Object<T>(obj, Rice::Data_Type<T>::klass(),
16
+ Rice::Default_Mark_Function<T>::mark,
17
+ EmptyFreeFunction<T>::free);
18
+ }
19
+
20
+ template<typename Iter, typename Func>
21
+ Rice::Array mapArray(Iter begin, Iter end, Func func) {
22
+ Rice::Array ret;
23
+ for (; begin != end; ++begin) {
24
+ ret.push(to_ruby(func(*begin)));
25
+ }
26
+ return ret;
27
+ }
28
+
29
+ template<typename T>
30
+ std::vector<T> arrayToVector(Rice::Array arr) {
31
+ int n = arr.size();
32
+ std::vector<T> ret(n);
33
+ for (int i = 0; i < n; ++i) {
34
+ ret[i] = from_ruby<T>(arr[i]);
35
+ }
36
+ return ret;
37
+ }
38
+
39
+ #endif
@@ -0,0 +1,5 @@
1
+ require 'caffe/version'
2
+ require 'caffe/caffe.pb'
3
+ require 'caffe/caffe'
4
+ require 'caffe/common'
5
+ require 'caffe/blob'
@@ -0,0 +1,35 @@
1
+ module Caffe
2
+ # Wrapper class for caffe::Blob<float>
3
+ class Blob
4
+ # Proxy class to access caffe::Blob<float> like Array / Enumerable
5
+ class Cursor
6
+ include Enumerable
7
+
8
+ alias count size
9
+ end
10
+
11
+ def [](index)
12
+ data[index]
13
+ end
14
+
15
+ def []=(index, x)
16
+ data[index] = x
17
+ end
18
+
19
+ def size
20
+ data.size
21
+ end
22
+
23
+ def copy_from!(x)
24
+ data.copy_from! x
25
+ end
26
+
27
+ def each(&blk)
28
+ data.each(&blk)
29
+ end
30
+
31
+ include Enumerable
32
+
33
+ alias count size
34
+ end
35
+ end
@@ -0,0 +1,902 @@
1
+ # encoding: utf-8
2
+
3
+ ##
4
+ # This file is auto-generated. DO NOT EDIT!
5
+ #
6
+ require 'protobuf/message'
7
+
8
+ module Caffe
9
+
10
+ ##
11
+ # Enum Classes
12
+ #
13
+ class Phase < ::Protobuf::Enum
14
+ define :TRAIN, 0
15
+ define :TEST, 1
16
+ end
17
+
18
+
19
+ ##
20
+ # Message Classes
21
+ #
22
+ class BlobShape < ::Protobuf::Message; end
23
+ class BlobProto < ::Protobuf::Message; end
24
+ class BlobProtoVector < ::Protobuf::Message; end
25
+ class Datum < ::Protobuf::Message; end
26
+ class FillerParameter < ::Protobuf::Message
27
+ class VarianceNorm < ::Protobuf::Enum
28
+ define :FAN_IN, 0
29
+ define :FAN_OUT, 1
30
+ define :AVERAGE, 2
31
+ end
32
+
33
+ end
34
+
35
+ class NetParameter < ::Protobuf::Message; end
36
+ class SolverParameter < ::Protobuf::Message
37
+ class SnapshotFormat < ::Protobuf::Enum
38
+ define :HDF5, 0
39
+ define :BINARYPROTO, 1
40
+ end
41
+
42
+ class SolverMode < ::Protobuf::Enum
43
+ define :CPU, 0
44
+ define :GPU, 1
45
+ end
46
+
47
+ class SolverType < ::Protobuf::Enum
48
+ define :SGD, 0
49
+ define :NESTEROV, 1
50
+ define :ADAGRAD, 2
51
+ define :RMSPROP, 3
52
+ define :ADADELTA, 4
53
+ define :ADAM, 5
54
+ end
55
+
56
+ end
57
+
58
+ class SolverState < ::Protobuf::Message; end
59
+ class NetState < ::Protobuf::Message; end
60
+ class NetStateRule < ::Protobuf::Message; end
61
+ class ParamSpec < ::Protobuf::Message
62
+ class DimCheckMode < ::Protobuf::Enum
63
+ define :STRICT, 0
64
+ define :PERMISSIVE, 1
65
+ end
66
+
67
+ end
68
+
69
+ class LayerParameter < ::Protobuf::Message; end
70
+ class TransformationParameter < ::Protobuf::Message; end
71
+ class LossParameter < ::Protobuf::Message
72
+ class NormalizationMode < ::Protobuf::Enum
73
+ define :FULL, 0
74
+ define :VALID, 1
75
+ define :BATCH_SIZE, 2
76
+ define :NONE, 3
77
+ end
78
+
79
+ end
80
+
81
+ class AccuracyParameter < ::Protobuf::Message; end
82
+ class ArgMaxParameter < ::Protobuf::Message; end
83
+ class ConcatParameter < ::Protobuf::Message; end
84
+ class BatchNormParameter < ::Protobuf::Message; end
85
+ class BiasParameter < ::Protobuf::Message; end
86
+ class ContrastiveLossParameter < ::Protobuf::Message; end
87
+ class ConvolutionParameter < ::Protobuf::Message
88
+ class Engine < ::Protobuf::Enum
89
+ define :DEFAULT, 0
90
+ define :CAFFE, 1
91
+ define :CUDNN, 2
92
+ end
93
+
94
+ end
95
+
96
+ class CropParameter < ::Protobuf::Message; end
97
+ class DataParameter < ::Protobuf::Message
98
+ class DB < ::Protobuf::Enum
99
+ define :LEVELDB, 0
100
+ define :LMDB, 1
101
+ end
102
+
103
+ end
104
+
105
+ class DropoutParameter < ::Protobuf::Message; end
106
+ class DummyDataParameter < ::Protobuf::Message; end
107
+ class EltwiseParameter < ::Protobuf::Message
108
+ class EltwiseOp < ::Protobuf::Enum
109
+ define :PROD, 0
110
+ define :SUM, 1
111
+ define :MAX, 2
112
+ end
113
+
114
+ end
115
+
116
+ class ELUParameter < ::Protobuf::Message; end
117
+ class EmbedParameter < ::Protobuf::Message; end
118
+ class ExpParameter < ::Protobuf::Message; end
119
+ class FlattenParameter < ::Protobuf::Message; end
120
+ class HDF5DataParameter < ::Protobuf::Message; end
121
+ class HDF5OutputParameter < ::Protobuf::Message; end
122
+ class HingeLossParameter < ::Protobuf::Message
123
+ class Norm < ::Protobuf::Enum
124
+ define :L1, 1
125
+ define :L2, 2
126
+ end
127
+
128
+ end
129
+
130
+ class ImageDataParameter < ::Protobuf::Message; end
131
+ class InfogainLossParameter < ::Protobuf::Message; end
132
+ class InnerProductParameter < ::Protobuf::Message; end
133
+ class InputParameter < ::Protobuf::Message; end
134
+ class LogParameter < ::Protobuf::Message; end
135
+ class LRNParameter < ::Protobuf::Message
136
+ class NormRegion < ::Protobuf::Enum
137
+ define :ACROSS_CHANNELS, 0
138
+ define :WITHIN_CHANNEL, 1
139
+ end
140
+
141
+ class Engine < ::Protobuf::Enum
142
+ define :DEFAULT, 0
143
+ define :CAFFE, 1
144
+ define :CUDNN, 2
145
+ end
146
+
147
+ end
148
+
149
+ class MemoryDataParameter < ::Protobuf::Message; end
150
+ class MVNParameter < ::Protobuf::Message; end
151
+ class ParameterParameter < ::Protobuf::Message; end
152
+ class PoolingParameter < ::Protobuf::Message
153
+ class PoolMethod < ::Protobuf::Enum
154
+ define :MAX, 0
155
+ define :AVE, 1
156
+ define :STOCHASTIC, 2
157
+ end
158
+
159
+ class Engine < ::Protobuf::Enum
160
+ define :DEFAULT, 0
161
+ define :CAFFE, 1
162
+ define :CUDNN, 2
163
+ end
164
+
165
+ end
166
+
167
+ class PowerParameter < ::Protobuf::Message; end
168
+ class PythonParameter < ::Protobuf::Message; end
169
+ class RecurrentParameter < ::Protobuf::Message; end
170
+ class ReductionParameter < ::Protobuf::Message
171
+ class ReductionOp < ::Protobuf::Enum
172
+ define :SUM, 1
173
+ define :ASUM, 2
174
+ define :SUMSQ, 3
175
+ define :MEAN, 4
176
+ end
177
+
178
+ end
179
+
180
+ class ReLUParameter < ::Protobuf::Message
181
+ class Engine < ::Protobuf::Enum
182
+ define :DEFAULT, 0
183
+ define :CAFFE, 1
184
+ define :CUDNN, 2
185
+ end
186
+
187
+ end
188
+
189
+ class ReshapeParameter < ::Protobuf::Message; end
190
+ class ScaleParameter < ::Protobuf::Message; end
191
+ class SigmoidParameter < ::Protobuf::Message
192
+ class Engine < ::Protobuf::Enum
193
+ define :DEFAULT, 0
194
+ define :CAFFE, 1
195
+ define :CUDNN, 2
196
+ end
197
+
198
+ end
199
+
200
+ class SliceParameter < ::Protobuf::Message; end
201
+ class SoftmaxParameter < ::Protobuf::Message
202
+ class Engine < ::Protobuf::Enum
203
+ define :DEFAULT, 0
204
+ define :CAFFE, 1
205
+ define :CUDNN, 2
206
+ end
207
+
208
+ end
209
+
210
+ class TanHParameter < ::Protobuf::Message
211
+ class Engine < ::Protobuf::Enum
212
+ define :DEFAULT, 0
213
+ define :CAFFE, 1
214
+ define :CUDNN, 2
215
+ end
216
+
217
+ end
218
+
219
+ class TileParameter < ::Protobuf::Message; end
220
+ class ThresholdParameter < ::Protobuf::Message; end
221
+ class WindowDataParameter < ::Protobuf::Message; end
222
+ class SPPParameter < ::Protobuf::Message
223
+ class PoolMethod < ::Protobuf::Enum
224
+ define :MAX, 0
225
+ define :AVE, 1
226
+ define :STOCHASTIC, 2
227
+ end
228
+
229
+ class Engine < ::Protobuf::Enum
230
+ define :DEFAULT, 0
231
+ define :CAFFE, 1
232
+ define :CUDNN, 2
233
+ end
234
+
235
+ end
236
+
237
+ class V1LayerParameter < ::Protobuf::Message
238
+ class LayerType < ::Protobuf::Enum
239
+ define :NONE, 0
240
+ define :ABSVAL, 35
241
+ define :ACCURACY, 1
242
+ define :ARGMAX, 30
243
+ define :BNLL, 2
244
+ define :CONCAT, 3
245
+ define :CONTRASTIVE_LOSS, 37
246
+ define :CONVOLUTION, 4
247
+ define :DATA, 5
248
+ define :DECONVOLUTION, 39
249
+ define :DROPOUT, 6
250
+ define :DUMMY_DATA, 32
251
+ define :EUCLIDEAN_LOSS, 7
252
+ define :ELTWISE, 25
253
+ define :EXP, 38
254
+ define :FLATTEN, 8
255
+ define :HDF5_DATA, 9
256
+ define :HDF5_OUTPUT, 10
257
+ define :HINGE_LOSS, 28
258
+ define :IM2COL, 11
259
+ define :IMAGE_DATA, 12
260
+ define :INFOGAIN_LOSS, 13
261
+ define :INNER_PRODUCT, 14
262
+ define :LRN, 15
263
+ define :MEMORY_DATA, 29
264
+ define :MULTINOMIAL_LOGISTIC_LOSS, 16
265
+ define :MVN, 34
266
+ define :POOLING, 17
267
+ define :POWER, 26
268
+ define :RELU, 18
269
+ define :SIGMOID, 19
270
+ define :SIGMOID_CROSS_ENTROPY_LOSS, 27
271
+ define :SILENCE, 36
272
+ define :SOFTMAX, 20
273
+ define :SOFTMAX_LOSS, 21
274
+ define :SPLIT, 22
275
+ define :SLICE, 33
276
+ define :TANH, 23
277
+ define :WINDOW_DATA, 24
278
+ define :THRESHOLD, 31
279
+ end
280
+
281
+ class DimCheckMode < ::Protobuf::Enum
282
+ define :STRICT, 0
283
+ define :PERMISSIVE, 1
284
+ end
285
+
286
+ end
287
+
288
+ class V0LayerParameter < ::Protobuf::Message
289
+ class PoolMethod < ::Protobuf::Enum
290
+ define :MAX, 0
291
+ define :AVE, 1
292
+ define :STOCHASTIC, 2
293
+ end
294
+
295
+ end
296
+
297
+ class PReLUParameter < ::Protobuf::Message; end
298
+
299
+
300
+ ##
301
+ # Message Fields
302
+ #
303
+ class BlobShape
304
+ repeated :int64, :dim, 1, :packed => true
305
+ end
306
+
307
+ class BlobProto
308
+ optional ::Caffe::BlobShape, :shape, 7
309
+ repeated :float, :data, 5, :packed => true
310
+ repeated :float, :diff, 6, :packed => true
311
+ repeated :double, :double_data, 8, :packed => true
312
+ repeated :double, :double_diff, 9, :packed => true
313
+ optional :int32, :num, 1, :default => 0
314
+ optional :int32, :channels, 2, :default => 0
315
+ optional :int32, :height, 3, :default => 0
316
+ optional :int32, :width, 4, :default => 0
317
+ end
318
+
319
+ class BlobProtoVector
320
+ repeated ::Caffe::BlobProto, :blobs, 1
321
+ end
322
+
323
+ class Datum
324
+ optional :int32, :channels, 1
325
+ optional :int32, :height, 2
326
+ optional :int32, :width, 3
327
+ optional :bytes, :data, 4
328
+ optional :int32, :label, 5
329
+ repeated :float, :float_data, 6
330
+ optional :bool, :encoded, 7, :default => false
331
+ end
332
+
333
+ class FillerParameter
334
+ optional :string, :type, 1, :default => "constant"
335
+ optional :float, :value, 2, :default => 0
336
+ optional :float, :min, 3, :default => 0
337
+ optional :float, :max, 4, :default => 1
338
+ optional :float, :mean, 5, :default => 0
339
+ optional :float, :std, 6, :default => 1
340
+ optional :int32, :sparse, 7, :default => -1
341
+ optional ::Caffe::FillerParameter::VarianceNorm, :variance_norm, 8, :default => ::Caffe::FillerParameter::VarianceNorm::FAN_IN
342
+ end
343
+
344
+ class NetParameter
345
+ optional :string, :name, 1
346
+ repeated :string, :input, 3
347
+ repeated ::Caffe::BlobShape, :input_shape, 8
348
+ repeated :int32, :input_dim, 4
349
+ optional :bool, :force_backward, 5, :default => false
350
+ optional ::Caffe::NetState, :state, 6
351
+ optional :bool, :debug_info, 7, :default => false
352
+ repeated ::Caffe::LayerParameter, :layer, 100
353
+ repeated ::Caffe::V1LayerParameter, :layers, 2
354
+ end
355
+
356
+ class SolverParameter
357
+ optional :string, :net, 24
358
+ optional ::Caffe::NetParameter, :net_param, 25
359
+ optional :string, :train_net, 1
360
+ repeated :string, :test_net, 2
361
+ optional ::Caffe::NetParameter, :train_net_param, 21
362
+ repeated ::Caffe::NetParameter, :test_net_param, 22
363
+ optional ::Caffe::NetState, :train_state, 26
364
+ repeated ::Caffe::NetState, :test_state, 27
365
+ repeated :int32, :test_iter, 3
366
+ optional :int32, :test_interval, 4, :default => 0
367
+ optional :bool, :test_compute_loss, 19, :default => false
368
+ optional :bool, :test_initialization, 32, :default => true
369
+ optional :float, :base_lr, 5
370
+ optional :int32, :display, 6
371
+ optional :int32, :average_loss, 33, :default => 1
372
+ optional :int32, :max_iter, 7
373
+ optional :int32, :iter_size, 36, :default => 1
374
+ optional :string, :lr_policy, 8
375
+ optional :float, :gamma, 9
376
+ optional :float, :power, 10
377
+ optional :float, :momentum, 11
378
+ optional :float, :weight_decay, 12
379
+ optional :string, :regularization_type, 29, :default => "L2"
380
+ optional :int32, :stepsize, 13
381
+ repeated :int32, :stepvalue, 34
382
+ optional :float, :clip_gradients, 35, :default => -1
383
+ optional :int32, :snapshot, 14, :default => 0
384
+ optional :string, :snapshot_prefix, 15
385
+ optional :bool, :snapshot_diff, 16, :default => false
386
+ optional ::Caffe::SolverParameter::SnapshotFormat, :snapshot_format, 37, :default => ::Caffe::SolverParameter::SnapshotFormat::BINARYPROTO
387
+ optional ::Caffe::SolverParameter::SolverMode, :solver_mode, 17, :default => ::Caffe::SolverParameter::SolverMode::GPU
388
+ optional :int32, :device_id, 18, :default => 0
389
+ optional :int64, :random_seed, 20, :default => -1
390
+ optional :string, :type, 40, :default => "SGD"
391
+ optional :float, :delta, 31, :default => 1e-08
392
+ optional :float, :momentum2, 39, :default => 0.999
393
+ optional :float, :rms_decay, 38, :default => 0.99
394
+ optional :bool, :debug_info, 23, :default => false
395
+ optional :bool, :snapshot_after_train, 28, :default => true
396
+ optional ::Caffe::SolverParameter::SolverType, :solver_type, 30, :default => ::Caffe::SolverParameter::SolverType::SGD
397
+ optional :bool, :layer_wise_reduce, 41, :default => true
398
+ end
399
+
400
+ class SolverState
401
+ optional :int32, :iter, 1
402
+ optional :string, :learned_net, 2
403
+ repeated ::Caffe::BlobProto, :history, 3
404
+ optional :int32, :current_step, 4, :default => 0
405
+ end
406
+
407
+ class NetState
408
+ optional ::Caffe::Phase, :phase, 1, :default => ::Caffe::Phase::TEST
409
+ optional :int32, :level, 2, :default => 0
410
+ repeated :string, :stage, 3
411
+ end
412
+
413
+ class NetStateRule
414
+ optional ::Caffe::Phase, :phase, 1
415
+ optional :int32, :min_level, 2
416
+ optional :int32, :max_level, 3
417
+ repeated :string, :stage, 4
418
+ repeated :string, :not_stage, 5
419
+ end
420
+
421
+ class ParamSpec
422
+ optional :string, :name, 1
423
+ optional ::Caffe::ParamSpec::DimCheckMode, :share_mode, 2
424
+ optional :float, :lr_mult, 3, :default => 1
425
+ optional :float, :decay_mult, 4, :default => 1
426
+ end
427
+
428
+ class LayerParameter
429
+ optional :string, :name, 1
430
+ optional :string, :type, 2
431
+ repeated :string, :bottom, 3
432
+ repeated :string, :top, 4
433
+ optional ::Caffe::Phase, :phase, 10
434
+ repeated :float, :loss_weight, 5
435
+ repeated ::Caffe::ParamSpec, :param, 6
436
+ repeated ::Caffe::BlobProto, :blobs, 7
437
+ repeated :bool, :propagate_down, 11
438
+ repeated ::Caffe::NetStateRule, :include, 8
439
+ repeated ::Caffe::NetStateRule, :exclude, 9
440
+ optional ::Caffe::TransformationParameter, :transform_param, 100
441
+ optional ::Caffe::LossParameter, :loss_param, 101
442
+ optional ::Caffe::AccuracyParameter, :accuracy_param, 102
443
+ optional ::Caffe::ArgMaxParameter, :argmax_param, 103
444
+ optional ::Caffe::BatchNormParameter, :batch_norm_param, 139
445
+ optional ::Caffe::BiasParameter, :bias_param, 141
446
+ optional ::Caffe::ConcatParameter, :concat_param, 104
447
+ optional ::Caffe::ContrastiveLossParameter, :contrastive_loss_param, 105
448
+ optional ::Caffe::ConvolutionParameter, :convolution_param, 106
449
+ optional ::Caffe::CropParameter, :crop_param, 144
450
+ optional ::Caffe::DataParameter, :data_param, 107
451
+ optional ::Caffe::DropoutParameter, :dropout_param, 108
452
+ optional ::Caffe::DummyDataParameter, :dummy_data_param, 109
453
+ optional ::Caffe::EltwiseParameter, :eltwise_param, 110
454
+ optional ::Caffe::ELUParameter, :elu_param, 140
455
+ optional ::Caffe::EmbedParameter, :embed_param, 137
456
+ optional ::Caffe::ExpParameter, :exp_param, 111
457
+ optional ::Caffe::FlattenParameter, :flatten_param, 135
458
+ optional ::Caffe::HDF5DataParameter, :hdf5_data_param, 112
459
+ optional ::Caffe::HDF5OutputParameter, :hdf5_output_param, 113
460
+ optional ::Caffe::HingeLossParameter, :hinge_loss_param, 114
461
+ optional ::Caffe::ImageDataParameter, :image_data_param, 115
462
+ optional ::Caffe::InfogainLossParameter, :infogain_loss_param, 116
463
+ optional ::Caffe::InnerProductParameter, :inner_product_param, 117
464
+ optional ::Caffe::InputParameter, :input_param, 143
465
+ optional ::Caffe::LogParameter, :log_param, 134
466
+ optional ::Caffe::LRNParameter, :lrn_param, 118
467
+ optional ::Caffe::MemoryDataParameter, :memory_data_param, 119
468
+ optional ::Caffe::MVNParameter, :mvn_param, 120
469
+ optional ::Caffe::ParameterParameter, :parameter_param, 145
470
+ optional ::Caffe::PoolingParameter, :pooling_param, 121
471
+ optional ::Caffe::PowerParameter, :power_param, 122
472
+ optional ::Caffe::PReLUParameter, :prelu_param, 131
473
+ optional ::Caffe::PythonParameter, :python_param, 130
474
+ optional ::Caffe::RecurrentParameter, :recurrent_param, 146
475
+ optional ::Caffe::ReductionParameter, :reduction_param, 136
476
+ optional ::Caffe::ReLUParameter, :relu_param, 123
477
+ optional ::Caffe::ReshapeParameter, :reshape_param, 133
478
+ optional ::Caffe::ScaleParameter, :scale_param, 142
479
+ optional ::Caffe::SigmoidParameter, :sigmoid_param, 124
480
+ optional ::Caffe::SoftmaxParameter, :softmax_param, 125
481
+ optional ::Caffe::SPPParameter, :spp_param, 132
482
+ optional ::Caffe::SliceParameter, :slice_param, 126
483
+ optional ::Caffe::TanHParameter, :tanh_param, 127
484
+ optional ::Caffe::ThresholdParameter, :threshold_param, 128
485
+ optional ::Caffe::TileParameter, :tile_param, 138
486
+ optional ::Caffe::WindowDataParameter, :window_data_param, 129
487
+ end
488
+
489
+ class TransformationParameter
490
+ optional :float, :scale, 1, :default => 1
491
+ optional :bool, :mirror, 2, :default => false
492
+ optional :uint32, :crop_size, 3, :default => 0
493
+ optional :string, :mean_file, 4
494
+ repeated :float, :mean_value, 5
495
+ optional :bool, :force_color, 6, :default => false
496
+ optional :bool, :force_gray, 7, :default => false
497
+ end
498
+
499
+ class LossParameter
500
+ optional :int32, :ignore_label, 1
501
+ optional ::Caffe::LossParameter::NormalizationMode, :normalization, 3, :default => ::Caffe::LossParameter::NormalizationMode::VALID
502
+ optional :bool, :normalize, 2
503
+ end
504
+
505
+ class AccuracyParameter
506
+ optional :uint32, :top_k, 1, :default => 1
507
+ optional :int32, :axis, 2, :default => 1
508
+ optional :int32, :ignore_label, 3
509
+ end
510
+
511
+ class ArgMaxParameter
512
+ optional :bool, :out_max_val, 1, :default => false
513
+ optional :uint32, :top_k, 2, :default => 1
514
+ optional :int32, :axis, 3
515
+ end
516
+
517
+ class ConcatParameter
518
+ optional :int32, :axis, 2, :default => 1
519
+ optional :uint32, :concat_dim, 1, :default => 1
520
+ end
521
+
522
+ class BatchNormParameter
523
+ optional :bool, :use_global_stats, 1
524
+ optional :float, :moving_average_fraction, 2, :default => 0.999
525
+ optional :float, :eps, 3, :default => 1e-05
526
+ end
527
+
528
+ class BiasParameter
529
+ optional :int32, :axis, 1, :default => 1
530
+ optional :int32, :num_axes, 2, :default => 1
531
+ optional ::Caffe::FillerParameter, :filler, 3
532
+ end
533
+
534
+ class ContrastiveLossParameter
535
+ optional :float, :margin, 1, :default => 1
536
+ optional :bool, :legacy_version, 2, :default => false
537
+ end
538
+
539
+ class ConvolutionParameter
540
+ optional :uint32, :num_output, 1
541
+ optional :bool, :bias_term, 2, :default => true
542
+ repeated :uint32, :pad, 3
543
+ repeated :uint32, :kernel_size, 4
544
+ repeated :uint32, :stride, 6
545
+ repeated :uint32, :dilation, 18
546
+ optional :uint32, :pad_h, 9, :default => 0
547
+ optional :uint32, :pad_w, 10, :default => 0
548
+ optional :uint32, :kernel_h, 11
549
+ optional :uint32, :kernel_w, 12
550
+ optional :uint32, :stride_h, 13
551
+ optional :uint32, :stride_w, 14
552
+ optional :uint32, :group, 5, :default => 1
553
+ optional ::Caffe::FillerParameter, :weight_filler, 7
554
+ optional ::Caffe::FillerParameter, :bias_filler, 8
555
+ optional ::Caffe::ConvolutionParameter::Engine, :engine, 15, :default => ::Caffe::ConvolutionParameter::Engine::DEFAULT
556
+ optional :int32, :axis, 16, :default => 1
557
+ optional :bool, :force_nd_im2col, 17, :default => false
558
+ end
559
+
560
+ class CropParameter
561
+ optional :int32, :axis, 1, :default => 2
562
+ repeated :uint32, :offset, 2
563
+ end
564
+
565
+ class DataParameter
566
+ optional :string, :source, 1
567
+ optional :uint32, :batch_size, 4
568
+ optional :uint32, :rand_skip, 7, :default => 0
569
+ optional ::Caffe::DataParameter::DB, :backend, 8, :default => ::Caffe::DataParameter::DB::LEVELDB
570
+ optional :float, :scale, 2, :default => 1
571
+ optional :string, :mean_file, 3
572
+ optional :uint32, :crop_size, 5, :default => 0
573
+ optional :bool, :mirror, 6, :default => false
574
+ optional :bool, :force_encoded_color, 9, :default => false
575
+ optional :uint32, :prefetch, 10, :default => 4
576
+ end
577
+
578
+ class DropoutParameter
579
+ optional :float, :dropout_ratio, 1, :default => 0.5
580
+ end
581
+
582
+ class DummyDataParameter
583
+ repeated ::Caffe::FillerParameter, :data_filler, 1
584
+ repeated ::Caffe::BlobShape, :shape, 6
585
+ repeated :uint32, :num, 2
586
+ repeated :uint32, :channels, 3
587
+ repeated :uint32, :height, 4
588
+ repeated :uint32, :width, 5
589
+ end
590
+
591
+ class EltwiseParameter
592
+ optional ::Caffe::EltwiseParameter::EltwiseOp, :operation, 1, :default => ::Caffe::EltwiseParameter::EltwiseOp::SUM
593
+ repeated :float, :coeff, 2
594
+ optional :bool, :stable_prod_grad, 3, :default => true
595
+ end
596
+
597
+ class ELUParameter
598
+ optional :float, :alpha, 1, :default => 1
599
+ end
600
+
601
+ class EmbedParameter
602
+ optional :uint32, :num_output, 1
603
+ optional :uint32, :input_dim, 2
604
+ optional :bool, :bias_term, 3, :default => true
605
+ optional ::Caffe::FillerParameter, :weight_filler, 4
606
+ optional ::Caffe::FillerParameter, :bias_filler, 5
607
+ end
608
+
609
+ class ExpParameter
610
+ optional :float, :base, 1, :default => -1
611
+ optional :float, :scale, 2, :default => 1
612
+ optional :float, :shift, 3, :default => 0
613
+ end
614
+
615
+ class FlattenParameter
616
+ optional :int32, :axis, 1, :default => 1
617
+ optional :int32, :end_axis, 2, :default => -1
618
+ end
619
+
620
+ class HDF5DataParameter
621
+ optional :string, :source, 1
622
+ optional :uint32, :batch_size, 2
623
+ optional :bool, :shuffle, 3, :default => false
624
+ end
625
+
626
+ class HDF5OutputParameter
627
+ optional :string, :file_name, 1
628
+ end
629
+
630
+ class HingeLossParameter
631
+ optional ::Caffe::HingeLossParameter::Norm, :norm, 1, :default => ::Caffe::HingeLossParameter::Norm::L1
632
+ end
633
+
634
+ class ImageDataParameter
635
+ optional :string, :source, 1
636
+ optional :uint32, :batch_size, 4, :default => 1
637
+ optional :uint32, :rand_skip, 7, :default => 0
638
+ optional :bool, :shuffle, 8, :default => false
639
+ optional :uint32, :new_height, 9, :default => 0
640
+ optional :uint32, :new_width, 10, :default => 0
641
+ optional :bool, :is_color, 11, :default => true
642
+ optional :float, :scale, 2, :default => 1
643
+ optional :string, :mean_file, 3
644
+ optional :uint32, :crop_size, 5, :default => 0
645
+ optional :bool, :mirror, 6, :default => false
646
+ optional :string, :root_folder, 12
647
+ end
648
+
649
+ class InfogainLossParameter
650
+ optional :string, :source, 1
651
+ end
652
+
653
+ class InnerProductParameter
654
+ optional :uint32, :num_output, 1
655
+ optional :bool, :bias_term, 2, :default => true
656
+ optional ::Caffe::FillerParameter, :weight_filler, 3
657
+ optional ::Caffe::FillerParameter, :bias_filler, 4
658
+ optional :int32, :axis, 5, :default => 1
659
+ optional :bool, :transpose, 6, :default => false
660
+ end
661
+
662
+ class InputParameter
663
+ repeated ::Caffe::BlobShape, :shape, 1
664
+ end
665
+
666
+ class LogParameter
667
+ optional :float, :base, 1, :default => -1
668
+ optional :float, :scale, 2, :default => 1
669
+ optional :float, :shift, 3, :default => 0
670
+ end
671
+
672
+ class LRNParameter
673
+ optional :uint32, :local_size, 1, :default => 5
674
+ optional :float, :alpha, 2, :default => 1
675
+ optional :float, :beta, 3, :default => 0.75
676
+ optional ::Caffe::LRNParameter::NormRegion, :norm_region, 4, :default => ::Caffe::LRNParameter::NormRegion::ACROSS_CHANNELS
677
+ optional :float, :k, 5, :default => 1
678
+ optional ::Caffe::LRNParameter::Engine, :engine, 6, :default => ::Caffe::LRNParameter::Engine::DEFAULT
679
+ end
680
+
681
+ class MemoryDataParameter
682
+ optional :uint32, :batch_size, 1
683
+ optional :uint32, :channels, 2
684
+ optional :uint32, :height, 3
685
+ optional :uint32, :width, 4
686
+ end
687
+
688
+ class MVNParameter
689
+ optional :bool, :normalize_variance, 1, :default => true
690
+ optional :bool, :across_channels, 2, :default => false
691
+ optional :float, :eps, 3, :default => 1e-09
692
+ end
693
+
694
+ class ParameterParameter
695
+ optional ::Caffe::BlobShape, :shape, 1
696
+ end
697
+
698
+ class PoolingParameter
699
+ optional ::Caffe::PoolingParameter::PoolMethod, :pool, 1, :default => ::Caffe::PoolingParameter::PoolMethod::MAX
700
+ optional :uint32, :pad, 4, :default => 0
701
+ optional :uint32, :pad_h, 9, :default => 0
702
+ optional :uint32, :pad_w, 10, :default => 0
703
+ optional :uint32, :kernel_size, 2
704
+ optional :uint32, :kernel_h, 5
705
+ optional :uint32, :kernel_w, 6
706
+ optional :uint32, :stride, 3, :default => 1
707
+ optional :uint32, :stride_h, 7
708
+ optional :uint32, :stride_w, 8
709
+ optional ::Caffe::PoolingParameter::Engine, :engine, 11, :default => ::Caffe::PoolingParameter::Engine::DEFAULT
710
+ optional :bool, :global_pooling, 12, :default => false
711
+ end
712
+
713
+ class PowerParameter
714
+ optional :float, :power, 1, :default => 1
715
+ optional :float, :scale, 2, :default => 1
716
+ optional :float, :shift, 3, :default => 0
717
+ end
718
+
719
+ class PythonParameter
720
+ optional :string, :module, 1
721
+ optional :string, :layer, 2
722
+ optional :string, :param_str, 3
723
+ optional :bool, :share_in_parallel, 4, :default => false
724
+ end
725
+
726
+ class RecurrentParameter
727
+ optional :uint32, :num_output, 1, :default => 0
728
+ optional ::Caffe::FillerParameter, :weight_filler, 2
729
+ optional ::Caffe::FillerParameter, :bias_filler, 3
730
+ optional :bool, :debug_info, 4, :default => false
731
+ optional :bool, :expose_hidden, 5, :default => false
732
+ end
733
+
734
+ class ReductionParameter
735
+ optional ::Caffe::ReductionParameter::ReductionOp, :operation, 1, :default => ::Caffe::ReductionParameter::ReductionOp::SUM
736
+ optional :int32, :axis, 2, :default => 0
737
+ optional :float, :coeff, 3, :default => 1
738
+ end
739
+
740
+ class ReLUParameter
741
+ optional :float, :negative_slope, 1, :default => 0
742
+ optional ::Caffe::ReLUParameter::Engine, :engine, 2, :default => ::Caffe::ReLUParameter::Engine::DEFAULT
743
+ end
744
+
745
+ class ReshapeParameter
746
+ optional ::Caffe::BlobShape, :shape, 1
747
+ optional :int32, :axis, 2, :default => 0
748
+ optional :int32, :num_axes, 3, :default => -1
749
+ end
750
+
751
+ class ScaleParameter
752
+ optional :int32, :axis, 1, :default => 1
753
+ optional :int32, :num_axes, 2, :default => 1
754
+ optional ::Caffe::FillerParameter, :filler, 3
755
+ optional :bool, :bias_term, 4, :default => false
756
+ optional ::Caffe::FillerParameter, :bias_filler, 5
757
+ end
758
+
759
+ class SigmoidParameter
760
+ optional ::Caffe::SigmoidParameter::Engine, :engine, 1, :default => ::Caffe::SigmoidParameter::Engine::DEFAULT
761
+ end
762
+
763
+ class SliceParameter
764
+ optional :int32, :axis, 3, :default => 1
765
+ repeated :uint32, :slice_point, 2
766
+ optional :uint32, :slice_dim, 1, :default => 1
767
+ end
768
+
769
+ class SoftmaxParameter
770
+ optional ::Caffe::SoftmaxParameter::Engine, :engine, 1, :default => ::Caffe::SoftmaxParameter::Engine::DEFAULT
771
+ optional :int32, :axis, 2, :default => 1
772
+ end
773
+
774
+ class TanHParameter
775
+ optional ::Caffe::TanHParameter::Engine, :engine, 1, :default => ::Caffe::TanHParameter::Engine::DEFAULT
776
+ end
777
+
778
+ class TileParameter
779
+ optional :int32, :axis, 1, :default => 1
780
+ optional :int32, :tiles, 2
781
+ end
782
+
783
+ class ThresholdParameter
784
+ optional :float, :threshold, 1, :default => 0
785
+ end
786
+
787
+ class WindowDataParameter
788
+ optional :string, :source, 1
789
+ optional :float, :scale, 2, :default => 1
790
+ optional :string, :mean_file, 3
791
+ optional :uint32, :batch_size, 4
792
+ optional :uint32, :crop_size, 5, :default => 0
793
+ optional :bool, :mirror, 6, :default => false
794
+ optional :float, :fg_threshold, 7, :default => 0.5
795
+ optional :float, :bg_threshold, 8, :default => 0.5
796
+ optional :float, :fg_fraction, 9, :default => 0.25
797
+ optional :uint32, :context_pad, 10, :default => 0
798
+ optional :string, :crop_mode, 11, :default => "warp"
799
+ optional :bool, :cache_images, 12, :default => false
800
+ optional :string, :root_folder, 13
801
+ end
802
+
803
+ class SPPParameter
804
+ optional :uint32, :pyramid_height, 1
805
+ optional ::Caffe::SPPParameter::PoolMethod, :pool, 2, :default => ::Caffe::SPPParameter::PoolMethod::MAX
806
+ optional ::Caffe::SPPParameter::Engine, :engine, 6, :default => ::Caffe::SPPParameter::Engine::DEFAULT
807
+ end
808
+
809
+ class V1LayerParameter
810
+ repeated :string, :bottom, 2
811
+ repeated :string, :top, 3
812
+ optional :string, :name, 4
813
+ repeated ::Caffe::NetStateRule, :include, 32
814
+ repeated ::Caffe::NetStateRule, :exclude, 33
815
+ optional ::Caffe::V1LayerParameter::LayerType, :type, 5
816
+ repeated ::Caffe::BlobProto, :blobs, 6
817
+ repeated :string, :param, 1001
818
+ repeated ::Caffe::V1LayerParameter::DimCheckMode, :blob_share_mode, 1002
819
+ repeated :float, :blobs_lr, 7
820
+ repeated :float, :weight_decay, 8
821
+ repeated :float, :loss_weight, 35
822
+ optional ::Caffe::AccuracyParameter, :accuracy_param, 27
823
+ optional ::Caffe::ArgMaxParameter, :argmax_param, 23
824
+ optional ::Caffe::ConcatParameter, :concat_param, 9
825
+ optional ::Caffe::ContrastiveLossParameter, :contrastive_loss_param, 40
826
+ optional ::Caffe::ConvolutionParameter, :convolution_param, 10
827
+ optional ::Caffe::DataParameter, :data_param, 11
828
+ optional ::Caffe::DropoutParameter, :dropout_param, 12
829
+ optional ::Caffe::DummyDataParameter, :dummy_data_param, 26
830
+ optional ::Caffe::EltwiseParameter, :eltwise_param, 24
831
+ optional ::Caffe::ExpParameter, :exp_param, 41
832
+ optional ::Caffe::HDF5DataParameter, :hdf5_data_param, 13
833
+ optional ::Caffe::HDF5OutputParameter, :hdf5_output_param, 14
834
+ optional ::Caffe::HingeLossParameter, :hinge_loss_param, 29
835
+ optional ::Caffe::ImageDataParameter, :image_data_param, 15
836
+ optional ::Caffe::InfogainLossParameter, :infogain_loss_param, 16
837
+ optional ::Caffe::InnerProductParameter, :inner_product_param, 17
838
+ optional ::Caffe::LRNParameter, :lrn_param, 18
839
+ optional ::Caffe::MemoryDataParameter, :memory_data_param, 22
840
+ optional ::Caffe::MVNParameter, :mvn_param, 34
841
+ optional ::Caffe::PoolingParameter, :pooling_param, 19
842
+ optional ::Caffe::PowerParameter, :power_param, 21
843
+ optional ::Caffe::ReLUParameter, :relu_param, 30
844
+ optional ::Caffe::SigmoidParameter, :sigmoid_param, 38
845
+ optional ::Caffe::SoftmaxParameter, :softmax_param, 39
846
+ optional ::Caffe::SliceParameter, :slice_param, 31
847
+ optional ::Caffe::TanHParameter, :tanh_param, 37
848
+ optional ::Caffe::ThresholdParameter, :threshold_param, 25
849
+ optional ::Caffe::WindowDataParameter, :window_data_param, 20
850
+ optional ::Caffe::TransformationParameter, :transform_param, 36
851
+ optional ::Caffe::LossParameter, :loss_param, 42
852
+ optional ::Caffe::V0LayerParameter, :layer, 1
853
+ end
854
+
855
+ class V0LayerParameter
856
+ optional :string, :name, 1
857
+ optional :string, :type, 2
858
+ optional :uint32, :num_output, 3
859
+ optional :bool, :biasterm, 4, :default => true
860
+ optional ::Caffe::FillerParameter, :weight_filler, 5
861
+ optional ::Caffe::FillerParameter, :bias_filler, 6
862
+ optional :uint32, :pad, 7, :default => 0
863
+ optional :uint32, :kernelsize, 8
864
+ optional :uint32, :group, 9, :default => 1
865
+ optional :uint32, :stride, 10, :default => 1
866
+ optional ::Caffe::V0LayerParameter::PoolMethod, :pool, 11, :default => ::Caffe::V0LayerParameter::PoolMethod::MAX
867
+ optional :float, :dropout_ratio, 12, :default => 0.5
868
+ optional :uint32, :local_size, 13, :default => 5
869
+ optional :float, :alpha, 14, :default => 1
870
+ optional :float, :beta, 15, :default => 0.75
871
+ optional :float, :k, 22, :default => 1
872
+ optional :string, :source, 16
873
+ optional :float, :scale, 17, :default => 1
874
+ optional :string, :meanfile, 18
875
+ optional :uint32, :batchsize, 19
876
+ optional :uint32, :cropsize, 20, :default => 0
877
+ optional :bool, :mirror, 21, :default => false
878
+ repeated ::Caffe::BlobProto, :blobs, 50
879
+ repeated :float, :blobs_lr, 51
880
+ repeated :float, :weight_decay, 52
881
+ optional :uint32, :rand_skip, 53, :default => 0
882
+ optional :float, :det_fg_threshold, 54, :default => 0.5
883
+ optional :float, :det_bg_threshold, 55, :default => 0.5
884
+ optional :float, :det_fg_fraction, 56, :default => 0.25
885
+ optional :uint32, :det_context_pad, 58, :default => 0
886
+ optional :string, :det_crop_mode, 59, :default => "warp"
887
+ optional :int32, :new_num, 60, :default => 0
888
+ optional :int32, :new_channels, 61, :default => 0
889
+ optional :int32, :new_height, 62, :default => 0
890
+ optional :int32, :new_width, 63, :default => 0
891
+ optional :bool, :shuffle_images, 64, :default => false
892
+ optional :uint32, :concat_dim, 65, :default => 1
893
+ optional ::Caffe::HDF5OutputParameter, :hdf5_output_param, 1001
894
+ end
895
+
896
+ class PReLUParameter
897
+ optional ::Caffe::FillerParameter, :filler, 1
898
+ optional :bool, :channel_shared, 2, :default => false
899
+ end
900
+
901
+ end
902
+