程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

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

发布于2019-12-05 00:01     阅读(328)     评论(0)     点赞(15)     收藏(4)


Is it possible to load the model for a FaceRecognizer from memory or a string rather than from a saved file. The API docs do not show a 'FromString or Buffer' version.

The current code loads from file:

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

Some more background. The presisted models are stored in S3. I don't want to retrieve from S3 and then save to disk in order to use. I would rather load directly from s3 into the model or load the xml string/document into the model.


解决方案


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();

sad as it is, you can neither access FileStorage api, nor the FaceReco::load(FileStorage&) methods from python

(sidenote : at least you could resave them once from the facereco as yml.gz, to get the traffic down to 1/5 of the uncompressed xml)



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:https://www.pythonheidong.com/blog/article/168266/ebe64dc6479ae23dc6e5/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

15 0
收藏该文
已收藏

评论内容:(最多支持255个字符)