Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to update the model LBPHFaceRecognizer #351

Open
sinitsyn-alex opened this issue Jul 8, 2018 · 4 comments
Open

There is no way to update the model LBPHFaceRecognizer #351

sinitsyn-alex opened this issue Jul 8, 2018 · 4 comments

Comments

@sinitsyn-alex
Copy link

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

@sinitsyn-alex
Copy link
Author

sinitsyn-alex commented Jul 8, 2018

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

@sinitsyn-alex
Copy link
Author

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

@justadudewhohacks
Copy link
Owner

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

@entmike
Copy link

entmike commented Jul 18, 2018

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. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants