Facemorph.mdl
Class SpecificityTemplateTest

java.lang.Object
  extended by Facemorph.mdl.SpecificityTemplateTest
All Implemented Interfaces:
SpecificityTest<Template>

public class SpecificityTemplateTest
extends java.lang.Object
implements SpecificityTest<Template>

Template specificity testing


Constructor Summary
SpecificityTemplateTest(java.util.ArrayList<java.lang.String> warpNames, Template average)
          Constructs the test object
 
Method Summary
 double calculateError(Template tem1, Template tem2)
          Calculates the error between two Templates
 double[] calculateSpecificity(int comps, int trials)
          Calculates the specitivity of the model
 double findMinError(Template testTem)
          Find the minimum error from the set of Templates
static void main(java.lang.String[] args)
          Main method runs the tests
 Template makeRandom(int comps)
          Makes a random Template from the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificityTemplateTest

public SpecificityTemplateTest(java.util.ArrayList<java.lang.String> warpNames,
                               Template average)
                        throws java.io.FileNotFoundException,
                               java.io.IOException,
                               java.lang.ClassNotFoundException
Constructs the test object

Parameters:
warpNames - the list of warp file names
average - the average Template
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
Method Detail

makeRandom

public Template makeRandom(int comps)
Makes a random Template from the model

Specified by:
makeRandom in interface SpecificityTest<Template>
Parameters:
comps - the number of model components to use
Returns:
returns the generated Template

calculateError

public double calculateError(Template tem1,
                             Template tem2)
Calculates the error between two Templates

Specified by:
calculateError in interface SpecificityTest<Template>
Parameters:
tem1 - first template
tem2 - second template
Returns:
mean absolute distance

findMinError

public double findMinError(Template testTem)
Find the minimum error from the set of Templates

Specified by:
findMinError in interface SpecificityTest<Template>
Parameters:
testTem - the test template
Returns:
returns the error from the most similar in the training set

calculateSpecificity

public double[] calculateSpecificity(int comps,
                                     int trials)
Calculates the specitivity of the model

Specified by:
calculateSpecificity in interface SpecificityTest<Template>
Parameters:
comps - the number of model components to use
trials - the number of trials to performs
Returns:
returns the mean and sd of the error in an array {meanErr, sdErr}

main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        java.io.IOException,
                        java.lang.ClassNotFoundException
Main method runs the tests

Parameters:
args - args[0] = number of warps (all named "warp"+i+".warp"), args[1] is the average template, args [2] = file to write results to
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.ClassNotFoundException