This multi-label model is used to classify a variety of objects. You can classify an image against this model just as you would a custom model; but instead of using the modelId
of the custom model, you specify a modelId
of MultiLabelImageClassifier
. For the list of classes this model contains, see Multi-Label Image Model Class List.
This cURL command sends in a local image and returns a prediction from the multi-label image model.
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "[email protected]:\Data\laptop_and_camera.jpg" -F "modelId=MultiLabelImageClassifier" https://api.einstein.ai/v2/vision/predict
The model returns a result similar to the following JSON. This response is truncated. When you use this model, the response contains all the classes in the model. Multi-label models are used to detect multiple objects in an image, so you'll see the classes with the highest probability returned first.
// Response is truncated for brevity. Multi-label models return all classes
// sorted by probability.
{
"probabilities": [
{
"label": "laptop",
"probability": 0.96274024
},
{
"label": "camera",
"probability": 0.39719293
},
{
"label": "BACKGROUND_Google",
"probability": 0.2958626
},
{
"label": "cup",
"probability": 0.09132507
},
{
"label": "stapler",
"probability": 0.081633374
}
],
"object": "predictresponse"
}
If you want to send in an image by using its URL, replace the sampleContent
parameter with the sampleLocation
parameter.
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "sampleLocation=https://www.einstein.ai/images/laptop_and_camera.jpg" -F "modelId=MultiLabelImageClassifier" https://api.einstein.ai/v2/vision/predict
Updated less than a minute ago