# Create and Train a Recognizer

To create and train an object class recognizer, follow these steps. For more information about the actions used in this section, refer to the Media Server Reference.

To create and train a recognizer

1. Start by creating a new recognizer. For example:

       curl http://localhost:14000 -F action=CreateObjectClassRecognizer
                                   -F recognizer=vehicles

2. (Optional) Choose the type of recognizer that you want to train. For example:

       curl http://localhost:14000 -F action=SetObjectClassRecognizerTrainingOption
                                   -F key=recognizer_type
                                   -F value=generation2

3. Add your chosen object classes to the recognizer.

   The following example adds a new class named "car" to the "vehicles" recognizer.

       curl http://localhost:14000 -F action=CreateObjectClass
                                   -F recognizer=vehicles
                                   -F identifier=car

4. Add images to the recognizer that contain example objects for training.

   The following example adds two images to the "vehicles" recognizer, and labels them "car42" and "bike19":

       curl http://localhost:14000 -F action=AddObjectClassImages
                                   -F recognizer=vehicles
                                   -F imagedata=@car42.jpg,bike19.jpg
                                   -F imagelabels=car42,bike19

5. Annotate each training image. An annotation identifies a region of a training image that contains an object, and the class that the object belongs to. Media Server can then use that region of the image to train the recognizer. You can add multiple annotations to the same image, if the image contains multiple objects.

   The following example adds an annotation to the image "car42", associating a region covering the center 25% of the image with the "car" object class. The region is specified by the `Boxes` parameter, which is a comma-separated list of values in the form `(left,top,width,height)`. `Left` specifies the distance from the left side of the image to the left side of the region. `Top` specifies the distance from the top of the image to the top of the region. `Width` and `Height` specify the width and height of the region. The values are in pixels, unless you set `RegionsAsPercentage=true` (in which case specify `Left` and `Width` as a percentage of the image width and `Top` and `Height` as a percentage of the image height).

       curl http://localhost:14000 -F action=AddObjectClassAnnotations
                                   -F recognizer=vehicles
                                   -F imagelabel=car42
                                   -F identifiers=car
                                   -F boxes=(25,25,50,50)
                                   -F regionsaspercentage=true

   TIP: To obtain a list of training images that have been added to the recognizer but have not been annotated, use the action `ListUnannotatedObjectClassImages`.

6. Train Media Server by building the recognizer. For example:

       curl http://localhost:14000 -F action=BuildObjectClassRecognizer
                                   -F recognizer=vehicles

© Copyright 2020 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 mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm