monai.deploy.core.models.ModelFactory#
- class monai.deploy.core.models.ModelFactory[source]#
Bases:
objectModelFactory is a class that provides a way to create a model object.
Methods
__init__()create(path[, name, model_type])Creates a model object.
detect_model_type(path[, model_type])Detects the model type based on a model path.
- static create(path, name='', model_type='')[source]#
Creates a model object.
- Parameters:
path (Union[str, Path]) – A path to the model.
name (str) – A name of the model.
model_type (str) – A type of the model.
- Return type:
Optional[Model]- Returns:
A model object. Returns None if the model file/folder does not exist.
- static detect_model_type(path, model_type='')[source]#
Detects the model type based on a model path.
- Parameters:
path (Union[str, Path]) – A path to the model file/folder.
model_type (str) – A model type.
- Return type:
Tuple[str,Optional[Type[Model]]]- Returns:
A tuple of the model type string and the model class.