Using Models in Projects
The Encord SDK allows you to interact with Encord’s advanced model features. Our model library includes state-of-the-art classification, object detection, segmentation, and pose estimation models.
Creating a model row
The easiest way to get started with creating a model row is to navigate to the Models tab in your Project on the Encord platform. Create a model and set parameters accordingly.
Click on the Model API details button to toggle a code snippet with create model row API details when you are happy with your selected parameters.
The following models are available, and are all imported using from encord.constants.model import *
.
Training models
To get started with model training, navigate to the ‘models’ tab in your project on the Encord platform. Start by creating a model by following the Create model guidelines. You can also use an existing model by clicking on the Train button.
Navigate through the training flow and set parameters accordingly.
Click on the Training API details button to toggle a code snippet with model training API details when you are happy with your selected label rows and parameters.
It is important that the weights used for the model training is compatible with the created model. For example, if you have created a faster_rcnn object detection model, you should use faster_rcnn weights.
The following pre-trained weights are available for training and are all imported using from encord.constants.model_weights import *.
Inference
To get started with model inference, make sure you have created a project API key with model.inference
added to access scopes. The easiest way to get started with model inference is to navigate to the ‘models’ tab in your project.
Open the model training log for the model you would like to use for inference.
Click the Inference API details icon next to the download button to toggle a code snippet with model inference details.
You can run inference on existing videos/image groups in the platform. You can do the same by specifying the data_hashes parameter
which is the list of unique identifiers of the video/image groups on which you want to run inference. You can define confidence, intersection-over-union (IoU) and polygon coarseness thresholds. The default confidence threshold is set to 0.6
, the default IoU threshold is set to 0.3
and the default value for the polygon coarseness is set to 0.005
.
The model inference API also accepts a list of locally stored images to run inference on. In case of locally stored images only JPEG and PNG file types are supported for running inference.
For running inference on locally stored videos, only mp4 and webm video types are supported.
The model inference API also accepts a list of base64 encoded strings.
Limits on the input values
-
conf_thresh
: the value of this parameter should be between 0 and 1. -
iou_thresh
: the value of this parameter should be between 0 and 1. -
rdp_thresh
: the value for this parameter should be between 0 and 0.01. -
data_hashes
: the cumulative size of the videos/image groups specified should be less than or equal to 1 GB, otherwise a FileSizeNotSupportedError would be thrown. -
detection_frame_range
: the maximum difference between the 2 frame range values can be 1000, otherwise a DetectionRangeInvalidError would be thrown.
Was this page helpful?