コード例 #1
0
 /// <summary>Trains SVM with self data</summary>
 public void SelfTrain()
 {
     try
     {
         SVM = new MultiClassSVM(SelfTSet);
     }
     catch
     {
     }
 }
コード例 #2
0
        private TrainingSet tSet; //, testSet;

        #endregion Fields

        #region Constructors

        /// <summary>Constructor. Loads and classifies face dataset if desired</summary>
        /// <param name="TrainFaceDataset">Load and classify face dataset?</param>
        public CLObjClassifier(bool TrainFaceDataset)
        {
            if (CLCalc.CLAcceleration == CLCalc.CLAccelerationType.Unknown) CLCalc.InitCL();

            if (TrainFaceDataset)
            {
                LoadMITFaceClassifier();
                SVM = new MultiClassSVM(tSet);
                InitKernel();
            }
        }
コード例 #3
0
        /// <summary>Constructor. Loads parameters from a file.</summary>
        /// <param name="svmFile">File to read</param>
        public CLObjClassifier(string svmFile)
        {
            if (CLCalc.CLAcceleration == CLCalc.CLAccelerationType.Unknown)
            {
                CLCalc.InitCL();
            }
            SVM = new MultiClassSVM(new TrainingSet());
            SVM.SVMs.Add(new SVM());
            SVM.Classifications.Add(1.0f);
            SVM.SVMs[0].Load(svmFile);

            InitKernel();
        }
コード例 #4
0
        /// <summary>Constructor. Loads and classifies face dataset if desired</summary>
        /// <param name="TrainFaceDataset">Load and classify face dataset?</param>
        public CLObjClassifier(bool TrainFaceDataset)
        {
            if (CLCalc.CLAcceleration == CLCalc.CLAccelerationType.Unknown)
            {
                CLCalc.InitCL();
            }

            if (TrainFaceDataset)
            {
                LoadMITFaceClassifier();
                SVM = new MultiClassSVM(tSet);
                InitKernel();
            }
        }
コード例 #5
0
        /// <summary>Loads and classifies dataset</summary>
        private void LoadMITFaceClassifier()
        {
            /*
             *
             * CBCL Face Database #1
             * MIT Center For Biological and Computation Learning
             *
             */
            string p         = System.Windows.Forms.Application.StartupPath;
            string fileTrain = p + "\\svm.train.normgrey";
            string fileTest  = p + "\\svm.test.normgrey";


            tSet = new TrainingSet();

            //Fills both, we're not testing the results
            FillTrainingSet(fileTrain, tSet);
            FillTrainingSet(fileTest, tSet);

            SVM = new MultiClassSVM(tSet);
        }
コード例 #6
0
        /// <summary>Constructor. Loads parameters from a file.</summary>
        /// <param name="svmFile">File to read</param>
        public CLObjClassifier(string svmFile)
        {
            if (CLCalc.CLAcceleration == CLCalc.CLAccelerationType.Unknown) CLCalc.InitCL();
            SVM = new MultiClassSVM(new TrainingSet());
            SVM.SVMs.Add(new SVM());
            SVM.Classifications.Add(1.0f);
            SVM.SVMs[0].Load(svmFile);

            InitKernel();
        }
コード例 #7
0
        /// <summary>Loads and classifies dataset</summary>
        private void LoadMITFaceClassifier()
        {
            /*

            CBCL Face Database #1
            MIT Center For Biological and Computation Learning
             *
             */
            string p = System.Windows.Forms.Application.StartupPath;
            string fileTrain = p + "\\svm.train.normgrey";
            string fileTest = p + "\\svm.test.normgrey";

            tSet = new TrainingSet();

            //Fills both, we're not testing the results
            FillTrainingSet(fileTrain, tSet);
            FillTrainingSet(fileTest, tSet);

            SVM = new MultiClassSVM(tSet);
        }
コード例 #8
0
 /// <summary>Trains SVM with self data</summary>
 public void SelfTrain()
 {
     try
     {
         SVM = new MultiClassSVM(SelfTSet);
     }
     catch
     {
     }
 }