Walk-through: Training an Object Detection Model
Object detection is a common and important computer vision task that involves identifying and labeling objects within images, video frames, or live feeds. It involves labeling each instance of a specific object within an image. An object detection model will draw bounding boxes around objects, learning to identify and predict future instances as it processes more visual data over time.

Collect the data for your model

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 are using a dataset from a Google Cloud storage bucket and synced to Plainsight.

Define your Object Detection label

Once you are happy with the images you have added for your dataset, you can define your bounding box label which is used for object detection.
In the "Label Definitions" tab, enter a name for the label. In this example we named our label truck. Next, select the Bounding Box label type. Optionally, you can select a color for the label using the color chooser, or keep the default.
If this is a new dataset, scroll down and click "Save and Start Labeling" to begin labeling your data.

Label your training data

You are now ready to label the images using the bounding box label type you defined in the previous step. In the "Labeler", select the bounding box label from Labels panel.
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 version, you can click "Train" on the dataset version to configure your training options.
Train a model from a dataset version.
You will be taken to the "Add New Model" screen. Enter a model name and select your desired training options. Under the "Model Output Options" drop-down, select "Bounding Box".
Configure model training options with SmartML.
Once you are satisfied with your training settings, 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.
An email and in-app notification will notify you that your model is ready.
Below shows the model version details of a successfully trained model.
Successfully trained object detection model.
You can scroll down and view the dataset images and preview your model's performance.
Preview images in the dataset splits and compare model detections and labeled annotations.

Predict values 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.
Start the Image API to deploy the model.
Deploying the model can take up to 20 mins. The "Image API" status will show as "Active" when it's ready to use.
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.
Copy the Image API URL to make Prediction requests and return detections.
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 input image for is used in a Predictions API request.

Request:

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

Response:

{
"truck": [
{
"type": "rectangle",
"data": {
"min": [
0.205671443939209,
0.3034465407718725
],
"max": [
0.4349382019042969,
0.5484284369100259
]
},
"score": 0.9517288208007812,
"children": {}
},
{
"type": "rectangle",
"data": {
"min": [
0.5385221862792968,
0.3615528100624751
],
"max": [
0.8626577758789062,
0.5390722035224563
]
},
"score": 0.9465966820716858,
"children": {}
},
{
"type": "rectangle",
"data": {
"min": [
0.3786514282226562,
0.3400407315058625
],
"max": [
0.9536986541748047,
0.5605842335614567
]
},
"score": 0.6663102507591248,
"children": {}
}
]
}
In this example, the object detection model detected 3 trucks in the image with confidence scores ranging from 66% to 95%.

Test your model

You can also use Test Model to visualize your model detections. With the Image API active, click the Test Model button located in the dataset images section.
Select your image with the file chooser or drag and drop it into the modal.
Your image will be used as input to the model and the detections will be overlaid.
In this example, 9 trucks were detected in the image.
That's it! We just labeled, trained, deployed, and tested an object detection model all within the Plainsight platform.
Copy link
On this page
Collect the data for your model
Define your Object Detection label
Label your training data
Review and approve
Train your model
Predict values with the Predictions API
Test your model