Beispiel #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            ImageDataParameter p = new ImageDataParameter();

            p.Copy(this);
            return(p);
        }
Beispiel #2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            ImageDataParameter p = (ImageDataParameter)src;

            m_nRandomSkip   = p.m_nRandomSkip;
            m_bShuffle      = p.m_bShuffle;
            m_nNewHeight    = p.m_nNewHeight;
            m_nNewWidth     = p.m_nNewWidth;
            m_bIsColor      = p.m_bIsColor;
            m_strRootFolder = p.m_strRootFolder;
        }
Beispiel #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto           proto = RawProto.Parse(br.ReadString());
            ImageDataParameter p     = FromProto(proto);

            if (!bNewInstance)
            {
                Copy(p);
            }

            return(p);
        }
Beispiel #4
0
        /// <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 ImageDataParameter FromProto(RawProto rp, ImageDataParameter p = null)
        {
            string strVal;

            if (p == null)
            {
                p = new ImageDataParameter();
            }

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

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

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

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

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

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

            return(p);
        }