21 #ifndef _IMAGE_CLASSIFIER_OPERATOR_H
22 #define _IMAGE_CLASSIFIER_OPERATOR_H
32 std::vector<float> resp;
41 bool operator()(
const std::string & filename,
const ImageHandle & img,
int category)
47 cat.push_back(category);
83 void setVerbosity(
int l) {
86 void setThreshold(
double th) {
90 bool operator()(
const std::string & filename,
const ImageHandle & img,
int category)
105 std::cout << v <<
' ';
110 std::cout << std::endl;
114 std::cout << filename <<
' ' << v <<
' ';
119 std::cout << std::endl;
123 std::cout << v <<
' ' << filename <<
' ';
128 std::cout << std::endl;
146 std::cout << v <<
' ';
151 std::cout << std::endl;
155 std::cout << filename <<
' ' << v <<
' ';
160 std::cout << std::endl;
164 std::cout << v <<
' ' << filename <<
' ';
169 std::cout << std::endl;
196 pavg /= (double) (FN+TP);
197 navg /= (double) (FP+TN);
199 std::cout <<
"Margin: " << mpos - mneg <<
"(" << mneg <<
";" << mpos <<
")\n";
200 std::cout <<
"Average: " << pavg <<
"(+) " << navg <<
"(-)\n";
201 std::cout <<
"Sqm: " << std::sqrt((pavg2/(
double) (FN+TP)) - pavg*pavg) <<
"(+) " << std::sqrt((navg2/(
double) (FP+TN)) - navg*navg) <<
"(-)\n";
202 std::cout <<
"Statistics with threshold = " << threshold <<
'\n';
203 std::cout <<
"TP:" << TP <<
", TN:" << TN <<
", FN:" << FN <<
", FP:" << FP <<
'\n';
204 std::cout <<
"Correct Detection: " << TP+TN <<
" (" << (100*(TP+TN))/(TP+TN+FN+FP) <<
"%), Errors: " << FN+FP <<
'\n';
205 std::cout <<
"Accuracy: " << (float)(TP+TN)/(float)(TP+TN+FN+FP)
206 <<
" Error Rate: " << (float)(FN+FP)/(float)(TP+TN+FN+FP)
207 <<
" Precision: " << (float)(TP)/(float)(FP+TP)
208 <<
" Recall: " << (float)(TP)/(float)(FN+TP) << std::endl;
"Binary" Classifier, virtual class
Definition: ImageClassifier.h:37
Definition: ImageClassifierOperator.h:27
an operator used to collect pattern from the ProcessSet operator
Definition: ImageClassifierOperator.h:56
virtual classes to work on classifier. ImageClassifier is the simplest one, computing the response im...
virtual void setImage(const unsigned char *ptr, long stride, unsigned int width, unsigned int height)=0