You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

caffe.proto 75 kB

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

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示