Exemplo n.º 1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            BatchDataParameter p = new BatchDataParameter();

            p.Copy(this);
            return(p);
        }
Exemplo n.º 2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            BatchDataParameter p = (BatchDataParameter)src;

            m_strSource      = p.m_strSource;
            m_nBatchSetCount = p.m_nBatchSetCount;
            m_nBatchSize     = p.m_nBatchSize;
            m_nIterations    = p.m_nIterations;
            m_backend        = p.m_backend;
            m_evtCompleted   = p.m_evtCompleted;
        }
Exemplo n.º 3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto           proto = RawProto.Parse(br.ReadString());
            BatchDataParameter p     = FromProto(proto);

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

            return(p);
        }
Exemplo n.º 4
0
        /// <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 BatchDataParameter FromProto(RawProto rp)
        {
            string             strVal;
            BatchDataParameter p = new BatchDataParameter();

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

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

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

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

            if ((strVal = rp.FindValue("backend")) != null)
            {
                switch (strVal)
                {
                case "IMAGEDB":
                    p.backend = DataParameter.DB.IMAGEDB;
                    break;

                case "LMDB":
                    p.backend = DataParameter.DB.IMAGEDB;
                    break;

                default:
                    throw new Exception("Unknown 'backend' value " + strVal);
                }
            }

            return(p);
        }