Commit 772439c4b2589b63455fd2384937289509c73e1b
1 parent
20e3c75f
plugin maintainance
Showing
4 changed files
with
9 additions
and
9 deletions
scripts/evalFaceRecognition-MEDS.sh
scripts/trainImageRetrieval-LFW.sh
| ... | ... | @@ -18,4 +18,4 @@ br -algorithm ImageRetrieval -train ~/lfw2[step=10] ../share/openbr/models/algor |
| 18 | 18 | br -algorithm ImageRetrieval -compare ~/lfw2[step=10] . ImageRetrieval_LFW.mtx -eval ImageRetrieval_LFW.mtx LFW.mask Algorithm_Dataset/ImageRetrieval_LFW.csv |
| 19 | 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 | 167 | void train(const TemplateList &src) |
| 168 | 168 | { |
| 169 | 169 | Mat data = OpenCVUtils::toMat(src.data()); |
| 170 | - qDebug() << data.rows << data.cols; | |
| 171 | 170 | if (data.cols % n != 0) qFatal("Expected dimensionality to be divisible by n."); |
| 172 | 171 | |
| 173 | 172 | Mat &lut = ProductQuantizationLUTs[index]; |
| ... | ... | @@ -186,16 +185,16 @@ private: |
| 186 | 185 | void project(const Template &src, Template &dst) const |
| 187 | 186 | { |
| 188 | 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 | 191 | double bestDistance = std::numeric_limits<double>::max(); |
| 193 | 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 | 195 | if (distance < bestDistance) { |
| 197 | 196 | bestDistance = distance; |
| 198 | - bestIndex = i; | |
| 197 | + bestIndex = j; | |
| 199 | 198 | } |
| 200 | 199 | } |
| 201 | 200 | dst.m().at<uchar>(0,i) = bestIndex; | ... | ... |
sdk/plugins/regions.cpp