Skip to content

core.models.model

model

Classes:

Name Description
Model

Represents a model version and manages its associated files and runtime instance.

Model(name, model_version, pretrained_weights_name=None, trained_weights_name=None, config_name=None, exported_weights_name=None, labelmap=None)

Represents a model version and manages its associated files and runtime instance.

Methods:

Name Description
set_loaded_model

Set the runtime-loaded model instance.

download_weights

Download all configured model files (weights, config, exports) to destination.

save_artifact_to_experiment

Store an artifact file in the given experiment.

Attributes:

Name Type Description
name

The name of the model.

model_version

The version of the model from Picsellia.

pretrained_weights_name

The name of the pretrained weights file attached to the model version in Picsellia.

trained_weights_name

The name of the trained weights file attached to the model version in Picsellia.

config_name

The name of the configuration file attached to the model version in Picsellia.

exported_weights_name

The name of the exported weights file attached to the model version in Picsellia.

labelmap

A dictionary mapping category names to labels.

weights_dir str | None

The directory where model weights are stored.

results_dir str | None

The directory where model results are stored.

pretrained_weights_dir str | None

The directory where pretrained weights are stored.

trained_weights_dir str | None

The directory where trained weights are stored.

config_dir str | None

The directory where model configuration files are stored.

exported_weights_dir str | None

The directory where exported weights are stored.

pretrained_weights_path str | None

The path to the pretrained weights file.

trained_weights_path str | None

The path to the trained weights file.

config_path str | None

The path to the model configuration file.

exported_weights_path str | None

The path to the exported weights file.

loaded_model Any

Return the loaded model instance.

name = name instance-attribute

The name of the model.

model_version = model_version instance-attribute

The version of the model from Picsellia.

pretrained_weights_name = pretrained_weights_name instance-attribute

The name of the pretrained weights file attached to the model version in Picsellia.

trained_weights_name = trained_weights_name instance-attribute

The name of the trained weights file attached to the model version in Picsellia.

config_name = config_name instance-attribute

The name of the configuration file attached to the model version in Picsellia.

exported_weights_name = exported_weights_name instance-attribute

The name of the exported weights file attached to the model version in Picsellia.

labelmap = labelmap or {} instance-attribute

A dictionary mapping category names to labels.

weights_dir = None instance-attribute

The directory where model weights are stored.

results_dir = None instance-attribute

The directory where model results are stored.

pretrained_weights_dir = None instance-attribute

The directory where pretrained weights are stored.

trained_weights_dir = None instance-attribute

The directory where trained weights are stored.

config_dir = None instance-attribute

The directory where model configuration files are stored.

exported_weights_dir = None instance-attribute

The directory where exported weights are stored.

pretrained_weights_path = None instance-attribute

The path to the pretrained weights file.

trained_weights_path = None instance-attribute

The path to the trained weights file.

config_path = None instance-attribute

The path to the model configuration file.

exported_weights_path = None instance-attribute

The path to the exported weights file.

loaded_model property

Return the loaded model instance.

set_loaded_model(model)

Set the runtime-loaded model instance.

download_weights(destination_dir)

Download all configured model files (weights, config, exports) to destination.

Parameters:

Name Type Description Default
destination_dir
str

Root directory for downloaded files.

required

save_artifact_to_experiment(experiment, artifact_name, artifact_path)

Store an artifact file in the given experiment.

Parameters:

Name Type Description Default
experiment
Experiment

Experiment to store into.

required
artifact_name
str

Name under which to save the artifact.

required
artifact_path
str

Path to the file.

required