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

Initialize() public method

Do external initialize (dll instance)
public Initialize ( int classes, bool asciiTarget = true ) : void
classes int
asciiTarget bool
return void
        public void Initialize(int[] classes, bool asciiTarget = true)
        {
            List<int> cl = new List<int>(classes.Length);
            for (int i = 0; i < classes.Length; i++)
                if (classes[i] != jc())
                    cl.Add(classes[i]);
            CharClass.AsciiTarget = asciiTarget;
            //CharClass.NetNorm = true;
            CharClass.Classes = cl.ToArray();
            JunkClass.AsciiTarget = asciiTarget;
            //JunkClass.NetNorm = true;
            int[] jcl;
            if (asciiTarget)
                jcl = new int[] { (int)'0', (int)'1' }; // '0' - any symbol, '1' - junk
            else
                jcl = new int[] { 0, 1 };
            JunkClass.Classes = jcl;

            // create char classifier instance
            CharClass.CreateLenet(CharClass.Classes.Length, CharClass.Classes,
                CharClass.TanhSigmoid, CharClass.NetNorm, CharClass.AsciiTarget);
            // create junk classifier instance
            if (PGeti("junk") > 0)
                JunkClass.CreateLenet(JunkClass.Classes.Length, JunkClass.Classes,
                    JunkClass.TanhSigmoid, JunkClass.NetNorm, JunkClass.AsciiTarget);
        }

Usage Example

Exemplo 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);
        }
All Usage Examples Of Ocronet.Dynamic.Recognizers.Lenet.LenetClassifier::Initialize