Media Server 23.3

# Add a Face to a Database (Using a Single Action)

You can train Media Server to recognize a face by sending a single action (`TrainFace`).

Running this action is equivalent to running the following actions in the following order:

- `NewFace`
- `AddFaceImages`
- `AddFaceMetadata` (optional)
- `BuildFace`

The `TrainFace` action is atomic, so that any interruption to the server does not leave the database in an inconsistent state.

Alternatively, you can train Media Server by sending these actions individually. You might want to do this if you are building a front end application that trains Media Server in response to user input. For more information about how to do this, see Add a Face to a Database (Using Separate Steps).

To add a face to a database (using a single action)

- Add a face using the `TrainFace` action. Set the following parameters:

  `database` | The name of the database to add the face to. The database must already exist.
  `identifier` | (Optional) A unique identifier for the face (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.
  `imagedata` | (Set this or `imagepath`, but not both). The training images to add. Files must be uploaded as multipart/form-data. For more information about sending data to Media Server, see Send Data by Using a POST Method.
  `imagepath` | (Set this or `imagedata`, but not both). The paths of the training images to add. The paths must be absolute or relative to the Media Server executable file.
  `imagelabels` | (Optional) A comma-separated list of labels. One label is associated with each image (maximum 254 bytes for each label). The number of labels must match the number of images. If you do not set this parameter, Media Server generates labels automatically.
  `metadata` | (Optional) A comma-separated list of metadata key-value pairs to add to the face. Separate keys from values using a colon (:). To include a comma or colon in a key name or value, you must enclose the key name or value in quotation marks (`"`) and escape any quotation marks that occur within the string with a backslash (`\`).

  For example:

      curl http://localhost:14000 -F action=TrainFace
                                  -F database=Faces
                                  -F imagedata=@face1_smile.jpg,face1_neutral.jpg
                                  -F imagelabels=image1,image2
                                  -F "metadata=lastname:Smith,fullname:\"John Smith, Jr\""

  Alternatively, the following example provides the paths of the training images rather than sending the image data:

      curl http://localhost:14000 -F action=TrainFace
                                  -F database=Faces
                                  -F imagepath=face1_smile.jpg,face1_neutral.jpg
                                  -F imagelabels=image1,image2
                                  -F "metadata=lastname:Smith,fullname:\"John Smith, Jr\""

  Media Server adds the face to the database and returns the identifier.

Copyright 2023 Open Text
Version 23.3 | Last updated June 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Media Server 23.3

Topic Title: Add a Face to a Database (Using a Single Action)