Micro models

Micro-models are powerful tools designed to automate labeling and frame classifications in a variety of ways. They are top-level entities, which means they can be attached to several Projects to detect and label objects they have been trained to recognize.

This document will teach you how to:

  1. Create and set up a micro-model.
  2. Train the model on previously labeled data.
  3. Use the model to create labels or classifications.

Creating micro-models

To create a model, navigate to Models in the Apollo section of the sidebar in the Encord platform, and click the + New model button.

Next, enter details for your model such as a title and optionally a description. Information on other details is given below. When all details for a model have been selected, click the Create model button to complete the model creation process.


Model type

The type of micro-model determines the function you would like it to perform. Click the links below to learn about the different micro-model types available to use within Encord, as well as which frameworks and models are available for each.


Model ontology

The model Ontology consists of the objects and classifications you would like your model to detect and label. Functionally, these are strings of text which are later associated with particular objects in a Project's Ontology when the model is trained.

Each object and classification you would like your model to learn how to label should have its own model Ontology.

👍

Tip

Your Project Ontology should have a meaningful name that easily allows you to determine what your model is trained to detect, or classify.


Training micro-models

After creating a model it will have to be trained to learn how to classify, or detect / segment objects within frames or images. Begin by selecting the model you wish to train from the list of micro-models.

Then click the Train model button to begin setting up your model's training.

  • Select the Project you would like to train your model on. Make sure to select a Project with accurate labels, as high quality labels result in better performing micro-models.

  • Map each model Ontology to an entity in the Project's Ontology. This step associates the model Ontology to a set of objects or classifications in the Project which is can learn from.

  • Select all Project tasks you would like your model to train on by selecting the checkboxes in the list. A minimum of 5 labels are needed for your model to be trained.

  • Select the number of epochs you would like to include in this training. Epochs refer to the number of iterations through the entire training dataset that should be included in the training process. The default number of epochs is set to 500.

  • Select the batch size for this training. The batch size refers to the number of training examples processed by the model in a single forward and backward pass.

  • Select which training weights should be used. This refers to the model's initialization weights, which determine how many parameters a model has as well as their weights. Please visit the PyTorch website for more information on this topic. Training weights are not available for classification models.

  • If you would like to add training data from a different Project, click the + Add training data tab.

Once all the above has been set and selected click the Train model button. Your model is now being trained - and you can monitor the progress by clicking the icon in the top right corner of the Encord app. The icon will appear next to the task when the process has completed.


Training log

After a model has finished training, the 'Training log' allows you to study each training iteration and determine how differences in training data affect the model's performance over time.

It displays the batch size, the number of epochs, and a graph showing how the model's loss evolved during the course of each training iteration. Training loss will not be recorded for classification models.


Deleting micro-models

Navigate to the Danger zone of the Settings tab to delete a micro-model.

🚧

Caution

Deletion is a permanent action and cannot be undone.


Using micro-models

Once you create and train a model, the model can be attached to Projects and used to create annotations.


Attaching micro-models to Projects

ℹ️

Note

Only Project admins are able to attach models to Projects

Open the Project you want to attach your model to and navigate to the Models tab. Click + Attach a model.

Select the model you want to attach to the Project, and map each model ontology to the entity in the Project's ontology you would like to associate it with. In the following example we want the 'Apple' model Ontology to correspond with 'Apple' in the Project's Ontology.

Next, select which training iterations you would like to include from your model. Click Attach model when you are done.

Detaching micro-models from Projects

Open the Project you want to detach your model from and navigate to the Models tab. Click the icon and select Detach model.

Downloading models

ℹ️

Note

Only pytorch model weights can be downloaded.

You can download the learned parameters (known as weights) of a model for each training iteration. These weights are the result of training the model on a specific Dataset.

  1. Select the training iteration you want to download model weights for.
  2. Click the Download button.
    A file named weights.pt is downloaded.

👍

Tip

The PyTorch documentation provides information on using .pt files.