Commit cd17455464f85453029623223b0ad675e6d7b36c

Authored by Scott Klum
2 parents 9b2cfd5b d9c315f2

Merge branch 'master' of https://github.com/biometrics/openbr

openbr/openbr_plugin.cpp
... ... @@ -15,6 +15,7 @@
15 15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 16  
17 17 #include <QCoreApplication>
  18 +#include <QCryptographicHash>
18 19 #include <QFutureSynchronizer>
19 20 #include <QMetaProperty>
20 21 #include <QPointF>
... ... @@ -443,7 +444,9 @@ TemplateList TemplateList::fromGallery(const br::File &amp;gallery)
443 444 newTemplates.insert(i+1, allPartitionTemplate);
444 445 }
445 446 } else {
446   - newTemplates[i].file.set("Partition", rand() % crossValidate);
  447 + const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.subject().toLatin1(), QCryptographicHash::Md5);
  448 + // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow
  449 + newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate);
447 450 }
448 451 }
449 452 }
... ...
openbr/plugins/ct8.cpp
... ... @@ -422,8 +422,14 @@ struct CT8Compare : public Distance,
422 422 if (!srcA.m().data || !srcB.m().data) return score;
423 423  
424 424 try {
  425 + static QMutex mutex;
  426 + QMutexLocker locker(&mutex);
  427 +
  428 + // Internally Cognitec keeps a total count of the allocated templates,
  429 + // it seems that this reference count update is not thread safe
425 430 FRsdk::FIR firA = firBuilder->build( (FRsdk::Byte *) srcA.m().data, srcA.m().cols);
426 431 FRsdk::FIR firB = firBuilder->build( (FRsdk::Byte *) srcB.m().data, srcB.m().cols);
  432 +
427 433 score = (float)facialMatchingEngine->compare(firA, firB);
428 434 } catch (std::exception &e) {
429 435 qFatal("CT8Compare Exception: %s", e.what());
... ...
openbr/plugins/output.cpp
... ... @@ -203,7 +203,7 @@ class mtxOutput : public Output
203 203 if (!f.open(QFile::ReadWrite))
204 204 qFatal("Unable to open %s for modifying.", qPrintable(file));
205 205 for (int i=0; i<blockScores.rows; i++) {
206   - f.seek(headerSize + sizeof(float)*((rowBlock*Globals->blockSize+i)*targetFiles.size()+(columnBlock*Globals->blockSize)));
  206 + f.seek(headerSize + sizeof(float)*(quint64(rowBlock*Globals->blockSize+i)*targetFiles.size()+(columnBlock*Globals->blockSize)));
207 207 f.write((const char*)blockScores.row(i).data, sizeof(float)*blockScores.cols);
208 208 }
209 209 f.close();
... ...
scripts/enrollFaces.sh deleted
1   -#!/bin/bash
2   -
3   -if [ ! -f enrollFaces.sh ]; then
4   - echo "Run this script from the scripts folder!"
5   - exit
6   -fi
7   -
8   -if ! hash br 2>/dev/null; then
9   - echo "Can't find 'br'. Did you forget to build and install OpenBR? Here's some help: http://openbiometrics.org/doxygen/latest/installation.html"
10   - exit
11   -fi
12   -
13   -DATA_ROOT=/Volumes/Seagate
14   -GALLERY_ROOT=/Volumes/Seagate
15   -
16   -for ALGORITHM in PP5
17   -do
18   -
19   - for SIGSET in CUFS_photo CUFS_sketch
20   - do
21   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/CUFS -enroll ../data/CUFS/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
22   - done
23   -
24   - for SIGSET in CUFSF_photo CUFSF_sketch
25   - do
26   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/CUFSF -enroll ../data/CUFSF/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
27   - done
28   -
29   - for SIGSET in fa fb fc dup1 dup2
30   - do
31   - br -algorithm ${ALGORITHM} -path "${DATA_ROOT}/FERET/dvd2/gray_feret_cd1/data/images/;${DATA_ROOT}/FERET/dvd2/gray_feret_cd2/data/images/" -enroll ../data/FERET/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
32   - done
33   -
34   - for SIGSET in FRGC-1 FRGC-2 FRGC-4_target FRGC-4_query
35   - do
36   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/FRGC2 -enroll ../data/FRGC/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
37   - done
38   -
39   - for SIGSET in HFB_NIR HFB_VIS
40   - do
41   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/HFB -enroll ../data/HFB/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
42   - done
43   -
44   - for SIGSET in LFW
45   - do
46   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/LFW -enroll ../data/LFW/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
47   - done
48   -
49   - for SIGSET in MEDS_frontal_all
50   - do
51   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/MEDS -enroll ../data/MEDS/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
52   - done
53   -
54   - for SIGSET in PCSO_2x10k
55   - do
56   - br -algorithm ${ALGORITHM} -path ${DATA_ROOT}/PCSO -enroll ../data/PCSO/sigset/${SIGSET}.xml ${GALLERY_ROOT}/galleries/${ALGORITHM}_${SIGSET}.gal
57   - done
58   -
59   -done
60 0 \ No newline at end of file