2using System.Collections.Generic;
20 [TypeConverter(typeof(ExpandableObjectConverter))]
23 int m_nMaxBatchesToStore = 10;
35 [Description(
"Specifies the number of output items (e.g. classes).")]
38 get {
return m_nOutput; }
39 set { m_nOutput = value; }
45 [Description(
"Specifies the number of nearest neighbors to compare per class, selected from items with the shortest distance. The default = 100, which selects the class with the highest count from the 10 shortest distances. It is recommended that K > ((2 * num_output) + 1) or convergence may not occur.")]
55 [Description(
"Specifies the maximum number of batches to store and search for neighbors. Each batch input is stored until the maximum count is reached at which time, the oldest batch is released. A larger max value = more GPU memory used.")]
58 get {
return m_nMaxBatchesToStore; }
59 set { m_nMaxBatchesToStore = value; }
68 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
86 m_nOutput = p.m_nOutput;
88 m_nMaxBatchesToStore = p.m_nMaxBatchesToStore;
112 rgChildren.
Add(
"k",
k.ToString());
115 return new RawProto(strName,
"", rgChildren);
128 if ((strVal = rp.
FindValue(
"num_output")) !=
null)
131 if ((strVal = rp.
FindValue(
"k")) !=
null)
132 p.
k =
int.Parse(strVal);
134 if ((strVal = rp.
FindValue(
"max_stored_batches")) !=
null)
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.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the KnnLayer.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
int max_stored_batches
Specifies the maximum number of batches to store before releasing batches.
int num_output
Specifies the number of output items (e.g. classes)
override void Copy(LayerParameterBase src)
Copy on parameter to another.
int k
Specifies the 'k' number of nearest neighbors to compare (per class).
KnnParameter()
Constructor for the parameter.
static KnnParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
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-...