Initialize() public method

Do external initialize (dll instance)
public Initialize ( int classes, bool asciiTarget = true ) : void
classes int
asciiTarget bool
return void
Example #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);
        }
Example #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);
        }