关于 python 人脸检测库 dlib 的 初识 2
简介
关于人脸检测算法python库的初步认识2
使用CNN的实现人脸检测
简单说明
The example loads a pretrained model and uses it to find faces in images. 这个是使用已经训练好的模型
CNN model is much more accurate than the HOG based model shown in the face_detector.py CNN训练的模型相对于HOG有更好的精准性。 放在GPU上才能达到更好的速度。
code
#!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This example shows how to run a CNN based face detector using dlib. The
# example loads a pretrained model and uses it to find faces in images. The
# CNN model is much more accurate than the HOG based model shown in the
# face_detector.py example, but takes much more computational power to
# run, and is meant to be executed on a GPU to attain reasonable speed.
#
# You can download the pre-trained model from:
# http://dlib.net/files/mmod_human_face_detector.dat.bz2
#
# The examples/faces folder contains some jpg images of people. You can run
# this program on them and see the detections by executing the
# following command:
# ./cnn_face_detector.py mmod_human_face_detector.dat ../examples/faces/*.jpg
#
#
# COMPILING/INSTALLING THE DLIB PYTHON INTERFACE
# You can install dlib using the command:
# pip install dlib
#
# Alternatively, if you want to compile dlib yourself then go into the dlib
# root folder and run:
# python setup.py install
#
# Compiling dlib should work on any operating system so long as you have
# CMake installed. On Ubuntu, this can be done easily by running the
# command:
# sudo apt-get install cmake
#
# Also note that this example requires Numpy which can be installed
# via the command:
# pip install numpy
import glob
from imageio import imread
import dlib
paths=glob.glob('faces/*.jpg')
cnn_face_detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat')
win = dlib.image_window()
for path in paths:
img = imread(path)
dets = cnn_face_detector(img, 1)
for i,d in enumerate(dets):
print("Detection {}: Left: {} Top: {} Right: {} Bottom: {} Confidence: {}".format(
i, d.rect.left(), d.rect.top(), d.rect.right(), d.rect.bottom(), d.confidence))
rects = dlib.rectangles()
rects.extend([d.rect for d in dets])
win.clear_overlay()
win.set_image(img)
win.add_overlay(rects)
dlib.hit_enter_to_continue()
训练好的CNN模型
mmod_human_face_detector.dat
下载地址 http://dlib.net/files/mmod_human_face_detector.dat.bz2
关于 python 人脸检测库 dlib 的 初识 2的更多相关文章
- [深度学习] Python人脸识别库Deepface使用教程
deepface是一个Python轻量级人脸识别和人脸属性分析(年龄.性别.情感和种族)框架,提供非常简单的接口就可以实现各种人脸识别算法的应用.deepface官方仓库为deepface.deepf ...
- [深度学习] Python人脸识别库face_recognition使用教程
Python人脸识别库face_recognition使用教程 face_recognition号称是世界上最简单的开源人脸识别库,可以通过Python或命令行识别和操作人脸.face_recogni ...
- 【计算机视觉】如何使用于仕琪老师的libfacedetect人脸检测库
前言 最近又开始进行人脸检测方向的内容,看到于仕琪老师的多角度检测想试一下,还不清楚原理,先测试效果如何. libfacedetect人脸检测库是深圳大学于仕琪老师发布的开源库,与opencv自带的人 ...
- 基于Android平台的简易人脸检测库
代码地址如下:http://www.demodashi.com/demo/12135.html ViseFace 简易人脸检测库,不依赖三方库,可快速接入人脸检测功能. 项目依赖:compile 'c ...
- 如何快糙好猛的使用Shiqi.Yu老师的公开人脸检测库(附源码)
前言 本次编写所用的库为于仕祺老师免费提供的人脸检测库.真心好用,识别率和识别速度完全不是Opencv自带的程序能够比拟的.将其配合Opencv的EigenFace算法,基本上可以形成一个小型的毕业设 ...
- dlib python 人脸检测与关键点标记
http://blog.csdn.net/sunmc1204953974/article/details/49976045 人脸检测 #coding=utf-8 # -*- coding: utf-8 ...
- 人脸检测学习笔记(数据集-DLIB人脸检测原理-DLIB&OpenCV人脸检测方法及对比)
1.Easily Create High Quality Object Detectors with Deep Learning 2016/10/11 http://blog.dlib.net/201 ...
- OpenCV + Python 人脸检测
必备知识 Haar-like opencv api 读取图片 灰度转换 画图 显示图像 获取人脸识别训练数据 探测人脸 处理人脸探测的结果 实例 图片素材 人脸检测代码 人脸检测结果 总结 下午的时候 ...
- 人脸检测库libfacedetection介绍
libfacedetection是于仕琪老师放到GitHub上的二进制库,没有源码,它的License是MIT,可以商用.目前只提供了windows 32和64位的release动态库,主页为http ...
- [深度学习工具]·极简安装Dlib人脸识别库
[深度学习工具]·极简安装Dlib人脸识别库 Dlib介绍 Dlib是一个现代化的C ++工具箱,其中包含用于在C ++中创建复杂软件以解决实际问题的机器学习算法和工具.它广泛应用于工业界和学术界,包 ...
随机推荐
- FastAPI与SQLAlchemy数据库集成与CRUD操作
title: FastAPI与SQLAlchemy数据库集成与CRUD操作 date: 2025/04/16 09:50:57 updated: 2025/04/16 09:50:57 author: ...
- python读取文件夹内所有图片名称,随机设置为桌面壁纸且把设置后的图片移到其他文件夹内的方法
关键词:读取文件夹.读取文件.操作系统.设置壁纸.移动文件 预期实现如下几个步骤 1.获取指定文件夹内所有图片名 2.随机取一张图片设置为壁纸 3.设置为壁纸的图片移动到另外一个文件夹中 第一步,获取 ...
- 线上救急-AWS限频
线上救急-AWS限频 问题 在一个天气炎热的下午,我正喝着可口可乐,悠闲地看着Cursor生成代码,忽然各大群聊中出现了加急@全体的消息,当时就心里一咯噔,点开一看,果然,线上服务出问题,多个能源统计 ...
- 【踩坑系列】使用Comparator.comparing对中文字符串排序结果不对
1. 踩坑经历 假设有这样一个业务场景,需要对各个城市的订单量排序,排序规则为: 先根据订单量倒序排列,再根据城市名称正序排列. 示例代码: import lombok.Getter; import ...
- GUI development with Rust and GTK4 阅读笔记
简记 这是我第二次从头开始阅读,有第一次的印象要容易不少. 如果只关心具体的做法,而不思考为什么这样做,以及整体的框架,阅读的过程将会举步维艰. 简略记录 gtk-rs 的书中提到的点.对同一个问题书 ...
- C#数据结构及算法之链表
C# 链表 链表是节点的列表,节点包含两部分:值和链接,其中值部分用于储存数据,链接部分用于指向下一个元素的地址,是引用 类型. 单链表 public class LinkedList { priva ...
- DarkGreenTrip主题美化调整CSS
#cnblogs_c2,#cnblogs_c1,#ad_t2,#under_post_card1,#under_post_card2{display:none}#cnblogs_post_body i ...
- 【教程】Ubuntu 16.04 配置 CLion 开发 ROS Melodic
[教程]Ubuntu 16.04 配置 CLion 开发 ROS Melodic 目录 [教程]Ubuntu 16.04 配置 CLion 开发 ROS Melodic 笔者环境 步骤 下载安装 CL ...
- 面试题:Spring BeanFactory和FactoryBean的区别
BeanFactory:以Factory结尾,表明它是一个工厂类(接口),它是Spring IOC容器的核心接口,负责实例化和管理bean的一个工厂,为具体的IoC容器的实现提供规范.BeanFa ...
- Django Web应用开发实战第五章
视图类是通过定义和声明类的形式实现的,根据用途划分3部分:数据显示视图.数据操作视图和日期筛选视图. 数据显示视图:将后台数据显示在网页上,数据主要来自模型,有:RedirectView.Templa ...