MlModelsClient Objects
__init__
api_client- An authenticated ApiClient instance
create_model
features- List of feature names that define the model’s output layer structure (e.g. [“car”, “person”]). These features are directly mapped to neurons in the model’s final layer and remain fixed across all training iterations. The number and names of features cannot be changed without rebuilding the model’s architecture, since they determine the size and structure of the output layer. This fixed structure enables several key capabilities:- Transfer Learning: The model can be retrained on new datasets while preserving its learned feature detectors, since the output layer structure stays consistent
- Cross-Project Usage: The same model can be used across different projects by mapping its fixed features to different ontology features in each project
- Flexible Inference: A model trained to detect “vehicle” can be mapped to detect “car”, “truck” etc. in different projects based on their specific ontologies
model- The architecture type of the model to createtitle- Title for the modeldescription- Optional description for the model
ModelWithIterations- The created model and its iterations
get_model
model_uuid- UUID of the model to get information for
ModelWithIterations- Information about the requested model
list_models
order_by- Field to order results byorder_asc- True for ascending order, False for descendingquery- Optional search query to filter results
Iterable[ModelWithIterations]- Iterator of models matching the specified criteria
delete_model
model_uuid- UUID of the model to delete
update_model
model_uuid- UUID of the model to updatetitle- New title for the modeldescription- New description for the model
ModelWithIterations- Updated model information
create_training_job
-
model_uuid- UUID of the model to train -
batch_size- Training batch size -
epochs- Number of training epochs -
features_mapping- Maps project UUIDs to mappings between ontology features and model features. This complex structure allows training examples for model features to be sourced from multiple projects with different ontologies. For example:In this case:- Training examples for model_feature_0 will come from:
- project_uuid_0’s ontology_0_feature_0
- project_uuid_1’s ontology_1_feature_0
- Training examples for model_feature_1 will come from:
- project_uuid_0’s ontology_0_feature_1
- project_uuid_1’s ontology_1_feature_0
- Different projects can use different ontologies
- The same semantic concept (e.g. “car”) might have different feature IDs across ontologies
- Allows flexibly combining training data from multiple sources while maintaining correct mappings between ontology features and model features
-
labels_uuids- List of label UUIDs to use for training -
pretrained_training_uuid- Optional UUID of previous training to use for transfer learning -
pretrained_weights_type- Optional type of pretrained weights to use
UUID- The unique identifier of the created training job
get_training_status
model_uuid- UUID of the model being trainedtraining_uuid- UUID of the training jobtimeout_seconds- Maximum time to wait for training completion. Defaults to 7 days.
ModelIteration- Information about the training iteration
EncordException- If training encountered an errorValueError- If status response is invalidRequestException- If there are network connectivity issues
get_training_data
model_uuid- UUID of the modeltraining_uuid- UUID of the training iteration
Iterable[ModelIterationTrainingData]- Iterator of training data items
get_weights_download_link
model_uuid- UUID of the modeltraining_uuid- UUID of the training iteration
str- URL for downloading model weights
delete_training_iteration
model_uuid- UUID of the modeltraining_uuid- UUID of the training iteration to delete
create_model_attachment
project_uuid- UUID of the project to attach the model tofeatures_mapping- Maps model features to project ontology features. For example:This mapping connects each model feature (e.g. “car” detection) to the corresponding feature in the project’s ontology. Since different projects may use different ontologies with different feature hashes for the same concept, this mapping allows the same trained model to be reused across projects by correctly mapping its features to each project’s specific ontology structure.iteration_policy- Policy for model iteration selectionmodel_uuid- UUID of the model to attachtraining_uuids- Optional list of specific training iterations to use. Only required when iteration_policy is set to MANUAL_SELECTION.
ProjectModelWithIterations- Information about the created model attachment
list_model_attachments
project_uuid- UUID of the project
Iterable[ProjectModelWithIterations]- Iterator of attached model information
update_model_attachment
project_uuid- UUID of the projectproject_model_uuid- UUID identifying this specific model attachment to the projectfeatures_mapping- Maps model features to project ontology features. For example:This lets you remap model features to different ontology features - useful when the project’s ontology has changed or if you want the model to detect different classes than it was originally mapped to.iteration_policy- Updated policy for selecting which trained iteration of the model to use. Can be changed between automatically using latest iteration or manually specified ones.training_uuids- Optional list of specific training iterations to use. Only required when iteration_policy is set to MANUAL_SELECTION. Allows cherry-picking which trained versions of the model to use for inference.
ProjectModelWithIterations- Information about the updated model attachment
delete_model_attachment
project_uuid- UUID of the projectproject_model_uuid- UUID of the model attachment to project
predict_classification
project_uuid- UUID of the projectproject_model_uuid- UUID of the model attachment to projecttraining_uuid- UUID of the training iteration to usedata_uuid- Optional UUID of data to predict ondata_path- Optional path to local data fileframe_range_from- Optional starting frame for prediction (first frame if not set)frame_range_to- Optional ending frame for prediction (last frame if not set)conf_thresh- Confidence threshold for predictions (0.0 - 1.0)
predict_instance_segmentation
project_uuid- UUID of the projectproject_model_uuid- UUID of the model attachment to projecttraining_uuid- UUID of the training iteration to usedata_uuid- Optional UUID of data to predict ondata_path- Optional path to local data fileframe_range_from- Optional starting frame for prediction (first frame if not set)frame_range_to- Optional ending frame for prediction (last frame if not set)allocation_enabled- Whether to enable object id trackingconf_thresh- Confidence threshold for predictions (0.0 - 1.0)iou_thresh- Intersection over Union threshold (0.0 - 1.0)rdp_thresh- Optional Ramer-Douglas-Peucker algorithm threshold for polygon simplification
predict_object_detection
project_uuid- UUID of the projectproject_model_uuid- UUID of the model attachment to projecttraining_uuid- UUID of the training iteration to usedata_uuid- Optional UUID of data to predict ondata_path- Optional path to local data fileframe_range_from- Optional starting frame for prediction (first frame if not set)frame_range_to- Optional ending frame for prediction (last frame if not set)allocation_enabled- Whether to enable object id trackingconf_thresh- Confidence threshold for predictions (0.0 - 1.0)iou_thresh- Intersection over Union threshold (0.0 - 1.0)

