Ejemplo n.º 1
0
 /// <summary>Trains SVM with self data</summary>
 public void SelfTrain()
 {
     try
     {
         SVM = new MultiClassSVM(SelfTSet);
     }
     catch
     {
     }
 }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
 /// <summary>Trains SVM with self data</summary>
 public void SelfTrain()
 {
     try
     {
         SVM = new MultiClassSVM(SelfTSet);
     }
     catch
     {
     }
 }