FACE
- Type of DetectedFace
PERSON
- Type of object representing a personpublic class FisherFaceRecogniser<FACE extends DetectedFace,PERSON> extends FaceRecogniser<FACE,PERSON>
FaceRecogniser
based on Fisherfaces. Any kind of
machine learning implementation can be used for the actual classification.Modifier | Constructor and Description |
---|---|
protected |
FisherFaceRecogniser() |
|
FisherFaceRecogniser(FisherFaceFeature.Extractor<FACE> extractor,
FaceRecogniser<FACE,PERSON> internalRecogniser)
Construct with the given feature extractor and underlying
FaceRecogniser . |
|
FisherFaceRecogniser(FisherFaceFeature.Extractor<FACE> extractor,
IncrementalAnnotator<FACE,PERSON> annotator)
Construct with the given feature extractor and underlying
IncrementalAnnotator . |
Modifier and Type | Method and Description |
---|---|
List<ScoredAnnotation<PERSON>> |
annotate(FACE object)
Attempt to recognize the given face.
|
List<ScoredAnnotation<PERSON>> |
annotate(FACE object,
Collection<PERSON> restrict)
Attempt to recognize the given face, restricting the potential people to
coming from the given set.
|
protected void |
beforeBatchTrain(GroupedDataset<PERSON,ListDataset<FACE>,FACE> dataset)
Called before batch training/re-training takes place.
|
byte[] |
binaryHeader()
Header for binary input.
|
static <FACE extends DetectedFace,PERSON> |
create(int numComponents,
FaceAligner<FACE> aligner,
int k,
DoubleFVComparator compar)
Convenience method to create an
FisherFaceRecogniser with a
standard KNN classifier. |
static <FACE extends DetectedFace,PERSON> |
create(int numComponents,
FaceAligner<FACE> aligner,
int k,
DoubleFVComparator compar,
float threshold)
Convenience method to create an
FisherFaceRecogniser with a
standard KNN classifier, incorporating a threshold on the maximum
distance (or minimum similarity) to allow a match. |
Set<PERSON> |
getAnnotations() |
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
reset()
Reset the object to its initial condition, as if
it hasn't seen any training data.
|
String |
toString() |
void |
train(Annotated<FACE,PERSON> annotated)
Train/update object using a new instance.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
annotateBest, annotateBest, listPeople
train, train, trainMultiClass
classify
protected FisherFaceRecogniser()
public FisherFaceRecogniser(FisherFaceFeature.Extractor<FACE> extractor, FaceRecogniser<FACE,PERSON> internalRecogniser)
FaceRecogniser
.extractor
- the feature extractorinternalRecogniser
- the face recogniserpublic FisherFaceRecogniser(FisherFaceFeature.Extractor<FACE> extractor, IncrementalAnnotator<FACE,PERSON> annotator)
IncrementalAnnotator
.extractor
- the feature extractorannotator
- the annotatorpublic static <FACE extends DetectedFace,PERSON> FisherFaceRecogniser<FACE,PERSON> create(int numComponents, FaceAligner<FACE> aligner, int k, DoubleFVComparator compar)
FisherFaceRecogniser
with a
standard KNN classifier.FACE
- The type of DetectedFace
PERSON
- the type representing a personnumComponents
- the number of principal components to keepaligner
- the face alignerk
- the number of nearest neighbourscompar
- the distance comparison functionFisherFaceRecogniser
public static <FACE extends DetectedFace,PERSON> FisherFaceRecogniser<FACE,PERSON> create(int numComponents, FaceAligner<FACE> aligner, int k, DoubleFVComparator compar, float threshold)
FisherFaceRecogniser
with a
standard KNN classifier, incorporating a threshold on the maximum
distance (or minimum similarity) to allow a match.FACE
- The type of DetectedFace
PERSON
- the type representing a personnumComponents
- the number of principal components to keepaligner
- the face alignerk
- the number of nearest neighbourscompar
- the distance comparison functionthreshold
- a distance threshold to limit matches.FisherFaceRecogniser
protected void beforeBatchTrain(GroupedDataset<PERSON,ListDataset<FACE>,FACE> dataset)
dataset
- the datasetpublic void readBinary(DataInput in) throws IOException
ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic void writeBinary(DataOutput out) throws IOException
WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic byte[] binaryHeader()
ReadableBinary
public void train(Annotated<FACE,PERSON> annotated)
IncrementalTrainer
annotated
- instance to train withpublic void reset()
IncrementalTrainer
public Set<PERSON> getAnnotations()
public List<ScoredAnnotation<PERSON>> annotate(FACE object, Collection<PERSON> restrict)
FaceRecogniser
annotate
in interface RestrictedAnnotator<FACE extends DetectedFace,PERSON>
annotate
in class FaceRecogniser<FACE extends DetectedFace,PERSON>
object
- the detected facerestrict
- the set of allowed peoplepublic List<ScoredAnnotation<PERSON>> annotate(FACE object)
FaceRecogniser
annotate
in interface Annotator<FACE extends DetectedFace,PERSON>
annotate
in class FaceRecogniser<FACE extends DetectedFace,PERSON>
object
- the detected face