/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { DetectionEvaluateParameter p = new DetectionEvaluateParameter(); p.Copy(this); return(p); }
/** @copydoc LayerParameterBase::Load */ public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); DetectionEvaluateParameter p = FromProto(proto); if (!bNewInstance) { Copy(p); } return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { DetectionEvaluateParameter p = (DetectionEvaluateParameter)src; m_nNumClasses = p.m_nNumClasses; m_nBackgroundLabelId = p.m_nBackgroundLabelId; m_fOverlapThreshold = p.m_fOverlapThreshold; m_bEvaluateDifficultGt = p.m_bEvaluateDifficultGt; m_strNameSizeFile = p.m_strNameSizeFile; if (p.m_resizeParam == null) { m_resizeParam = null; } else { m_resizeParam = p.resize_param.Clone(); } }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static DetectionEvaluateParameter FromProto(RawProto rp) { DetectionEvaluateParameter p = new DetectionEvaluateParameter(); string strVal; if ((strVal = rp.FindValue("num_classes")) != null) { p.num_classes = uint.Parse(strVal); } if ((strVal = rp.FindValue("background_label_id")) != null) { p.background_label_id = uint.Parse(strVal); } if ((strVal = rp.FindValue("overlap_threshold")) != null) { p.overlap_threshold = float.Parse(strVal); } if ((strVal = rp.FindValue("evaluate_difficult_gt")) != null) { p.evaulte_difficult_gt = bool.Parse(strVal); } p.name_size_file = rp.FindValue("name_size_file"); RawProto rpResize = rp.FindChild("resize_param"); if (rpResize != null) { p.resize_param = ResizeParameter.FromProto(rpResize); } return(p); }