roboflow
RoboflowModelRegistry
¶
Bases: ModelRegistry
A Roboflow-specific model registry which gets the model type using the model id, then returns a model class based on the model type.
Source code in inference/core/registries/roboflow.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
get_model(model_id, api_key)
¶
Returns the model class based on the given model id and API key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the model to be retrieved. |
required |
api_key |
str
|
The API key used to authenticate. |
required |
Returns:
Name | Type | Description |
---|---|---|
Model |
Model
|
The model class corresponding to the given model ID and type. |
Raises:
Type | Description |
---|---|
ModelNotRecognisedError
|
If the model type is not supported or found. |
Source code in inference/core/registries/roboflow.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
get_model_type(model_id, api_key=None)
¶
Retrieves the model type based on the given model ID and API key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the model. |
required |
api_key |
str
|
The API key used to authenticate. |
None
|
Returns:
Name | Type | Description |
---|---|---|
tuple |
Tuple[TaskType, ModelType]
|
The project task type and the model type. |
Raises:
Type | Description |
---|---|
WorkspaceLoadError
|
If the workspace could not be loaded or if the API key is invalid. |
DatasetLoadError
|
If the dataset could not be loaded due to invalid ID, workspace ID or version ID. |
MissingDefaultModelError
|
If default model is not configured and API does not provide this info |
MalformedRoboflowAPIResponseError
|
Roboflow API responds in invalid format. |
Source code in inference/core/registries/roboflow.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|