You have two options:
Create a new model—Train the dataset using the feedback images and generate a new model. This method creates a model with a new model ID.
Update an existing model—Train the dataset using the feedback images and update an existing model. When you update a model it maintains the model ID, so if you’re using that model ID in production code, you don’t need to update it.
Create a New Model
To create a model with the dataset feedback, you call the /train
resource and pass in the dataset ID as you normally would, but you also pass in this request parameter:
"trainParams": {"withFeedback" : true}
The withFeedback
parameter specifies that the training operation use the feedback examples to create the model. This cURL call trains a dataset and uses the feedback examples.
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "name=Beach Mountain Model With Feedback" -F "datasetId=57" -F "trainParams={\"withFeedback\" : true}" https://api.einstein.ai/v2/vision/train
This command has double quotes and escaped double quotes around withFeedback
to run on Windows. You might need to reformat it to run on another OS. For more information, see Train a Dataset.
The response looks as you would expect from any training call. The trainParams
field shows that the training uses feedback examples.
{
"datasetId": 57,
"datasetVersionId": 0,
"name": "Beach Mountain Model With Feedback",
"status": "QUEUED",
"progress": 0,
"createdAt": "2017-05-08T18:09:24.000+0000",
"updatedAt": "2017-05-08T18:09:24.000+0000",
"learningRate": 0.001,
"epochs": 3,
"queuePosition": 3,
"object": "training",
"modelId": "DWLKXLCOH7G7RSCCRM108RGOVE",
"trainParams": {
"withFeedback": true
},
"trainStats": null,
"modelType": "image"
}
Update an Existing Model
If you want to update an existing model with the feedback in the dataset and keep the model ID, you can call the /retrain
resource and pass in this request parameter.
"trainParams": {"withFeedback" : true}
This approach is useful when you have a model in production and you want to maintain the model ID. This cURL call trains the dataset associated with the specified model, uses the feedback examples, and updates the model.
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "modelId=DWLKXLCOH7G7RSCCRM108RGOVE" -F "trainParams={\"withFeedback\" : true}" https://api.einstein.ai/v2/vision/retrain
This command has double quotes and escaped double quotes around withFeedback
to run on Windows. You might need to reformat it to run on another OS. For more information, see Retrain a Dataset.
The response looks as you would expect from any training call. The only difference is that this response contains the same modelId
that was passed in. The trainParams
field shows that the retraining uses feedback examples.
{
"datasetId": 57,
"datasetVersionId": 0,
"name": "Beach Mountain Model With Feedback",
"status": "QUEUED",
"progress": 0,
"createdAt": "2017-05-08T18:09:24.000+0000",
"updatedAt": "2017-05-08T18:09:24.000+0000",
"learningRate": 0.001,
"epochs": 3,
"queuePosition": 2,
"object": "training",
"modelId": "DWLKXLCOH7G7RSCCRM108RGOVE",
"trainParams": {
"withFeedback": true
},
"trainStats": null,
"modelType": "image"
}
Updated 11 months ago