lbph icon indicating copy to clipboard operation
lbph copied to clipboard

[ Question ] Is there any way to save the trained model?

Open AthanatiusC opened this issue 5 years ago • 3 comments

hello, i'm trying to implement your library to my project with 24000 faces which takes a long time to train every time i start the application. so i there any way i could save the trained model into a file and load it back?

Thank you

AthanatiusC avatar Dec 22 '19 07:12 AthanatiusC

Hello @AthanatiusC, I don't think it is possible right now.

The "trained model" (the histograms calculated) is stored by the trainingData variable, but this is an unexported identifier.

I believe one way would be to turn this identifier "public" so you could save and load data freely, maybe using some pickling strategy.

Sorry, I don't have time to do this change right now (and to be honest, my Go skills are rusty) but feel free to open a PR to add it.

kelvins avatar Dec 30 '19 00:12 kelvins

@kelvins Is there specific way to save a model ? Or we automate the saving/pickling of the trainingData variable ?

1ycx avatar Mar 13 '20 14:03 1ycx

@Kogam22, this project was initially developed for study purposes and I haven't thought about model serialization. I believe we could keep the model state by saving/loading the trainingData variable.

kelvins avatar Mar 15 '20 15:03 kelvins