Exemplo n.º 1
0
        /// <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 (out_max_val != false)
            {
                rgChildren.Add("out_max_val", out_max_val.ToString());
            }

            if (top_k != 1)
            {
                rgChildren.Add("top_k", top_k.ToString());
            }

            if (axis.HasValue)
            {
                rgChildren.Add("axis", axis.Value.ToString());
            }

            if (operation != COMPARE_OPERATOR.MAX)
            {
                rgChildren.Add("operation", operation.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 2
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            if (discount_rate != 0.99)
            {
                rgChildren.Add("discount_rate", discount_rate.ToString());
            }

            if (exploration_rate_start != 0.6)
            {
                rgChildren.Add("exploration_rate_start", exploration_rate_start.ToString());
            }

            if (exploration_rate_end != 0.4)
            {
                rgChildren.Add("exploration_rate_end", exploration_rate_end.ToString());
            }

            if (exploration_rate_decay != 6.0)
            {
                rgChildren.Add("exploration_rate_decay", exploration_rate_decay.ToString());
            }

            if (training_step != 4)
            {
                rgChildren.Add("training_step", training_step.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 3
0
        /// <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)
        {
            RawProto           rpBase     = base.ToProto("engine");
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(rpBase.Children);
            rgChildren.Add("num_output", num_output.ToString());

            if (weight_filler != null)
            {
                rgChildren.Add(weight_filler.ToProto("weight_filler"));
            }

            if (bias_filler != null)
            {
                rgChildren.Add(bias_filler.ToProto("bias_filler"));
            }

            rgChildren.Add("debug_info", debug_info.ToString());
            rgChildren.Add("expose_hidden", expose_hidden.ToString());

            if (engine != Engine.CAFFE)
            {
                rgChildren.Add("dropout_ratio", dropout_ratio.ToString());
                rgChildren.Add("dropout_seed", dropout_seed.ToString());
                rgChildren.Add("num_layers", num_layers.ToString());
            }

            rgChildren.Add("cudnn_enable_tensor_cores", cudnn_enable_tensor_cores.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();
            List <string>      rgstrStep  = new List <string>();

            for (int i = 0; i < m_rgNormalizationSteps.Count; i++)
            {
                rgstrStep.Add(steps[i].ToString().ToLower());
            }

            rgChildren.Add <string>("step", rgstrStep);
            rgChildren.Add("across_data_and_label", "\"" + across_data_and_label.ToString() + "\"");
            rgChildren.Add <int>("ignore_ch", ignore_channels);
            rgChildren.Add("input_min", input_min.ToString());
            rgChildren.Add("input_max", input_max.ToString());
            rgChildren.Add("output_min", output_min.ToString());
            rgChildren.Add("output_max", output_max.ToString());

            if (input_mean.HasValue)
            {
                rgChildren.Add("input_mean", input_mean.Value.ToString());
            }

            if (input_stdev.HasValue)
            {
                rgChildren.Add("input_stdev", input_stdev.Value.ToString());
            }

            if (label_data_channel.HasValue)
            {
                rgChildren.Add("label_data_channel", label_data_channel.Value.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 5
0
        /// <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 (top_k != 1)
            {
                rgChildren.Add("top_k", top_k.ToString());
            }

            if (axis != 1)
            {
                rgChildren.Add("axis", axis.ToString());
            }

            if (m_rgnIgnoreLabel.Count > 0)
            {
                if (m_rgnIgnoreLabel.Count == 1)
                {
                    rgChildren.Add("ignore_label", m_rgnIgnoreLabel[0]);
                }
                else
                {
                    rgChildren.Add("ignore_labels", Utility.ToString <int>(m_rgnIgnoreLabel));
                }
            }

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Converts a NetStateRule into a RawProto.
        /// </summary>
        /// <param name="strName">Specifies a name given to the RawProto.</param>
        /// <returns>The new RawProto representing the NetStateRule is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("phase", phase.ToString());

            if (min_level.HasValue)
            {
                rgChildren.Add("min_level", min_level);
            }

            if (max_level.HasValue)
            {
                rgChildren.Add("max_level", max_level);
            }

            if (stage.Count > 0)
            {
                rgChildren.Add <string>("stage", stage);
            }

            if (not_stage.Count > 0)
            {
                rgChildren.Add <string>("not_stage", not_stage);
            }

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 7
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("alpha", alpha.ToString());
            rgChildren.Add("separate", separate.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Convert this object to a raw proto.
        /// </summary>
        /// <param name="strName">Specifies the name of the proto.</param>
        /// <returns>The new proto is returned.</returns>
        public RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(new RawProto("prob", prob.ToString()));
            rgChildren.Add(new RawProto("max_expand_ratio", max_expand_ratio.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
        /// <summary>
        /// Convert the DataDebugParameter into a RawProto.
        /// </summary>
        /// <param name="strName">Specifies the RawProto name.</param>
        /// <returns>The RawProto containing the settings is returned.</returns>
        public RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("iterations", m_nIterations.ToString());
            rgChildren.Add("debug_data_path", debug_save_path_persist);

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 10
0
        /// <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();

            rgChildren.Add("min", min.ToString());
            rgChildren.Add("max", max.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 11
0
        /// <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();

            rgChildren.Add("alpha", alpha.ToString());
            rgChildren.Add("pregen_label_start", pregen_label_start.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 12
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("axis", axis.ToString());
            rgChildren.Add("tiles", tiles.ToString());

            return new RawProto(strName, "", rgChildren);
        }
Exemplo n.º 13
0
        /// <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();

            rgChildren.Add("axis", axis.ToString());
            rgChildren.Add("mean_error_type", mean_error_type.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Convert this object to a raw proto.
        /// </summary>
        /// <param name="strName">Specifies the name of the proto.</param>
        /// <returns>The new proto is returned.</returns>
        public RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(new RawProto("emit_type", m_emitType.ToString()));
            rgChildren.Add(new RawProto("emit_overlap", m_fEmitOverlap.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();

            rgChildren.Add("alpha_in", alpha_in.ToString());
            rgChildren.Add("alpha_out", alpha_out.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Converts this NetState to a RawProto.
        /// </summary>
        /// <param name="strName">Specifies a name given to the RawProto.</param>
        /// <returns>The new RawProto representing the NetState is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("phase", phase.ToString());
            rgChildren.Add("level", level.ToString());
            rgChildren.Add <string>("stage", stage);

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 17
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("power", power.ToString());
            rgChildren.Add("scale", scale.ToString());
            rgChildren.Add("shift", shift.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
        /// <summary>
        /// Convert the DataLabelMappingParameter into a RawProto.
        /// </summary>
        /// <param name="strName">Specifies the RawProto name.</param>
        /// <returns>The RawProto containing the settings is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProto           rpBase     = base.ToProto("option");
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(rpBase);
            rgChildren.Add <string>("mapping", m_rgMapping.ToStringList());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 19
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("num_output", num_output.ToString());
            rgChildren.Add("k", k.ToString());
            rgChildren.Add("max_stored_batches", max_stored_batches.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 20
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("value", m_dfVal.ToString());
            rgChildren.Add("operation", m_op.ToString());
            rgChildren.Add("passthrough_gradient", passthrough_gradient.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
        /// <summary>
        /// Convert this object to a raw proto.
        /// </summary>
        /// <param name="strName">Specifies the name of the proto.</param>
        /// <returns>The new proto is returned.</returns>
        public RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(new RawProto("nms_threshold", nms_threshold.ToString()));
            rgChildren.Add(new RawProto("top_k", top_k.ToString()));
            rgChildren.Add(new RawProto("eta", eta.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 22
0
        /** @copydoc EngineParameter::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProto           rpBase     = base.ToProto("engine");
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(rpBase.Children);
            rgChildren.Add("method", pool.ToString());
            rgChildren.Add("pyramid_height", pyramid_height.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();

            rgChildren.Add("across_spatial", m_bAcrossSpatial.ToString());
            rgChildren.Add("channel_shared", m_bChannelShared.ToString());
            rgChildren.Add("esp", m_fEps.ToString());
            rgChildren.Add(scale_filler.ToProto("scale_filler"));

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 24
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("batch_size", batch_size.ToString());
            rgChildren.Add("channels", channels.ToString());
            rgChildren.Add("height", height.ToString());
            rgChildren.Add("width", width.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Convert this object to a raw proto.
        /// </summary>
        /// <param name="strName">Specifies the name of the proto.</param>
        /// <returns>The new proto is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProto           rpBase     = base.ToProto("option");
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(rpBase);
            rgChildren.Add(new RawProto("emit_type", m_emitType.ToString()));
            rgChildren.Add(new RawProto("emit_overlap", m_fEmitOverlap.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Converts the Sample to a RawProto.
        /// </summary>
        /// <param name="strName">Specifies a name for the RawProto.</param>
        /// <returns>A new RawProto representing the Sample is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(new RawProto("min_scale", m_fMinScale.ToString()));
            rgChildren.Add(new RawProto("max_scale", m_fMaxScale.ToString()));
            rgChildren.Add(new RawProto("min_aspect_ratio", m_fMinAspectRatio.ToString()));
            rgChildren.Add(new RawProto("max_aspect_ratio", m_fMaxAspectRatio.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 27
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("lower_bound", lower_bound.ToString());
            rgChildren.Add("upper_bound", upper_bound.ToString());
            rgChildren.Add("alpha", alpha.ToString());
            rgChildren.Add("max_iter", max_iter.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 28
0
        /// <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();

            rgChildren.Add("axis", axis.ToString());
            rgChildren.Add("alpha", alpha.ToString());
            rgChildren.Add("beta", beta.ToString());
            rgChildren.Add("disable_scaling_on_gradient", disable_scaling_on_gradient.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Convert this object to a raw proto.
        /// </summary>
        /// <param name="strName">Specifies the name of the proto.</param>
        /// <returns>The new proto is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProto           rpBase     = base.ToProto("option");
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add(rpBase);
            rgChildren.Add(new RawProto("active", Active.ToString()));
            rgChildren.Add(new RawProto("prob", prob.ToString()));
            rgChildren.Add(new RawProto("max_expand_ratio", max_expand_ratio.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
Exemplo n.º 30
0
        /// <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();

            rgChildren.Add("axis", axis.ToString());
            rgChildren.Add("num_output", num_output.ToString());
            rgChildren.Add("min", min.ToString());
            rgChildren.Add("max", max.ToString());
            rgChildren.Add("min_axes", min_axes.ToString());

            return(new RawProto(strName, "", rgChildren));
        }