/// <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 SaltPepperParameter FromProto(RawProto rp)
        {
            SaltPepperParameter p = new SaltPepperParameter(false);
            string strVal;

            RawProto rpOption = rp.FindChild("option");

            if (rpOption != null)
            {
                ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption));
            }

            if ((strVal = rp.FindValue("fraction")) != null)
            {
                p.fraction = float.Parse(strVal);
            }

            p.value = new List <float>();
            RawProtoCollection col = rp.FindChildren("value");

            foreach (RawProto rp1 in col)
            {
                if ((strVal = rp.FindValue("value")) != null)
                {
                    p.value.Add(float.Parse(strVal));
                }
            }

            return(p);
        }
        /// <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));
        }
Example #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)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            if (height.HasValue)
            {
                rgChildren.Add("height", height.ToString());
            }
            if (width.HasValue)
            {
                rgChildren.Add("width", width.ToString());
            }
            if (zoom_factor.HasValue)
            {
                rgChildren.Add("zoom_factor", zoom_factor.ToString());
            }
            if (shrink_factor.HasValue)
            {
                rgChildren.Add("shrink_factor", shrink_factor.ToString());
            }
            rgChildren.Add("pad_beg", pad_beg.ToString());
            rgChildren.Add("pad_end", pad_end.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Example #4
0
        /// <summary>
        /// Collect the inputs from the RawProto.
        /// </summary>
        /// <param name="rp">Specifies the raw proto.</param>
        /// <returns>A dictionary of the inputs and their shapes is returned.</returns>
        public static Dictionary <string, BlobShape> InputFromProto(RawProto rp)
        {
            List <string>    rgstrInput = rp.FindArray <string>("input");
            List <BlobShape> rgShape    = new List <BlobShape>();

            RawProtoCollection rgp = rp.FindChildren("input_shape");

            foreach (RawProto rpChild in rgp)
            {
                rgShape.Add(BlobShape.FromProto(rpChild));
            }

            if (rgstrInput.Count != rgShape.Count)
            {
                throw new Exception("The input array and shape array must have the same count!");
            }

            Dictionary <string, BlobShape> rgInput = new Dictionary <string, BlobShape>();

            for (int i = 0; i < rgstrInput.Count; i++)
            {
                rgInput.Add(rgstrInput[i], rgShape[i]);
            }

            return(rgInput);
        }
        /// <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("loc_loss_type", loc_loss_type.ToString()));
            rgChildren.Add(new RawProto("conf_loss_type", conf_loss_type.ToString()));
            rgChildren.Add(new RawProto("loc_weight", loc_weight.ToString()));
            rgChildren.Add(new RawProto("num_classes", num_classes.ToString()));
            rgChildren.Add(new RawProto("share_location", share_location.ToString()));
            rgChildren.Add(new RawProto("match_type", match_type.ToString()));
            rgChildren.Add(new RawProto("overlap_threshold", overlap_threshold.ToString()));
            rgChildren.Add(new RawProto("background_label_id", background_label_id.ToString()));
            rgChildren.Add(new RawProto("use_difficult_gt", use_difficult_gt.ToString()));
            rgChildren.Add(new RawProto("do_neg_mining", do_neg_mining.ToString()));
            rgChildren.Add(new RawProto("neg_pos_ratio", neg_pos_ratio.ToString()));
            rgChildren.Add(new RawProto("neg_overlap", neg_overlap.ToString()));
            rgChildren.Add(new RawProto("code_type", code_type.ToString()));
            rgChildren.Add(new RawProto("encode_variance_in_target", encode_variance_in_target.ToString()));
            rgChildren.Add(new RawProto("map_object_to_agnostic", map_object_to_agnostic.ToString()));
            rgChildren.Add(new RawProto("ignore_cross_boundary_bbox", ignore_cross_boundary_bbox.ToString()));
            rgChildren.Add(new RawProto("bp_inside", bp_inside.ToString()));
            rgChildren.Add(new RawProto("mining_type", mining_type.ToString()));
            rgChildren.Add(nms_param.ToProto("nms_param"));
            rgChildren.Add(new RawProto("sample_size", sample_size.ToString()));
            rgChildren.Add(new RawProto("use_prior_for_nms", use_prior_for_nms.ToString()));

            return(new RawProto(strName, "", rgChildren));
        }
Example #6
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());
            rgChildren.Add("label_channels", label_channels.ToString());
            rgChildren.Add("label_height", label_height.ToString());
            rgChildren.Add("label_width", label_width.ToString());

            if (label_type != LABEL_TYPE.SINGLE)
            {
                rgChildren.Add("label_type", label_type.ToString());
            }

            if (primary_data == false)
            {
                rgChildren.Add("primary_data", primary_data.ToString());
            }

            if (m_nClipLength1 > 0)
            {
                rgChildren.Add("clip_length1", m_nClipLength1.ToString());
            }

            if (m_nClipLength2 > 0)
            {
                rgChildren.Add("clip_length2", m_nClipLength2.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #7
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));
        }
