Commit fdc17560305415bdcc9d480846cf01239b48f79c

Authored by Brendan Klare
1 parent 8ca8c83b

Script to run algorithms on the torque

scripts/attributesTorque.sh 0 → 100755
  1 +#!/bin/bash
  2 +
  3 +
  4 +SUBSPACE=$1
  5 +NAME=$2
  6 +DATA=$3
  7 +
  8 +ROOT=/data2/pattrec/home/bklare/src/openbr/scripts
  9 +BR="/data2/pattrec/home/bklare/src/openbr/build/app/br/br"
  10 +#SUBSPACE="CvtFloat+PCA(0.95)+Center(Range)"
  11 +
  12 +BASE="Open+PP5Register+Rename(PP5_Landmark0_Right_Eye,Affine_0)+Rename(PP5_Landmark1_Left_Eye,Affine_1)+Affine(192,240,.345,.475)+Cvt(Gray)+Stasm(false,true,[(66.24,114),(125.76,114)])"
  13 +NOSE="RectFromStasmNoseWithBridge+ROI+Resize(36,24)+$SUBSPACE"
  14 +MOUTH="RectFromStasmMouth+ROI+Resize(24,36)+$SUBSPACE"
  15 +EYES="RectFromStasmEyes+ROI+Resize(24,36)+$SUBSPACE"
  16 +HAIR="RectFromStasmHair+ROI+Resize(24,36)+$SUBSPACE"
  17 +BROW="RectFromStasmBrow+ROI+Resize(24,36)+$SUBSPACE"
  18 +JAW="RectFromStasmJaw+ROI+Resize(36,36)+$SUBSPACE"
  19 +FACE="Crop(24,30,144,190)+Resize(36,36)+$SUBSPACE"
  20 +
  21 +mkdir $NAME
  22 +
  23 +if [ ! -f $NAME/all.model ]; then
  24 + ${BR} -crossValidate 2 -algorithm "CrossValidate($BASE+ \
  25 +($BROW+ \
  26 +(Turk(unibrow,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=unibrow,AttributesVariable=predicted_unibrow)+Cat)/ \
  27 +(Turk(eyebroworientation,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=eyebrowsdown,AttributesVariable=predicted_eyebrowsdown)/ \
  28 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=eyebrowsuptodown,AttributesVariable=predicted_eyebrowsuptodown)+Cat)/ \
  29 +(Turk(thickeyebrows,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=thickeyebrows,AttributesVariable=predicted_thickeyebrows)/ \
  30 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=lighteyebrows,AttributesVariable=predicted_lighteyebrows)+Cat))/ \
  31 +($MOUTH+ \
  32 +(Turk(smiling,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=smiling,AttributesVariable=predicted_smiling)+Cat)/ \
  33 +(Turk(mouthasymmetry,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=asymmetrical,AttributesVariable=predicted_asymmetrical)+Cat))/ \
  34 +($EYES+ \
  35 +(Turk(eyecolor,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=darkeyes,AttributesVariable=predicted_darkeyes)/ \
  36 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=lighteyes,AttributesVariable=predicted_lighteyes)+Cat)/ \
  37 +(Turk(baggyeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=baggy,AttributesVariable=predicted_baggy)+Cat)/ \
  38 +(Turk(almondeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=almond,AttributesVariable=predicted_almond)+Cat)/ \
  39 +(Turk(buriedeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=buriedeyes,AttributesVariable=predicted_buriedeyes)+Cat)/ \
  40 +(Turk(sleepyeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=sleepy,AttributesVariable=predicted_sleepy)+Cat)/ \
  41 +(Turk(lineeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=line,AttributesVariable=predicted_line)+Cat)/ \
  42 +(Turk(roundeyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=round,AttributesVariable=predicted_round)+Cat)/ \
  43 +(Turk(smalleyes,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=smalleyes,AttributesVariable=predicted_smalleyes)+Cat)/ \
  44 +(Turk(glasses,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=glasses,AttributesVariable=predicted_glasses)+Cat)/ \
  45 +(Turk(eyelashvisibility,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=feweyelashes,AttributesVariable=predicted_feweyelashes)+Cat))/ \
  46 +($FACE+ \
  47 +(Turk(gender,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=male,AttributesVariable=predicted_male)+Cat)/ \
  48 +(Turk(cheekdensity,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=puffy,AttributesVariable=predicted_puffy)/ \
  49 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=in,AttributesVariable=predicted_in)/ \
  50 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=normal,AttributesVariable=predicted_normal)+Cat)/ \
  51 +(Turk(facemarks,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=scars,AttributesVariable=predicted_scars)/ \
  52 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=moles,AttributesVariable=predicted_moles)/ \
  53 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=normal,AttributesVariable=predicted_normal)+Cat)/ \
  54 +(Turk(facelength,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=long,AttributesVariable=predicted_long)+Cat)/ \
  55 +(Turk(nosetomouthdist,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=long,AttributesVariable=predicted_long)/ \
  56 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=small,AttributesVariable=predicted_small)+Cat))/ \
  57 +($HAIR+ \
  58 +(Turk(foreheadwrinkles,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=wrinkled,AttributesVariable=predicted_wrinkled)+Cat)/ \
  59 +(Turk(haircolor,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=darkhair,AttributesVariable=predicted_darkhair)/ \
  60 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=lighthair,AttributesVariable=predicted_lighthair)/ \
  61 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=greyhair,AttributesVariable=predicted_greyhair)+Cat)/ \
  62 +(Turk(hairstyle,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=curlyhair,AttributesVariable=predicted_curlyhair)+Cat))/ \
  63 +($NOSE+ \
  64 +(Turk(noseorientation,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=upnose,AttributesVariable=predicted_upnose)/ \
  65 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=downnose,AttributesVariable=predicted_downnose)+Cat)/ \
  66 +(Turk(nosewidth,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=small,AttributesVariable=predicted_small)/ \
  67 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=thick,AttributesVariable=predicted_thick)+Cat)/ \
  68 +(Turk(nosesize,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=smallnose,AttributesVariable=predicted_smallnose)/ \
  69 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=bignose,AttributesVariable=predicted_bignose)+Cat))/ \
  70 +($JAW+ \
  71 +(Turk(chinsize,3)+SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=shortchin,AttributesVariable=predicted_shortchin)/ \
  72 +SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=longchin,AttributesVariable=predicted_longchin))+Cat)): \
  73 +CrossValidate+Fuse([ \
  74 +Turk(unibrow,[unibrow],3), \
  75 +Turk(eyebroworientation,[eyebrowsdown,eyebrowsuptodown],3), \
  76 +Turk(thickeyebrows,[thickeyebrows,lighteyebrows],3), \
  77 +Turk(smiling,[smiling],3), \
  78 +Turk(mouthasymmetry,[asymmetrical],3), \
  79 +Turk(eyecolor,[darkeyes,lighteyes],3), \
  80 +Turk(baggyeyes,[baggy],3), \
  81 +Turk(almondeyes,[almond],3), \
  82 +Turk(buriedeyes,[buriedeyes],3), \
  83 +Turk(sleepyeyes,[sleepy],3), \
  84 +Turk(lineeyes,[line],3), \
  85 +Turk(roundeyes,[round],3), \
  86 +Turk(smalleyes,[smalleyes],3), \
  87 +Turk(glasses,[glasses],3), \
  88 +Turk(cheekdensity,[puffy,in,normal],3), \
  89 +Turk(facemarks,[scars,moles,normal],3), \
  90 +Turk(facelength,[long],3), \
  91 +Turk(nosetomouthdist,[long,small],3), \
  92 +Turk(foreheadwrinkles,[wrinkled],3), \
  93 +Turk(haircolor,[darkhair,lighthair,greyhair],3), \
  94 +Turk(hairstyle,[curlyhair],3), \
  95 +Turk(noseorientation,[upnose,downnose],3), \
  96 +Turk(nosewidth,[small,thick],3), \
  97 +Turk(nosesize,[smallnose,bignose],3), \
  98 +Turk(chinsize,[shortchin,longchin],3)],indices=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,16,17,18,19,20,21,22,23,24,25,26])" \
  99 +-path $DATA/CUFSF/target/ -train results1194v2.turk $NAME/all.model
  100 +fi
  101 +
  102 +${BR} -crossValidate 2 -path $DATA/CUFSF/target/ -algorithm $NAME/all.model -compare results1194v2.turk results1194v2.turk $NAME/all.mtx
  103 +
  104 +${BR} -crossValidate 2 -setHeader $NAME/all.mtx $DATA/CUFSF/target.xml $DATA/CUFSF/query.xml
  105 +${BR} -crossValidate 2 -convert Output $NAME/all.mtx $NAME/all.rank
  106 +${BR} -crossValidate 2 -convert Output $NAME/all.mtx $NAME/all_CUFSF%1.eval
