Opencv4nodejs: There is no way to update the model LBPHFaceRecognizer

Created on 8 Jul 2018  路  4Comments  路  Source: justadudewhohacks/opencv4nodejs

Hey. I do not have static photos, I want to train the model dynamically. So I need a method update.
In the original opencv_contrib, this method is present:
https://github.com/kyamagu/mexopencv/blob/master/opencv_contrib/%2Bcv/LBPHFaceRecognizer.m#L306

const lbph = new cv.LBPHFaceRecognizer()
lbph.update([resizeFaceImage], [0])

TypeError: lbph.update is not a function

good first issue help wanted

Most helpful comment

The binding for lbph.update is not implemented currently. Load and save should work.

All 4 comments

I need something like that from face-recognition.js, only from the opencv4node.js package
fs.writeFileSync(trainedModelFilePath, JSON.stringify(recognizer.serialize()));

If I understand, then I need:
const faceImage = getFaceImage(grayImage) // new image to train
const lbph = new cv.LBPHFaceRecognizer();
lbph.load(trainedModelFilePath); // trainedModelFilePath -> path to "model.yml"
lbph.update([faceImage], [5]); // 5 - exists Id in model.yml (I want to add a new face)
lbph.save(trainedModelFilePath);

TypeError: lbph.update is not a function

The binding for lbph.update is not implemented currently. Load and save should work.

Just ran into this same issue here. You've got a +1 from me on this request! I need to have the ability to load an LBPH model, add training data, and save it. Loading the model and doing a .train overwrites rather than updates. :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fildaniels picture fildaniels  路  5Comments

goulash1971 picture goulash1971  路  7Comments

YaronHershkovitz picture YaronHershkovitz  路  6Comments

developer239 picture developer239  路  5Comments

seanquijote picture seanquijote  路  6Comments