Open topic with navigation

# Add a Vehicle Model to a Database (Using Separate Steps)

This section describes how to create a new (empty) vehicle model, add training images, and then train Media Server, using separate actions. You can also add metadata to the vehicle model, but this is an optional step.

Alternatively, you can train Media Server to recognize a vehicle model by sending a single action. To do this, see Add a Vehicle Model to a Database (Using a Single Action).

To add a vehicle model to a database (using separate steps)

1. Add a new vehicle model using the `NewVehicleModel` action. Set the following parameters:

   `database` | The name of the database to add the vehicle model to. The database must already exist.
   `identifier` | (Optional) A unique identifier for the vehicle model (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.
   `vehiclemake` | The vehicle manufacturer. You must set this to one of the makes returned by the action ListVehicleMakes, or `Unknown`.

   For example:

       curl http://localhost:14000 -F action=NewVehicleModel
                                   -F database=Cars
                                   -F identifier=FordFocus
                                   -F vehiclemake=Ford

   Media Server adds the vehicle model to the database and returns the identifier.

2. Add one or more training images to the model using the `AddVehicleModelImages` action. Set the following parameters:

   `database` | The name of the database that contains the vehicle model.
   `identifier` | The identifier for the vehicle model, returned by the `NewVehicleModel` action.
   `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. The paths must be absolute or relative to the Media Server executable file.
   `imagelabels` | 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, to add a training image by supplying the image data:

       curl http://localhost:14000 -F action=AddVehicleModelImages
                                   -F database=Cars
                                   -F identifier=FordFocus
                                   -F imagedata=@ford-focus.png

   Alternatively, to add a training image by supplying its path:

       curl http://localhost:14000 -F action=AddVehicleModelImages
                                   -F database=Cars
                                   -F identifier=FordFocus
                                   -F imagepath=./images/ford-focus.png

3. (Optional) Add metadata to the vehicle model using the `AddVehicleModelMetadata` action. You can add any number of key-value pairs. Set the following parameters:

   `database` | The name of the database that contains the vehicle model.
   `identifier` | The identifier for the vehicle model, returned by the `NewVehicleModel` 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=AddVehicleModelMetadata
                                   -F database=Cars
                                   -F identifier=FordFocus
                                   -F key=type
                                   -F value=hatchback

4. Complete the training for the vehicle model using the `BuildVehicleModel` action. Set the following parameters:

   `database` | The name of the database that contains the vehicle model.
   `identifier` | The identifier for the vehicle model, returned by the `NewVehicleModel` action.

   For example:

       curl http://localhost:14000 -F action=BuildVehicleModel
                                   -F database=Cars
                                   -F identifier=FordFocus

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus 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