Train Media Server to Recognize Vehicles

Before using vehicle model identification, you must train Media Server by providing images of the vehicle models that you want to recognize. Vehicle identification performs best when vehicles are moving towards the camera, when the front of the vehicle is visible in the video.

Vehicles must be added to an object database as two-dimensional objects.

Obtain Training Images

You can obtain training images by running vehicle model identification on a sample video. Output the result images to the image encoder. For example, you could use the following configuration:

[Ingest]
IngestEngine=libav

[libav]
Type=libav

[Analysis]
AnalysisEngine0=ANPR
AnalysisEngine1=VehicleModel

[ANPR]
Type=numberplate
Location=uk

[VehicleModel]
Type=vehiclemodel
Input=ANPR.DataWithSource

[Transform]
TransformEngine0=Crop

[Crop]
Type=Crop
Input=VehicleModel.ResultWithSource

[Encoding]
EncodingEngine0=VehicleImages

[VehicleImages]
Type=ImageEncoder
ImageInput=Crop.Output
OutputPath=./training/image-%segment.sequence%.jpg

The vehicle model analysis engine requires as input either the DataWithSource or ResultWithSource track from a number plate analysis task.

Usually, the vehicle model analysis task would include the Database parameter, which specifies the database to use for recognizing vehicles. If you are obtaining training images, you can run vehicle identification without setting this parameter.

Before you output images using the image encoder, configure a Crop transform task so that the images are cropped to the region identified by the vehicle model analysis engine.

Train Media Server

Vehicle identification is trained in the same way as object recognition (see Train Media Server to Recognize Objects). Vehicles must be trained as two-dimensional objects.

Tip: The following procedure explains how to train Media Server by sending actions to Media Server's ACI port. However, you can also train Media Server using IDOL Admin. For information about opening IDOL Admin, see Access IDOL Admin. For information about using IDOL Admin, refer to the IDOL Admin User Guide.

To train Media Server to recognize vehicles

  1. Create a new object database. Use the CreateObjectDatabase action, with the database parameter:

    database The name of the new database (maximum 254 bytes).

    For example:

    curl http://localhost:14000 -F action=CreateObjectDatabase
                                -F database=vehicles
  2. Add each vehicle to the database using the TrainObject action. Use the following parameters:

    database The name of the database to add the object to. The database must already exist.
    identifier A unique identifier for the object (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.
    imagedata 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.
    imagelabels A comma-separated list of labels to associate with the images that you are adding (maximum 254 bytes for each label). The number of labels must match the number of images provided. If you do not set this parameter, Media Server generates labels automatically.
    trainingoptions A comma-separated list of training options to apply to the object. Separate training options from their values using a colon (:). For information about the training options that you can set, see Object Training Options.

    For example:

    curl http://localhost:14000 -F action=TrainObject
                                -F database=vehicles
                                -F identifier=ford_focus
                                -F imagedata=@image-1.jpg,image-27.jpg,image-33.jpg
                                -F imagelabels=2013focus,2005focus,2002focus
                                -F trainingoptions=useColor:true,3D:false
  3. Verify that the training was successful.


_HP_HTML5_bannerTitle.htm