Walk-through: Training a Regression Model
Walk-through: Training a Classification ModelPlainsight now supports labeling and training regression models. While classification, bounding box, and polygon models predict classes, regression models are used to predict continuous values.
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.
To get the best performing model make sure you have data representing the full range of possible value and that the data is well distributed. For example if you were to divide the range of values into 10 equally size smaller buckets, each bucket should have roughly the same number of images.
Once you have collected the images for your dataset, you can define your bounding box or polygon label to begin the labeling process. There are pros and cons to using a bounding box or polygon
In the "Label Definitions" tab, enter a name for the label. In this example we named our label
bone-age-in-months. Next, select the Rectangle label type. The "Color" value isn't used for this label type so it can be ignored. Click "Save" when complete.
If this is a new dataset, scroll down and click "Save and Start Labeling" to begin labeling your data.
You are now ready to label the images using the regression label type you defined in the previous step. In the "Labeler", select the regression label from Labels panel. Enter the appropriate float value for this image. Click "Save" then "Submit" when you are finished labeling this data point.
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.
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.
After locking a dataset, you can click "Train" on the dataset version to configure your training options.
Train from dataset versions tab
In the "Add New Model" screen, enter a model name and select your desired training options. Under the "Model Output Options" drop-down, select "Regression".
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.
Successfully trained regression model
Dataset image results showing Labeled vs. Detected values
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 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 input image for 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/bone_age/00160.jpg"'
In this example, the regression model predicted an age of 150.125 months.
Last modified 9mo ago