Media Server 25.4
Media Server Help

# TrainVehicleModel

Trains Media Server to recognize a vehicle model in one action.

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

- NewVehicleModel
- AddVehicleModelImages
- AddVehicleModelMetadata (optional)
- BuildVehicleModel
- NullVehicleModelImageData (optional)

This action is atomic, so that any interruption to the server does not leave the database in an inconsistent state. If you stop the action using the QueueInfo action, or the action returns an error, the database is not modified. If all of the training images fail, Media Server does not add the vehicle model to the database.

Type: asynchronous

Parameter | Description | Required
--- | --- | ---
`anprlocations` | A comma-separated list of number plate locations that correspond to the images specified with `imagedata` or `imagepath`. For a list of values that you can specify, use the action ListNumberPlateLocations. When you specify a number plate location the corresponding training image can show a complete vehicle. If you do not specify a location, the training image must be cropped to show only the vehicle's grille. For more information, see Obtain Images for Training. To add multiple images where some of the images contain an entire vehicle but others are cropped, specify a comma-separated list with blank entries. For example, if the second, fourth, and fifth images have been cropped you could use the value `GB,,DE,,,FR`. You can specify multiple values for a single image by enclosing the values for that image in quotation marks. For example, if the vehicle in the second image has a number plate that originates from either Great Britain or Germany you could use the value `FR,"GB,DE",FR`. | No
`database` | The name of the database to add the vehicle model to. The database must already exist. | Yes
`gpudeviceid` | The device ID of the GPU to use, if you have enabled GPU acceleration and want to override the value of the GPUDeviceID configuration parameter. You can also set this parameter to `CPU`, to disable GPU acceleration for this action and use the CPU instead. | No
`identifier` | A unique identifier for the vehicle model (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically. | No
`imagedata` | The training images to add. Send files to Media Server using a multipart/form-data HTTP POST request. | Set this or `imagepath`
`imagelabels` | A comma-separated list of labels to identify the images that you are adding (maximum 254 bytes for each label). Every image added to the same vehicle model must have a unique label, so the number of labels must match the number of images provided using either `imagedata` or `imagepath`. If you do not set this parameter, Media Server generates labels automatically. | No
`imagepath` | A comma-separated list of paths to the training images to add. The paths must be absolute, or relative to the Media Server executable file. To strengthen security, Media Server can be configured to read files only from specified directories. For information about the directories that Media Server is permitted to read from, see the parameter AllowedInputDirectories. | Set this or `imagedata`
`metadata` | 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 (`\`). | No
`nullimagedata` | A Boolean value, default `false`, that specifies whether to remove the images from the database after training is complete. Setting this to `true` is equivalent to running the action NullVehicleModelImageData on the vehicle model. Be aware that if you remove the images, the training cannot be updated in future. | No
`numparallel` | The maximum number of threads to use to complete the training (default 1), subject to the limit specified by MaxNumParallel. | No
`vehiclemake` | The vehicle make to associate with the model. You must specify one of the vehicle makes returned by the action ListVehicleMakes, or `Unknown`. | Yes

## Example

The following example trains Media Server by sending the paths of the training images using the `imagepath` parameter:

    curl http://localhost:14000/action=TrainVehicleModel
                                -F database=Cars
                                -F identifier=Mustang
                                -F imagepath=image1.jpg,image2.jpg
                                -F imagelabels=image1,image2
                                -F vehiclemake=Ford
                                -F anprlocations=GB,GB

Alternatively, you can train Media Server by sending the image data, for example:

    curl http://localhost:14000/action=TrainVehicleModel
                                -F database=Cars
                                -F identifier=Mustang
                                -F imagedata=@image1.jpg,image2.jpg
                                -F imagelabels=image1,image2
                                -F vehiclemake=Ford
                                -F anprlocations=GB,GB

## Response

This action is asynchronous, so Media Server always returns success accompanied by a token. You can use this token with the QueueInfo action to retrieve the status of your request.

The following is an example response from the `QueueInfo` action.

    <autnresponse>
      <action>QUEUEINFO</action>
      <response>SUCCESS</response>
      <responsedata>
        <actions>
          <action>
            <status>Finished</status>
            <queued_time>2016-Sep-16 15:14:17</queued_time>
            <time_in_queue>1</time_in_queue>
            <process_start_time>2016-Sep-16 15:14:18</process_start_time>
            <time_processing>1</time_processing>
            <process_end_time>2016-Sep-16 15:14:19</process_end_time>
            <build>
              <image>
                <index>1</index>
                <label>image1</label>
                <status>trained</status>
                <hasimagedata>true</hasimagedata>
                <vehicle>
                  <plate>
                    <readregion>
                      <point>
                        <x>274</x>
                        <y>282</y>
                      </point>
                      <point>
                        <x>367</x>
                        <y>282</y>
                      </point>
                      <point>
                        <x>367</x>
                        <y>297</y>
                      </point>
                      <point>
                        <x>274</x>
                        <y>297</y>
                      </point>
                    </readregion>
                    <plateregion>
                      <point>
                        <x>273</x>
                        <y>280</y>
                      </point>
                      <point>
                        <x>370</x>
                        <y>280</y>
                      </point>
                      <point>
                        <x>370</x>
                        <y>299</y>
                      </point>
                      <point>
                        <x>272</x>
                        <y>299</y>
                      </point>
                    </plateregion>
                    <plateread>...</plateread>
                    <platetype>Regular</platetype>
                    <country>DE</country>
                  </plate>
                  <grillepatch>
                    <point>
                      <x>179</x>
                      <y>200</y>
                    </point>
                    <point>
                      <x>463</x>
                      <y>200</y>
                    </point>
                    <point>
                      <x>463</x>
                      <y>282</y>
                    </point>
                    <point>
                      <x>179</x>
                      <y>282</y>
                    </point>
                  </grillepatch>
                  <grillepercentage>100</grillepercentage>
                </vehicle>
              </image>
              <image>
                ...
              </image>
              ...
            </build>
            <database>Cars</database>
            <identifier>Mustang</identifier>
            <numimages>2</numimages>
            <numtrained>2</numtrained>
            <token>MTAuMi4xMDQuNTQ6MTgwMDA6VFJBSU5PQkpFQ1Q6MTQzMzQwODAwMTU0Mi0xNjAxNDc5NzMx</token>
          </action>
        </actions>
      </responsedata>
    </autnresponse>

Copyright 2025 Open Text
Version 25.4 | Last updated October 2025

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: Knowledge Discovery Media Server 25.4

Topic Title: TrainVehicleModel