How to train models

Learn how to use Supervisely Apps to train custom AI models, deploy them on your GPU and use in the labeling toolboxes

circle-info

This 5-minute tutorial is a part of introduction to Supervisely series. You can complete them one-by-one, in random order, or jump to the rest of the documentation at any moment.

circle-check

We will provide a step-by-step guide for training a custom model, using YOLO (v8, v9)arrow-up-right as an example. Supervisely offers a no-code solution for training, deploying and predicting with YOLO (v8, v9)arrow-up-right models directly in your web browser, leveraging user-friendly interfaces and integrated tools.

Step 1. Prepare training data

You have several options for preparing your training data:

  • Upload your images, label them, and then train a custom neural network model.

circle-info

We recommend starting experiments with several hundred images. Continuously improve your object detection neural network by adding new images, especially those where the model's accuracy is lower.

Step 2. Deploy an agent

Before you start training or running neural networks, you need to connect your PC or a cloud server with a GPU to Supervisely by running a simple command in your terminal. This connection allows you to train neural networks and run inference directly from the Supervisely web interface. You can find detailed instructions on how to do this here.

circle-exclamation

Step 3. Train a model

  1. Open the training app from your labeled data project, click the [⫶] button → Neural Networks → YOLO → Train YOLO (v8, v9)arrow-up-right.

How to run the YOLOv8 training App from your custom training dataset
  1. Follow the wizard to configure the main training settings, similar to those allowed by the original repository. You can:

  • Choose all or a subset of classes for training.

  • Define training and validation splits.

  • Select one of the available model architectures.

  • Configure training hyperparameters, including augmentations.

  1. Press the Train button and monitor logs, charts and visualizations in real-time.

  1. The training process generates artifacts, including model weights (checkpoints), logs, charts, additional visualizations of training batches, predictions on validation data, precision-recall curves, confusion matrices and so on. These artifacts will be automatically saved to your Team Files.

Step 4. Deploy a trained model

Once the model is trained, you probably want to try it on your data and evaluate its performance.

  1. Use the Serve YOLO (v8, v9)arrow-up-right app to deploy your model as a REST API service so it can receive images and return predictions in response.

  2. Provide the checkpoint (model weights file in .pt format) and follow the app's instructions.

circle-info

In Supervisely you can quickly deploy custom or pretrained neural network models weights on your GPU using the Serve Supervisely Applicationsarrow-up-right in just a few clicks.

Step 5. Get predictions

Option 1. Integrate model in Labeling Interface

Use the NN Image Labeling arrow-up-rightapp to apply your model to images or regions of interest during annotation, configure inference settings like confidence thresholds or select all or several model classes.

This approach gives you the ability to automatically pre-label images and then just manually correct model mistakes

Option 2. Apply model to all images at once

Use the Apply NN to Images Projectarrow-up-right app to pre-label all images in a project. Follow the wizard to configure settings and run batch inference (connect to the model, select model classes, configure inference settings, and preview predictions).

The app will iterate over all images in your project, apply your model in a batch manner, and save all predicted labels to a new project.

Apply the custom model to all images in your project in a few clicks

Step 6. Export weights

The trained model can be easily exported and used outside the platform. Go to the directory with training artifacts in your Team Files and download the model weights in PyTorch (.pt) format for external use.

Just download the trained model and use it outside the Supevisley platform

Now you can follow the YOLOv8 documentationarrow-up-right to get predictions on images.

Here is a Python example of inference:

You can check the main section of the documentation on neural networks:

Overviewchevron-right

Last updated