Installing and upgrading
Backups
Security
User management
Advanced user group options
Customising ResourceSpace
Plugins
StaticSync
Configuring ResourceSpace
Integrations

OpenCV (facial recognition)

OpenCV is the library ResourceSpace uses for facial recognition capability. You can install OpenCV from the system's repository (how to install on Ubuntu):

sudo apt install python3-opencv

# You may also need to install separately (for virtual environments or because they're missing) the following:
pip install -U opencv-python opencv-contrib-python numpy matplotlib

Advanced

To install OpenCV from source, on either Linux or Windows please check OpenCV's documentation.

Version requirements

  • Python - 3.10.12
  • OpenCV - 4.9.0

Check Python and OpenCV versions

To check Python version, type the following in your terminal:

python3 --version

To check what OpenCV you have installed run the following Python command:

python3 -c "import cv2; print(cv2.__version__)"

Configure facial recognition feature in ResourceSpace

All the configuration mentioned below should happen in config.php

  • Set path to Python (adjust accordingly to your setup - be it system wide or Python virtual environment)
  • Set the field used to store the name of the person suggested/ detected (MUST be a dynamic keyword list)
  • Set the location for the face recogniser model state(s) and data
  • Enable facial recognition
$python_path = '/usr/bin';
$facial_recognition = true;
$facial_recognition_tag_field = 20;
$facial_recognition_face_recognizer_models_location = '/var/faceRecogniserData';

Note: the above configuration is an example. Please adjust the values accordingly.

Configure trainer to run on a regular basis

Create a cron job (Linux) or a new scheduled task (Windows) and make sure to run /path to ResourceSpace web root/pages/tools/facial_recognition_trainer.php.