Loading model state in FaceRecognizer from memory or string in python opencv

Is it possible to load the model for FaceRecognizer from memory or a string, and not from a saved file. API documents do not display the FromString or Buffer version.

The current code is loaded from the file:

model = cv2.createLBPHFaceRecognizer()
model.load('model.xml')

Another background. Presented models are stored in S3. I do not want to extract from S3 and then save to disk for use. I would prefer to load directly from s3 to the model or load a xml string / document into the model.

+4
source share
1 answer

unfortunately not possible from python (cv2) atm.

while you can do it from C ++,

string yml; // the whole schlepp in a string
FileStorage fs;
fs.open(yml,FileStorage::READ|FileStorage::MEMORY);
facereco->load(fs);
fs.release();

, FileStorage api, FaceReco:: load (FileStorage &) python

(sidenote: , facereco yml.gz, 1/5 xml)

+4

Source: https://habr.com/ru/post/1523751/


All Articles