Skip to main content

Face recognition from identity cards with OpenCV and Deep Learning.

Project description


facereg is a module for face recognition with OpenCV and Deep Learning.

For now it can be used for just images. It is easy to use with a handy feature which downloads images from Google for you with given keywords to create dataset/s.

Uses two different technics CNN and HoG for recognition based on dlib’s face recognition system with using face_recognition. facereg has totally three different layers and only recognizer has connection on encoder.



  • CMake
  • All dependencies are listed on requirements.txt and will be installed when you install with pip.


  • Install module using pip:

    $ pip install facereg
  • Download the latest facereg library from: and install module using pip:

    $ pip install -e .
  • Extract the source distribution and run:

    $ python build
    $ python install


  • google_images:
import os
from facereg import google_images

output_directory = os.getcwd() + '/datasets' # directory path where you want to save photos
image_paths ='michael jordan', limit=3)
  • face_encoder:
import os
from facereg import face_encoder

datasets_path = os.getcwd() + '/datasets'
encodings_path = os.path.dirname(os.path.realpath(__file__)) + '/encodings.pickle'
# these are default values for this method
face_encoder.encode_faces(datasets=datasets_path, encodings=encodings_path, detection_method='cnn')
  • recognize_faces:
from facereg import recognize_faces

names = recognize_faces.recognize(image_path)
# returns found names from your datasets

CLI Usage

  • Download images
# -d: keyword, -l: limit
$ python -m facereg -d 'michael jordan'
$ python -m facereg -d 'michael jordan' -l 5
  • Recognition
# -i: Directory path for image
$ python -m facereg -i tests/resources/michael_jordan.jpeg

Sample Result


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for facereg, version
Filename, size File type Python version Upload date Hashes
Filename, size facereg- (10.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page