2using System.Collections.Generic;
17 [TypeConverter(typeof(ExpandableObjectConverter))]
20 bool m_bNormalizeAcrossDataAndLabel =
false;
21 List<int> m_rgIgnoreChannels =
new List<int>();
22 List<NORMALIZATION_STEP> m_rgNormalizationSteps =
new List<NORMALIZATION_STEP>();
23 double m_dfOutputMin = 0;
24 double m_dfOutputMax = 1;
25 double m_dfInputMin = 0;
26 double m_dfInputMax = 0;
27 double? m_dfInputStdDev =
null;
28 double? m_dfInputMean =
null;
29 int? m_nLabelDataChannel =
null;
74 [Description(
"Specifies to data channel used for the label (if any).")]
77 get {
return m_nLabelDataChannel; }
78 set { m_nLabelDataChannel = value; }
88 [Description(
"Specifies to normalize across both the data and label data together.")]
91 get {
return m_bNormalizeAcrossDataAndLabel; }
92 set { m_bNormalizeAcrossDataAndLabel = value; }
98 [Description(
"Specifies the normalization steps which are performed in the order for which they are listed.")]
99 public List<NORMALIZATION_STEP>
steps
101 get {
return m_rgNormalizationSteps; }
102 set { m_rgNormalizationSteps = value; }
108 [Description(
"Specifies the channels to ignore and just pass through in their original form.")]
111 get {
return m_rgIgnoreChannels; }
112 set { m_rgIgnoreChannels = value; }
118 [Description(
"Specifies the minimum data range of the intput, if known. When not specified the input_stdev is determined dynamically from the data input itself.")]
121 get {
return m_dfInputStdDev; }
122 set { m_dfInputStdDev = value; }
128 [Description(
"Specifies the minimum data range of the intput, if known. When not specified the input_mean is determined dynamically from the data input itself.")]
131 get {
return m_dfInputMean; }
132 set { m_dfInputMean = value; }
138 [Description(
"Specifies the minimum data range of the intput, if known. If both input_min and input_max are 0 the input_min/input_max are determined dynamically from the data input itself.")]
141 get {
return m_dfInputMin; }
142 set { m_dfInputMin = value; }
148 [Description(
"Specifies the maximum data range of the intput, if known. If both input_min and input_max are 0 the input_min/input_max are determined dynamically from the data input itself.")]
151 get {
return m_dfInputMax; }
152 set { m_dfInputMax = value; }
158 [Description(
"Specifies the minimum data range of the output.")]
161 get {
return m_dfOutputMin; }
162 set { m_dfOutputMin = value; }
168 [Description(
"Specifies the maximum data range of the output.")]
171 get {
return m_dfOutputMax; }
172 set { m_dfOutputMax = value; }
176 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
209 List<string> rgstrStep =
new List<string>();
211 for (
int i = 0; i < m_rgNormalizationSteps.Count; i++)
213 rgstrStep.Add(
steps[i].ToString().ToLower());
216 rgChildren.
Add<
string>(
"step", rgstrStep);
233 return new RawProto(strName,
"", rgChildren);
249 List<string> rgstrStep = rp.FindArray<
string>(
"step");
250 p.steps =
new List<NORMALIZATION_STEP>();
252 foreach (
string strStep
in rgstrStep)
254 p.steps.Add(convertStep(strStep));
257 if ((strVal = rp.FindValue(
"across_data_and_label")) !=
null)
258 p.across_data_and_label =
bool.Parse(strVal);
260 p.ignore_channels = rp.FindArray<
int>(
"ignore_ch");
262 if ((strVal = rp.FindValue(
"input_min")) !=
null)
265 if ((strVal = rp.FindValue(
"input_max")) !=
null)
268 if ((strVal = rp.FindValue(
"output_min")) !=
null)
271 if ((strVal = rp.FindValue(
"output_max")) !=
null)
274 if ((strVal = rp.FindValue(
"input_mean")) !=
null)
279 if ((strVal = rp.FindValue(
"input_stdev")) !=
null)
282 p.input_stdev =
null;
284 if ((strVal = rp.FindValue(
"label_data_channel")) !=
null)
285 p.label_data_channel =
int.Parse(strVal);
287 p.label_data_channel =
null;
314 throw new Exception(
"The step '" + str +
"' is unknown!");
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.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
Specifies the parameter for the data normalizer layer.
double output_max
Specifies the maximum data range of the output.
double input_max
Specifies the maximum data range of the intput, if known. If both input_min and input_max are 0 the i...
int? label_data_channel
Specifies to data channel used for the label (if any).
bool across_data_and_label
Specifies to normalize across both the data and label data together.
DataNormalizerParameter()
Constructor for the parameter.
double input_min
Specifies the minimum data range of the intput, if known. If both input_min and input_max are 0 the i...
override void Copy(LayerParameterBase src)
Copy on parameter to another.
static DataNormalizerParameter FromProto(RawProto rp, DataNormalizerParameter p=null)
Parses the parameter from a RawProto.
double output_min
Specifies the minimum data range of the output.
List< NORMALIZATION_STEP > steps
Specifies the normalization steps which are performed in the order for which they are listed.
NORMALIZATION_STEP
Specifies the normalization step to run.
List< int > ignore_channels
Specifies the channels to ignore and just pass through in their original form.
double? input_mean
Specifies the input mean, if known. When not specified the input_mean is determined dynamically from ...
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
double? input_stdev
Specifies the input standard deviation, if known. When not specified input_stdev is determined dynami...
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
Specifies the parameter for the data layer.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
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-...