From 1dbb3e3c4f7ab5773dfb025103e29d982fa0b790 Mon Sep 17 00:00:00 2001 From: bklare Date: Fri, 4 Sep 2015 00:24:24 +0000 Subject: [PATCH 01/16] Script for btas tutorial --- scripts/BTASTutorial/representation.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/BTASTutorial/representation.sh diff --git a/scripts/BTASTutorial/representation.sh b/scripts/BTASTutorial/representation.sh new file mode 100755 index 000000000..bce42c77e --- /dev/null +++ b/scripts/BTASTutorial/representation.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ ! -f meds.mask ]; then + br -makeMask ../../data/MEDS/sigset/MEDS_frontal_target.xml ../../data/MEDS/sigset/MEDS_frontal_query.xml meds.mask +fi + +PIXEL_ALG="Open+Cvt(Gray)+Cascade+ASEFEyes+Affine(88,88,0.25,0.35)+Blur(1)+Cat+Normalize(L2):Dist(L2)" +LBP_ALG="Open+Cvt(Gray)+Cascade+ASEFEyes+Affine(88,88,0.25,0.35)+Blur(1)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59)+Normalize(L1)+Cat+Normalize(L2):Dist(L2)" +ALG="Open+Cvt(Gray)+Cascade+ASEFEyes+Affine(88,88,0.25,0.35)+Blur(1)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59)+Normalize(L1)+Cat+LDA(0.95)+Normalize(L2):Dist(L2)" + +br -path $DATA/MEDS -algorithm "${PIXEL_ALG}" -compare ../../data/MEDS/sigset/MEDS_frontal_target.xml ../../data/MEDS/sigset/MEDS_frontal_query.xml meds.mtx -eval meds.mtx meds.mask Algorithm_Dataset/pixels_MEDS.csv +br -path $DATA/MEDS -algorithm "${ALG}" -compare ../../data/MEDS/sigset/MEDS_frontal_target.xml ../../data/MEDS/sigset/MEDS_frontal_query.xml meds.mtx -eval meds.mtx meds.mask Algorithm_Dataset/LBP_MEDS.csv + +br -path $DATA/LFW-original -algorithm "${ALG}" -train ../../data/LFW/sigset/LFW.xml representLDA.model +br -path $DATA/MEDS -algorithm representLDA.model -compare ../../data/MEDS/sigset/MEDS_frontal_target.xml ../../data/MEDS/sigset/MEDS_frontal_query.xml meds.mtx -eval meds.mtx meds.mask Algorithm_Dataset/LDA_MEDS.csv + +br -plot Algorithm_Dataset/* btasResults.pdf From c931bcb0992d1d4471ea3f82fb301b7bb92f92e8 Mon Sep 17 00:00:00 2001 From: bklare Date: Fri, 4 Sep 2015 00:25:03 +0000 Subject: [PATCH 02/16] New openbr algorithm --- openbr/plugins/core/algorithms.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index f34382601..a287f6882 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -31,20 +31,31 @@ class AlgorithmsInitializer : public Initializer void initialize() const { // Face - Globals->abbreviations.insert("FaceRecognition", "FaceDetection+FaceRecognitionRegistration++++SetMetadata(AlgorithmID,-1):Unit(ByteL1)"); + Globals->abbreviations.insert("FaceRecognition", "FaceRecognition_1_0"); + + Globals->abbreviations.insert("FaceRecognition_1_0", "FR_Detect+(FR_Eyes+FR_Represent)/(FR_Eyebrows+FR_Represent)/(FR_Mouth+FR_Represent)/(FR_Nose+FR_Represent)/(FR_Nose+FR_Represent)+Cat+LDA(768)+Normalize(L2):Dist(L2)"); + Globals->abbreviations.insert("FR_Eyes", "(CropFromLandmarks([30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); + Globals->abbreviations.insert("FR_Eyebrows", "(CropFromLandmarks([$EYEBROW_POINTS],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); + Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([$MOUTH_POINTS])+Resize(24,48))"); + Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([$NOSE_POINTS],padding=3)+Resize(36,36))"); + Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88)+Resize(44,44))"); + Globals->abbreviations.insert("FR_Detect", "(FaceDetection+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); + Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2)"); + + Globals->abbreviations.insert("FaceRecognition_0_5", "FaceDetection+FaceRecognitionRegistration+++Normalize(L2):Dist(L2)"); Globals->abbreviations.insert("GenderClassification", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); Globals->abbreviations.insert("AgeRegression", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); + Globals->abbreviations.insert("FaceQuality", "Open+Expand+Cascade(FrontalFace)+ASEFEyes+Affine(64,64,0.25,0.35)+ImageQuality+Cvt(Gray)+DFFS+Discard"); Globals->abbreviations.insert("MedianFace", "Open+Expand+Cascade(FrontalFace)+ASEFEyes+Affine(256,256,0.37,0.45)+Center(Median)"); Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); Globals->abbreviations.insert("DrawFaceDetection", "Open+Cascade(FrontalFace)+Expand+ASEFEyes+Draw(inPlace=true)"); Globals->abbreviations.insert("ShowFaceDetection", "DrawFaceDetection+Contract+First+Show+Discard"); - Globals->abbreviations.insert("DownloadFaceRecognition", "Download+Open+ROI+Cvt(Gray)+Cascade(FrontalFace)+FaceRecognitionRegistration++++SetMetadata(AlgorithmID,-1):Unit(ByteL1)"); + Globals->abbreviations.insert("DownloadFaceRecognition", "Download+Open+ROI+Cvt(Gray)+Cascade(FrontalFace)+FaceRecognitionRegistration+++Normalize(L2)+SetMetadata(AlgorithmID,-1):Dist(L2)"); Globals->abbreviations.insert("OpenBR", "FaceRecognition"); Globals->abbreviations.insert("GenderEstimation", "GenderClassification"); Globals->abbreviations.insert("AgeEstimation", "AgeRegression"); - Globals->abbreviations.insert("FaceRecognition2", "{PP5Register+Affine(128,128,0.25,0.35)+Cvt(Gray)}+(Gradient+HistBin(0,360,9,true))/(Blur(1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2,true)+HistBin(0,10,10,true))+Merge+Integral+RecursiveIntegralSampler(4,2,8,LDA(.98)+Normalize(L1))+Cat+PCA(768)+Normalize(L1)+Quantize:UCharL1"); Globals->abbreviations.insert("CropFace", "Open+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+Affine(128,128,0.25,0.35)"); - Globals->abbreviations.insert("4SF", "Open+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+Affine(128,128,0.33,0.45)+(Grid(10,10)+SIFTDescriptor(12)+ByRow)/(Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59))+PCA(0.95)+Cat+Normalize(L2)+Dup(12)+RndSubspace(0.05,1)+LDA(0.98)+Cat+PCA(0.95)+Normalize(L1)+Quantize:NegativeLogPlusOne(ByteL1)"); + Globals->abbreviations.insert("4SF", "Open+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+Affine(128,128,0.33,0.45)+(Grid(10,10)+SIFTDescriptor(12)+ByRow)/(Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59))+PCA(0.95)+Cat+Normalize(L2)+Dup(12)+RndSubspace(0.05,1)+LDA(0.98)+Cat+PCA(0.95)+Normalize(L1):NegativeLogPlusOne(ByteL1)"); // Video Globals->abbreviations.insert("DisplayVideo", "FPSLimit(30)+Show(false,[FrameNumber])+Discard"); @@ -94,7 +105,6 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FaceRecognitionRegistration", "ASEFEyes+Affine(88,88,0.25,0.35)"); Globals->abbreviations.insert("FaceRecognitionExtraction", "(Mask+DenseSIFT/DenseLBP+DownsampleTraining(PCA(0.95),instances=1)+Normalize(L2)+Cat)"); Globals->abbreviations.insert("FaceRecognitionEmbedding", "(Dup(12)+RndSubspace(0.05,1)+DownsampleTraining(LDA(0.98),instances=-2)+Cat+DownsampleTraining(PCA(768),instances=1))"); - Globals->abbreviations.insert("FaceRecognitionQuantization", "(Normalize(L1)+Quantize)"); Globals->abbreviations.insert("FaceClassificationRegistration", "ASEFEyes+Affine(56,72,0.33,0.45)"); Globals->abbreviations.insert("FaceClassificationExtraction", "((Grid(7,7)+SIFTDescriptor(8)+ByRow)/DenseLBP+DownsampleTraining(PCA(0.95),instances=-1, inputVariable=Gender)+Cat)"); Globals->abbreviations.insert("AgeRegressor", "DownsampleTraining(Center(Range),instances=-1, inputVariable=Age)+DownsampleTraining(SVM(RBF,EPS_SVR,inputVariable=Age),instances=100, inputVariable=Age)"); From 8d9db097a2b2e61538299c68000135824cf3d17a Mon Sep 17 00:00:00 2001 From: bhklein Date: Thu, 3 Sep 2015 21:15:58 -0400 Subject: [PATCH 03/16] update models --- share/openbr/models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/openbr/models b/share/openbr/models index e0fa4314a..9e223d55c 160000 --- a/share/openbr/models +++ b/share/openbr/models @@ -1 +1 @@ -Subproject commit e0fa4314abdda0dea598f24609601e2323670969 +Subproject commit 9e223d55ce5b8a795b3c15013ec92371ff856120 From 8ed3678e6377eabb7e9fd6250e0d80beaa4ff9a3 Mon Sep 17 00:00:00 2001 From: bhklein Date: Fri, 4 Sep 2015 02:43:14 +0000 Subject: [PATCH 04/16] update models --- share/openbr/models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/openbr/models b/share/openbr/models index 9e223d55c..b0c85b321 160000 --- a/share/openbr/models +++ b/share/openbr/models @@ -1 +1 @@ -Subproject commit 9e223d55ce5b8a795b3c15013ec92371ff856120 +Subproject commit b0c85b3215aab33cb264517faeb9323e394dbfc0 From b0db05d892f28b313a043bc980a859eb6207866b Mon Sep 17 00:00:00 2001 From: bhklein Date: Thu, 3 Sep 2015 23:46:22 -0400 Subject: [PATCH 05/16] example script for training/testing BLUFR --- scripts/evalFaceRecognition-BLUFR.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/evalFaceRecognition-BLUFR.sh diff --git a/scripts/evalFaceRecognition-BLUFR.sh b/scripts/evalFaceRecognition-BLUFR.sh new file mode 100644 index 000000000..d6bdcef78 --- /dev/null +++ b/scripts/evalFaceRecognition-BLUFR.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +#input algorithm string as argument +ALGORITHM=$1 + +if [ ! -f evalFaceRecognition-BLUFR.sh ]; then + echo "Run this script from the scripts folder!" + exit +fi + +if ! hash br 2>/dev/null; then + echo "Can't find 'br'. Did you forget to build and install OpenBR? Here's some help: http://openbiometrics.org/docs/install/index.html" + exit +fi + +# Get the data +./downloadDatasets.sh + +if [ ! -e Algorithm_Split ]; then + mkdir Algorithm_Split +fi + +for i in `seq 1 10`; do + br -algorithm ${ALGORITHM} -path ../data/LFW/img -train ../data/LFW/sigset/BLUFR/split${i}/train${i}.xml -compare ../data/LFW/sigset/BLUFR/split${i}/gallery${i}.xml ../data/LFW/sigset/BLUFR/split${i}/probe${i}.xml Algorithm_Split/newAlgorithm_BLUFR${i}.eval +done + +br -plot Algorithm_Split/* BLUFR.pdf[smooth=Split] \ No newline at end of file From dcbf7645b6b4d5e86c6a2d0f4e681797f6ab85af Mon Sep 17 00:00:00 2001 From: bhklein Date: Fri, 4 Sep 2015 12:29:52 -0400 Subject: [PATCH 06/16] sort algorithms case insensitive for tables --- share/openbr/plotting/plot_utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/openbr/plotting/plot_utils.R b/share/openbr/plotting/plot_utils.R index 40e684e02..ef4996327 100644 --- a/share/openbr/plotting/plot_utils.R +++ b/share/openbr/plotting/plot_utils.R @@ -45,7 +45,7 @@ plotTable <- function(tableData=NULL, name=NULL, labels=NULL) { input = tableData$Y } mat <- matrix(input, nrow=length(labels), ncol=length(algs), byrow=FALSE) - colnames(mat) <- algs + colnames(mat) <- algs[order(tolower(algs))] rownames(mat) <- labels table <- as.table(mat) if (csv) { From 983211036bd94da83bc36de3c1b7b46886fa512c Mon Sep 17 00:00:00 2001 From: Brendan Klare Date: Fri, 4 Sep 2015 12:47:32 -0400 Subject: [PATCH 07/16] Fix to abbreviations --- openbr/plugins/core/algorithms.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index a287f6882..8c2bfb5b4 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -35,12 +35,12 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FaceRecognition_1_0", "FR_Detect+(FR_Eyes+FR_Represent)/(FR_Eyebrows+FR_Represent)/(FR_Mouth+FR_Represent)/(FR_Nose+FR_Represent)/(FR_Nose+FR_Represent)+Cat+LDA(768)+Normalize(L2):Dist(L2)"); Globals->abbreviations.insert("FR_Eyes", "(CropFromLandmarks([30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); - Globals->abbreviations.insert("FR_Eyebrows", "(CropFromLandmarks([$EYEBROW_POINTS],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); - Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([$MOUTH_POINTS])+Resize(24,48))"); - Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([$NOSE_POINTS],padding=3)+Resize(36,36))"); + Globals->abbreviations.insert("FR_Eyebrows", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); + Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])+Resize(24,48))"); + Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],padding=3)+Resize(36,36))"); Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88)+Resize(44,44))"); Globals->abbreviations.insert("FR_Detect", "(FaceDetection+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); - Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2)"); + Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2))"); Globals->abbreviations.insert("FaceRecognition_0_5", "FaceDetection+FaceRecognitionRegistration+++Normalize(L2):Dist(L2)"); Globals->abbreviations.insert("GenderClassification", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); From 92cc47d2f6163b8147f31c9e7ddf38f992b8efab Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Fri, 4 Sep 2015 13:10:21 -0400 Subject: [PATCH 08/16] dlib OFF by default, sourceforge link --- openbr/plugins/cmake/dlib.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openbr/plugins/cmake/dlib.cmake b/openbr/plugins/cmake/dlib.cmake index f0a246aaa..f2735aad1 100644 --- a/openbr/plugins/cmake/dlib.cmake +++ b/openbr/plugins/cmake/dlib.cmake @@ -1,8 +1,8 @@ -set(BR_WITH_DLIB ON CACHE BOOL "Build with DLib") +set(BR_WITH_DLIB OFF CACHE BOOL "Build with DLib") if(${BR_WITH_DLIB}) ExternalProject_Add(dlib - URL https://github.com/davisking/dlib/releases/download/v18.16/dlib-18.16.tar.bz2 + URL http://downloads.sourceforge.net/project/dclib/dlib/v18.16/dlib-18.16.tar.bz2 URL_MD5 e9e5449bc25370afce2d254327afac99 SOURCE_DIR "${PROJECT_SOURCE_DIR}/3rdparty/dlib-18.16" CONFIGURE_COMMAND "" From c2d02e5b1238ab71d81b479661a11358e21aa4ad Mon Sep 17 00:00:00 2001 From: bhklein Date: Fri, 4 Sep 2015 13:27:39 -0400 Subject: [PATCH 09/16] remove FaceRecognition_0_5 --- openbr/plugins/core/algorithms.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index 8c2bfb5b4..c6781f212 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -42,7 +42,6 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FR_Detect", "(FaceDetection+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2))"); - Globals->abbreviations.insert("FaceRecognition_0_5", "FaceDetection+FaceRecognitionRegistration+++Normalize(L2):Dist(L2)"); Globals->abbreviations.insert("GenderClassification", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); Globals->abbreviations.insert("AgeRegression", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); Globals->abbreviations.insert("FaceQuality", "Open+Expand+Cascade(FrontalFace)+ASEFEyes+Affine(64,64,0.25,0.35)+ImageQuality+Cvt(Gray)+DFFS+Discard"); @@ -50,7 +49,6 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); Globals->abbreviations.insert("DrawFaceDetection", "Open+Cascade(FrontalFace)+Expand+ASEFEyes+Draw(inPlace=true)"); Globals->abbreviations.insert("ShowFaceDetection", "DrawFaceDetection+Contract+First+Show+Discard"); - Globals->abbreviations.insert("DownloadFaceRecognition", "Download+Open+ROI+Cvt(Gray)+Cascade(FrontalFace)+FaceRecognitionRegistration+++Normalize(L2)+SetMetadata(AlgorithmID,-1):Dist(L2)"); Globals->abbreviations.insert("OpenBR", "FaceRecognition"); Globals->abbreviations.insert("GenderEstimation", "GenderClassification"); Globals->abbreviations.insert("AgeEstimation", "AgeRegression"); @@ -103,8 +101,6 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)"); Globals->abbreviations.insert("DenseSIFT2", "(Grid(5,5)+SIFTDescriptor(12)+ByRow)"); Globals->abbreviations.insert("FaceRecognitionRegistration", "ASEFEyes+Affine(88,88,0.25,0.35)"); - Globals->abbreviations.insert("FaceRecognitionExtraction", "(Mask+DenseSIFT/DenseLBP+DownsampleTraining(PCA(0.95),instances=1)+Normalize(L2)+Cat)"); - Globals->abbreviations.insert("FaceRecognitionEmbedding", "(Dup(12)+RndSubspace(0.05,1)+DownsampleTraining(LDA(0.98),instances=-2)+Cat+DownsampleTraining(PCA(768),instances=1))"); Globals->abbreviations.insert("FaceClassificationRegistration", "ASEFEyes+Affine(56,72,0.33,0.45)"); Globals->abbreviations.insert("FaceClassificationExtraction", "((Grid(7,7)+SIFTDescriptor(8)+ByRow)/DenseLBP+DownsampleTraining(PCA(0.95),instances=-1, inputVariable=Gender)+Cat)"); Globals->abbreviations.insert("AgeRegressor", "DownsampleTraining(Center(Range),instances=-1, inputVariable=Age)+DownsampleTraining(SVM(RBF,EPS_SVR,inputVariable=Age),instances=100, inputVariable=Age)"); From dced00a6320bf6474725324f3e15a916b1c31649 Mon Sep 17 00:00:00 2001 From: bhklein Date: Fri, 4 Sep 2015 13:28:56 -0400 Subject: [PATCH 10/16] update mdoels --- share/openbr/models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/openbr/models b/share/openbr/models index b0c85b321..ea61f850d 160000 --- a/share/openbr/models +++ b/share/openbr/models @@ -1 +1 @@ -Subproject commit b0c85b3215aab33cb264517faeb9323e394dbfc0 +Subproject commit ea61f850df9cff8458c02d6df0f474a3f80644e5 From f33a24f409748b311950cfd3b3dc38d094290e32 Mon Sep 17 00:00:00 2001 From: bklare Date: Sat, 5 Sep 2015 14:44:08 +0000 Subject: [PATCH 11/16] Transform for scale mat values --- openbr/plugins/imgproc/scalemat.cpp | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 openbr/plugins/imgproc/scalemat.cpp diff --git a/openbr/plugins/imgproc/scalemat.cpp b/openbr/plugins/imgproc/scalemat.cpp new file mode 100644 index 000000000..56b100164 --- /dev/null +++ b/openbr/plugins/imgproc/scalemat.cpp @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright 2015 Rank One Computing + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +#include + +using namespace cv; + +namespace br +{ + +/*! + * \ingroup transforms + * \brief Scales the mat values by provided factor + * \author Brendan Klare \cite bklare + */ +class ScaleMatTransform : public UntrainableTransform +{ + Q_OBJECT + + Q_PROPERTY(float scaleFactor READ get_scaleFactor WRITE set_scaleFactor RESET reset_scaleFactor STORED false) + BR_PROPERTY(float, scaleFactor, 1.) + + void project(const Template &src, Template &dst) const + { + dst = src * scaleFactor; + } +}; + +BR_REGISTER(Transform, ScaleMatTransform) + +} // namespace br + +#include "imgproc/scalemat.moc" From ebfd998bc8bf86aea56d4bf3816f7ad8b2ae0fa2 Mon Sep 17 00:00:00 2001 From: bklare Date: Sat, 5 Sep 2015 19:26:44 +0000 Subject: [PATCH 12/16] Handle out of bounds case --- openbr/plugins/imgproc/cropfromlandmarks.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openbr/plugins/imgproc/cropfromlandmarks.cpp b/openbr/plugins/imgproc/cropfromlandmarks.cpp index c23e2aa18..8842ccb4b 100644 --- a/openbr/plugins/imgproc/cropfromlandmarks.cpp +++ b/openbr/plugins/imgproc/cropfromlandmarks.cpp @@ -1,4 +1,5 @@ #include +#include using namespace cv; @@ -43,7 +44,13 @@ class CropFromLandmarksTransform : public UntrainableTransform int padW = qRound((maxX - minX) * (paddingHorizontal / 2)); int padH = qRound((maxY - minY) * (paddingVertical / 2)); - dst = Mat(src, Rect(minX - padW, minY - padH, (maxX - minX + 1) + padW * 2, (maxY - minY + 1) + padH * 2)); + QRectF rect(minX - padW, minY - padH, (maxX - minX + 1) + padW * 2, (maxY - minY + 1) + padH * 2); + if (rect.x() < 0) rect.setX(0); + if (rect.y() < 0) rect.setY(0); + if (rect.x() + rect.width() > src.m().cols) rect.setWidth(src.m().cols - rect.x()); + if (rect.y() + rect.width() > src.m().rows) rect.setHeight(src.m().rows - rect.y()); + + dst = Mat(src, OpenCVUtils::toRect(rect)); } }; From 724893913bcda79b3df9312c5be6600a609a1feb Mon Sep 17 00:00:00 2001 From: bklare Date: Sat, 5 Sep 2015 19:28:14 +0000 Subject: [PATCH 13/16] Final ver 1.0 algorithm --- openbr/plugins/core/algorithms.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index 8c2bfb5b4..342281dca 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -33,12 +33,12 @@ class AlgorithmsInitializer : public Initializer // Face Globals->abbreviations.insert("FaceRecognition", "FaceRecognition_1_0"); - Globals->abbreviations.insert("FaceRecognition_1_0", "FR_Detect+(FR_Eyes+FR_Represent)/(FR_Eyebrows+FR_Represent)/(FR_Mouth+FR_Represent)/(FR_Nose+FR_Represent)/(FR_Nose+FR_Represent)+Cat+LDA(768)+Normalize(L2):Dist(L2)"); + Globals->abbreviations.insert("FaceRecognition_1_0", "FR_Detect+(FR_Eyes+FR_Represent)/(FR_Eyebrows+FR_Represent)/(FR_Mouth+FR_Represent)/(FR_Nose+FR_Represent)/(FR_Face+FR_Represent+ScaleMat(2.0))+Cat+LDA(768)+Normalize(L2):Dist(L2)"); Globals->abbreviations.insert("FR_Eyes", "(CropFromLandmarks([30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); Globals->abbreviations.insert("FR_Eyebrows", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])+Resize(24,48))"); Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],padding=3)+Resize(36,36))"); - Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88)+Resize(44,44))"); + Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88))"); Globals->abbreviations.insert("FR_Detect", "(FaceDetection+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2))"); From 88f1ae06a8810f7a65a82548f1e126504b26354f Mon Sep 17 00:00:00 2001 From: bklare Date: Sun, 6 Sep 2015 01:17:51 +0000 Subject: [PATCH 14/16] Reduce model size (no change in accuracy) --- openbr/plugins/core/algorithms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index 61832a1f5..114f6c766 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -38,7 +38,7 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FR_Eyebrows", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],paddingVertical=.8,paddingHorizontal=.2)+Resize(24,48))"); Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])+Resize(24,48))"); Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],padding=3)+Resize(36,36))"); - Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88))"); + Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88)+Resize(44,44))"); Globals->abbreviations.insert("FR_Detect", "(FaceDetection+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2))"); From 6ba71e0d8b1b56064d4597b642f6a28690baff2b Mon Sep 17 00:00:00 2001 From: bklare Date: Sun, 6 Sep 2015 01:21:09 +0000 Subject: [PATCH 15/16] New model submodule --- share/openbr/models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/openbr/models b/share/openbr/models index ea61f850d..be38bd854 160000 --- a/share/openbr/models +++ b/share/openbr/models @@ -1 +1 @@ -Subproject commit ea61f850df9cff8458c02d6df0f474a3f80644e5 +Subproject commit be38bd854f7a563818f153a15972f8495de7e80b From 1af9c6ce003441823d000d260abbc6681f05cd7a Mon Sep 17 00:00:00 2001 From: bhklein Date: Mon, 7 Sep 2015 10:27:56 -0400 Subject: [PATCH 16/16] update installation instructions --- docs/docs/install.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/docs/install.md b/docs/docs/install.md index 35f42ddc6..6aaee52a3 100644 --- a/docs/docs/install.md +++ b/docs/docs/install.md @@ -35,7 +35,7 @@ A hacker's guide to building, editing, and running OpenBR. $ git clone https://github.com/biometrics/openbr.git $ cd openbr - $ git checkout 0.5 + $ git checkout 1.0 $ git submodule init $ git submodule update @@ -71,8 +71,14 @@ A hacker's guide to building, editing, and running OpenBR. $ sudo cpack -G TGZ 10. (Optional) Build OpenBR documentation! + 1. Build the docs -Need to rewrite this step for the new docs! + $ pip install mkdocs + $ cd openbr/docs + $ sh build_docs.sh + $ mkdocs serve + + 2. Navigate to `http://127.0.0.1:8000` in your browser to view the docs. --- @@ -83,13 +89,13 @@ Need to rewrite this step for the new docs! 2. [Download CMake 3.0.2](http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz) $ cd ~/Downloads - $ tar -xf cmake-2.8.11.2.tar.gz - $ cd cmake-2.8.11.2 + $ tar -xf cmake-3.0.2.tar.gz + $ cd cmake-3.0.2 $ ./configure $ make -j4 $ sudo make install $ cd .. - $ rm -rf cmake-2.8.11.2* + $ rm -rf cmake-3.0.2* 3. [Download OpenCV 2.4.11](http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip/download) @@ -110,7 +116,7 @@ Need to rewrite this step for the new docs! $ git clone https://github.com/biometrics/openbr.git $ cd openbr - $ git checkout 0.5 + $ git checkout 1.0 $ git submodule init $ git submodule update @@ -148,8 +154,14 @@ Need to rewrite this step for the new docs! 10. (Optional) Build OpenBR documentation! + 1. Build the docs + + $ pip install mkdocs + $ cd openbr/docs + $ sh build_docs.sh + $ mkdocs serve -Need to remake this step with the new docs! + 2. Navigate to `http://127.0.0.1:8000` in your browser to view the docs. --- @@ -184,7 +196,7 @@ Need to remake this step with the new docs! $ cd /c $ git clone https://github.com/biometrics/openbr.git $ cd openbr - $ git checkout 0.5 + $ git checkout 1.0 $ git submodule init $ git submodule update @@ -265,7 +277,7 @@ Need to remake this step with the new docs! $ git clone https://github.com/biometrics/openbr.git $ cd openbr - $ git checkout 0.5 + $ git checkout 1.0 $ git submodule init $ git submodule update