T
- public static class EigenFaceFeature.Extractor<T extends DetectedFace> extends Object implements FacialFeatureExtractor<EigenFaceFeature,T>, BatchTrainer<T>
FacialFeatureExtractor
for producing EigenFaces. Unlike most
FacialFeatureExtractor
s, this one either needs to be trained or
provided with a pre-trained EigenImages
object.
A FaceAligner
can be used to produce aligned faces for training
and feature extraction.
Constructor and Description |
---|
Extractor(EigenImages basis,
FaceAligner<T> aligner)
Construct with given pre-trained
EigenImages 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.
|
EigenFaceFeature |
extractFeature(T face)
Extract features from an object and return them.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
String |
toString() |
void |
train(Dataset<? extends T> data)
Train from a dataset
|
void |
train(List<? extends T> data)
Train the object with the given 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(EigenImages basis, FaceAligner<T> aligner)
EigenImages
basis and a face
aligner.basis
- the pre-trained basisaligner
- the face alignerpublic EigenFaceFeature extractFeature(T face)
FeatureExtractor
extractFeature
in interface FeatureExtractor<EigenFaceFeature,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 T> data)
BatchTrainer
BatchTrainer
s should reset the underlying
model everytime this method is called.train
in interface BatchTrainer<T extends DetectedFace>
data
- the training datapublic void train(Dataset<? extends T> data)
data
- the dataset