Einstein Vision is part of the Einstein Platform Services technologies, and you can use it to AI-enable your apps. Leverage pre-trained classifiers, or train your own custom classifiers to solve a vast array of specialized image-recognition use cases. 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.
Einstein Vision includes these APIs:
- Einstein Image Classification—Enables developers to train deep learning models to recognize and classify images at scale.
- Einstein Object Detection (Pilot)—Enables developers to train models to recognize and count multiple distinct objects within an image, providing granular details like the size and location of each object.
Today we will cover the Einstein Image Classification . As we have a very good Apex wrapper provided by Salesforce dev team here. Which you can use to make all request of Einstein while it handle all the heavy work in background for you.
But if you don’t want to install a full library to test these requests then I will share quick code sample which you can use to create your own request.
After all this setup our org is ready to make our first prediction. For our demo purpose we will use Bike vs Car model. Here I have commented Token Id, Dataset Id and Model Id you can enter your related Id there.
First to make a request we need the access token, Here we take help of our base classes which we have included. To get the access token we will use JWT access token helper.
Then we need to make our Dataset: A data set is a folder which contains the images. Here we pass the data in multipart/form-data format.
Dataset can be created Asyn or syn. In our example we are creating Asynchronously.
Next we will train our dataset to identify the images. You will get Dataset ID from previous request.
this command train the Dataset and create a Model. Model creation process takes time based on number of images which you have provided. In our example number of picture is less so it will complete early.
You can also check the status
Once the Dataset is trained we are ready to make our first prediction.
For prediction we will use this image
And the response we get is
So we get Almost 100% for this image. You can make your own Dataset and can play with them.
Let me know what you like most about Einstein in comments. If you want to add something share with me in comments section.
Happy Programming 🙂