2using System.Collections.Generic;
17 [TypeConverter(typeof(ExpandableObjectConverter))]
22 bool m_bMirror =
false;
24 bool m_bUseImageDbMean =
false;
25 List<double> m_rgMeanValue =
new List<double>();
26 bool m_bForceColor =
false;
27 bool m_bForceGray =
false;
28 double m_dfForcedPositiveRangeMax = 0.0;
29 int? m_nRandomSeed =
null;
30 string m_strMeanFile =
null;
85 [Category(
"Data Pre-Processing"), Description(
"When specified (value > 0), the data values are fit into the positive range [0, forced_positive_range_max]. When set to 0 no range fitting is performed.")]
88 get {
return m_dfForcedPositiveRangeMax; }
89 set { m_dfForcedPositiveRangeMax = value; }
97 [Category(
"Data Pre-Processing"), Description(
"This value is used for simple scaling and subtracting the data mean if provided. Note that the mean subtraction is always carried out before scaling.")]
100 get {
return m_dfScale; }
101 set { m_dfScale = value; }
109 get {
return m_scaleOperator; }
110 set { m_scaleOperator = value; }
116 [Category(
"Data Pre-Processing"), Description(
"Specify if we want to randomly mirror the data.")]
119 get {
return m_bMirror; }
120 set { m_bMirror = value; }
126 [Category(
"Data Pre-Processing"), Description(
"Specify if we want to randomly crop the image. A value of 0 disables the croping.")]
129 get {
return m_nCropSize; }
130 set { m_nCropSize = value; }
137 [Category(
"Data Mean"), Description(
"Specifies whether or not to use the image mean for the data source from the image database. When true, the mean image is subtracted from the current image.")]
140 get {
return m_bUseImageDbMean; }
141 set { m_bUseImageDbMean = value; }
154 [Category(
"Data Mean"), Description(
"If specified can be repeated once (will subtract the value from all of teh channels, or can be repeated the same number of times as channels which will then subtract each corresponding value from each associated channel) So for example if there are 3 channels, mean values could have 3 values (one for each channel) or just one value that is then applied to all channels.")]
157 get {
return m_rgMeanValue; }
158 set { m_rgMeanValue = value; }
164 [Category(
"Data Color"), Description(
"When true, force the decoded image to have 3 color channels.")]
167 get {
return m_bForceColor; }
168 set { m_bForceColor = value; }
174 [Category(
"Data Color"), Description(
"When true, force the decoded image to have 1 color channel.")]
177 get {
return m_bForceGray; }
178 set { m_bForceGray = value; }
184 [Category(
"Testing"), Description(
"Only used during testing.")]
187 get {
return m_nRandomSeed; }
188 set { m_nRandomSeed = value; }
198 [Category(
"Data Mean"), Description(
"The mean file is used when specified and 'use_imagedb_mean' = true. If the 'use_imagedb_mean' is true and the 'mean_file' is not set, then the image database is queried for the mean image to use.")]
201 get {
return m_strMeanFile; }
202 set { m_strMeanFile = value; }
209 [Category(
"Data Color"), Description(
"Specifies the color ordering to use. Native Caffe models expect the BGR color ordering.")]
212 get {
return m_colorOrder; }
213 set { m_colorOrder = value; }
222 [Category(
"Image"), Description(
"When active, used as the resize policy for altering image data.")]
225 get {
return m_resize; }
226 set { m_resize = value; }
235 [Category(
"Image"), Description(
"When active, used as the noise policy for altering image data.")]
238 get {
return m_noise; }
239 set { m_noise = value; }
248 [Category(
"Image"), Description(
"When active, used as the distortion policy for altering image data.")]
251 get {
return m_distortion; }
252 set { m_distortion = value; }
261 [Category(
"Image"), Description(
"When active, used as the expansion policy for altering image data.")]
264 get {
return m_expansion; }
265 set { m_expansion = value; }
274 [Category(
"Image"), Description(
"When active, used as the emit constratin for emitting annotation after transformation.")]
277 get {
return m_emitConstraint; }
278 set { m_emitConstraint = value; }
289 [Category(
"Image"), Description(
"When active, used to mask portions of the image (set to Black) as defined by the boundary of the mask. The mask is applied after all other alterations.")]
292 get {
return m_mask; }
293 set { m_mask = value; }
304 get {
return m_labelMapping; }
305 set { m_labelMapping = value; }
309 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
325 m_bUseImageDbMean = p.m_bUseImageDbMean;
326 m_bForceColor = p.m_bForceColor;
327 m_bForceGray = p.m_bForceGray;
328 m_bMirror = p.m_bMirror;
329 m_dfScale = p.m_dfScale;
330 m_scaleOperator = p.m_scaleOperator;
331 m_nCropSize = p.m_nCropSize;
332 m_rgMeanValue =
Utility.Clone<
double>(p.m_rgMeanValue);
333 m_dfForcedPositiveRangeMax = p.m_dfForcedPositiveRangeMax;
334 m_nRandomSeed = p.m_nRandomSeed;
335 m_strMeanFile = p.m_strMeanFile;
336 m_colorOrder = p.m_colorOrder;
369 rgChildren.
Add(
"scale",
scale.ToString());
375 rgChildren.
Add(
"mirror",
mirror.ToString());
397 rgChildren.
Add(
"color_order", m_colorOrder.ToString());
399 if (m_resize !=
null)
400 rgChildren.
Add(m_resize.
ToProto(
"resize_param"));
403 rgChildren.
Add(m_noise.
ToProto(
"noise_param"));
405 if (m_distortion !=
null)
406 rgChildren.
Add(m_distortion.
ToProto(
"distortion_param"));
408 if (m_expansion !=
null)
409 rgChildren.
Add(m_expansion.
ToProto(
"expansion_param"));
411 if (m_emitConstraint !=
null)
412 rgChildren.
Add(m_emitConstraint.
ToProto(
"emit_constraint"));
417 if (m_labelMapping !=
null)
418 rgChildren.
Add(m_labelMapping.
ToProto(
"label_mapping"));
420 return new RawProto(strName,
"", rgChildren);
433 if ((strVal = rp.
FindValue(
"scale")) !=
null)
436 if ((strVal = rp.
FindValue(
"scale_operator")) !=
null)
450 if ((strVal = rp.
FindValue(
"mirror")) !=
null)
451 p.
mirror =
bool.Parse(strVal);
453 if ((strVal = rp.
FindValue(
"crop_size")) !=
null)
456 if ((strVal = rp.
FindValue(
"use_image_mean")) !=
null ||
457 (strVal = rp.
FindValue(
"use_imagedb_mean")) !=
null)
460 if ((strVal = rp.
FindValue(
"mean_file")) !=
null)
463 p.
mean_value = rp.FindArray<
double>(
"mean_value");
465 if ((strVal = rp.
FindValue(
"force_color")) !=
null)
468 if ((strVal = rp.
FindValue(
"force_gray")) !=
null)
471 if ((strVal = rp.
FindValue(
"force_positive_range_max")) !=
null)
474 if ((strVal = rp.
FindValue(
"mean_file")) !=
null)
477 if ((strVal = rp.
FindValue(
"color_order")) !=
null)
486 if (rpResize !=
null)
498 if (rpDistort !=
null)
502 if (rpExpand !=
null)
508 if (rpEmitCon !=
null)
518 if (rpLabelMapping !=
null)
static double ParseDouble(string strVal)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
The RawProtoCollection class is a list of RawProto objects.
void Add(RawProto p)
Adds a RawProto to the collection.
The RawProto class is used to parse and output Google prototxt file data.
RawProto FindChild(string strName)
Searches for a given node.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
The Utility class provides general utility funtions.
Specifies the parameters for the DataLabelMappingParameter used to map labels by the DataTransformer....
DataLabelMappingParameter Clone()
Return a copy of this object.
override RawProto ToProto(string strName)
Convert the DataLabelMappingParameter into a RawProto.
static new DataLabelMappingParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the MaskParameter used to mask portions of the transformed data when act...
override RawProto ToProto(string strName)
Convert this object to a raw proto.
static new MaskParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
MaskParameter Clone()
Return a copy of this object.
Specifies the parameters for the DistortionParameter used with SSD.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
static new DistortionParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
DistortionParameter Clone()
Return a clone of the object.
Specifies the parameters for the EmitConstraint used with SSD.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
EmitConstraint Clone()
Return a copy of this object.
static new EmitConstraint FromProto(RawProto rp)
Parses the parameter from a RawProto.
Specifies the parameters for the ExpansionParameter used with SSD.
static new ExpansionParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
ExpansionParameter Clone()
Return a clone of the object.
Specifies the parameters for the NoiseParameter used with SSD.
static new NoiseParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
NoiseParameter Clone()
Return a clone of the object.
Specifies the parameters for the ResizeParameter for use with SSD.
ResizeParameter Clone()
Return a copy of this object.
static new ResizeParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
@ NONE
No training category specified.
The MyCaffe.common namespace contains common MyCaffe classes.
@ MUL
Specifies to perform a multiplication operation.
The MyCaffe.param.ssd namespace contains all SSD related parameter objects that correspond to the nat...
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...