Get an Einstein Platform Services Account
- Sign up for an Einstein Platform Services account.
- Create code elements to call the Einstein Image Classification API from Salesforce.
- Send an image to the general image classifier and get back a prediction.
Artificial Intelligence (AI) is already part of our lives. Whenever you pick up your smartphone, you’re already seeing AI in action—from tailored recommendations to relevant search results. With Einstein Vision, you can harness the power of image recognition to build AI-powered apps fast—all without a data science degree!
Using the Einstein Image Classification API, you can train deep learning models to recognize and classify images. A model is a machine learning construct used to solve a classification problem. The model “learns” from data instead of from explicit rules. In this project, the terms model and classifier mean the same thing.
You design a model by first creating a dataset. Then you define the labels or categories of data in the dataset. Finally, you provide examples of data for each label. When you train the dataset, the system determines the commonalities and differences between the various labels and generalizes the characteristics that define each label. When you send an image to the model, the model predicts which label that image falls into based on the labels specified in your training dataset.
You may find some of these terms unfamiliar, so if you’re new to AI and deep learning, fear not! This project is a great way to get started, because we’re using a model that’s already been built. Plus, this project takes you through each step of the way to send in an image and get back a prediction.
Einstein Image Classification lets you use pre-trained classifiers or train your own custom classifiers to solve unique use cases. Creating a custom classifier requires a lot of data. So in this project, you access the pre-built general image classifier from your Salesforce org.
First, you create Apex classes that call the API. Then you create a Visualforce page to tie it all together. Finally, you test all your work by sending this image of a tree frog into the classifier. The classifier returns a prediction of what the image contains.
When you sign up for an account, you’re prompted to log in to your Salesforce org. For this module, you use the username and password for your hands-on Trailhead Playground (TP) org. If you don’t know what a Trailhead Playground org is, or you need to find your TP username and password, check out the Trailhead Playground Management module.
After you log in, you’re prompted to allow the sign-up page to access information in your Salesforce org. Giving access lets the sign-up page retrieve some basic information such as your ID, profile, email, address, and phone number. After your account is created, you can download your key.
- Navigate to the sign-up page at https://api.einstein.ai/signup.
Click Sign Up Using Salesforce.
On the Salesforce login page, type your Trailhead Playground username and
password and click Log In.
Click Allow so the page can access basic information,
such as your email address, and perform requests.
On the activation page, click Download Key to save the
key locally. The key file is named einstein_platform.pem. If you can’t download it, cut and paste
your key from the browser into a text file and save it as einstein_platform.pem.
- In Salesforce, click , then search for and click Files.
- Click Upload Files.
- Navigate to the directory where you saved the einstein_platform.pem file, select the file, and click Open.
Click Done to confirm the upload.
You see the key file in the list of files owned by you.
That’s it. We won’t check any of your setup. Click Verify Step to proceed to the next step in the project.