Enable Face Attribute Recognition

The face attributes such as age, gender, emotions, etc. present in the filter set for detected face analysis during a case investigation.

Face attribute recognition can be automatically enabled and configured during the FindFace installation. If you skip this step, you can manually do so afterwards. Face attribute recognition works on both GPU- and CPU-acceleration.

Do the following:

  1. Open the /etc/findface-extraction-api.ini configuration file.

    sudo vi /etc/findface-extraction-api.ini
    
  2. Specify the relevant recognition models in the extractors section, as shown in the example below. Be sure to indicate the right acceleration type for each model, matching the acceleration type of findface-extraction-api: CPU or GPU. Be aware that findface-extraction-api on CPU can work only with CPU-models, while findface-extraction-api on GPU supports both CPU- and GPU-models.

    extractors:
      face_age: faceattr/age.v2.gpu.fnk
      face_beard: faceattr/beard.v0.gpu.fnk
      face_emotions: faceattr/emotions.v1.gpu.fnk
      face_gender: faceattr/gender.v2.gpu.fnk
      face_glasses3: faceattr/glasses3.v0.gpu.fnk
      face_medmask3: faceattr/medmask3.v2.gpu.fnk
      face_headpose: faceattr/headpose.v2.gpu.fnk
    

    The following models are available:

    Face attribute

    Acceleration

    Configure as follows

    age

    CPU

    face_age: faceattr/age.v2.cpu.fnk

    GPU

    face_age: faceattr/age.v2.gpu.fnk

    gender

    CPU

    face_gender: faceattr/gender.v2.cpu.fnk

    GPU

    face_gender: faceattr/gender.v2.gpu.fnk

    emotions

    CPU

    face_emotions: faceattr/emotions.v1.cpu.fnk

    GPU

    face_emotions: faceattr/emotions.v1.gpu.fnk

    glasses

    CPU

    face_glasses3: faceattr/glasses3.v0.cpu.fnk

    GPU

    face_glasses3: faceattr/glasses3.v0.gpu.fnk

    beard

    CPU

    face_beard: faceattr/beard.v0.cpu.fnk

    GPU

    face_beard: faceattr/beard.v0.gpu.fnk

    face mask

    CPU

    face_medmask3: faceattr/medmask3.v2.cpu.fnk

    GPU

    face_medmask3: faceattr/medmask3.v2.gpu.fnk

    head pose

    CPU

    face_headpose: faceattr/headpose.v2.cpu.fnk

    GPU

    face_headpose: faceattr/headpose.v2.gpu.fnk

    Tip

    To leave a recognition model disabled, pass the empty value "" to the relevant parameter. Do not remove the parameter itself. Otherwise, the system will be searching for the default model.

    extractors:
      face_age: ""
      face_beard: ""
      face_emotions: ""
      face_gender: ""
      face_glasses3: ""
      face_medmask3: ""
    

    Note

    You can find face attribute recognition models at /usr/share/findface-data/models/faceattr/.

    ls /usr/share/findface-data/models/faceattr/
    age.v2.cpu.fnk  age.v2.gpu.fnk  beard.v0.cpu.fnk  beard.v0.gpu.fnk  emotions.v1.cpu.fnk  emotions.v1.gpu.fnk  gender.v2.cpu.fnk  gender.v2.gpu.fnk  glasses3.v0.cpu.fnk  glasses3.v0.gpu.fnk medmask3.v2.cpu.fnk medmask3.v2.gpu.fnk liveness.colombo.cpu.fnk liveness.colombo.gpu.fnk liveness.pacs.v0.cpu.fnk liveness.pacs.v0.gpu.fnk quality.v1.cpu.fnk quality.v1.gpu.fnk
    
  3. Restart findface-extraction-api.

    sudo systemctl restart findface-extraction-api
    
  4. To display the face attribute recognition results in the event list, open the /etc/findface-security/config.py configuration file.

    sudo vi /etc/findface-security/config.py
    
  5. Specify the required models in the following line of the FFSECURITY section, subject to the list of enabled models:

    FFSECURITY = {
        ...
        'FACE_EVENTS_FEATURES': ['gender', 'age', 'emotions', 'beard', 'glasses', 'medmask', ''headpose']
        ...
    }
    
  6. Restart findface-security.

    sudo systemctl restart findface-security