-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
77 lines (63 loc) · 2.35 KB
/
Copy pathmain.cpp
File metadata and controls
77 lines (63 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/opencv.hpp>
#include "tinydir.h"
// Our Headers
#include "Process.h"
#include "SVMClassifier.h"
#include "MLPClassifier.h"
#include "KNNClassifier.h"
#include "SVMSGDClassifier.h"
#include "ClusteringPreprocess.h"
#include "KMClustering.h"
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
//cout << CV_VERSION;
/*Process *process = new Process();
process->setTrainingFiles();
vector<string> TrainFileNames = process->getTrainFileNames();
vector<int> MatrixLabels = process->getMatrixLabels();
process->setTestFiles();
vector<string> testFNames = process->getTestFileNames();
vector<int> testLabels = process->getTestMatrixLabels();*/
/*
cout << "Starting Support Vector Machine Classification..." << endl;
SVMClassifier* SVMclasy = new SVMClassifier();
//SVMclasy->trainSVM(TrainFileNames, MatrixLabels);
SVMclasy->testSVM(testFNames, testLabels);
cout << endl << endl;
// MLP Neural Network
//cout << "Starting Multilayer Perceptron Neural Network..." << endl;
//MLPClassifier* MLPclasy = new MLPClassifier();
//MLPclasy->trainMLP(TrainFileNames, MatrixLabels);
//MLPclasy->testMLP(testFNames, testLabels);
MLPclasy->testMLP(testFNames, testLabels);
cout << endl << endl;
*/
//// KNN CLassification
//cout << "Starting K-Nearest Neighbour Classification..." << endl;
//KNNClassifier* KNNclasy = new KNNClassifier();
////KNNclasy->trainKNN(TrainFileNames, MatrixLabels);
//KNNclasy->testKNN(testFNames, testLabels);
//cout << "Starting SVMSGD Classification..." << endl;
//SVMSGDClassifier * SVMSGDclasy = new SVMSGDClassifier();
////SVMSGDclasy->trainSVMSGD(TrainFileNames, MatrixLabels);
//SVMSGDclasy->testSVMSGD(testFNames, testLabels);
// Cluster certain digit
ClusteringPreprocess *cp = new ClusteringPreprocess();
cp->setFiles(0);
vector<string> clusteringFileNames = cp->getTestFileNames();
vector<int> clusteringLabels = cp->getTestMatrixLabels();
// K-Means Clustering
KMClustering* kmeans = new KMClustering(clusteringFileNames, clusteringLabels);
kmeans->Cluster(3);
kmeans->CalculateDistance(cv::NORM_L2); // Euclidean distance
kmeans->CalculateDistance(cv::NORM_HAMMING); // Hamming distance
kmeans->CalculateDistance(cv::NORM_L1); // Manhattan distance
system("pause");
return 0;
}