Exemple #1
0
        /// <summary>
        /// The ParseConfigurationString method parses a deep draw configuration string into the actual settings.
        /// </summary>
        /// <param name="strConfig">Specifies the configuration string to parse.</param>
        /// <param name="nWd">Returns the input width.</param>
        /// <param name="nHt">Returns the input height.</param>
        /// <param name="dfOutputDetailPct">Returns the percentage of detail to apply to the final image.</param>
        /// <param name="strSrcBlobName">Returns the source blob name.</param>
        /// <param name="dfRandomImageScale">Returns the random image scale to use, a number in the range [0,50] used to create varying degrees of gray in the random input image.
        /// A value of 0 removes the variation and uses a consistent image.  The default value is 16.</param>
        /// <returns>Returns the collection of Octaves to run.</returns>
        public static OctavesCollection ParseConfigurationString(string strConfig, out int nWd, out int nHt, out double dfOutputDetailPct, out string strSrcBlobName, out double dfRandomImageScale)
        {
            RawProto proto = RawProto.Parse(strConfig);
            string   strVal;

            nHt = -1;
            if ((strVal = proto.FindValue("input_height")) != null)
            {
                nHt = int.Parse(strVal);
            }

            nWd = -1;
            if ((strVal = proto.FindValue("input_width")) != null)
            {
                nWd = int.Parse(strVal);
            }

            dfOutputDetailPct = 0.25;
            if ((strVal = proto.FindValue("output_detail_pct")) != null)
            {
                dfOutputDetailPct = double.Parse(strVal);
            }

            strSrcBlobName = "data";
            if ((strVal = proto.FindValue("src_blob_name")) != null)
            {
                strSrcBlobName = strVal;
            }

            dfRandomImageScale = 16;
            if ((strVal = proto.FindValue("random_image_scale")) != null)
            {
                dfRandomImageScale = double.Parse(strVal);
            }

            OctavesCollection  col   = new OctavesCollection();
            RawProtoCollection rpcol = proto.FindChildren("octave");

            foreach (RawProto protoChild in rpcol)
            {
                col.Add(Octaves.FromProto(protoChild));
            }

            return(col);
        }
Exemple #2
0
 /// <summary>
 /// Adds a new Octave to run the deep drawing over.
 /// </summary>
 /// <param name="strLayer">Specifies the name of the target 'end' layer in the network.</param>
 /// <param name="nIterations">Specifies the number of iterations to run over the Octave.</param>
 /// <param name="dfStartSigma">Specifies the starting sigma used when performing the gaussian bluring, on each iteration this value moves toward the end sigma.</param>
 /// <param name="dfEndSigma">Specifies the ending sigma to use whenp performing the gaussian bluring.</param>
 /// <param name="dfStartStep">Specifis the starting step, this value moves towards the end step on each iteration.</param>
 /// <param name="dfEndStep">Specifies the ending step.</param>
 /// <param name="bSaveFile">Specifies whether or not to save the final image for the octave to disk.</param>
 /// <param name="dfPctDetailsToApply">Specifies the percentage of the details from the previous octave run to apply to the source for this Octave - this value must be 1.0 when only using one Octave.</param>
 public void Add(string strLayer, int nIterations, double dfStartSigma, double dfEndSigma, double dfStartStep, double dfEndStep, bool bSaveFile = false, double dfPctDetailsToApply = 0.25)
 {
     m_rgOctaves.Add(new Octaves(strLayer, nIterations, dfStartSigma, dfEndSigma, dfStartStep, dfEndStep, bSaveFile, dfPctDetailsToApply));
 }