T
- public static class FisherFaceFeature.Extractor<T extends DetectedFace> extends Object implements FacialFeatureExtractor<FisherFaceFeature,T>, BatchTrainer<IndependentPair<?,T>>
FacialFeatureExtractor
for producing FisherFaces. Unlike most
FacialFeatureExtractor
s, this one either needs to be trained or
provided with a pre-trained FisherImages
object.
A FaceAligner
can be used to produce aligned faces for training
and feature extraction.
Constructor and Description |
---|
Extractor(FisherImages basis,
FaceAligner<T> aligner)
Construct with given pre-trained
FisherImages basis and a
face aligner. |
Extractor(int numComponents,
FaceAligner<T> aligner)
Construct with the requested number of components (the number of PCs
to keep) and a face aligner.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
binaryHeader()
Header for binary input.
|
FisherFaceFeature |
extractFeature(T face)
Extract features from an object and return them.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
<KEY> void |
train(GroupedDataset<KEY,? extends ListDataset<T>,T> data)
Train on a grouped dataset.
|
void |
train(List<? extends IndependentPair<?,T>> data)
Train the object with the given data.
|
void |
train(Map<?,? extends List<T>> data)
Train on a map of data.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
public Extractor(int numComponents, FaceAligner<T> aligner)
train(List)
.numComponents
- the number of principal components to keep.aligner
- the face alignerpublic Extractor(FisherImages basis, FaceAligner<T> aligner)
FisherImages
basis and a
face aligner.basis
- the pre-trained basisaligner
- the face alignerpublic FisherFaceFeature extractFeature(T face)
FeatureExtractor
extractFeature
in interface FeatureExtractor<FisherFaceFeature,T extends DetectedFace>
face
- the object to extract frompublic void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic void train(List<? extends IndependentPair<?,T>> data)
BatchTrainer
BatchTrainer
s should reset the underlying
model everytime this method is called.train
in interface BatchTrainer<IndependentPair<?,T extends DetectedFace>>
data
- the training datapublic void train(Map<?,? extends List<T>> data)
data
- the datapublic <KEY> void train(GroupedDataset<KEY,? extends ListDataset<T>,T> data)
KEY
- The group typedata
- the data