2using System.Collections.Generic;
20 [TypeConverter(typeof(ExpandableObjectConverter))]
23 bool m_bUseOriginalImage =
true;
26 uint m_nMaxSample = 0;
27 uint m_nMaxTrials = 100;
40 public void Save(BinaryWriter bw)
42 bw.Write(m_bUseOriginalImage);
43 bw.Write(m_nMaxSample);
44 bw.Write(m_nMaxTrials);
46 m_constraint.
Save(bw);
55 public object Load(BinaryReader br,
bool bNewInstance)
62 m_bUseOriginalImage = br.ReadBoolean();
63 m_nMaxSample = br.ReadUInt32();
64 m_nMaxTrials = br.ReadUInt32();
87 get {
return m_bUseOriginalImage; }
88 set { m_bUseOriginalImage = value; }
96 get {
return m_nMaxSample; }
97 set { m_nMaxSample = value; }
105 get {
return m_nMaxTrials; }
106 set { m_nMaxTrials = value; }
114 get {
return m_sampler; }
115 set { m_sampler = value; }
123 get {
return m_constraint; }
124 set { m_constraint = value; }
135 bs.m_bUseOriginalImage = m_bUseOriginalImage;
136 bs.m_nMaxSample = m_nMaxSample;
137 bs.m_nMaxTrials = m_nMaxTrials;
138 bs.m_sampler = m_sampler.
Clone();
139 bs.m_constraint = m_constraint.
Clone();
148 object ICloneable.
Clone()
160 if (bs.m_bUseOriginalImage != m_bUseOriginalImage)
163 if (bs.m_nMaxSample != m_nMaxSample)
166 if (bs.m_nMaxTrials != m_nMaxTrials)
169 if (!bs.m_sampler.
Compare(m_sampler))
172 if (!bs.m_constraint.
Compare(m_constraint))
205 rgChildren.
Add(
new RawProto(
"use_original_image", m_bUseOriginalImage.ToString()));
206 rgChildren.
Add(
new RawProto(
"max_sample", m_nMaxSample.ToString()));
207 rgChildren.
Add(
new RawProto(
"max_trials", m_nMaxTrials.ToString()));
210 rgChildren.
Add(m_constraint.
ToProto(
"sample_constraint"));
212 return new RawProto(strName,
"", rgChildren);
225 if ((strVal = rp.
FindValue(
"use_original_image")) !=
null)
228 if ((strVal = rp.
FindValue(
"max_sample")) !=
null)
231 if ((strVal = rp.
FindValue(
"max_trials")) !=
null)
235 if (protoSampler !=
null)
239 if (protoConstraint !=
null)
253 strOut +=
"use_original_image = " +
use_original_image.ToString() + Environment.NewLine;
254 strOut +=
"max_sample = " +
max_sample.ToString() + Environment.NewLine;
255 strOut +=
"max_trials = " +
max_trials.ToString() + Environment.NewLine;
The BaseParameter class is the base class for all other parameter classes.
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.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Specifies a sample of batch of bboxes with provided constraints in SSD.
bool Compare(BatchSampler bs)
Compares this BatchSampler to another.
int CompareTo(object obj)
Compares this BatchSampler to another.
bool use_original_image
Use the original image as the source for sampling.
static BatchSampler FromProto(RawProto rp)
Parse a new BatchSampler from a RawProto.
static BatchSampler Load(BinaryReader br)
Load the BatchSampler from a binary reader.
SamplerConstraint sample_constraint
Get/set the sample constraint.
Sampler sampler
Specifies the constraints for sampling the bbox
override RawProto ToProto(string strName)
Converts the BatchSampler to a RawProto.
uint max_trials
Maximum number of trials for sampling to avoid an infinite loop.
BatchSampler Clone()
Creates a copy of the BatchSampler.
void Save(BinaryWriter bw)
Save the BatchSampler to a binary writer.
object Load(BinaryReader br, bool bNewInstance)
Load the BatchSampler from a binary reader.
uint max_sample
If provided (greater than zero), break when found certain number of samples satisfying the sample con...
override string ToString()
Return the string representation of the shape.
BatchSampler()
The BatchSampler constructor.
Specifies the constratins for selecting sampled bbox used in SSD.
static SamplerConstraint FromProto(RawProto rp)
Parse a new SampleConstraint from a RawProto.
override RawProto ToProto(string strName)
Converts the SampleConstraint to a RawProto.
void Save(BinaryWriter bw)
Save the SampleConstraint to a binary writer.
override string ToString()
Return the string representation of the shape.
object Load(BinaryReader br, bool bNewInstance)
Load the SampleConstraint from a binary reader.
SamplerConstraint Clone()
Creates a copy of the SampleConstraint.
bool Compare(SamplerConstraint bs)
Compares this SampleConstraint to another.
Specifies the sample of a bbox in the normalized space [0,1] with provided constraints used in SSD.
override string ToString()
Return the string representation of the shape.
void Save(BinaryWriter bw)
Save the Sample to a binary writer.
bool Compare(Sampler bs)
Compares this Sample to another.
Sampler Clone()
Creates a copy of the Sample.
override RawProto ToProto(string strName)
Converts the Sample to a RawProto.
object Load(BinaryReader br, bool bNewInstance)
Load the Sample from a binary reader.
static Sampler FromProto(RawProto rp)
Parse a new Sample from a RawProto.
The IBinaryPersist interface provides generic save and load functionality.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.common namespace contains common MyCaffe classes.
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-...