Add an Object to a Database (Using Separate Steps)
This section describes how to create a new (empty) object, then add training images, and then train Media Server, using separate actions. You can also add metadata to the object, and configure training options, but these are optional steps. You might want to perform training in this way if you are building a front end application that responds to user input.
Alternatively, you can train Media Server to recognize an object by sending a single action. To do this, see Add an Object to a Database (Using a Single Action).
To add an object to a database (using separate steps)
-
Add an object using the NewObject action. For example:
curl http://localhost:14000/action=NewObject -F database=CompanyLogos -F identifier=AcmeCo
-
Add one or more training images to the object using the AddObjectImages action.
For example, to add a training image by supplying the image data:
curl http://localhost:14000/action=AddObjectImages -F database=CompanyLogos -F identifier=AcmeCo -F imagedata=@logo1.png
Alternatively, to add a training image by supplying its path, relative to the Media Server executable file:
curl http://localhost:14000/action=AddObjectImages -F database=CompanyLogos -F identifier=AcmeCo -F imagepath=logo1.png
-
(Optional) Configure the way that Media Server is trained by setting training options for the object. To do this use the SetObjectTrainingOption action:
curl http://localhost:14000/action=SetObjectTrainingOption -F database=CompanyLogos -F identifier=AcmeCo -F key=useColor -F value=true
-
(Optional) Add metadata to the object using the AddObjectMetadata action. You can add any number of key-value pairs. For example:
curl http://localhost:14000/action=AddObjectMetadata -F database=CompanyLogos -F identifier=AcmeCo -F key=category -F value=software
-
Complete the training for the object using the BuildObject action.
curl http://localhost:14000/action=BuildObject -F database=CompanyLogos -F identifier=AcmeCo