# Automatically Enroll Unrecognized Faces

Media Server can automatically enroll unrecognized faces (add them to the training database).

A configuration to enroll unrecognized faces is included in the Media Server installation folder (`configurations/examples/Face/Enroll.cfg`). It contains the following steps:

- Face detection, to detect all faces that appear in the media.
- Face recognition, to determine whether a face is already present in the training database. This task uses the `RecognitionThreshold` parameter to specify the minimum confidence required to successfully recognize a face. The `OutputIdentities` parameter is set to `Unknown` so that the output includes only unknown faces.
- An event stream processing (ESP) task, to discard faces that are in profile or partially outside the image. To achieve the best performance, face recognition should be trained with images that show a complete face with both eyes visible.
- A crop transformation task, to create cropped images that each show a single unrecognized face. Images that contain more than one face cannot be used for training face recognition, so this step is important in case several unrecognized people appear at the same time.
- A rotate transformation task, to rotate the images (if necessary) so that the face is upright.
- An enroll task, to enroll the images of unrecognized faces in the database.
- An output task so that you can see what Media Server has added to the database. To see the images, you could also add an encoding task, or use the action `GetFaceImage` after enrollment is complete.

The following procedure describes how to configure an enroll task.

To automatically enroll faces

1. Open the configuration that you want to modify.

2. In the `[Session]` section, add a new task by setting the `EngineN` parameter.

3. Create a new configuration section that matches the name of the task and configure Media Server to enroll the images. Use the following configuration parameters:

   `Type` | The engine to use. Set this parameter to `Enroll`.
   `Module` | Set this parameter to `Face`.
   `Input` | The track that contains the images to enroll.
   `Database` | The name of the database to add the faces to. Micro Focus recommends that you add faces to a new database, not the database you use for recognition. An operator can then check the enrolled faces. For example, you should make sure that all of the images added to a face represent the same person. After verifying the enrolled faces, you can move them to the correct recognition database.
   `PostAction` | Specifies what Media Server should do after enrolling an image in the database. The default value, `build`, trains Media Server to recognize the face.
   `PostSyncDatabase` | Specifies whether Media Server should synchronize with the training database after enrolling an image. You might want to use this parameter if you are adding faces to the same database that is used for recognition. If an unrecognized face appears again but you have not trained Media Server and synchronized with the database, the face remains unrecognized. This means that Media Server adds another entry to the database for the same face. If you are enrolling faces in a different database to the one that is used for recognition, there is no need to set this parameter.
   `Identifier` | The identifier to use when adding a new face to the database. Micro Focus recommends using the macro `%record.id%`, because this identifier is set by the face detection task and is unique for each detected face.

   For example:

       [EnrollFaces]
       Type=Enroll
       Module=Face
       Input=CropFaces.Output
       Database=EnrolledFaces
       PostAction=Build
       PostSyncDatabase=TRUE
       Identifier=%record.id%

4. Save and close the configuration file. Micro Focus recommends that you save your configuration files in the location specified by the `ConfigDirectory` parameter.

_FT_HTML5_bannerTitle.htm