Media Server 24.2

# Create and Train a Classifier

This section describes how to create and train a classifier. For more information about the actions that are discussed, refer to the Media Server Reference.

To create and train a classifier

1. Create a new classifier with the action `CreateClassifier`.

   `curl http://localhost:14000/action=CreateClassifier -F classifier=vehicles`

2. Add classes to the classifier with the action `CreateClass`. Repeat this action for each class that you want to add.

   `curl http://localhost:14000/action=CreateClass -F classifier=vehicles -F identifier=car`

3. Add training images to a class with the action `AddClassImages`. Run this action as many times as necessary to add sufficient training images to each class.

   `curl http://localhost:14000/action=AddClassImages -F classifier=vehicles -F identifier=car -F imagedata=@cars/1.jpg,cars/2.jpg`

4. Choose the number of training iterations to run by setting the `iterations` training option with the action `SetClassifierTrainingOption`.

   `curl http://localhost:14000/action=SetClassifierTrainingOption -F classifier=vehicles -F key=iterations -F value=1000`

5. (Optional) To take snapshots of the classifier at regular intervals during training, set the `snapshot_frequency` training option. When you take snapshots, Media Server also sets aside images for evaluating the performance of the classifier. If you want to change the proportion of images that are set aside, you can set the `validation_proportion` training option.

   `curl http://localhost:14000/action=SetClassifierTrainingOption -F classifier=vehicles -F key=snapshot_frequency -F value=250`

6. Train the classifier by running the action `BuildClassifier`:

   `curl http://localhost:14000/action=BuildClassifier -F classifier=vehicles`

   This action is asynchronous, so Media Server returns a token. You can use the `QueueInfo` action to check the status of the request.

   When the `BuildClassifier` action has finished, you can use the classifier. If you did not enable snapshots, the training process is complete.

7. If you enabled snapshots, test the performance of the classifier and select the snapshot to use.

   1. Run the `ListClassifiers` action to list the snapshots that are available.

      `curl http://localhost:14000/action=ListClassifiers`

      The response to this action includes an index number for each snapshot.

   2. Run the `TestClassifierSnapshot` action for each snapshot that you want to evaluate. The action is asynchronous, so Media Server returns a token. You can use the `QueueInfo` action to check the status of your request(s).

      `curl http://localhost:14000/action=TestClassifierSnapshot -F classifier=vehicles -F snapshotindex=0`

   3. Review the results with the `GetClassifierSnapshotStatistics` action.

      `curl http://localhost:14000/action=GetClassifierSnapshotStatistics -F classifier=vehicles`

   4. If one of the snapshots provides acceptable performance, select the snapshot by running the action `SelectClassifierSnapshot`.

      `curl http://localhost:14000/action=SelectClassifierSnapshot -F classifier=vehicles -F snapshotindex=3`

      If none of the snapshots provides acceptable performance, you might need to add additional training data or run more training iterations.

Copyright 2024 Open Text
Version 24.2 | Last updated March 2024

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL Media Server 24.2

Topic Title: Create and Train a Classifier