... ...
scripts/runAttribute.py 0 → 100644
  1 +import torque
  2 +import os
  3 +
  4 +def call(alg, name):
  5 +
  6 + name = 'Attribute_%s' % name
  7 + cmdList = []
  8 + cmdList.append('cd /data2/pattrec/home/bklare/src/openbr/scripts')
  9 + cmdList.append('bash attributesTorque.sh %s %s %s' % (alg,name ,os.environ['DATA']))
  10 + torque.createQsub(3,0,cmdList,name)
  11 +
  12 +call('"CvtFloat+PCA(0.95)+Center(Range)"','Baseline')
  13 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.95)"','DoGLBP')
  14 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(2,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.95)"','DoGLBP2')
  15 +call('"CvtFloat+Blur(2.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.95)"','DoGLBP_Blur2')
  16 +
  17 +
  18 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(4,4,4,4)+Hist(59)+Cat+PCA(0.95)"','DoGLBP_Rect4')
  19 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.8)"','DoGLBP_PCA8')
  20 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.95,whiten=true)"','DoGLBP_Whiten')
  21 +call('"CvtFloat+Blur(1.1)+GammaFull(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(4,2)+RectRegions(16,16,8,8)+Hist(59)+Cat+PCA(0.95)"','DoGLBP4_Rect16')
... ...