CreateClass
Adds a new object class to a classifier.
You can add images to the new object class by setting either the imagedata
parameter or imagepath
parameter. Alternatively, add images at a later time using the action AddClassImages.
Type: synchronous
Parameter | Description | Required |
---|---|---|
classifier
|
The name of the classifier to add the object class to. The classifier must already exist. | Yes |
identifier
|
A unique identifier for the object class (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. | No |
imagelabels
|
A comma-separated list of labels to identify the images that you are adding (maximum 254 bytes for each label). Every label added to the same object class 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. |
No |
Example
The following example adds a new object class named "cars" to a classifier named "vehicles", without providing any training images:
curl http://localhost:14000/action=createclass -F classifier=vehicles -F identifier=cars
The following example simultaneously creates the object class and adds training images. This example provides the paths of the images by using the imagepath
parameter:
curl http://localhost:14000/action=createclass -F classifier=vehicles -F identifier=cars -F imagepath=image1.jpg,image2.jpg
Alternatively, you can create an object class and add training images by sending the image data, for example:
curl http://localhost:14000/action=createclass -F classifier=vehicles -F identifier=cars -F imagedata=@image1.jpg,image2.jpg
Response
<autnresponse xmlns:autn='http://schemas.autonomy.com/aci/'> <action>CREATECLASS</action> <response>SUCCESS</response> <responsedata> <identifier>cars</identifier> <images> <image> <index>1</index> <label>label1</label> </image> <image> <index>2</index> <label>label2</label> </image> ... </images> </responsedata> </autnresponse>
See Also
- If you haven't created a classifier, first run the action CreateClassifier.
- To add training images to an object class that you have created, use the action AddClassImages.
- To add custom metadata to the object class, use the action AddClassMetadata.
- To complete training for the classifier, use the action BuildClassifier.