AddObjectClassAnnotations
Adds one or more annotations to a 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.
Type: synchronous
Parameter | Description | Required |
---|---|---|
recognizer
|
The name of the recognizer that contains the training image. | Yes |
imagelabel
|
The label of the image to annotate. | Yes |
annotationlabels
|
A comma-separated list of labels to identify the annotations that you are adding (one label per annotation, maximum 254 bytes for each label). If you do not set this parameter, Media Server generates labels automatically. | No |
identifiers
|
A comma-separated list of object class identifiers (as returned by ListObjectClasses) to identify the types of objects present in the training image. You must specify the same number of values as for boxes . |
Yes |
boxes
|
A comma-separated list of regions. A region is specified in the format (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 . Specify the same number of regions as you specified identifiers . |
Yes |
regionsaspercentage
|
A Boolean value (default false) that specifies whether the values for the boxes parameter are specified as percentages. If you set this parameter to true , specify Left and Width as a percentage of the image width and Top and Height as a percentage of the image height. |
No |
Example
The following example instructs Media Server that the bottom-left quarter of the training image with the label image1
contains an object of the class car
.
curl http://localhost:14000/action=AddObjectClassAnnotations -F recognizer=vehicles -F imagelabel=image1 -F identifiers=car -F boxes=(0,50,50,50) -F regionsaspercentage=true
You can annotate multiple regions in the same action. The following example is the same, but adds another region:
curl http://localhost:14000/action=AddObjectClassAnnotations -F recognizer=vehicles -F imagelabel=image1 -F identifiers=car,van -F boxes=(0,50,50,50),(50,0,50,50) -F regionsaspercentage=true
Response
The following XML is an example response for an action that annotates a single region:
<autnresponse> <action>ADDOBJECTCLASSANNOTATIONS</action> <response>SUCCESS</response> <responsedata> <annotation> <index>1</index> <label>9d40cbdf78e20f9234f9ec1a0fb3f261</label> </annotation> </responsedata> </autnresponse>