/// <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); }
/// <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 new SaveOutputParameter FromProto(RawProto rp) { SaveOutputParameter p = new SaveOutputParameter(false); string strVal; RawProto rpOption = rp.FindChild("option"); if (rpOption != null) { ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption)); } if ((strVal = rp.FindValue("output_directory")) != null) { p.output_directory = strVal; } if ((strVal = rp.FindValue("output_name_prefix")) != null) { p.output_name_prefix = strVal; } if ((strVal = rp.FindValue("output_format")) != null) { if (strVal == OUTPUT_FORMAT.VOC.ToString()) { p.output_format = OUTPUT_FORMAT.VOC; } else if (strVal == OUTPUT_FORMAT.COCO.ToString()) { p.output_format = OUTPUT_FORMAT.COCO; } else { throw new Exception("Unknown output_format '" + strVal + "'!"); } } if ((strVal = rp.FindValue("label_map_file")) != null) { p.label_map_file = strVal; } if ((strVal = rp.FindValue("name_size_file")) != null) { p.name_size_file = strVal; } if ((strVal = rp.FindValue("num_test_image")) != null) { p.num_test_image = uint.Parse(strVal); } RawProto rpResize = rp.FindChild("resize_param"); if (rpResize != null) { p.resize_param = ResizeParameter.FromProto(rpResize); } return(p); }