Simple face recognition
This is a simple face recognition example of using deep learning to
recognise faces within a picture. It originates from Adrian
Rosebrock’s article —
Face recognition with OpenCV, Python, and deep learning.
See the GitHub repository for examples of its usage:
https://github.com/simonzhaoms/facematch
To install and demonstrate the algorithm:
$ pip3 install mlhub
$ ml install facematch
$ ml configure facematch
$ ml demo facematch
To recognise an arbitrary person who can be found in the Internet,
you can just type:
$ ml score facematch
It will use Microsoft Bing image search API to search a person’s
photo you want to recognise. In order to use the API, you must have
a subcription key. A 7-days free account can be created at
https://azure.microsoft.com/en-us/try/cognitive-services/?api=search-api-v7
To match you in camera:
$ ml score facematch --capture --camera
It will open your camera to capture 5 photos of you to generate your
face database, then recognise you in a live camera video.
You can also provide the path or URL of a person’s photos via option--data
, and let facematch to recognise him/her in a photo via the
option --match
:
$ ml score facematch --data <photo-of-the-person> --match <photo-for-recognition>
or video via the option --video
:
$ ml score facematch --data <photo-of-the-person> --video <video-for-recognition>
The photos used for recognition here are collected by using
Bing image search API. The code for collecting photos is adapted from
How to (quickly) build a deep learning image dataset.
In the interactive mode of ml score facematch
, a subscription key of
Bing image search API is required. You can get 7-days free account
together with a subscription key at Try Microsoft Azure Cognitive
Services.
More details about how to use Bing image search API can be found at