Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略目录dlib库的简介dlib库的安装dlib库的使用函数0、利用dlib.get_frontal_face_detector函数实现人脸检测可视化1、hog提取特征的函数2、CNN提取特征的函数dlib库的简介一个机器学习的开源库,包含了机器学习的很多算…

大家好,又见面了,我是你们的朋友全栈君。

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

目录

dlib库的简介

dlib库的安装

dlib库的使用函数

0、利用dlib.get_frontal_face_detector函数实现人脸检测可视化

1、hog提取特征的函数

2、CNN提取特征的函数


dlib库的简介

    一个机器学习的开源库,包含了机器学习的很多算法,使用起来很方便,直接包含头文件即可,并且不依赖于其他库(自带图像编解码库源码)。Dlib可以帮助您创建很多复杂的机器学习方面的软件来帮助解决实际问题。目前Dlib已经被广泛的用在行业和学术领域,包括机器人,嵌入式设备,移动电话和大型高性能计算环境。

Dlib是一个使用现代C++技术编写的跨平台的通用库,遵守Boost Software licence. 主要特点如下: 

  • 完善的文档:每个类每个函数都有详细的文档,并且提供了大量的示例代码,如果你发现文档描述不清晰或者没有文档,告诉作者,作者会立刻添加。 
  • 可移植代码:代码符合ISO C++标准,不需要第三方库支持,支持win32、Linux、Mac OS X、Solaris、HPUX、BSDs 和 POSIX 系统 
  • 线程支持:提供简单的可移植的线程API 
  • 网络支持:提供简单的可移植的Socket API和一个简单的Http服务器 
  • 图形用户界面:提供线程安全的GUI API 
  • 数值算法:矩阵、大整数、随机数运算等 
  • 机器学习算法:
  • 图形模型算法: 
  • 图像处理:支持读写Windows BMP文件,不同类型色彩转换 
  • 数据压缩和完整性算法:CRC32、Md5、不同形式的PPM算法 
  • 测试:线程安全的日志类和模块化的单元测试框架以及各种测试assert支持
  • 一般工具:XML解析、内存管理、类型安全的big/little endian转换、序列化支持和容器类
     

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

dlib pypi
dlib库
dlib c++ library

dlib库的安装

dlib压缩包集合Index of /files

本博客提供三种方法进行安装

T1方法:pip install dlib

此方法是需要在你安装cmake、Boost环境的计算机使用

T2方法:conda install -c menpo dlib=18.18

此方法适合那些已经安装好conda库的环境的计算机使用,conda库的安装本博客有详细攻略,请自行翻看。

T3方法:pip install dlib-19.8.1-cp36-cp36m-win_amd64.whl

dlib库的whl文件——dlib-19.7.0-cp36-cp36m-win_amd64.rar

dlib-19.3.1-cp35-cp35m-win_amd64.whl

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

哈哈,大功告成!如有资料或问题需求,请留言!

dlib库的使用函数

0、利用dlib.get_frontal_face_detector函数实现人脸检测可视化

CV之dlib:利用dlib.get_frontal_face_detector函数实现人脸检测

Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略

1、hog提取特征的函数

dlib.get_frontal_face_detector()    #人脸特征提取器,该函数是在C++里面定义的

help(dlib.get_frontal_face_detector())
Help on fhog_object_detector in module dlib.dlib object:

class fhog_object_detector(Boost.Python.instance)
 |  This object represents a sliding window histogram-of-oriented-gradients based object detector.
 |
 |  Method resolution order:
 |      fhog_object_detector
 |      Boost.Python.instance
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __call__(...)
 |      __call__( (fhog_object_detector)arg1, (object)image [, (int)upsample_num_times=0]) -> rectangles :
 |          requires
 |              - image is a numpy ndarray containing either an 8bit grayscale or RGB
 |                image.
 |              - upsample_num_times >= 0
 |          ensures
 |              - This function runs the object detector on the input image and returns
 |                a list of detections.
 |              - Upsamples the image upsample_num_times before running the basic
 |                detector.
 |
 |  __getstate__(...)
 |      __getstate__( (fhog_object_detector)arg1) -> tuple
 |
 |  __init__(...)
 |      __init__( (object)arg1) -> None
 |
 |      __init__( (object)arg1, (str)arg2) -> object :
 |          Loads an object detector from a file that contains the output of the
 |          train_simple_object_detector() routine or a serialized C++ object of type
 |          object_detector<scan_fhog_pyramid<pyramid_down<6>>>.
 |
 |  __reduce__ = <unnamed Boost.Python function>(...)
 |
 |  __setstate__(...)
 |      __setstate__( (fhog_object_detector)arg1, (tuple)arg2) -> None
 |
 |  run(...)
 |      run( (fhog_object_detector)arg1, (object)image [, (int)upsample_num_times=0 [, (float)adjust_threshold=0.0]]) -> tuple :
 |          requires
 |              - image is a numpy ndarray containing either an 8bit grayscale or RGB
 |                image.
 |              - upsample_num_times >= 0
 |          ensures
 |              - This function runs the object detector on the input image and returns
 |                a tuple of (list of detections, list of scores, list of weight_indices).
 |              - Upsamples the image upsample_num_times before running the basic
 |                detector.
 |
 |  save(...)
 |      save( (fhog_object_detector)arg1, (str)detector_output_filename) -> None :
 |          Save a simple_object_detector to the provided path.
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  run_multiple(...)
 |      run_multiple( (list)detectors, (object)image [, (int)upsample_num_times=0 [, (float)adjust_threshold=0.0]]) -> tuple :
 |          requires
 |              - detectors is a list of detectors.
 |              - image is a numpy ndarray containing either an 8bit grayscale or RGB
 |                image.
 |              - upsample_num_times >= 0
 |          ensures
 |              - This function runs the list of object detectors at once on the input image and returns
 |                a tuple of (list of detections, list of scores, list of weight_indices).
 |              - Upsamples the image upsample_num_times before running the basic
 |                detector.
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __instance_size__ = 160
 |
 |  __safe_for_unpickling__ = True
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from Boost.Python.instance:
 |
 |  __new__(*args, **kwargs) from Boost.Python.class
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from Boost.Python.instance:
 |
 |  __dict__
 |
 |  __weakref__

