Detection with Image File

Returns labels, probabilities, and bounding box coordinates for items detected in the specified local image file.

Request Parameters

Name

Type

Description

Available Version

modelId

string

ID of the model that makes the prediction.

2.0

numResults

int

N/A

2.0

sampleId

string

String that you can pass in to tag the prediction. Optional. Can be any value, and is returned in the response.

2.0

sampleContent

string

Binary content of image file uploaded as multipart/form-data.

2.0

A detection model (modelType is image-detection) is designed to return a prediction and bounding box information for each item in an image for which the model finds a match. Detection models are available in Einstein Vision API version 2.0 and later.

The response format is similar to a prediction from an image or multi-label model, because it contains a label value and a probability value. However, the response also contains a boundingBox object that contains the coordinates of the corresponding item in the image.

Keep the following points in mind when sending an image in for detection:

  • The maximum image file size you can pass to this resource is 5 MB.
  • The supported image file types are PNG, JPG, and JPEG.
  • The numResults parameter has no effect on the response from a detection model. The prediction response from a detection model always returns probabilities for all objects detected in the image.

Response Body

Name

Type

Description

Available Version

object

string

Object returned; in this case, predictresponse.

2.0

probabilities

array

Array of probabilities for the prediction.

2.0

sampleId

string

Value passed in when the prediction call was made. Returned only if the sampleId request parameter is provided.

2.0

Probabilities Response Body

Name

Type

Description

Available Version

boundingBox

object

Contains the coordinates for the bounding box that encloses the detected object.

2.0

label

string

Label for the detected object.

2.0

probability

float

Probability value for the detected object. Values are between 0–1.

2.0

boundingBox Response Body

Name

Type

Description

Available Version

maxX

int

X-coordinate of the left of the bounding box. The origin of the coordinate system is the top-left of the image.

2.0

maxY

int

Y-coordinate of the top of the bounding box.

2.0

minX

int

X-coordinate of the right of the bounding box.

2.0

minY

int

Y-coordinate of the bottom of the bounding box.

2.0

If the detection model doesn't identify any objects in the image you pass in for prediction, an empty array is returned.

{
    "probabilities": [],
    "object": "predictresponse"
}

Rate Limit Headers

Any time you make an API call to the /detect 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

X-RateLimit-Limit

Maximum number of prediction calls available for the current plan month.

2000

X-RateLimit-Remaining

Total number of prediction calls you have left for the current plan month.

1997

X-RateLimit-Reset

Date on which your predictions are next provisioned. Always the first of the month.

2017-04-01 22:07:40.0

Language