2using System.Collections.Generic;
7using System.Threading.Tasks;
26 bool m_bDifficult =
false;
41 public NormalizedBBox(
float fxmin,
float fymin,
float fxmax,
float fymax,
int nLabel = 0,
bool bDifficult =
false,
float fScore = 0,
float fSize = 0)
43 Set(fxmin, fymin, fxmax, fymax, nLabel, bDifficult, fScore, fSize);
57 public void Set(
float fxmin,
float fymin,
float fxmax,
float fymax,
int? nLabel =
null,
bool? bDifficult =
null,
float? fScore =
null,
float? fSize =
null)
65 m_nLabel = nLabel.Value;
67 if (bDifficult.HasValue)
68 m_bDifficult = bDifficult.Value;
71 m_fScore = fScore.Value;
74 m_fSize = fSize.Value;
83 return new NormalizedBBox(m_fxmin, m_fymin, m_fxmax, m_fymax, m_nLabel, m_bDifficult, m_fScore, m_fSize);
91 get {
return m_fxmin; }
92 set { m_fxmin = value; }
100 get {
return m_fxmax; }
101 set { m_fxmax = value; }
109 get {
return m_fymin; }
110 set { m_fymin = value; }
118 get {
return m_fymax; }
119 set { m_fymax = value; }
127 get {
return m_nLabel; }
128 set { m_nLabel = value; }
136 get {
return m_bDifficult; }
137 set { m_bDifficult = value; }
145 get {
return m_fScore; }
146 set { m_fScore = value; }
154 get {
return m_fSize; }
155 set { m_fSize = value; }
162 public void Save(BinaryWriter bw)
169 bw.Write(m_bDifficult);
181 float fXmin = br.ReadSingle();
182 float fXmax = br.ReadSingle();
183 float fYmin = br.ReadSingle();
184 float fYmax = br.ReadSingle();
185 int nLabel = br.ReadInt32();
186 bool bDifficult = br.ReadBoolean();
187 float fScore = br.ReadSingle();
188 float fSize = br.ReadSingle();
190 return new NormalizedBBox(fXmin, fYmin, fXmax, fYmax, nLabel, bDifficult, fScore, fSize);
199 string strOut =
"(" + m_nLabel.ToString() +
") { ";
201 strOut += m_fxmin.ToString() +
", ";
202 strOut += m_fymin.ToString() +
", ";
203 strOut += m_fxmax.ToString() +
", ";
204 strOut += m_fymax.ToString() +
" } -> ";
205 strOut += m_fScore.ToString();
206 strOut +=
" size = " + m_fSize.ToString();
207 strOut +=
" difficult = " + m_bDifficult.ToString();
220 float fX1 = m_fxmin * nWidth;
221 float fX2 = m_fxmax * nWidth;
222 float fY1 = m_fymin * nHeight;
223 float fY2 = m_fymax * nHeight;
225 return new RectangleF(fX1, fY1, fX2 - fX1, fY2 - fY1);
The NormalizedBBox manages a bounding box used in SSD.
float ymax
Get/set the y maximum.
float xmax
Get/set the x maximum.
NormalizedBBox Clone()
Return a copy of the object.
float xmin
Get/set the x minimum.
RectangleF GetBounds(int nWidth, int nHeight)
Calculates and returns the non-normalized bounding rectangle based in the specified width and height.
bool difficult
Get/set the difficulty.
float size
Get/set the size.
static NormalizedBBox Load(BinaryReader br)
Load and return a new NormalizedBbox.
float ymin
Get/set the y minimum.
void Set(float fxmin, float fymin, float fxmax, float fymax, int? nLabel=null, bool? bDifficult=null, float? fScore=null, float? fSize=null)
Set the values of the NormalizedBbox.
void Save(BinaryWriter bw)
Save the NormalizedBbox using the binary writer.
override string ToString()
Returns a string representation of the NormalizedBBox.
float score
Get/set the score.
NormalizedBBox(float fxmin, float fymin, float fxmax, float fymax, int nLabel=0, bool bDifficult=false, float fScore=0, float fSize=0)
The constructor.
int label
Get/set the label.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.