2、CNN提取特征的函数

cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)

help(dlib.cnn_face_detection_model_v1)
Help on class cnn_face_detection_model_v1 in module dlib.dlib:

class cnn_face_detection_model_v1(Boost.Python.instance)
 |  This object detects human faces in an image.  The constructor loads the face detection model from a file. You can download a pre-trained model from http://dlib.net/files/mmod_human_face_detector.dat.bz2.
 |
 |  Method resolution order:
 |      cnn_face_detection_model_v1
 |      Boost.Python.instance
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __call__(...)
 |      __call__( (cnn_face_detection_model_v1)arg1, (object)img [, (int)upsample_num_times=0]) -> mmod_rectangles :
 |          Find faces in an image using a deep learning model.
 |                    - Upsamples the image upsample_num_times before running the face
 |                      detector.
 |
 |      __call__( (cnn_face_detection_model_v1)arg1, (list)imgs [, (int)upsample_num_times=0 [, (int)batch_size=128]]) -> mmod_rectangless :
 |          takes a list of images as input returning a 2d list of mmod rectangles
 |
 |  __init__(...)
 |      __init__( (object)arg1, (str)arg2) -> None
 |
 |  __reduce__ = <unnamed Boost.Python function>(...)
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __instance_size__ = 984
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from Boost.Python.instance:
 |
 |  __new__(*args, **kwargs) from Boost.Python.class
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from Boost.Python.instance:
 |
 |  __dict__
 |
 |  __weakref__

inline frontal_face_detector get_frontal_face_detector()
 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/147749.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • delphi 进程通信_多线程实现java

    delphi 进程通信_多线程实现java多线程总体认识当前程序是一个进程,进程只是一个工作环境,线程是工作者; 每个进程都会有一个启动线程(或叫主线程),也就是说:大量的编码都是写给这个主线程的; ExitThread(0);退出主线程; 系统不允许一个没有线程的进程存在,所以程序就退出了. ExitThread函数的参数是一个退出码,这个退出码是给之后的其他函数用的,这里随便给个无符号整数即可….

    2025年5月24日
    0
  • 如何理解Python 面向对象编程思想

    如何理解Python 面向对象编程思想Python面向对象编程思想:从四个方面来理解1.宽泛的面向对象的概念举例说明面向过程:做一件事情,从头到尾,每一个细节都要关注,重点在于过程面向对象:做一件事情,用对象去做,不关心细节和过程,万物皆对象

    2022年10月26日
    0
  • 从高考落榜生到网络专家

    从高考落榜生到网络专家成功的背后,有着许多不为人知的故事,而正是这些夹杂着泪水和汗水的过去,才成就了一个个走 向成功的普通人——凌晨两点半,早已习惯了一个人坐在电脑前的我,望着屏幕,任思绪在暗夜的包容 下静静流淌,时光仿佛又定格在三年多前的那一刻:“283分”。那是被中国万千学子称为“黑色七 月”中的一天,下班回家的母亲从家门打开后说出的一个数字,虽然早知道自己不会考上大学,但如此 的成绩也多少出乎自己

    2022年10月22日
    0
  • docker访问宿主机_docker容器获取宿主机ip

    docker访问宿主机_docker容器获取宿主机ip前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程我们需要让宿主机的mysql允许远程接入。需要授权,不同版本的mysql授权语句不一样,这个在之前讲过。如下是mysql8.0之前版本的授权语句:GRANTALLPRIVILEGESON*.*TO’root’@’%’IDENTIFIEDBY’root’WITHGRANTOPTION;docker安装的mysql走网桥网络,这样docker容器的mysql就能跟宿主机同一个网络

    2022年8月21日
    8
  • idea查看激活码(JetBrains全家桶)

    (idea查看激活码)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.htmlHFFWNFD5GX-eyJsaWNlbnNlSWQi…

    2022年3月28日
    75
  • stream.map的用法_stream

    stream.map的用法_stream使用Stream流时发现其中的map方法使用不好容易理解,以一个小案例详细探讨Stream中map的使用。案例涉及知识点:1、Stream中of方法传入可变参数2、Stream中map元素类型转化方法3、Function匿名接口,自定义类匿名对象的使用4、Lambda表达式为了便于理解,首先借鉴其他博客中的说法,stream()优点无存储。stream不是一种数据结构,它只是某种数据源的一个视图,数据源可以是一个数组,Java容器或I/Ochannel等。为函数式编程而生。对strea

    2022年9月8日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号