Returns a prediction from an image or multi-label model for the specified local image file.
Request Parameters
Name | Type | Description | Available Version |
---|---|---|---|
| string | ID of the model that makes the prediction. | 1.0 |
| int | Number of probabilities to return. Optional. If passed, must be a number greater than zero. The response is sorted by | 2.0 |
| string | Binary content of image file uploaded as multipart/form-data. | 1.0 |
| string | String that you can pass in to tag the prediction. Optional. Can be any value, and is returned in the response. | 1.0 |
Keep the following points in mind when sending an image in for prediction:
- The maximum image file size you can pass to this resource is 5 MB.
- The supported image file types are PNG, JPG, and JPEG.
- If you omit the
numResults
parameter and themodelId
specifies a standard classification model, the response returns the top five labels and probabilities. - The
numResults
parameter has no effect on the response from a multi-label model. The prediction response from a multi-label model always returns probabilities for all the labels in a model.
Response Body
Name | Type | Description | Available Version |
---|---|---|---|
| string | Error message. Returned only if the status is something other than successful (200). | 1.0 |
| string | Object returned; in this case, | 1.0 |
| array | Array of probabilities for the prediction. | 1.0 |
| string | Value passed in when the prediction call was made. Returned only if the | 1.0 |
| string | Status of the prediction. Status of 200 means the prediction was successful. | 1.0 |
Probabilities Response Body
Name | Type | Description | Available Version |
---|---|---|---|
| string | Probability label for the input. | 1.0 |
| float | Probability value for the input. Values are between 0–1. | 1.0 |
Probabilities from a Multi-Label Model
A multi-label model (modelType
is image-multi-label
) is designed to return predictions for multiple objects in an image. The response format is the same as a prediction from a model with a modelType
of image
, however, the probabilities don't add up to one.
For example, if you send an image of a baseball bat and a baseball glove into a sports-related multi-label model, the response might look something like the following JSON. This response shows high probabilities for both the baseball-bat
and the baseball-glove
labels.
{
"probabilities": [
{
"label": "baseball-bat",
"probability": 0.7356758
},
{
"label": "baseball-glove",
"probability": 0.74909562
},
{
"label": "basketball-hoop",
"probability": 0.112600096
},
{
"label": "tennis-ball",
"probability": 0.088070825
},
{
"label": "tennis-racket",
"probability": 0.0854089
},
{
"label": "tennis-court",
"probability": 0.0007318517
}
],
"object": "predictresponse"
}
When a response comes back from a multi-label model, it returns probabilities for all the labels in the model. Multi-label models are available in Einstein Vision API verison 2.0 and later.
Rate Limit Headers
Any time you make an API call to the /predict
resource, your rate limit information is returned in the header. The rate limit headers specify your prediction usage for the current calendar month only.
X-RateLimit-Limit 2000
X-RateLimit-Remaining 1997
X-RateLimit-Reset 2017-04-01 19:31:42.0
Header | Description | Example |
---|---|---|
| Maximum number of prediction calls available for the current plan month. | 2000 |
| Total number of prediction calls you have left for the current plan month. | 1997 |
| Date on which your predictions are next provisioned. Always the first of the month. | 2017-04-01 22:07:40.0 |