Skip to content

simonzhaoms/facedetect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Face Detection

This is a simple face detection example of using machine learning algorithms to search faces within a picture. It originates from Shantnu Tiwari's tutorial -- Face Recognition with Python, in Under 25 Lines of Code and Face Detection in Python Using a Webcam. It uses OpenCV cascade to break the problem of detecting faces into multiple stages. The algorithm starts at the top left of a picture and moves down across small blocks of data. During the moves, a series of coarse-to-fine quick tests are carried out on each block. And it will only detect a face if all stages pass.

See the github repository for examples of its usage: https://github.com/simonzhaoms/facedetect

Usage

  • To install and demostrate the algorithm:

    $ pip3 install mlhub
    $ ml install   facedetect
    $ ml configure facedetect
    $ ml demo      facedetect

Examples

To detect faces:

  • From a local image file:

    $ ml score facedetect ~/.mlhub/facedetect/images/abba.png
  • From an image on the web:

    $ ml score facedetect https://github.com/opencv/opencv/raw/master/samples/data/lena.jpg
  • From your camera:

    $ ml live facedetect

Sometimes the algorithm will fail to detect real faces, then you need to fine-tune the parameters to get the ideal results:

$ ml score facedetect https://github.com/ageitgey/face_recognition/raw/master/tests/test_images/obama.jpg
$ ml score facedetect https://github.com/ageitgey/face_recognition/raw/master/tests/test_images/obama.jpg --scaleFactor 1.3
$ ml live facedetect --scaleFactor 1.3 --minSize 7 --minNeighbors 40

About

Simple face detection package for MLHUB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages