简介

关于人脸检测算法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的更多相关文章

  1. [深度学习] Python人脸识别库Deepface使用教程

    deepface是一个Python轻量级人脸识别和人脸属性分析(年龄.性别.情感和种族)框架,提供非常简单的接口就可以实现各种人脸识别算法的应用.deepface官方仓库为deepface.deepf ...

  2. [深度学习] Python人脸识别库face_recognition使用教程

    Python人脸识别库face_recognition使用教程 face_recognition号称是世界上最简单的开源人脸识别库,可以通过Python或命令行识别和操作人脸.face_recogni ...

  3. 【计算机视觉】如何使用于仕琪老师的libfacedetect人脸检测库

    前言 最近又开始进行人脸检测方向的内容,看到于仕琪老师的多角度检测想试一下,还不清楚原理,先测试效果如何. libfacedetect人脸检测库是深圳大学于仕琪老师发布的开源库,与opencv自带的人 ...

  4. 基于Android平台的简易人脸检测库

    代码地址如下:http://www.demodashi.com/demo/12135.html ViseFace 简易人脸检测库,不依赖三方库,可快速接入人脸检测功能. 项目依赖:compile 'c ...

  5. 如何快糙好猛的使用Shiqi.Yu老师的公开人脸检测库(附源码)

    前言 本次编写所用的库为于仕祺老师免费提供的人脸检测库.真心好用,识别率和识别速度完全不是Opencv自带的程序能够比拟的.将其配合Opencv的EigenFace算法,基本上可以形成一个小型的毕业设 ...

  6. dlib python 人脸检测与关键点标记

    http://blog.csdn.net/sunmc1204953974/article/details/49976045 人脸检测 #coding=utf-8 # -*- coding: utf-8 ...

  7. 人脸检测学习笔记(数据集-DLIB人脸检测原理-DLIB&OpenCV人脸检测方法及对比)

    1.Easily Create High Quality Object Detectors with Deep Learning 2016/10/11 http://blog.dlib.net/201 ...

  8. OpenCV + Python 人脸检测

    必备知识 Haar-like opencv api 读取图片 灰度转换 画图 显示图像 获取人脸识别训练数据 探测人脸 处理人脸探测的结果 实例 图片素材 人脸检测代码 人脸检测结果 总结 下午的时候 ...

  9. 人脸检测库libfacedetection介绍

    libfacedetection是于仕琪老师放到GitHub上的二进制库,没有源码,它的License是MIT,可以商用.目前只提供了windows 32和64位的release动态库,主页为http ...

  10. [深度学习工具]·极简安装Dlib人脸识别库

    [深度学习工具]·极简安装Dlib人脸识别库 Dlib介绍 Dlib是一个现代化的C ++工具箱,其中包含用于在C ++中创建复杂软件以解决实际问题的机器学习算法和工具.它广泛应用于工业界和学术界,包 ...

随机推荐

  1. Sentinel源码—8.限流算法和设计模式总结

    大纲 1.关于限流的概述 2.高并发下的四大限流算法原理及实现 3.Sentinel使用的设计模式总结 1.关于限流的概述 保护高并发系统的三把利器:缓存.降级和限流.限流就是通过限制请求的流量以达到 ...

  2. 可视化图解算法:按之字形顺序打印二叉树( Z字形、锯齿形遍历)

    1. 题目 描述 给定一个二叉树,返回该二叉树的之字形层序遍历,(第一层从左向右,下一层从右向左,一直这样交替) 数据范围:0≤n≤1500,树上每个节点的val满足 |val| <= 1500 ...

  3. tp5 分页权限权限设置显示

    $adminid = cookie("adminid"); $shop_id=$this->get_shop_id(); if($adminid==1){ $uid = in ...

  4. AutoFac(五)——通过lambda表达式灵活注册

    按参数值不同实现不同的注册 一.定义接口 public interface InterfaceDao { public virtual void DoSomething(string type) { ...

  5. Spring Kafka: UnknownHostException: 34bcfcc207e0

    参考: https://stackoverflow.com/questions/69527813/spring-kafka-unknownhostexception-34bcfcc207e0 我遇到的 ...

  6. 痞子衡嵌入式:聊聊i.MXRT1024/1064片内4MB Flash的SFDP表易丢失导致的烧录异常

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MXRT1024/1064片内4MB Flash的SFDP表易丢失导致的烧录异常. 我们知道 i.MXRT 系列本身并没有片内非易失 ...

  7. 操作系统综合题之“用记录型信号量机制的wait操作和signal操作写出三个进程的同步代码(水果进箱问题-代码补充)”

    1.问题:假设一个水果赛选系统由三个进程A.B.C组成.进程A每次取一个水果,之后存放在货架F上,F的容量为每次只能存放一个水果.若货架上存放的是苹果则让进程B取出,并存放到苹果箱中:若货架上存放的是 ...

  8. acwing 智商药

    题目链接:5046. 智商药 - AcWing题库 首先考虑dfs 不用想肯定超时 过了10/17个测试点 代码 1 #include<bits/stdc++.h> 2 3 using n ...

  9. 解决Git异常 Access denied your account has 2FA enabled

    摘要:解决Git双因子身份验证问题. 问题背景   在使用账号和密码的方式拉取公司GitLab代码时,遇到了以下错误提示问题: remote: HTTP Basic: Access denied. T ...

  10. The length of parametric curve (x + sin x, cos x)

    问题引入 一个硬币(圆)的周长上有一个点,将硬币在一条线上无滑动地滚动.假设那个点开始时在最上面,滚了半圈到了最下面,求这个点相对于地面的运动轨迹的长度. 或者说,再简单点,自行车总骑过吧.假如你在骑 ...