Einstein Image Classification

Einstein custom image classifier enables developers to train deep learning models to recognize and classify images at scale. Developers can bring the power of image recognition to CRM and third-party applications so that end users across sales, service, and marketing can discover new insights about their customers and predict outcomes that lead to smarter decisions.

Documentation Example dataset

Getting started

We’ll demonstrate how easy it is to train your own classifier in three simple steps. The end result will be a model which, when given an image, can distinguish between mountains and beaches. Download the example dataset above for additional context.

Upload a dataset

This command creates a dataset called beachvsmountains from the specified dataset. It also creates two labels from the directory names found in our zip file. In this case, a beaches label and a mountains label.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "type=image" -F "path=http://einstein.ai/images/mountainvsbeach.zip" https://api.einstein.ai/v2/vision/datasets/upload/sync
{
 "id": 1000044,
 "name": "mountainvsbeach",
 "createdAt": "2017-02-21T21:59:29.000+0000",
 "updatedAt": "2017-02-21T21:59:29.000+0000",
 "labelSummary": {
  "labels": [
   {
    "id": 1865,
    "datasetId": 1000044,
    "name": "Mountains",
    "numExamples": 50
   },
   {
    "id": 1866,
    "datasetId": 1000044,
    "name": "Beaches",
    "numExamples": 49
   }
  ]
 },
 "totalExamples": 99,
 "totalLabels": 2,
 "available": true,
 "statusMsg": "SUCCEEDED",
 "type": "image",
 "object": "dataset"
}

Train your model

Now that you’ve uploaded a labeled image dataset, it’s time to train your model. This command trains your model against your dataset and names the model with the name specified in the name parameter.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "name=Beach and Mountain Model" -F "datasetId=<DATASET_ID>" https://api.einstein.ai/v2/vision/train
{
  "datasetId": 1000038,
  "datasetVersionId": 0,
  "name": "Beach and Mountain Model",
  "status": "QUEUED",
  "progress": 0,
  "createdAt": "2017-02-21T21:10:03.000+0000",
  "updatedAt": "2017-02-21T21:10:03.000+0000",
  "learningRate": 0.001,
  "epochs": 3,
  "queuePosition": 1,
  "object": "training",
  "modelId": "X76USM4Q3QRZRODBDTUGDZEHJU",
  "trainParams": null,
  "trainStats": null,
  "modelType": "image"
}

Predict

Now your model is ready to go! Send an image to the model, and the model returns label names and probability values. The probability value is the prediction that the model makes for whether the image matches a label in its dataset. The higher the value, the higher the probability.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "sampleLocation=http://einstein.ai/images/546212389.jpg" -F "modelId=<YOUR_MODEL_ID>" https://api.einstein.ai/v2/vision/predict
{
  "probabilities": [
    {
      "label": "Beaches",
      "probability": 0.97554934
    },
    {
      "label": "Mountains",
      "probability": 0.024450686
    }
  ],
  "object": "predictresponse"
}
x
We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.