Live visualisation of various facial recognition algorithms.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.8 KiB

A mirror which shows which faces are detected through three different facial detection algorithms:

  • OpenCV's deep neural net face detector.
  • Dlib's default frontal face detector, which is HOG based
  • A Viola-Jones Haarcascade detection. Any OpenCV compatible xml file should work. It defaults to the canonical haarcascade_frontalface_alt2.xml.


on windows

The installation in Windows can be done, though it is quite elaborate:

  • Install python3
  • Install VS C++ build tools
  • Install Cmake (needed for python dlib)
    • make sure to add it to path
  • Install git
    • including ssh deploy key
  • git clone
  • cd face_recognition
  • pip install virtualenv
  • virtualenv.exe venv
    • Might be that you need to run: C:\Users\DP Medialab\AppData\Roaming\Python\Python39\Scripts\virtualenv.exe (see pip output)
  • .\venv\Scripts\activate
    • Might be that you need to first run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  • cd .\dnn\face_detector
  • python.exe .\
  • cd ..\..
  • pip.exe install -r requirements.txt
  • cd .\visualhaar
  • Either one of:
  • Fetch SourceSansPro-Regular.ttf from the internet

  • Make the installer:

    • Either one of:

      • & 'C:\Users\DP Medialab\AppData\Roaming\Python\Python38\Scripts\pyinstaller.exe' .\ --add-binary '.\visualhaar\target\release\visual_haarcascades_lib.dll;.' --add-data '.\haarcascade_frontalface_alt2.xml;.' --add-data '.\SourceSansPro-Regular.ttf;.' --add-data 'dnn;dnn'
      • & '.\venv\Scripts\pyinstaller.exe' .\ --add-binary '.\visualhaar\target\release\visual_haarcascades_lib.dll;.' --add-data '.\haarcascade_frontalface_alt2.xml;.' --add-data '.\SourceSansPro-Regular.ttf;.' --add-data 'dnn;dnn'
    • mv '.\dist\mirror\mpl-data' '.\dist\mirror\matplotlib\'

    • Compress-Archive -LiteralPath .\dist\mirror -DestinationPath .\dist\

  • We could also use wine for cross compilation from Linux

    • make sure wine is set to pose as Windows 10 (winecfg)
    • wine ~/Downloads/python-3.9.0-amd64.exe (or whichever version you use)
      • Install for all users

    Instructor help

    If screen stays black: is the camera on?

    Enable camera through keyboard (MSI laptops: fn+F6). Then go to Settings/Instellingen -> Privacy instellingen voor camera -> Grant apps access to camera.