MyCaffe  1.11.8.27
Deep learning software for Windows C# programmers.
SourceDescriptor.cs
1using System;
2using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
9{
13 [Serializable]
14 [TypeConverter(typeof(ExpandableObjectConverter))]
16 {
17 int m_nImageHt;
18 int m_nImageWd;
19 int m_nImageCh;
20 bool m_bIsRealData;
21 int m_nImageCount;
22 int m_nInactiveCount;
23 bool m_bSaveImagesToFile;
24 List<LabelDescriptor> m_rgLabels = new List<LabelDescriptor>();
26 string m_strLabelCounts;
27 int m_nCopyOfSourceID;
28
44 public SourceDescriptor(int nID, string strName, int nWd, int nHt, int nCh, bool bIsRealData, bool bSaveImagesToFile, int nCopyOfSourceId = 0, string strOwner = null, int nCount = 0, List<LabelDescriptor> rgLabels = null, string strLabelCounts = null)
45 : base(nID, strName, strOwner)
46 {
47 m_nImageHt = nHt;
48 m_nImageWd = nWd;
49 m_nImageCh = nCh;
50 m_bIsRealData = bIsRealData;
51 m_nImageCount = nCount;
52 m_strLabelCounts = strLabelCounts;
53 m_rgLabels = rgLabels;
54 m_bSaveImagesToFile = bSaveImagesToFile;
55 m_nCopyOfSourceID = nCopyOfSourceId;
56 }
57
63 public SourceDescriptor(string strName, bool bSaveImagesToFile)
64 : this(0, strName, 0, 0, 0, false, bSaveImagesToFile)
65 {
66 }
67
74 {
75 m_colParameters = new descriptors.ParameterDescriptorCollection();
76 m_nInactiveCount = s.m_nInactiveCount;
77 foreach (ParameterDescriptor p in s.m_colParameters)
78 {
79 m_colParameters.Add(new ParameterDescriptor(p));
80 }
81 }
82
87 public void Copy(SourceDescriptor sd)
88 {
89 base.Copy(sd);
90
91 m_nImageCh = sd.m_nImageCh;
92 m_nImageHt = sd.m_nImageHt;
93 m_nImageWd = sd.m_nImageWd;
94 m_bIsRealData = sd.m_bIsRealData;
95 m_nImageCount = sd.m_nImageCount;
96 m_nInactiveCount = sd.m_nInactiveCount;
97 m_bSaveImagesToFile = sd.m_bSaveImagesToFile;
98 m_nCopyOfSourceID = sd.m_nCopyOfSourceID;
99
100 m_rgLabels = new List<descriptors.LabelDescriptor>();
101 foreach (LabelDescriptor ld in sd.m_rgLabels)
102 {
103 m_rgLabels.Add(new descriptors.LabelDescriptor(ld));
104 }
105
106 m_colParameters = new descriptors.ParameterDescriptorCollection();
107 foreach (ParameterDescriptor p in sd.m_colParameters)
108 {
109 m_colParameters.Add(new ParameterDescriptor(p));
110 }
111
112 m_strLabelCounts = sd.m_strLabelCounts;
113 }
114
121 public void Resize(int nChannels, int nHeight, int nWidth)
122 {
123 m_nImageCh = nChannels;
124 m_nImageHt = nHeight;
125 m_nImageWd = nWidth;
126 }
127
131 [Description("Specifies whether the images are saved to the file system or directly to the database.")]
133 {
134 get { return m_bSaveImagesToFile; }
135 }
136
140 [Description("If this source was copied from another source, this property returns the ID of the original Source, otherwise 0 is returned.")]
141 [ReadOnly(true)]
142 public int CopyOfSourceID
143 {
144 get { return m_nCopyOfSourceID; }
145 set { m_nCopyOfSourceID = value; }
146 }
147
151 [Browsable(false)]
152 public List<LabelDescriptor> Labels
153 {
154 get { return m_rgLabels; }
155 set { m_rgLabels = value; }
156 }
157
161 [Description("Specifies the image height in pixels.")]
162 public int ImageHeight
163 {
164 get { return m_nImageHt; }
165 }
166
170 [Description("Specifies the image width in pixels.")]
171 public int ImageWidth
172 {
173 get { return m_nImageWd; }
174 }
175
179 [Description("Specifies the image colors - 1 channel = black/white, 3 channels = RGB color.")]
180 public int ImageChannels
181 {
182 get { return m_nImageCh; }
183 }
184
188 [Description("Specifies whether or not the each data point represents a real or integer number. Integer numbers are used for black/white and color images where each data point falls within the range [0 - 255].")]
189 public bool IsRealData
190 {
191 get { return m_bIsRealData; }
192 }
193
197 [Description("Specifies the number of images within this data source.")]
198 public int ImageCount
199 {
200 get { return m_nImageCount; }
201 }
202
206 [Description("Specifies the number of inactive images within this data source.")]
208 {
209 get { return m_nInactiveCount; }
210 }
211
216 public void SetInactiveImageCount(int nCount)
217 {
218 m_nInactiveCount = nCount;
219 }
220
224 [Description("Lists the number of images for each label associated with this data source.")]
225 [ReadOnly(true)]
226 public string LabelCountsAsText
227 {
228 get { return m_strLabelCounts; }
229 set { m_strLabelCounts = value; }
230 }
231
236 public override string ToString()
237 {
238 return "Source Description " + Name;
239 }
240
244 [Description("Specifies the parameters of the data source (if any).")]
246 {
247 get { return m_colParameters; }
248 set { m_colParameters = value; }
249 }
250 }
251}
The BaseDescriptor is the base class for all other descriptors, where descriptors are used to describ...
string Owner
Get/set the owner of the item.
int ID
Get/set the database ID of the item.
string Name
Get/set the name of the item.
The LabelDescriptor class describes a single label.
The ParameterDescriptorCollection class contains a list of ParameterDescriptor's.
void Add(ParameterDescriptor p)
Adds a ParameterDescriptor to the collection.
ParameterDescriptorCollection()
The ParameterDescriptorCollection constructor.
The ParameterDescriptor class describes a parameter in the database.
The SourceDescriptor class contains all information describing a data source.
int InactiveImageCount
Returns the number of inactive images within this data source.
void SetInactiveImageCount(int nCount)
Set the number of inactive images within this data source.
void Resize(int nChannels, int nHeight, int nWidth)
Resize the testing and training data sources.
int CopyOfSourceID
Get/set the Source ID from which this source was copied. If this Source is an original,...
override string ToString()
Return a string representation of thet SourceDescriptor.
bool IsRealData
Returns whether or not the each data point represents a real or integer number. Integer numbers are u...
List< LabelDescriptor > Labels
Get/set the list of LabelDescriptors that describe the labels used by the data items.
void Copy(SourceDescriptor sd)
Copy another SourceDesciptor into this one.
SourceDescriptor(string strName, bool bSaveImagesToFile)
The SourceDescriptor constructor.
int ImageWidth
Returns the width of each data item in the data source.
int ImageChannels
Returns the image colors - 1 channel = black/white, 3 channels = RGB color.
bool SaveImagesToFile
Gets whether or not the images are saved to the file system (true), or directly to the database (fals...
SourceDescriptor(SourceDescriptor s)
The SourceDescriptor constructor.
int ImageHeight
Returns the height of each data item in the data source.
ParameterDescriptorCollection Parameters
Get/set the source parameters (if any).
string LabelCountsAsText
Get/set a string that lists the number of images for each label associated with this data source.
SourceDescriptor(int nID, string strName, int nWd, int nHt, int nCh, bool bIsRealData, bool bSaveImagesToFile, int nCopyOfSourceId=0, string strOwner=null, int nCount=0, List< LabelDescriptor > rgLabels=null, string strLabelCounts=null)
The SourceDescriptor constructor.
int ImageCount
Returns the number of images within this data source.
The descriptors namespace contains all descriptor used to describe various items stored within the da...