Open topic with navigation

# Add a Vehicle Model to a Database (Using a Single Action)

You can train Media Server to recognize a vehicle model by sending a single action (`TrainVehicleModel`).

Running this action is equivalent to running the following actions in the following order:

- `New`VehicleModel``
- `Add`VehicleModel`Images`
- `Add`VehicleModel`Metadata` (optional)
- `Build`VehicleModel``

The `Train`VehicleModel`` action is atomic, so that any interruption to the server does not leave the database in an inconsistent state.

Alternatively, you can train Media Server by sending these actions individually. For more information about how to do this, see Add a Vehicle Model to a Database (Using Separate Steps).

To add a vehicle model to a database (using a single action)

- Add a vehicle model using the `TrainVehicleModel` 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 model (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. 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.
  `metadata` | (Optional) A comma-separated list of metadata key-value pairs to add to the vehicle model. Separate keys from values using a colon (:). To include a comma or colon in a key name or value, you must enclose the key name or value in quotation marks (`"`) and escape any quotation marks that occur within the string with a backslash (`\`).
  `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=TrainVehicleModel
                                  -F database=Cars
                                  -F identifier=FordFocus
                                  -F vehiclemake=Ford
                                  -F imagedata=@ford-focus.png
                                  -F metadata=type:hatchback

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

      curl http://localhost:14000 -F action=TrainVehicleModel
                                  -F database=Cars
                                  -F identifier=FordFocus
                                  -F vehiclemake=Ford
                                  -F imagepath=./images/ford-focus.png
                                  -F metadata=type:hatchback

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

© 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