I started this project as a way to build an implementation of realtime facial recogniton for use in a company timeclock software & hardware solution.
I was planning, initially, on utilizing a Raspberry Pi Zero 2 W to run the software and a connected Arducam as the camera interface. However, it's becoming clear that this is configuration is very likely to change. Installing dlib on my pi02w took ~12 hours. Not practical at all.
The camera hardware implementation has been written as an abstract factory, so that essentially you can use any type of camera hardware and any OS as long as it supports python. Currently, Darwin (macOS) and Linux (specifically Raspberry Pi Zero 2 W) have implemented classes in the CameraFactory.
I have included steps in the installation instructions on how to build dlib with minimal requirements, as it was the only way I was able to get it installed.
Run the following commands before installing the Python package requirements:
sudo apt update
sudo apt install -y build-essential cmake pkg-config
sudo apt install -y python3-dev python3-pip
sudo apt install -y libatlas-base-dev gfortran
sudo apt install -y libopenblas-dev
python3 -m venv .venv
source .venv/bin/activate
pip install numpy
sudo apt install libcamera-dev libcamera-apps python3-libcamera python3-picamera2 x11-apps
sudo dphys-swapfile swapoff
sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
git clone https://github.com/davisking/dlib.git
cd dlib
python3 setup.py install --no DLIB_USE_CUDA
sudo swapoff -a
sudo rm /swapfile
Edit fstab with sudo nano /etc/fstab
and look for the line that contains swapfile
and comment it out or remove it.
Double check the swapfile has been removed with free -h
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt