Face Recognition Edge

Recognize faces on device by looking up against LDAP or a JSON list of faces.

Overview

The Face Recognition Edge node recognizes faces (by a match to faces provided by LDAP, JSON or CSV config) within a specified region in live video stream, and adds face metadata to the frame metadata.

To use this node, you specify face images via LDAP or a JSON/CSV configuration, and configure this node to perform lookup against those registered faces. You can also add metadata to those faces which this node will retrieve and display or color the face with.

This node makes it easy to build common use cases such as access control, customer experience improvements, etc.

This node requires a AI Model Node and a Track Objects Node before it in order to function properly.

Inputs & Outputs

  • Inputs : 1, Media Format : Raw Video
  • Outputs : 1, Media Format: Raw Video
  • Output Metadata : Face Information

Properties

PropertyDescriptionTypeDefaultRequired
display_roiDisplay ROI info on video.booltrueNo
display_faceinfoDisplay the Face and any related attributes on video. Options: disabled, bottom_left, bottom_right, top_left, top_right.enumbottom_leftNo
face_label_attributesComma-separated list of attributes from JSON user data or LDAP attributes used to generate the Face's label.stringnullNo
display_userdataDisplay any associated user metadata on the face.boolfalseNo
roisSemicolon-separated list of areas in the video within which the Face Recognition is performed, each area identified by a set of normalized coordinates. Format: x1,y1,x2,y2,x3,y3,x1,y1.stringnullNo
roi_labelsComma-separated list of labels for each ROI. Format: label1, label2. Conditional on rois.stringnullNo
known_face_sourceSource from which to fetch images and metadata of known faces to lookup against. Options: ldap, json, csv.enumldapYes
json_sourceRaw JSON or URL from which to fetch a JSON containing metadata and URLs for known faces. Conditional on known_face_source being json.stringnullYes
csv_sourceRaw CSV or URL from which to fetch a CSV file containing metadata and URLs for known faces. Conditional on known_face_source being csv.stringnullYes
ldap_source_serverLDAP Server Host + Port. Conditional on known_face_source being ldap.stringnullYes
ldap_source_use_sslUse SSL for LDAP. Conditional on known_face_source being ldap.booltrueYes
ldap_source_userLDAP Server User. Conditional on known_face_source being ldap.stringnullNo
ldap_source_passwordLDAP Server Password. Conditional on known_face_source being ldap.stringnullNo
ldap_certLDAP Certificate, if needed. Conditional on known_face_source being ldap.stringnullNo
ldap_cert_keyLDAP Certificate Key, if needed. Conditional on known_face_source being ldap.stringnullNo
ldap_search_baseSearch base to use when accessing LDAP. Conditional on known_face_source being ldap.stringnullYes
ldap_attributesExtra Attributes to pick from LDAP as user metadata. Conditional on known_face_source being ldap.stringnullNo
ldap_photo_attribAttribute name that stores the photo or photo URL in your LDAP configuration. Conditional on known_face_source being ldap.stringnullYes
ldap_photo_typeFormat of the LDAP Photo Attribute. Options: raw, url. Conditional on known_face_source being ldap.enumrawYes
min_confidenceIgnores face matches if they are below this threshold. Float, range: 0 - 1.float0.4No
min_face_size_pixelsMinimum width & height of a face that we attempt to lookup.int64No
face_modelFace Model to use. Options: small (5 point), large (68 point).enumsmallNo
face_lookup_intervalNumber of frames between successive lookups of a particular face.int3No
max_lookups_per_faceMaximum number of lookups for each new face before marking it unrecognized.int5No

Metadata

Metadata PropertyDescription
nodes.<node_id>Describes the ROIs monitored by this node, and their properties.
Format: as defined in the table below.

<node_id> for Face Recognition Nodes is of the form face_recX (ex. face_rec1)

Example

