基于机器学习CNN方法来检测人脸比之前介绍的效率要慢很多

需要先下载一个训练好的模型数据:

地址点击下载

// dlib_cnn_facedetect.cpp: 定义控制台应用程序的入口点。
// #include "stdafx.h" #include <iostream>
#include <dlib/dnn.h>
#include <dlib/data_io.h>
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h> using namespace std;
using namespace dlib; // ---------------------------------------------------------------------------------------- template <long num_filters, typename SUBNET> using con5d = con<num_filters, , , , , SUBNET>;
template <long num_filters, typename SUBNET> using con5 = con<num_filters, , , , , SUBNET>; template <typename SUBNET> using downsampler = relu<affine<con5d<, relu<affine<con5d<, relu<affine<con5d<, SUBNET>>>>>>>>>;
template <typename SUBNET> using rcon5 = relu<affine<con5<, SUBNET>>>; using net_type = loss_mmod<con<, , , , , rcon5<rcon5<rcon5<downsampler<input_rgb_image_pyramid<pyramid_down<>>>>>>>>; // ---------------------------------------------------------------------------------------- int main(int argc, char** argv)
{
try { if (argc == )
{
cout << "Call this program like this:" << endl;
cout << "./dnn_mmod_face_detection_ex mmod_human_face_detector.dat faces/*.jpg" << endl;
cout << "\nYou can get the mmod_human_face_detector.dat file from:\n";
cout << "http://dlib.net/files/mmod_human_face_detector.dat.bz2" << endl;
return ;
} net_type net;
deserialize(argv[]) >> net; image_window win;
for (int i = ; i < argc; ++i)
{
matrix<rgb_pixel> img;
load_image(img, argv[i]); // Upsampling the image will allow us to detect smaller faces but will cause the
// program to use more RAM and run longer.
while (img.size() < * )
pyramid_up(img); // Note that you can process a bunch of images in a std::vector at once and it runs
// much faster, since this will form mini-batches of images and therefore get
// better parallelism out of your GPU hardware. However, all the images must be
// the same size. To avoid this requirement on images being the same size we
// process them individually in this example.
auto dets = net(img);
win.clear_overlay();
win.set_image(img);
for (auto&& d : dets)
win.add_overlay(d); cout << "Hit enter to process the next image." << endl;
cin.get();
}
}
catch (std::exception& e)
{
cout << e.what() << endl;
} }

使用dlib基于CNN(卷积神经网络)的人脸检测器来检测人脸的更多相关文章

  1. Deep Learning模型之:CNN卷积神经网络(一)深度解析CNN

    http://m.blog.csdn.net/blog/wu010555688/24487301 本文整理了网上几位大牛的博客,详细地讲解了CNN的基础结构与核心思想,欢迎交流. [1]Deep le ...

  2. cnn(卷积神经网络)比较系统的讲解

    本文整理了网上几位大牛的博客,详细地讲解了CNN的基础结构与核心思想,欢迎交流. [1]Deep learning简介 [2]Deep Learning训练过程 [3]Deep Learning模型之 ...

  3. 基于3D卷积神经网络的人体行为理解(论文笔记)(转)

    基于3D卷积神经网络的人体行为理解(论文笔记) zouxy09@qq.com http://blog.csdn.net/zouxy09 最近看Deep Learning的论文,看到这篇论文:3D Co ...

  4. Keras(四)CNN 卷积神经网络 RNN 循环神经网络 原理及实例

    CNN 卷积神经网络 卷积 池化 https://www.cnblogs.com/peng8098/p/nlp_16.html 中有介绍 以数据集MNIST构建一个卷积神经网路 from keras. ...

  5. 3层-CNN卷积神经网络预测MNIST数字

    3层-CNN卷积神经网络预测MNIST数字 本文创建一个简单的三层卷积网络来预测 MNIST 数字.这个深层网络由两个带有 ReLU 和 maxpool 的卷积层以及两个全连接层组成. MNIST 由 ...

  6. [转]Theano下用CNN(卷积神经网络)做车牌中文字符OCR

    Theano下用CNN(卷积神经网络)做车牌中文字符OCR 原文地址:http://m.blog.csdn.net/article/details?id=50989742 之前时间一直在看 Micha ...

  7. Deep Learning论文笔记之(四)CNN卷积神经网络推导和实现(转)

    Deep Learning论文笔记之(四)CNN卷积神经网络推导和实现 zouxy09@qq.com http://blog.csdn.net/zouxy09          自己平时看了一些论文, ...

  8. CNN(卷积神经网络)、RNN(循环神经网络)、DNN(深度神经网络)的内部网络结构有什么区别?

    https://www.zhihu.com/question/34681168 CNN(卷积神经网络).RNN(循环神经网络).DNN(深度神经网络)的内部网络结构有什么区别?修改 CNN(卷积神经网 ...

  9. CNN(卷积神经网络)、RNN(循环神经网络)、DNN,LSTM

    http://cs231n.github.io/neural-networks-1 https://arxiv.org/pdf/1603.07285.pdf https://adeshpande3.g ...

随机推荐

  1. 盘一盘 Thread源码

    线程是操作系统能够进行运算调度的最小单位.它被包含在进程之中,是进程中的实际运作单位.一条线程指的是进程中一个单一顺序的控制流,一个进程中可以并发多个线程,每条线程并行执行不同的任务. 继承关系图 线 ...

  2. Linux 学习笔记 4 创建、复制、移动、文件的基本操作

    写在前面 通过上一节的学习,我们基本的了解到在Linux 里面对于设备的挂载.卸载以及设备存在的目录.挂载目录.都有了一个基本的了解 本节主要了解文件.以及目录的相关操作,比如文件.目录的创建.以及删 ...

  3. tomcat日志传参乱码问题

    问题:      在centos系统下,tomcat8.0.36控制台日志打印会出现中文乱码. 解决方案:      在catalina.sh里加上 JAVA_OPTS="-Dfile.en ...

  4. MyBatis原理-架构流程

    一 .MyBatis原理架构图 Mybatis的功能架构分为三层: API接口层:提供给外部使用的接口API,开发人员通过这些本地API来操纵数据库.接口层一接收到调用请求就会调用数据处理层来完成具体 ...

  5. FacadePattern(外观模式)-----Java/.Net

    外观模式(Facade Pattern)隐藏系统的复杂性,并向客户端提供了一个客户端可以访问系统的接口.这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂性

  6. Linux常用命令大全(二)

    Linux常用命令大全(二) cp命令 将源文件或目录复制到目标文件或目录中 注:如果是目录,需要使用-r选项 -d 复制时保留文件链接 -f 如果现存的目标文件不能打开,则删除并重试 -i 在覆盖目 ...

  7. 「Luogu P2508」[HAOI2008]圆上的整点 解题报告

    题面 给定圆的半径,求圆上整点数 这是一道很Nice的数学题!超爱!好吧,由于这道题,我去Study了一下复数(complex number)复杂的数 真棒!!! 有兴趣的戳这里!!!\(\huge ...

  8. Spring中常见的设计模式——模板模式

    一.模板模式的应用场景 模板模式又叫模板方法模式(Template Method Pattern),指定义一个算法的骨架,并允许自雷为一个或者多个步骤提供实现.模板模式使得子类可以在不改变算法结果的情 ...

  9. JVM之对象

    几乎所有对象都是在堆中分配内存的,这次来讲讲java的对象. 对象的创建主要分为以下几步: 首先,查看类是否装载.当JVM读取到new指令的时候,会拿着符号描述去方法区寻找它所属的类,如果未查找到,则 ...

  10. AspectJ——预编译方式实现AOP