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

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

dlib库的使用函数


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


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


image.png

image.png



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


目录
打赏
0
0
0
0
1042
分享
相关文章
【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
33 7
【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
【03】做一个精美的打飞机小游戏,规划游戏项目目录-分门别类所有的资源-库-类-逻辑-打包为可玩的exe-练习python打包为可执行exe-优雅草卓伊凡-持续更新-分享源代码和游戏包供游玩-1.0.2版本
【03】做一个精美的打飞机小游戏,规划游戏项目目录-分门别类所有的资源-库-类-逻辑-打包为可玩的exe-练习python打包为可执行exe-优雅草卓伊凡-持续更新-分享源代码和游戏包供游玩-1.0.2版本
112 31
【03】做一个精美的打飞机小游戏,规划游戏项目目录-分门别类所有的资源-库-类-逻辑-打包为可玩的exe-练习python打包为可执行exe-优雅草卓伊凡-持续更新-分享源代码和游戏包供游玩-1.0.2版本
使用 pipx 安装并执行 Python 应用程序 (1)
使用 pipx 安装并执行 Python 应用程序 (1)
45 17
【新手必看】PyCharm2025 免费下载安装配置教程+Python环境搭建、图文并茂全副武装学起来才嗖嗖的快,绝对最详细!
PyCharm是由JetBrains开发的Python集成开发环境(IDE),专为Python开发者设计,支持Web开发、调试、语法高亮、项目管理、代码跳转、智能提示、自动完成、单元测试和版本控制等功能。它有专业版、教育版和社区版三个版本,其中社区版免费且适合个人和小型团队使用,包含基本的Python开发功能。安装PyCharm前需先安装Python解释器,并配置环境变量。通过简单的步骤即可在PyCharm中创建并运行Python项目,如输出“Hello World”。
206 13
【新手必看】PyCharm2025 免费下载安装配置教程+Python环境搭建、图文并茂全副武装学起来才嗖嗖的快,绝对最详细!
python安装、vscode安装、conda安装:一文搞定Python的开发环境(史上最全)
尼恩架构团队推出了一系列《LLM大模型学习圣经》PDF,旨在帮助读者深入理解并掌握大型语言模型(LLM)及其相关技术。该系列包括Python基础、Transformer架构、LangChain框架、RAG架构及LLM智能体等内容,覆盖从理论到实践的各个方面。此外,尼恩还提供了配套视频教程,计划于2025年5月前发布,助力更多人成为大模型应用架构师,冲击年薪百万目标。
30天python速成-第一天(python简介及下载安装)
30天python速成-第一天(python简介及下载安装)
Indigo | Indigo(Python)简介、安装与入门
Indigo | Indigo(Python)简介、安装与入门
475 0
Indigo | Indigo(Python)简介、安装与入门

热门文章

最新文章