改进了openbr命令行工具的python包装器。

pyopenbr的Python项目详细描述


pyopenbr

openbr的另一种python包装器,它使用命令行工具。

简单用法:

importpyopenbrresult=pyopenbr.run(algorithm="FaceRecognition",compare="image1.jpg model.gal")print(result)

文档:

参数:

参数和算法与openbr完全相同 命令行工具官方文件见: http://openbiometrics.org/docs/api_docs/cl_api/

语法:

以下是执行相同操作的有效语法示例:

# [1st Option] --> RECOMMENDEDresult=pyopenbr.run("output.csv",algorithm="FaceRecognition",compare="image1.jpg model.gal")# [2nd Option - Splitting the parameter-option pairs]result=pyopenbr.run("output.csv","-algorithm FaceRecognition","-compare image1.jpg model.gal")# [3rd Option - Copying the Command Line Tool's parameters as a second argument of the `run` function]result=pyopenbr.run("output.csv","-algorithm FaceRecognition -compare image1.jpg model.gal")

注:

  • output参数是可选的
  • 第一个选项的参数名是not硬编码的这意味着任何参数都被转换为OpenBR工具使用的格式
  • 命令总是返回openbr输出的内容 工具。(即使是无法读取的格式-,例如raw format
  • 如果省略输出参数,或者以.csv结尾,则 返回的值将是一个字典,其结果是openbr 工具。

示例-人脸识别:

# You can read the official tutorial with the Command Line tool here: http://openbiometrics.org/docs/tutorials/#face-recognition# and see the similarities in the usage.importpyopenbr# Train the model with images in the `train` directory and store it in `model.gal`:pyopenbr.run("model.gal","-enrollAll -enroll train/",algorithm="FaceRecognition")# Run a test of the trained model:result=pyopenbr.run(algorithm="FaceRecognition",compare="model.gal testImage.jpg")

配置选项:

您可以在模块中配置两项功能:

  • 在终端中禁用错误打印:pyopenbr.disableErrors()
  • 提供OpenBR命令行工具的路径: pyopenbr.setExecutable(path)。默认情况下,模块将尝试 在系统中查找可执行文件。

要求:

您需要在系统上安装OpenBR用于安装 说明请访问:http://openbiometrics.org/docs/install/

兼容性:

该模块与Windows、Mac OS X和*nix系统兼容它 已经在Mac OS X El Capitan下测试过都是Python2.7 支持python 3。

优点/缺点:

使用这个包装器有很多优点,官方的python包装器 不会:-解决许多内存问题(例如,处理大量 图像),使用起来更简单。-不会抛出任何分段错误 或其他C/C++相关的错误,这在官方包装中是常见的。 -运行cmake时不需要特殊参数,以便 安装。-使用简单,因为它类似于OpenBR命令 线工具(这也是openbr中记录最充分的 网站,包括教程)。

但是,有一个缺点:它比 正式的python包装器官方包装没有 当用于许多连续的 过程。不过,这一个确实如此。这是不可避免的,因为我们 实际上,调用openbr命令行工具。

速度测试:

我做了一个快速的实验,看看官员之间的时间差 python包装器和这个模块。测试是关于识别 相同的图像,与经过训练的模型对比:

  • 正式包装时间:0.182754993439
  • 我们的时间:0.663321971893

所以,两者的速度性能有很大的不同 包装纸。可能这是速度和稳定性之间的权衡

注意:

这是一个相当简单的包装器,它使用基本的通信方式 使用openbr可执行文件。但是,它是稳定和易于使用的,这 这就是我将其作为开源发布的原因。

联系人:

你可以通过电子邮件联系我:antonis.katzourakis{at}gmail{dot}com

推特:@ant0nisktz

许可证:

Copyright 2016 Antonios Katzourakis
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何创建Restful服务并将其部署到OSGi容器?   java如何获取用户在EditText中输入的时间并从中扣除5小时30分钟?   java用户无法注销firebase 安卓   java Undertow始终将字符集添加到ContentType头,即使它不是文本MIME类型   java LocalBroadcastManager未正确接收消息   foreach在Java中有没有比For循环更好的方法可以灵活地遍历集合?   java如何在安卓上移动球   在OSGi下的Log4j中使所有记录器异步时,java ClassNotFoundException   java未知输入字节长度转换为int   java测试工厂在使用前缀命名时抛出NPE   对象的副本(JAVA)   java SP20310:无法打开文件。sql   java Spring安全性仅为一条路径添加安全性   java在idea中获取菱形运算符的编译错误