Image Recognition and Face Detection

421 篇文章 14 订阅

Image recognition and face detection has been around for some years. However, usage and adoption was limited due to quality and ease of development. With the release of Microsoft’s Project Oxford, the accessibility to such tools has massively improved. Their simple to use REST API provides an excellent opportunity for the average developer to augment their apps with fancy -state of the art- machine learning features.

To give you an example how this looks like:

Detecting Arnold Schwarzenegger

The API detects two faces (correct), one male one female (correct), the male face smiles (correct), the female face does not (correct). It also provides an age guess for Maria Shriver(36) and Arnold Schwarzenegger(48). As I don’t know when the photo was taken, it is hard to judge the accuracy. However, I assume that the guess is too low.

Let’s take a look at a more complex example; the German government.

Detecting German Government

Even though the images are pretty small, and faces are tilted in different ways the API does a good job at identifying faces, emotions, gender and ages.

In case you want to try it yourself, head over to my minimalistic implementation; provide an url of an image (with faces) and hit “classify”.

For the interested coder, I compiled a small R package Roxford providing access to the API. Please read the short installation guide.

To sum up; giving the complexity of image/face detection, I find it pretty amazing (and scary!) how easy it is. As faces get unique IDs, the API also provides functionality to label individuals in a large image library.

Written on December 31, 2015
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用dlib进行人脸识别可以使用dlib_face_recognition_resnet_model_v1模型,以下是一个简单的示例代码: ```c++ #include <iostream> #include <dlib/opencv.h> #include <dlib/image_processing/frontal_face_detector.h> #include <dlib/image_processing.h> #include <dlib/gui_widgets.h> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace dlib; using namespace std; int main() { // 初始化人脸检测器和人脸特征提取器 frontal_face_detector detector = get_frontal_face_detector(); shape_predictor sp; deserialize("shape_predictor_68_face_landmarks.dat") >> sp; // 加载人脸识别模型 anet_type net; deserialize("dlib_face_recognition_resnet_model_v1.dat") >> net; // 加载待识别的图像 cv::Mat img = cv::imread("test.jpg"); // 将图像转换为dlib的图像格式 cv_image<bgr_pixel> cimg(img); // 人脸检测 std::vector<rectangle> faces = detector(cimg); // 人脸特征提取 std::vector<matrix<float,0,1>> face_descriptors; for (unsigned long i = 0; i < faces.size(); ++i) { full_object_detection shape = sp(cimg, faces[i]); matrix<rgb_pixel> face_chip; extract_image_chip(cimg, get_face_chip_details(shape,150,0.25), face_chip); face_descriptors.push_back(net(face_chip)); } // 输出人脸特征 for (unsigned long i = 0; i < face_descriptors.size(); ++i) cout << "face descriptor " << i << ": " << trans(face_descriptors[i]) << endl; return 0; } ``` 其中,需要下载预训练模型文件`shape_predictor_68_face_landmarks.dat`和`dlib_face_recognition_resnet_model_v1.dat`,并放置在代码所在目录下。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值