MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
DummyDataParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7using MyCaffe.common;
8
9namespace MyCaffe.param
10{
16 [Serializable]
17 [TypeConverter(typeof(ExpandableObjectConverter))]
19 {
20 List<FillerParameter> m_rgFillers = new List<FillerParameter>();
21 List<BlobShape> m_rgShape = new List<BlobShape>();
22 List<uint> m_rgNum = new List<uint>();
23 List<uint> m_rgChannels = new List<uint>();
24 List<uint> m_rgHeight = new List<uint>();
25 List<uint> m_rgWidth = new List<uint>();
26 bool m_bPrimaryData = true;
27 bool m_bForceRefill = true;
28
31 {
32 }
33
41 public bool force_refill
42 {
43 get { return m_bForceRefill; }
44 set { m_bForceRefill = value; }
45 }
46
50 [Category("Data Selection"), Description("Specifies whether or not this data is the primary dataset as opposed to the target dataset. By default, this is set to 'true'.")]
51 public bool primary_data
52 {
53 get { return m_bPrimaryData; }
54 set { m_bPrimaryData = value; }
55 }
56
60 [Description("Specifies the data fillers used to fill the data. If no data fillers are specified, the constant filler is used.")]
61 public List<FillerParameter> data_filler
62 {
63 get { return m_rgFillers; }
64 set { m_rgFillers = value; }
65 }
66
74 [Description("Specifies the shape of the dummy data where: shape(0) = num; shape(1) = channels; shape(2) = height; shape(3) = width.")]
75 public List<BlobShape> shape
76 {
77 get { return m_rgShape; }
78 set { m_rgShape = value; }
79 }
80
84 [Description("DEPRECIATED: use 'shape(0)' instead.")]
85 public List<uint> num
86 {
87 get { return m_rgNum; }
88 set { m_rgNum = value; }
89 }
90
94 [Description("DEPRECIATED: use 'shape(1)' instead.")]
95 public List<uint> channels
96 {
97 get { return m_rgChannels; }
98 set { m_rgChannels = value; }
99 }
100
104 [Description("DEPRECIATED: use 'shape(2)' instead.")]
105 public List<uint> height
106 {
107 get { return m_rgHeight; }
108 set { m_rgHeight = value; }
109 }
110
114 [Description("DEPRECIATED: use 'shape(3)' instead.")]
115 public List<uint> width
116 {
117 get { return m_rgWidth; }
118 set { m_rgWidth = value; }
119 }
120
122 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
123 {
124 RawProto proto = RawProto.Parse(br.ReadString());
125 DummyDataParameter p = FromProto(proto);
126
127 if (!bNewInstance)
128 Copy(p);
129
130 return p;
131 }
132
134 public override void Copy(LayerParameterBase src)
135 {
137 m_rgFillers = Utility.Clone<FillerParameter>(p.m_rgFillers);
138 m_rgShape = Utility.Clone<BlobShape>(p.m_rgShape);
139 m_rgNum = Utility.Clone<uint>(p.m_rgNum);
140 m_rgChannels = Utility.Clone<uint>(p.m_rgChannels);
141 m_rgHeight = Utility.Clone<uint>(p.m_rgHeight);
142 m_rgWidth = Utility.Clone<uint>(p.m_rgWidth);
143 m_bPrimaryData = p.m_bPrimaryData;
144 m_bForceRefill = p.m_bForceRefill;
145 }
146
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 foreach (FillerParameter fp in data_filler)
165 {
166 rgChildren.Add(fp.ToProto("data_filler"));
167 }
168
169 foreach (BlobShape bs in shape)
170 {
171 rgChildren.Add(bs.ToProto("shape"));
172 }
173
174 rgChildren.Add<uint>("num", num);
175 rgChildren.Add<uint>("channels", channels);
176 rgChildren.Add<uint>("height", height);
177 rgChildren.Add<uint>("width", width);
178
179 if (primary_data == false)
180 rgChildren.Add("primary_data", primary_data.ToString());
181
182 if (force_refill == true)
183 rgChildren.Add("force_refill", force_refill.ToString());
184
185 return new RawProto(strName, "", rgChildren);
186 }
187
194 {
197
198 rgp = rp.FindChildren("data_filler");
199 foreach (RawProto child in rgp)
200 {
201 p.data_filler.Add(FillerParameter.FromProto(child));
202 }
203
204 rgp = rp.FindChildren("shape");
205 foreach (RawProto child in rgp)
206 {
207 p.shape.Add(BlobShape.FromProto(child));
208 }
209
210 p.num = rp.FindArray<uint>("num");
211 p.channels = rp.FindArray<uint>("channels");
212 p.height = rp.FindArray<uint>("height");
213 p.width = rp.FindArray<uint>("width");
214
215 string strVal;
216 if ((strVal = rp.FindValue("primary_data")) != null)
217 p.primary_data = bool.Parse(strVal);
218
219 if ((strVal = rp.FindValue("force_refill")) != null)
220 p.force_refill = bool.Parse(strVal);
221
222 return p;
223 }
224 }
225}
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
RawProtoCollection FindChildren(params string[] rgstrName)
Searches for all children with a given name in this node's children.
Definition: RawProto.cs:263
The Utility class provides general utility funtions.
Definition: Utility.cs:35
Specifies the shape of a Blob.
Definition: BlobShape.cs:15
override RawProto ToProto(string strName)
Converts the BlobShape to a RawProto.
Definition: BlobShape.cs:153
static BlobShape FromProto(RawProto rp)
Parse a new BlobShape from a RawProto.
Definition: BlobShape.cs:167
This layer produces N >= 1 top blobs. DummyDataParameter must specify 1 or shape fields,...
List< uint > width
DEPRECIATED - 4D dimensions, use 'shape' instead.
bool primary_data
(optional, default = true) Specifies whether or not the data is the primary datset as opposed to a se...
static DummyDataParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
List< FillerParameter > data_filler
If 0 data fillers are specified, ConstantFiller
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
List< BlobShape > shape
Specifies the shape of the dummy data where: shape(0) = num shape(1) = channels shape(2) = height sha...
List< uint > num
DEPRECIATED - 4D dimensions, use 'shape' instead.
bool force_refill
(optional, default = true) Specifies whether to force refill the data (even constant data) as opposed...
List< uint > channels
DEPRECIATED - 4D dimensions, use 'shape' instead.
DummyDataParameter()
Constructor for the parameter.
List< uint > height
>DEPRECIATED - 4D dimensions, use 'shape' instead.
Specifies the filler parameters used to create each Filler.
static FillerParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.common namespace contains common MyCaffe classes.
Definition: BatchInput.cs:8
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12