Walk-through: Training a Classification Model

Step-by-Step guide on training a classification model in Plainsight
Plainsight makes it easy to label and train your own image classifier and deploy your model to be used in your vision AI projects.

Collect the data

First, create a new dataset. Click on the "Create New" on the side navigation and select Dataset. Enter a name for your dataset. Click "Save & Continue to Sources".
Next, you will need to add your datasources to your dataset. In the "Sources" tab, you have several options including uploading files from your local machine or connecting to a Google Cloud or Amazon S3 storage bucket to sync your images.
In this example, we have downloaded a large dataset of car images from the web and are using the Upload Files option to upload them to Plainsight cloud storage. We also synced additional images from a Google Cloud bucket.

Define your classes

Once you are happy with the images you have added for your dataset, you can define your classes.
In the "Label Definitions" tab, define your Classification label with at least 2 options for the classes. In this example, we are adding several classes describing types of cars that we want to use to classify our data.
If this is a new dataset, scroll down and click "Save & Start Labeling" to begin labeling your data.

Classifying data

Now you are ready to to classify the images in your dataset using the Classification label you defined in the previous step. In the "Labeler" tab, ensure that the label is selected in the Label bar.
In the drop-down, selecting the class option that is appropriate for the image. Click "Submit" to save your classification.
Classifying images with the Classification label type
Repeat this process for all the images in your dataset. You also have the option to "Skip" over any images you wish to exclude from labeling.

Review and approve

Use the "Review" tab to review your dataset and approve the images to you wish to train your model with. (You can also go directly to the Versions tab and approve all Submitted images when you lock a new version.)
Before you can train or export a dataset, you must lock your dataset version. Click on the Versions tab to create a new version. You must have at least 3 annotated images in your dataset to complete this step.

Train your model

After locking a dataset, you can click "Train" on the dataset version to configure your training options.
Train from the dataset Versions tab
In the "Add New Model" screen, enter a model name and select your desired training options.
Configure model training options under Add New Model
Scroll down and click "Save & Start Training" to begin training your model. Your model will enter several training states as it goes through the training process.
Your model can take up to the budgeted Training Time (or slightly over) to train. You will be notified by email and an in-app notification when your model is ready. Below shows the model version details of a successfully trained model.
Model version details dashboard of a successfully trained model.
For classification models, a confusion matrix can be found in the model version details.

Predict classes with the Predictions API

If you wish to deploy your model and gather predictions, you can click "Start Image API" to initialize an endpoint for the Predictions API.
Deploying the model can take up to 20 mins. The "Image API" status will show as "Active" when it's ready to use.
Deploy your model by starting the Image API
Once your API is in the "Active" state, the endpoint is ready to use. You can then copy the "Image API URL" endpoint and use it to send an image and return predicted classes.
Click to copy the API endpoint.
You will need to generate a valid API Key to make a request. This key is used as an access token. See curl example below to see how the endpoint, API Key, and image to classify is used in a Predictions API request.


curl -X POST 'https://<HOSTNAME>/v1/models/01ERDH3S3TZ34S863N47RWECA7/predict' \
--header 'Authorization: Bearer <APIKEY>' \
--form '[email protected]"/Users/myuser/images/Datasets/cars_train/00160.jpg"'


"classification": {
"type": "select",
"data": {
"selected": "sedan"
"score": 0.4186546206474304,
"children": {}
In this example, the classifier predicted the image to be a "sedan" with a confidence score of 41%.