Ocronet.Dynamic.Recognizers.Lenet.LenetClassifier.Load C# (CSharp) Method

Load() public method

Load network from new format
public Load ( string filepath ) : void
filepath string full file path<
return void
        public override void Load(string filepath)
        {
            FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
            BinaryReader reader = new BinaryReader(stream);
            try
            {
                string s;
                BinIO.string_read(reader, out s);
                if (s == "<object>")
                {
                    BinIO.string_read(reader, out s);
                    if (s != this.Name && s != this.GetType().Name)
                        throw new Exception("LenetClassifier: incorrect file format");
                    this.Load(reader);
                    BinIO.string_read(reader, out s);
                    if (s != "</object>")
                        throw new Exception("Expected string: </object>");
                }
                else
                    throw new Exception("Expected string: <object>");
            }
            finally
            {
                reader.Close();
                stream.Close();
            }
        }

Usage Example

Example #1
0
        public LenetClassifier TestLoadNetwork()
        {
            // load network from new format
            LenetClassifier classifier = new LenetClassifier();
            classifier.Load(networkFileName);

            return classifier;
        }
All Usage Examples Of Ocronet.Dynamic.Recognizers.Lenet.LenetClassifier::Load