2using System.Collections.Generic;
7using System.Threading.Tasks;
20 [TypeConverter(typeof(ExpandableObjectConverter))]
26 List<InterpMode> m_rgInterp =
new List<InterpMode>();
29 uint m_nHeightScale = 0;
30 uint m_nWidthScale = 0;
31 List<float> m_rgfPadValue =
new List<float>();
49 FIT_LARGE_SIZE_AND_PAD = 3
109 [Description(
"Get/set probability of using this resize policy.")]
112 get {
return m_fProb; }
113 set { m_fProb = value; }
119 [Description(
"Get/set the resizing mode.")]
122 get {
return m_mode; }
123 set { m_mode = value; }
129 [Description(
"Get/set the resizing height.")]
132 get {
return m_nHeight; }
133 set { m_nHeight = value; }
139 [Description(
"Get/set the resizing width.")]
142 get {
return m_nWidth; }
143 set { m_nWidth = value; }
149 [Description(
"Get/set the resizing height scale used with FIT_SMALL_SIZE mode.")]
152 get {
return m_nHeightScale; }
153 set { m_nHeightScale = value; }
159 [Description(
"Get/set the resizing width scale used with FIT_SMALL_SIZE_mode.")]
162 get {
return m_nWidthScale; }
163 set { m_nWidthScale = value; }
169 [Description(
"Get/set the pad mode for FIT_LARGE_SIZE_AND_PAD mode.")]
172 get {
return m_pad; }
173 set { m_pad = value; }
179 [Description(
"Get/set the pad value which is repeated once for all channels, or provided one pad value per channel.")]
182 get {
return m_rgfPadValue; }
183 set { m_rgfPadValue = value; }
189 [Description(
"Get/set the interp mode which is repeated once for all channels, or provided once per channel.")]
192 get {
return m_rgInterp; }
193 set { m_rgInterp = value; }
229 m_rgInterp =
new List<InterpMode>();
232 m_rgInterp.Add(interp);
235 m_nHeight = p.height;
237 m_nHeightScale = p.height_scale;
238 m_nWidthScale = p.width_scale;
240 m_rgfPadValue =
new List<float>();
241 foreach (
float fPad
in p.pad_value)
243 m_rgfPadValue.Add(fPad);
266 RawProto rpBase = base.ToProto(
"option");
269 rgChildren.
Add(rpBase);
272 rgChildren.
Add(
new RawProto(
"resize_mode", m_mode.ToString()));
273 rgChildren.
Add(
new RawProto(
"pad_mode", m_pad.ToString()));
274 rgChildren.
Add(
new RawProto(
"height", m_nHeight.ToString()));
275 rgChildren.
Add(
new RawProto(
"width", m_nWidth.ToString()));
276 rgChildren.
Add(
new RawProto(
"height_scale", m_nHeightScale.ToString()));
277 rgChildren.
Add(
new RawProto(
"width_scale", m_nWidthScale.ToString()));
281 rgChildren.Add(
new RawProto(
"interp_mode", interp.ToString()));
284 foreach (
float fPad
in m_rgfPadValue)
286 rgChildren.Add(
new RawProto(
"pad_value", fPad.ToString()));
289 return new RawProto(strName,
"", rgChildren);
303 if (rpOption !=
null)
306 if ((strVal = rp.
FindValue(
"active")) !=
null)
307 p.
Active =
bool.Parse(strVal);
309 if ((strVal = rp.
FindValue(
"prob")) !=
null)
312 if ((strVal = rp.
FindValue(
"resize_mode")) !=
null)
320 case "FIT_SMALL_SIZE":
324 case "FIT_LARGE_SIZE_AND_PAD":
329 throw new Exception(
"Unknown resize_mode '" + strVal +
"'!");
333 if ((strVal = rp.
FindValue(
"height")) !=
null)
334 p.
height = uint.Parse(strVal);
336 if ((strVal = rp.
FindValue(
"width")) !=
null)
337 p.
width = uint.Parse(strVal);
339 if ((strVal = rp.
FindValue(
"height_scale")) !=
null)
342 if ((strVal = rp.
FindValue(
"width_scale")) !=
null)
345 if ((strVal = rp.
FindValue(
"pad_mode")) !=
null)
357 case "REPEAT_NEAREST":
362 throw new Exception(
"Unknown pad_mode '" + strVal +
"'!");
370 if ((strVal = rp.FindValue(
"pad_value")) !=
null)
374 p.interp_mode =
new List<InterpMode>();
403 throw new Exception(
"Unknown interp_mode '" + strVal +
"'!");
The BaseParameter class is the base class for all other parameter classes.
static float ParseFloat(string strVal)
Parse float values using the US culture if the decimal separator = '.', then using the native culture...
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.
string Value
Get/set the value of the node.
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.
RawProtoCollection FindChildren(params string[] rgstrName)
Searches for all children with a given name in this node's children.
The OptionalParameter is the base class for parameters that are optional such as the MaskParameter,...
static OptionalParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
OptionalParameter(bool bActive=false)
The constructor.
bool Active
When active, the parameter is used, otherwise it is ignored.
Specifies the parameters for the ResizeParameter for use with SSD.
InterpMode
Defines the interpolation mode.
uint height
Get/set the resizing height.
List< InterpMode > interp_mode
Get/set the interp mode which is repeated once for all channels, or provided once per channel.
PadMode pad_mode
Get/set the pad mode for FIT_LARGE_SIZE_AND_PAD mode.
uint width
Get/set the resizing width.
ResizeParameter Clone()
Return a copy of this object.
override void Copy(OptionalParameter src)
Copy the source object.
ResizeParameter Load(BinaryReader br, bool bNewInstance=true)
Load the and return a new ResizeParameter.
ResizeMode
Defines the resizing mode.
static new ResizeParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
PadMode
Defines the padding mode.
ResizeMode resize_mode
Get/set the resizing mode.
float prob
Get/set probability of using this resize policy.
override RawProto ToProto(string strName)
Convert this object to a raw proto.
ResizeParameter(bool bActive)
The constructor.
uint width_scale
Get/set the resizing width scale used with FIT_SMALL_SIZE_mode.
uint height_scale
Get/set the resizing height scale used with FIT_SMALL_SIZE mode.
List< float > pad_value
Get/set the pad value which is repeated once for all channels, or provided one pad value per channel.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.param.ssd namespace contains all SSD related parameter objects that correspond to the nat...
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...