-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
32 lines (24 loc) · 978 Bytes
/
main.cpp
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
/*
* Developer : Prakriti Chintalapoodi - c.prakriti@gmail.com
*/
#include "ocr.h"
#include "roc.h"
int main(int argc, const char* argv[])
{
if (argc < 4)
{
cout << "OCR between 2 digits (for now)" << endl;
cout << "Usage: " << argv[0] << " <train csv file1> <train csv file2> <test csv file1> <test csv file2>" << endl;
exit(1);
}
int TrainClassSize = 100, TestClassSize = 50, numClasses = 2;
OCR ocr_obj(TrainClassSize, TestClassSize, numClasses);
ocr_obj.read_from_csv(argv[1], argv[2], argv[3], argv[4]);
Mat responses = Mat::zeros(numClasses*TestClassSize, 1, CV_32FC1);
ocr_obj.svm_classify(responses);
ROC roc_obj(ocr_obj.getTestLabels(), responses, 1);
cout << "Precision = " << roc_obj.precision() * 100 << "%" << endl;
cout << "Recall = " << roc_obj.recall() * 100 << "%" << endl;
cout << "F-Score = " << roc_obj.FScore() * 100 << "%" << endl;
return 0;
}