MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
TripletLossParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.beta
9{
31 [Serializable]
32 [TypeConverter(typeof(ExpandableObjectConverter))]
34 {
35 double m_dfAlpha = 1.1;
36 int m_nPreGenerateTargtStart = 0;
37
40 {
41 }
42
46 public double alpha
47 {
48 get { return m_dfAlpha; }
49 set { m_dfAlpha = value; }
50 }
51
55 [Description("Specifies the starting label for pre-generated targets, only used when 'colBottom.Count' = 5, which contains centroids.")]
57 {
58 get { return m_nPreGenerateTargtStart; }
59 set { m_nPreGenerateTargtStart = value; }
60 }
61
68 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
69 {
70 RawProto proto = RawProto.Parse(br.ReadString());
72
73 if (!bNewInstance)
74 Copy(p);
75
76 return p;
77 }
78
83 public override void Copy(LayerParameterBase src)
84 {
86 m_dfAlpha = p.m_dfAlpha;
87 m_nPreGenerateTargtStart = p.m_nPreGenerateTargtStart;
88 }
89
94 public override LayerParameterBase Clone()
95 {
97 p.Copy(this);
98 return p;
99 }
100
106 public override RawProto ToProto(string strName)
107 {
108 RawProtoCollection rgChildren = new RawProtoCollection();
109
110 rgChildren.Add("alpha", alpha.ToString());
111 rgChildren.Add("pregen_label_start", pregen_label_start.ToString());
112
113 return new RawProto(strName, "", rgChildren);
114 }
115
122 {
123 string strVal;
125
126 if ((strVal = rp.FindValue("alpha")) != null)
127 p.alpha = ParseDouble(strVal);
128
129 if ((strVal = rp.FindValue("pregen_label_start")) != null)
130 p.pregen_label_start = int.Parse(strVal);
131
132 return p;
133 }
134 }
135}
static double ParseDouble(string strVal)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
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 TripletLossLayer.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
TripletLossParameter()
Constructor for the parameter.
static TripletLossParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
int pregen_label_start
Specifies the starting label for pre-generated targets, only used when 'colBottom....
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