Save() public method

Save network to new format
public Save ( string filepath ) : void
filepath string full file path
return void
Esempio n. 1
0
        public void TestSaveNetwork()
        {
            // create lenet
            LenetClassifier classifier = new LenetClassifier();
            classifier.CharClass.TanhSigmoid = false;
            classifier.CharClass.NetNorm = false;
            classifier.CharClass.AsciiTarget = true;
            classifier.JunkClass.TanhSigmoid = false;
            classifier.Set("junk", 0);      // disable junk
            classifier.SetExtractor("scaledfe");
            classifier.Initialize(classesNums);

            // load char lenet from old file format
            LenetWrapper.LoadNetwork(classifier.CharClass.HrLenet, oldformatFileName);

            // save network to new format
            classifier.Save(networkFileName);
        }
Esempio n. 2
0
        public void TestTrainSimple()
        {
            // create lenet
            LenetClassifier classifier = new LenetClassifier();
            classifier.Set("junk", 0);      // disable junk
            classifier.SetExtractor("scaledfe");
            classifier.Initialize(classesNums);

            StringBuilder sbout;
            classifier.GetStdout(out sbout);
            Console.Write(sbout);

            // load RowDataset8 from file
            RowDataset8 ds = new RowDataset8();
            ds.Load(trainDatasetFileName);

            // do train
            classifier.Set("epochs", 3);
            classifier.XTrain(ds);

            // save classifier to file
            classifier.Save(trainNetworkFileName);

            // test recognize
            DoTestRecognize(classifier);
        }