Pi 4 AI processing of camera data to measure face dwell times.

Here is some code that is designed for the Raspberry Pi 4. It is incomplete and may have been superseded in some areas. Here are the files provided under the MIT license:

  • “rpicam_still.cpp” – A C++ program to repeatedly take photos on a PiCam. It was needed at the time because the Python commands available were not sufficient for this purpose. A running number in the file name was needed. This file is a slightly modified version of the C++ file provided with the Pi 4 for taking photos (possibly from the image below).
  • “rpicam_still.mod.cpp” – The same program had face detection added, however the C++ libraries available had insufficient resolution. This file includes code from a demo program from “A Raspberry Pi 4 Bullseye 64-OS image with deep learning examples
  • “face_process.py” – Face detection, file naming and upload to server using Python AI.
  • “face_process_pt.py” – Server based face comparison to measure dwell times in front of camera.

Dwell time analysis seems to work, but DeepFace does not give very good results for face analysis. This partially completed project could be used as a start point for development of non-invasive or anonymous facial analysis research.