Live visualisation of various facial recognition algorithms.
Find a file
2021-01-27 11:04:28 +01:00
.vscode Changes after feedback + better Windows installer explanation in Readme 2020-12-21 12:04:38 +01:00
dnn All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
face_recognition remove unneccesary import 2020-12-21 13:14:38 +01:00
visualhaar@1319e644b1 Changes after feedback + better Windows installer explanation in Readme 2020-12-21 12:04:38 +01:00
.gitignore Save images with spacebar 2020-09-23 17:18:10 +02:00
.gitmodules Crisper output and many configuration to cli arguments 2020-09-23 15:58:36 +02:00
dnn_test.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
haarcascade_frontalface_alt2.xml All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
hog_test.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
live_dnn.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
live_hog.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
mirror.py Better use of absolute paths for portability 2020-10-12 16:23:27 +02:00
README.md explanation for running in Virtualbox 2021-01-27 11:04:28 +01:00
recognition_test.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
requirements.txt Requirements.txt for Windows installer 2021-01-04 15:13:14 +01:00
test_rec.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
test_rust.py Crisper output and many configuration to cli arguments 2020-09-23 15:58:36 +02:00
video_multiprocess.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00
video_threading.py All sorts of test scripts and the first functional mirror version 2020-09-15 10:28:52 +02:00

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.

Installation

on windows

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

  • Install python3.8
  • 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 https://git.rubenvandeven.com/r/face_recognition
  • 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 .\download_weights.py
  • 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' .\mirror.py --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' .\mirror.py --add-binary '.\visualhaar\target\release\visual_haarcascades_lib.dll;.' --add-data '.\haarcascade_frontalface_alt2.xml;.' --add-data '.\SourceSansPro-Regular.ttf;.' --add-data 'dnn;dnn' --hidden-import 'scipy.spatial.transform._rotation_groups' --hidden-import 'skimage.filters.rank.core_cy_3d'
    • Compress-Archive -LiteralPath .\dist\mirror -DestinationPath .\dist\mirror.zip
  • 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

On windows in VirtualBox

See this on getting the webcam working in the VM:

  1. Install extension pack: sudo apt install virtualbox-ext-pack
  2. VBoxManage list webcams
  3. VBoxManage controlvm "WIn10" webcam attach .3

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.