Open topic with navigation

# Add Classes to a Classifier

To add classes to a classifier, complete the following procedure.

To add classes to a classifier

1. Add each new class using the action `CreateClass`. Set the following parameters:

   `classifier` | The name of the classifier to add the class to. The classifier must already exist. To create a classifier, see Create a Classifier.
   `identifier` | (Optional) A unique identifier for the class (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 to the class. 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.

   For example:

       curl http://localhost:14000 -F action=createclass
                                   -F classifier=vehicles
                                   -F identifier=cars
                                   -F imagedata=@car1.jpg,car2.jpg,...

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

       curl http://localhost:14000 -F action=createclass
                                   -F classifier=vehicles
                                   -F identifier=cars
                                   -F imagepath=car1.jpg,car2.jpg,...

   Media Server adds the new class.

2. (Optional) Add metadata to the class using the `AddClassMetadata` action. You can add any number of key-value pairs. Set the following parameters:

   `classifier` | The name of the classifier that contains the class.
   `identifier` | The identifier for the class, as returned by the `CreateClass` action.
   `key` | The key to add (maximum 254 bytes).
   `value` | The value to add (maximum 254 bytes).

   For example:

       curl http://localhost:14000 -F action=AddClassMetadata
                                   -F classifier=vehicles
                                   -F identifier=cars
                                   -F key=notes
                                   -F value=motor%20vehicles

3. Complete the training for the classifier by running the action `BuildClassifier`:

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

   This action is asynchronous, so Media Server returns a token. You can use the token with the `QueueInfo` action to retrieve the response.

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm