MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
DataSequenceParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
7
15{
19 [Serializable]
20 [TypeConverter(typeof(ExpandableObjectConverter))]
22 {
23 int m_nK = 0;
24 bool m_bBalanceMatches = true;
25 int m_nCacheSize = 256;
26 bool m_bOutputLabels = true;
27 int m_nLabelCount = 0;
28 int m_nLabelStart = 0;
29
32 {
33 }
34
44 [Description("Specifies the cache size used for each labeled image cache, which should be at least 4 x the batch size used (default = 256).")]
45 public int cache_size
46 {
47 get { return m_nCacheSize; }
48 set { m_nCacheSize = value; }
49 }
50
57 [Description("Specifies the 'k' number of negatively matched labled images (default = 0, maximum = 10). When specifying 0, the output is just the anchor and a negatively matched image.")]
58 public int k
59 {
60 get { return m_nK; }
61 set { m_nK = value; }
62 }
63
67 [Description("Specifies to balance the matching image between negative and positive matches. This setting only applies when k=0 (default = true).")]
68 public bool balance_matches
69 {
70 get { return m_bBalanceMatches; }
71 set { m_bBalanceMatches = value; }
72 }
73
85 [Description("Specifies whether or not to output the labels in an additional top output where labels are organized in the same batch order and listed by tuplet order (e.g. when k = 0, balance_matches = true; anchor, positive, anchor, negative; when k = 1, anchor, positive, negative, etc")]
86 public bool output_labels
87 {
88 get { return m_bOutputLabels; }
89 set { m_bOutputLabels = value; }
90 }
91
95 [Description("Specifies the number of labels in the data set, or 0 to use dynamic label discovery (requires large enough batch sizes to cover all labels within first batch) - (default = 0).")]
96 public int label_count
97 {
98 get { return m_nLabelCount; }
99 set { m_nLabelCount = value; }
100 }
101
105 [Description("Specifies the first label in the label set (default = 0).")]
106 public int label_start
107 {
108 get { return m_nLabelStart; }
109 set { m_nLabelStart = value; }
110 }
111
118 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
119 {
120 RawProto proto = RawProto.Parse(br.ReadString());
122
123 if (!bNewInstance)
124 Copy(p);
125
126 return p;
127 }
128
133 public override void Copy(LayerParameterBase src)
134 {
136 m_nCacheSize = p.m_nCacheSize;
137 m_nK = p.m_nK;
138 m_bOutputLabels = p.m_bOutputLabels;
139 m_nLabelStart = p.m_nLabelStart;
140 m_nLabelCount = p.m_nLabelCount;
141 m_bBalanceMatches = p.m_bBalanceMatches;
142 }
143
148 public override LayerParameterBase Clone()
149 {
151 p.Copy(this);
152 return p;
153 }
154
160 public override RawProto ToProto(string strName)
161 {
162 RawProtoCollection rgChildren = new RawProtoCollection();
163
164 rgChildren.Add("cache_size", cache_size.ToString());
165 rgChildren.Add("k", k.ToString());
166 rgChildren.Add("output_labels", output_labels.ToString());
167 rgChildren.Add("label_count", label_count.ToString());
168 rgChildren.Add("label_start", label_start.ToString());
169 rgChildren.Add("balance_matches", balance_matches.ToString());
170
171 return new RawProto(strName, "", rgChildren);
172 }
173
180 {
181 string strVal;
183
184 if ((strVal = rp.FindValue("cache_size")) != null)
185 p.cache_size = int.Parse(strVal);
186
187 if ((strVal = rp.FindValue("k")) != null)
188 p.k = int.Parse(strVal);
189
190 if ((strVal = rp.FindValue("output_labels")) != null)
191 p.output_labels = bool.Parse(strVal);
192
193 if ((strVal = rp.FindValue("label_count")) != null)
194 p.label_count = int.Parse(strVal);
195
196 if ((strVal = rp.FindValue("label_start")) != null)
197 p.label_start = int.Parse(strVal);
198
199 if ((strVal = rp.FindValue("balance_matches")) != null)
200 p.balance_matches = bool.Parse(strVal);
201
202 return p;
203 }
204 }
205}
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.
Definition: RawProto.cs:17
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
Definition: RawProto.cs:306
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Definition: RawProto.cs:105
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the DataSequenceLayer.
int label_count
Specifies the number of labels in the data set, or 0 to use dynamic label discovery (requires large e...
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
int cache_size
Specifies the cache size used for each labeled image cache, which should be at least 4 x the batch si...
int k
Specifies the 'k' number of negatively matched labled images (default = 0, maximum = 10)....
static DataSequenceParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
bool balance_matches
Specifies to balance the matching image between negative and positive matches. This setting only appl...
override void Copy(LayerParameterBase src)
Copy on parameter to another.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
int label_start
Specifies the first label in the label set (default = 0).
DataSequenceParameter()
Constructor for the parameter.
bool output_labels
Specifies whether or not to output the labels in an additional top output. (default = true).
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.param.beta parameters are used by the MyCaffe.layer.beta layers.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12