Example #8
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("num_output", num_output.ToString());
            rgChildren.Add("bias_term", bias_term.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("axis", axis.ToString());

            if (transpose != false)
            {
                rgChildren.Add("tranpose", transpose.ToString());
            }

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

            if (m_fMinJaccardOverlap.HasValue)
            {
                rgChildren.Add(new RawProto("min_jaccard_overlap", m_fMinJaccardOverlap.Value.ToString()));
            }
            if (m_fMaxJaccardOverlap.HasValue)
            {
                rgChildren.Add(new RawProto("max_jaccard_overlap", m_fMaxJaccardOverlap.Value.ToString()));
            }

            if (m_fMinSampleCoverage.HasValue)
            {
                rgChildren.Add(new RawProto("min_sample_coverage", m_fMinSampleCoverage.Value.ToString()));
            }
            if (m_fMaxSampleCoverage.HasValue)
            {
                rgChildren.Add(new RawProto("max_sample_coverage", m_fMaxSampleCoverage.Value.ToString()));
            }

            if (m_fMinObjectCoverage.HasValue)
            {
                rgChildren.Add(new RawProto("min_object_coverage", m_fMinObjectCoverage.Value.ToString()));
            }
            if (m_fMaxObjectCoverage.HasValue)
            {
                rgChildren.Add(new RawProto("max_object_coverage", m_fMaxObjectCoverage.Value.ToString()));
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #10
0
        /// <summary>
        /// Convert the parameter into a RawProto.
        /// </summary>
        /// <param name="strName">Specifies the base name for the raw proto.</param>
        /// <returns>The RawProto is returned.</returns>
        public override RawProto ToProto(string strName)
        {
            RawProto           rpBase     = base.ToProto("engine");
            RawProtoCollection rgChildren = new RawProtoCollection();
            KernelParameter    p          = new KernelParameter();

            rgChildren.Add(rpBase.Children);
            rgChildren.Add <uint>("kernel_size", m_rgKernelSize);
            rgChildren.Add <uint>("stride", m_rgStride);
            rgChildren.Add <uint>("pad", m_rgPad);

            if (m_rgDilation.Count > 0)
            {
                rgChildren.Add <uint>("dilation", m_rgDilation);
            }

            rgChildren.Add("kernel_h", m_nKernelH);
            rgChildren.Add("kernel_w", m_nKernelW);
            rgChildren.Add("stride_h", m_nStrideH);
            rgChildren.Add("stride_w", m_nStrideW);
            rgChildren.Add("pad_h", m_nPadH);
            rgChildren.Add("pad_w", m_nPadW);

            return(new RawProto(strName, "", rgChildren));
        }
Example #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();

            if (margin != 1.0)
            {
                rgChildren.Add("margin", margin.ToString());
            }

            if (legacy_version != false)
            {
                rgChildren.Add("legacy_version", legacy_version.ToString());
            }

            if (output_matches)
            {
                rgChildren.Add("output_matches", output_matches.ToString());
            }

            if (centroid_learning != CENTROID_LEARNING.NONE)
            {
                rgChildren.Add("centroid_learning", centroid_learning.ToString());
            }

            rgChildren.Add("distance_calculation", distance_calculation.ToString());
            rgChildren.Add("matching_distance_scale", matching_distance_scale.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Example #12
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));
        }
Example #14
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));
        }
Example #15
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));
        }
Example #16
0
        /** @copydoc BaseParameter */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("name", name, RawProto.TYPE.STRING);
            rgChildren.Add <string>("input", input);

            foreach (BlobShape bs in input_shape)
            {
                rgChildren.Add(bs.ToProto("input_shape"));
            }

            rgChildren.Add <int>("input_dim", input_dim);

            if (force_backward != false)
            {
                rgChildren.Add("force_backward", force_backward.ToString());
            }

//            rgChildren.Add(state.ToProto("state"));

            if (debug_info != false)
            {
                rgChildren.Add("debug_info", debug_info.ToString());
            }

            foreach (LayerParameter lp in layer)
            {
                rgChildren.Add(lp.ToProto("layer"));
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #17
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 <float>("min_size", min_size);
            rgChildren.Add <float>("max_size", max_size);
            rgChildren.Add <float>("aspect_ratio", aspect_ratio);
            rgChildren.Add("flip", flip.ToString());
            rgChildren.Add("clip", clip.ToString());
            rgChildren.Add <float>("variance", variance);

            if (img_size.HasValue)
            {
                rgChildren.Add("img_size", img_size.Value.ToString());
            }
            else
            {
                rgChildren.Add("img_h", img_h.Value.ToString());
                rgChildren.Add("img_w", img_w.Value.ToString());
            }

            if (step.HasValue)
            {
                rgChildren.Add("step", step.Value.ToString());
            }
            else
            {
                rgChildren.Add("step_h", step_h.Value.ToString());
                rgChildren.Add("step_w", step_w.Value.ToString());
            }

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

            return(new RawProto(strName, "", rgChildren));
        }