"nodes": {
    "face_rec1": {
        "type": "face_rec",
        "rois": {
            "<roi_name>": {
                "recognized_faces": [{
                    "id": 1230171012121,
                    "person_id": "1239-12381-23110-1213",
                    "confidence": 0.4,
                    "user_data" : {},
                    "label": "person name"
                  }],
                  "unrecognized_face_ids": [120398123,12397231,21312],
                  "recognized_face_count": 3,
                  "recognized_face_delta": 2,
                  "unrecognized_face_count": 3,          
                  "unrecognized_face_delta": 1          
            }
        }
    }
}

Format

KeyTypeDescription
recognized_facesDictionaryAttributes for recognized faces
recognized_faces.idStringTracking ID for the face
recognized_faces.person_idStringAzure Person ID associated with this face. You can use this to match against repeat occurences of this face.
recognized_faces.confidenceFloatConfidence of the match
recognized_faces.user_dataDictionaryAny user_data stored with the Azure Face API
recognized_faces.labelStringFace Name as stored in the Azure Face API
unrecognized_face_idsArray of StringsTracking IDs for unrecognized Faces.
recognized_face_countIntegerNumber of recognized faces in this frame
recognized_face_deltaIntegerNumber of newly recognized faces in this frame
unrecognized_face_countIntegerNumber of unrecognized faces in this frame
unrecognized_face_deltaIntegerNumber of newly unrecognized faces in this frame

JSON or CSV Format

When using known_face_source set to json or csv, the specified configuration must follow the format below.

Fields

FieldRequirementDescription
person_idMandatoryUnique Identifier for a face.
image_urlMandatoryMust point to a Face image and be accessible from the internet.
ex. https://assets.lumeo.com/media/demos/facerec/8672.jpg
labelMandatoryLabel to be displayed on the video for the face.
user_dataYou can associate additional attributes along with each registered face/person (aka user_data). Lumeo can extract and display these attributes for matched faces. This node will use the following user_data attributes, if present.

These (and any other) user_data properties will be added to recognized_faces.user_data field within Lumeo metadata.
user_data.modifyTimestampOptionalNode will use this to cache face signatures to speed up subsequent startup times if this value has not changed.
user_data.colorOptionalNode will display the recognized face with a bounding box in this color.
user_data.aux_labelOptionalNode will display this label along with the recognized face on the video
user_data.<your_attribute_label>Optional

JSON

[
    {
        "image_url": "https://assets.lumeo.com/media/demos/facerec/8672.jpg",
        "person_id": "person1",
        "label": "person_name",
        "user_data": {
            "modifyTimestamp": "2022-01-02T12:12:12Z",
            "color": "00ffff",
            "aux_label": "FastPass Valid",
            "attrib1": 12345,
            "attrib2": "test"
        }
    },
    {
        "image_url": "https://assets.lumeo.com/media/demos/facerec/8674.jpg",
        "person_id": "person2",
        "label": "person_name2",
        "user_data": {
            "modifyTimestamp": "2022-01-02T12:12:12Z",
            "color": "00ffff",
            "aux_label": "FastPass Invalid",
            "attrib1": 12345,
            "attrib2": "test"
        }
    },
    {
       ...
    }
]

CSV

person_id,label,image_url,user_data.modifyTimestamp,user_data.aux_label,user_data.color,user_data.add_your_attributes_here
person1,person name,https://assets.lumeo.com/media/demos/facerec/8674.jpg,1/14/2023 8:53:22,access denied,0xff0000,testing

Google Sheets (CSV)

CSV template : https://docs.google.com/spreadsheets/d/1u4t1Fg3nMWQjP902xyLKk-H2ASw_DLNCr4nZ3tX8NAU/edit#gid=0

A neat trick is to enable Publish to Web feature in Google sheets which generates a live updating CSV link that you can configure in this node's settings. This lets you manage your face database in Google Sheets and have Lumeo automatically pull from it every time a deployment is started.

Here's how :

  1. Go to File -> Share -> Publish to Web in Google Sheets menu
1340

Go to File -> Share -> Publish to Web in Google Sheets menu

  1. Select Link, Sheet and CSV options. Also enable "Automatically republish ... " checkbox.
1115

Select Link, Sheet and CSV options.

  1. Copy the resulting link into this node's properties.