Emperor
Emperor

Reputation: 91

How to read trained file to FaceRecognitionEngine object in OpenImaj

I am using OpenImaj for face recognition. Due to the long time it takes train the data at runtime, I am saving the already trained data to system to use it later.

I am using the below code to save the trained data

IOUtils.writeToFile(faceEngine, new File("traineddata.txt"));

Please how do I read the data back to the faceEngine object when the software loads?

The faceEngine object is created this way

FKEFaceDetector faceDetector = new FKEFaceDetector(new HaarCascadeDetector(40));`
EigenFaceRecogniser<KEDetectedFace, Person> faceRecogniser = EigenFaceRecogniser.create(20, new RotateScaleAligner(), 1, DoubleFVComparison.CORRELATION, 0.9f);
FaceRecognitionEngine<KEDetectedFace, Person> faceEngine = FaceRecognitionEngine.create(faceDetector, faceRecogniser);

How do I load the traineddata.txt file?

Upvotes: 0

Views: 44

Answers (1)

asbachb
asbachb

Reputation: 573

You should be able to load the FaceRecognitionEngine<KEDetectedFace, Person> object again with IOutils.readFromFile.

(see http://openimaj.org/apidocs/src-html/org/openimaj/io/IOUtils.html#line.1071)

Upvotes: 0

Related Questions