/** @copydoc LayerParameterBase::ToProto */ public override RawProto ToProto(string strName) { RawProtoCollection rgChildren = new RawProtoCollection(); if (scale != 1.0) { rgChildren.Add("scale", scale.ToString()); } if (mirror != false) { rgChildren.Add("mirror", mirror.ToString()); } if (crop_size != 0) { rgChildren.Add("crop_size", crop_size.ToString()); } if (use_imagedb_mean != false) { rgChildren.Add("use_imagedb_mean", use_imagedb_mean.ToString()); } rgChildren.Add <double>("mean_value", mean_value); if (force_color != false) { rgChildren.Add("force_color", force_color.ToString()); } if (force_gray != false) { rgChildren.Add("force_gray", force_gray.ToString()); } if (forced_positive_range_max != 0) { rgChildren.Add("force_positive_range_max", forced_positive_range_max.ToString()); } if (mean_file != null && mean_file.Length > 0) { rgChildren.Add("mean_file", mean_file); } rgChildren.Add("color_order", m_colorOrder.ToString()); return(new RawProto(strName, "", rgChildren)); }
/// <summary> /// Convert the parameter into a RawProto. /// </summary> /// <param name="strName">Specifies the name to associate with the RawProto.</param> /// <returns>The new RawProto is returned.</returns> public override RawProto ToProto(string strName) { RawProtoCollection rgChildren = new RawProtoCollection(); if (scale != 1.0) { rgChildren.Add("scale", scale.ToString()); } if (scale_operator.HasValue) { rgChildren.Add("scale_operator", scale_operator.Value.ToString()); } if (mirror != false) { rgChildren.Add("mirror", mirror.ToString()); } if (crop_size != 0) { rgChildren.Add("crop_size", crop_size.ToString()); } if (use_imagedb_mean != false) { rgChildren.Add("use_imagedb_mean", use_imagedb_mean.ToString()); } rgChildren.Add <double>("mean_value", mean_value); if (force_color != false) { rgChildren.Add("force_color", force_color.ToString()); } if (force_gray != false) { rgChildren.Add("force_gray", force_gray.ToString()); } if (forced_positive_range_max != 0) { rgChildren.Add("force_positive_range_max", forced_positive_range_max.ToString()); } if (mean_file != null && mean_file.Length > 0) { rgChildren.Add("mean_file", mean_file); } rgChildren.Add("color_order", m_colorOrder.ToString()); if (m_resize != null) { rgChildren.Add(m_resize.ToProto("resize_param")); } if (m_noise != null) { rgChildren.Add(m_noise.ToProto("noise_param")); } if (m_distortion != null) { rgChildren.Add(m_distortion.ToProto("distortion_param")); } if (m_expansion != null) { rgChildren.Add(m_expansion.ToProto("expansion_param")); } if (m_emitConstraint != null) { rgChildren.Add(m_emitConstraint.ToProto("emit_constraint")); } if (m_mask != null) { rgChildren.Add(m_mask.ToProto("mask_param")); } if (m_labelMapping != null) { rgChildren.Add(m_labelMapping.ToProto("label_mapping")); } return(new RawProto(strName, "", rgChildren)); }