Commit 772439c4b2589b63455fd2384937289509c73e1b

Authored by Josh Klontz
1 parent 20e3c75f

plugin maintainance

scripts/evalFaceRecognition-MEDS.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 -ALGORITHM=OpenBR 3 +ALGORITHM=FaceRecognitionHoG
4 4
5 if [ ! -f evalFaceRecognition-MEDS.sh ]; then 5 if [ ! -f evalFaceRecognition-MEDS.sh ]; then
6 echo "Run this script from the scripts folder!" 6 echo "Run this script from the scripts folder!"
scripts/trainImageRetrieval-LFW.sh
@@ -18,4 +18,4 @@ br -algorithm ImageRetrieval -train ~/lfw2[step=10] ../share/openbr/models/algor @@ -18,4 +18,4 @@ br -algorithm ImageRetrieval -train ~/lfw2[step=10] ../share/openbr/models/algor
18 br -algorithm ImageRetrieval -compare ~/lfw2[step=10] . ImageRetrieval_LFW.mtx -eval ImageRetrieval_LFW.mtx LFW.mask Algorithm_Dataset/ImageRetrieval_LFW.csv 18 br -algorithm ImageRetrieval -compare ~/lfw2[step=10] . ImageRetrieval_LFW.mtx -eval ImageRetrieval_LFW.mtx LFW.mask Algorithm_Dataset/ImageRetrieval_LFW.csv
19 br -plot Algorithm_Dataset/*_LFW.csv LFW 19 br -plot Algorithm_Dataset/*_LFW.csv LFW
20 20
21 -rm -f ../share/openbr/models/algorithms/ImageRetrieval 21 +#rm -f ../share/openbr/models/algorithms/ImageRetrieval
sdk/plugins/quantize.cpp
@@ -167,7 +167,6 @@ private: @@ -167,7 +167,6 @@ private:
167 void train(const TemplateList &src) 167 void train(const TemplateList &src)
168 { 168 {
169 Mat data = OpenCVUtils::toMat(src.data()); 169 Mat data = OpenCVUtils::toMat(src.data());
170 - qDebug() << data.rows << data.cols;  
171 if (data.cols % n != 0) qFatal("Expected dimensionality to be divisible by n."); 170 if (data.cols % n != 0) qFatal("Expected dimensionality to be divisible by n.");
172 171
173 Mat &lut = ProductQuantizationLUTs[index]; 172 Mat &lut = ProductQuantizationLUTs[index];
@@ -186,16 +185,16 @@ private: @@ -186,16 +185,16 @@ private:
186 void project(const Template &src, Template &dst) const 185 void project(const Template &src, Template &dst) const
187 { 186 {
188 Mat m = src.m().reshape(1, 1); 187 Mat m = src.m().reshape(1, 1);
189 - dst = Mat(1, src.m().cols/n, CV_8UC1);  
190 - for (int i=0; i<m.cols/n; i++) {  
191 - uchar bestIndex = -1; 188 + dst = Mat(1, m.cols/n, CV_8UC1);
  189 + for (int i=0; i<dst.m().cols; i++) {
  190 + int bestIndex = 0;
192 double bestDistance = std::numeric_limits<double>::max(); 191 double bestDistance = std::numeric_limits<double>::max();
193 Mat m_i = m.colRange(i*n, (i+1)*n); 192 Mat m_i = m.colRange(i*n, (i+1)*n);
194 - for (uchar i=0; i<256; i++) {  
195 - double distance = norm(m_i, centers[index].row(i), NORM_L2); 193 + for (int j=0; j<256; j++) {
  194 + double distance = norm(m_i, centers[index].row(j), NORM_L2);
196 if (distance < bestDistance) { 195 if (distance < bestDistance) {
197 bestDistance = distance; 196 bestDistance = distance;
198 - bestIndex = i; 197 + bestIndex = j;
199 } 198 }
200 } 199 }
201 dst.m().at<uchar>(0,i) = bestIndex; 200 dst.m().at<uchar>(0,i) = bestIndex;
sdk/plugins/regions.cpp
@@ -120,6 +120,7 @@ class MergeTransform : public UntrainableMetaTransform @@ -120,6 +120,7 @@ class MergeTransform : public UntrainableMetaTransform
120 120
121 void project(const Template &src, Template &dst) const 121 void project(const Template &src, Template &dst) const
122 { 122 {
  123 + dst.file = src.file;
123 std::vector<Mat> mv; 124 std::vector<Mat> mv;
124 foreach (const Mat &m, src) 125 foreach (const Mat &m, src)
125 mv.push_back(m); 126 mv.push_back(m);