Example #18
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();

            foreach (FillerParameter fp in data_filler)
            {
                rgChildren.Add(fp.ToProto("data_filler"));
            }

            foreach (BlobShape bs in shape)
            {
                rgChildren.Add(bs.ToProto("shape"));
            }

            rgChildren.Add <uint>("num", num);
            rgChildren.Add <uint>("channels", channels);
            rgChildren.Add <uint>("height", height);
            rgChildren.Add <uint>("width", width);

            if (primary_data == false)
            {
                rgChildren.Add("primary_data", primary_data.ToString());
            }

            if (force_refill == true)
            {
                rgChildren.Add("force_refill", force_refill.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #19
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 (rand_skip > 0)
            {
                rgChildren.Add("rand_skip", rand_skip.ToString());
            }

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

            if (new_height > 0)
            {
                rgChildren.Add("new_height", new_height.ToString());
            }

            if (new_width > 0)
            {
                rgChildren.Add("new_width", new_width.ToString());
            }

            rgChildren.Add("is_color", is_color.ToString());
            rgChildren.Add("root_folder", "\"" + root_folder + "\"");

            return(new RawProto(strName, "", rgChildren));
        }
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <param name="p">Optionally, specifies an instance to load.  If <i>null</i>, a new instance is created and loaded.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static HDF5DataParameter FromProto(RawProto rp, HDF5DataParameter p = null)
        {
            string strVal;

            if (p == null)
                p = new HDF5DataParameter();

            if ((strVal = rp.FindValue("source")) != null)
                p.source = strVal.Trim('\"');

            if ((strVal = rp.FindValue("batch_size")) != null)
                p.batch_size = uint.Parse(strVal);

            if ((strVal = rp.FindValue("shuffle")) != null)
                p.shuffle = bool.Parse(strVal);

            p.m_rgExpectedTopShapes = new List<BlobShape>();
            RawProtoCollection colExpectedTopShapes = rp.FindChildren("expected_top_shape");
            foreach (RawProto rp1 in colExpectedTopShapes)
            {
                p.m_rgExpectedTopShapes.Add(BlobShape.FromProto(rp1));
            }

            return p;
        }
Example #21
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("resize_mode", m_mode.ToString()));
            rgChildren.Add(new RawProto("pad_mode", m_pad.ToString()));
            rgChildren.Add(new RawProto("height", m_nHeight.ToString()));
            rgChildren.Add(new RawProto("width", m_nWidth.ToString()));
            rgChildren.Add(new RawProto("height_scale", m_nHeightScale.ToString()));
            rgChildren.Add(new RawProto("width_scale", m_nWidthScale.ToString()));

            foreach (InterpMode interp in m_rgInterp)
            {
                rgChildren.Add(new RawProto("interp_mode", interp.ToString()));
            }

            foreach (float fPad in m_rgfPadValue)
            {
                rgChildren.Add(new RawProto("pad_value", fPad.ToString()));
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #22
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("num_output", m_nNumOutput.ToString());

            if (m_dfClippingThreshold != 0)
            {
                rgChildren.Add("clipping_threshold", m_dfClippingThreshold.ToString());
            }

            rgChildren.Add(m_fillerWeights.ToProto("weight_filler"));
            rgChildren.Add(m_fillerBias.ToProto("bias_filler"));

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

            if (m_bEnableClockworkForgetGateBias != false)
            {
                rgChildren.Add("enable_clockwork_forgetgate_bias", m_bEnableClockworkForgetGateBias.ToString());
            }

            return(new RawProto(strName, "", rgChildren));
        }
Example #23
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("source", "\"" + source + "\"");
            rgChildren.Add("batch_size", batch_size.ToString());
            rgChildren.Add("backend", backend.ToString());

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

            rgChildren.Add("enable_random_selection", enable_random_selection.GetValueOrDefault(true).ToString());

            if (enable_pair_selection.GetValueOrDefault(false) == true)
            {
                rgChildren.Add("enable_pair_selection", enable_pair_selection.Value.ToString());
            }

            if (display_timing == true)
            {
                rgChildren.Add("display_timing", display_timing.ToString());
            }

            if (load_multiple_labels == true)
            {
                rgChildren.Add("load_multiple_labels", load_multiple_labels.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 virtual RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

            rgChildren.Add("active", m_bActive.ToString());

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

            rgChildren.Add <int>("dim", m_rgDim);

            return(new RawProto(strName, "", rgChildren));
        }
Example #26
0
        /** @copydoc LayerParameterBase::ToProto */
        public override RawProto ToProto(string strName)
        {
            RawProtoCollection rgChildren = new RawProtoCollection();

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

            return(new RawProto(strName, "", rgChildren));
        }
Example #27
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("norm", m_norm.ToString());

            return(new RawProto(strName, "", rgChildren));
        }
Example #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("threshold", threshold.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(m_shape.ToProto("shape"));

            return(new RawProto(strName, "", rgChildren));
        }
Example #30
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);
        }