Synchronize with the Latest Training
Some analysis operations require training. When you train Media Server the training is added to the database, but is not used for analysis until Media Server has synchronized with the database. Synchronization loads the data into memory and makes it ready for use. Synchronization is necessary so that you can use any Media Server to perform training, even when several Media Servers share a single database.
Automatic Synchronization
The default configuration ensures that analysis uses the latest training data.
Before it starts a process
action that requires training data, Media Server synchronizes with the database and waits for the synchronization to complete. This is because the SyncDatabase
parameter - available for tasks that use training from the database - has a default value of TRUE
.
Media Server also synchronizes with the database at regular intervals. You can configure the interval by setting the SyncInterval
parameter in the [Database]
section of the configuration file. This is important for processing video streams, because Media Server could continue processing the same stream for days or weeks. Automatic synchronization ensures that Media Server regularly loads the latest training without you having to intervene.
NOTE: If you add a large amount of training data and immediately start a process
action, Media Server might not use the latest training. This is because some training actions are asynchronous and the new training might not have been committed to the database before the process
action starts. The new training therefore cannot be synchronized. To be sure that Media Server is using the latest training, wait for your training actions to complete before sending the process
action.
NOTE: With the Audio Match and Speaker ID analysis engines, synchronizing with the latest training has no effect on actions that are already running.
Manual Synchronization
In some cases, you might want to control when Media Server synchronizes with the training database:
- In a production environment, you might modify the training only at known times. In this case you might prefer to disable automatic synchronization, because forcing Media Server to query the database before it starts processing each request can reduce the processing speed.
- If you are processing a continuous video stream, you might not want Media Server to synchronize with the latest training while processing is in progress.
- You might want to disable automatic synchronization to ensure that a batch of
process
requests all use the same training. If you are processing discrete files, you might perform training in bulk and then process batches of files.
The configuration parameter ScheduledSync
specifies whether Media Server synchronizes with the database at regular intervals. The default value is periodic
, which enables scheduled synchronization at intervals defined by the parameter SyncInterval
. To load training data when Media Server starts, but not synchronize at regular intervals, set ScheduledSync=startup
. To disable scheduled synchronization completely, set ScheduledSync=never
. In this case, Media Server does not load any training data when it starts and does not synchronize with the database at timed intervals.
To prevent Media Server synchronizing with the database before it starts a process
action, set SyncDatabase=FALSE
in the configuration section for each relevant analysis task. With this setting, be aware that process
requests could use outdated training.
If you disable automatic synchronization but want to load the latest training, you can run an action (see Actions to Load and Unload Training).
Reduce Memory Use
With automatic synchronization, described above, Media Server loads all training data into memory. If you have an extremely large training database that contains many face databases, object databases, classifiers, and so on, this can consume a significant amount of memory.
To load only the training you need, set ScheduledSync=startup
or ScheduledSync=never
to disable scheduled synchronization. If you set ScheduledSync=startup
, Media Server loads all training data when it starts but you can remove training from memory as required. If you set ScheduledSync=never
, Media Server does not load any training data when it starts, so you can load only the training data you need.
To load training or remove training from memory, use one of the following methods:
- Allow Media Server to synchronize with the latest training before beginning an analysis task (this occurs by default). Media Server loads the training it needs to complete the task.
- To prevent Media Server synchronizing with the training database before beginning a task, set
SyncDatabase=FALSE
in the[TaskName]
section for your analysis task. In this case, you, must manually synchronize the training data you need by running actions (see Actions to Load and Unload Training).
Actions to Load and Unload Training
The following table lists the actions that you can use when you have disabled automatic synchronization but want to synchronize with the latest training, or remove training from memory.
Analysis task | Action to load training | Action to unload training |
---|---|---|
Audio matching | SyncAudioMatchClips | |
Face recognition | SyncFaces | UnsyncFaces |
Image classification | SyncClassifiers | UnsyncClassifiers |
Image embedding | SyncImageEmbeddingEncoders | UnsyncImageEmbeddingEncoders |
Image hashing | SyncImageHashes | UnsyncImageHashes |
Object class recognition | SyncObjectClasses | UnsyncObjectClasses |
Object recognition | SyncObjects | UnsyncObjects |
Speaker identification | SyncSpeakers | |
Speech-to-text | SyncCustomSpeechResources | |
Vehicle model ID | SyncVehicleModels | UnsyncVehicleModels |