2using System.Collections.Generic;
15 [TypeConverter(typeof(ExpandableObjectConverter))]
19 bool m_bUpdateDatabase =
false;
20 bool m_bResetDatabaseLabels =
false;
21 string m_strLabelBoosts =
"";
31 [Description(
"Specifies the label mapping where the original label is mapped to the new label specified.")]
35 set { m_rgMapping.
Mappings = value; }
41 [Description(
"Specifies whether or not to directly update the database with the label mapping for the data source used - when 'false' only the 'in-memory' labels are updated. WARNING: Updating the database sets the label mapping globally and will impact all other projects using this data source.")]
44 get {
return m_bUpdateDatabase; }
45 set { m_bUpdateDatabase = value; }
51 [Description(
"Specifies whether or not to reset the database labels to the original label values for the data source used. WARNING: This resets the labels globally to their original setting and will impact all other projects using this data source.")]
54 get {
return m_bResetDatabaseLabels; }
55 set { m_bResetDatabaseLabels = value; }
61 [Description(
"DEPRECIATED: Specifies the labels for which the label boost is to be set. When set, all labels specified are given a boost such that images are selected with equal probability between all labels specified.")]
64 get {
return m_strLabelBoosts; }
65 set { m_strLabelBoosts = value; }
79 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
95 m_rgMapping = p.m_rgMapping.
Clone();
96 m_bUpdateDatabase = p.m_bUpdateDatabase;
97 m_bResetDatabaseLabels = p.m_bResetDatabaseLabels;
98 m_strLabelBoosts = p.m_strLabelBoosts;
120 if (m_bUpdateDatabase)
121 rgChildren.
Add(
new RawProto(
"update_database", (m_bUpdateDatabase) ?
"true" :
"false"));
123 if (m_bResetDatabaseLabels)
124 rgChildren.
Add(
new RawProto(
"reset_database_labels", (m_bResetDatabaseLabels) ?
"true" :
"false"));
126 if (m_strLabelBoosts !=
null && m_strLabelBoosts.Length > 0)
127 rgChildren.
Add(
new RawProto(
"label_boosts", m_strLabelBoosts));
129 return new RawProto(strName,
"", rgChildren);
143 string strUpdateDb = rp.
FindValue(
"update_database");
144 if (strUpdateDb !=
null && strUpdateDb.ToLower() ==
"true")
145 p.m_bUpdateDatabase =
true;
147 string strReset = rp.
FindValue(
"reset_database_labels");
148 if (strReset !=
null && strReset.ToLower() ==
"true")
149 p.m_bResetDatabaseLabels =
true;
151 p.m_strLabelBoosts = rp.
FindValue(
"label_boosts");
152 if (p.m_strLabelBoosts ==
null)
153 p.m_strLabelBoosts =
"";
The LabelMappingCollection manages a collection of LabelMapping's.
List< string > ToStringList()
Returns a list of strings where each entry represents a mapping.
static LabelMappingCollection Parse(string strMappings)
Parses a label mapping string into a collection of label mappings.
List< LabelMapping > Mappings
Returns the label mapping list.
LabelMappingCollection Clone()
Returns a copy of the label mapping collection.
int MapLabelWithoutBoost(int nLabel)
Returns the mapped label associated with a given label.
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.
/b DEPRECIATED (use DataLayer DataLabelMappingParameter instead) Specifies the parameters for the Lab...
static LabelMappingParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
string label_boosts
DEPRECIATED: Specifies the labels for which the label boost is to be set. When set,...
bool reset_database_labels
Specifies whether or not to reset the database labels to the original label values for the data sourc...
LabelMappingParameter()
Constructor for the parameter.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
List< LabelMapping > mapping
Specifies the label mapping where the original label is mapped to the new label specified.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
bool update_database
Specifies whether or not to directly update the database with the label mapping for the data source u...
int MapLabel(int nLabel)
Queries the mapped label for a given label.
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.db.image namespace contains all image database related classes.
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-...