Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect faces using Ruby?

Can anyone tell me how to detect faces in a static picture using Ruby or Javascript?

like image 305
palani Avatar asked Sep 09 '09 13:09

palani


People also ask

How do you find a face in an image?

Detection — the process of finding a face in an image. This can be done by training an algorithm, usually a deep neural network, on a vast number of photos that have faces in known positions. Thanks to Flickr, Instagram, or Facebook, we have ready massive sets of images that are used to train deep neural networks.

What is the facial recognition API?

This API provides a suite of tools around facial detection and recognition within images. Capabilities provided include comparing two faces (face recognition), detecting the presence of faces within an image, and returning X,Y coordinates of faces detected in images.

How does OpenFace recognition work?

It starts off by detecting the face using dlib — a designated AI-based machine learning library and OpenCV — another library that mostly offers image processing with some machine learning available if you build from the source. Here is a simple overview of the OpenFace recognition pipeline:

How accurate is facial recognition technology?

The idea of facial recognition technology firstly appeared In 2014, when Facebook announced its DeepFace. Just for the record, this program was able to determine whether two photographed faces belong to the same person with an accuracy rate of 97.25%.


3 Answers

After some research and help from this thread I've decided to make a rubygem which can be found here:

EDIT: Unfortunately rekognize decided to discontinue their services making this Gem obsolete.

This uses the face recognition API from rekognition.com.

like image 52
dennis Avatar answered Oct 22 '22 10:10

dennis


Since the other answers to that interesting question are mostly outdated now, here the 2012 solution:

Using jQuery with jquery.objectdetect:

$("#faces").objectdetect("all", {classifier: objectdetect.frontalface}, function(coords) {
    // Do something with the face coordinates
});

Using jQuery with jquery.facedetection:

var coords = $("#faces").faceDetection();
// Do something with the face coordinates

Not using jQuery: Both plugins are based on stand-alone libraries that do not depend on jQuery at all.


In reply to @joeforker who said

"If you really don't understand that the notion JQuery can detect faces is a joke, you need to learn a lot before you will be ready to detect faces."

Or you just have to wait a year or two ;)

like image 27
le_m Avatar answered Oct 22 '22 10:10

le_m


If you are going to try and write something from scratch, there is a great explanation of the process on the Carnegie Mellon Website - neat graphics too.

However, your best bet is probably trying to hook into the Opensource Computer Vision project. Here is a good tutorial on using OpenCV for facial recognition.

like image 40
Mike Buckbee Avatar answered Oct 22 '22 08:10

Mike Buckbee