CustomModelsSelector
Introduction
CustomModelsSelector widget allows creating a table with NN models that you have trained in Supervisely by providing path to training application default save directory, Team ID and task type (e.g. object detection, instance segmentation, pose estimation and etc).
Read this tutorial in developer portal.
Function signature
CustomModelsSelector(
team_id = team_id,
training_app_directory="/yolov8_train/",
task_type="object_detection",
widget_id=None,
)
Parameters
team_id
int
Current Team ID
training_app_directory
str
Path to directory in Team File to training app default save directory
task_type
str
Model task type
widget_id
str
ID of the widget
team_id
Team ID where training app default save directory is located.
type: int
training_app_directory
Path to directory in Team File to training app default save directory. For example, if you have trained model in Train YOLOv8 application, you should provide /yolov8_train/ path.
type: str
task_type
Type of problem that model solves. Can be selected in the Training app GUI. For example, models that were trained with Train YOLOv8 application can have one of the following task types: object detection, instance segmentation, pose estimation.
type: str
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
columns
List[str]
rows
Dict[str, List[ModelRow]]
get_selected_row()
ModelRow or None
get_selected_row_index()
int or None
set_active_row(index)
None
get_selected_task_type()
str
set_active_task_type(task_type)
None
get_available_task_types()
List[str]
get_selected_model_params()
Dict or None
use_custom_checkpoint_path()
bool
get_custom_checkpoint_name()
str
get_custom_checkpoint_path()
str
set_custom_checkpoint_path(path)
None
set_custom_checkpoint_preview(file_info)
None
get_custom_checkpoint_task_type()
str
set_custom_checkpoint_task_type(task_type)
None
enable()
None
disable()
None
enable_table()
None
disable_table()
None
@value_changed
Decorator function is handled when widget value is changed
@task_type_changed
Decorator function is handled when widget task type is changed
ModelRow
ModelRow object represents an automatically generated row in the CustomModelsSelector widget. It has information about the training session including:
ID of the training session
Names and paths to model artifacts
Training data project
Function signature
Methods and attributes
task_id
Return task id of the training session.
task_date
Return date and time of the training session.
task_link
Return link to the training session.
training_project_info
Return ProjectInfo object with project info.
artifacts_paths
Return list of all artifacts paths.
artifacts_names
Return list of artifacts names.
artifacts_selector
Return artifact selector widget with type Select.
get_selected_artifact_path()
Return path of the selected artifact.
get_selected_artifact_name()
Return name of the selected artifact.
to_html()
Converts object to html string to use it in the widget template.
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/selection/019_trained_models_selector/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize CustomModelsSelector widget
CustomModelsSelector widgetCreate additional widgets to preview selected model
Create app layout
Prepare a layout for app using Card widget with the content parameter and place widgets that we've just created in the Container widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widgets from code
Last updated
Was this helpful?