Mmdet Model¶
sahi.models.mmdet
¶
MMDetection detection model wrapper for SAHI.
Provides integration with OpenMMLab's MMDetection framework for object detection and instance segmentation.
Classes¶
DetInferencerWrapper
¶
DetInferencerWrapper(
model: ModelType | str | None = None,
weights: str | None = None,
device: str | None = None,
scope: str | None = "mmdet",
palette: str = "none",
image_size: int | None = None,
)
Bases: DetInferencer
Wrapper around MMDetection DetInferencer for custom inference pipeline.
Initialize the DetInferencer wrapper.
Source code in sahi/models/mmdet.py
MmdetDetectionModel
¶
MmdetDetectionModel(
model_path: str | None = None,
model: object | None = None,
config_path: str | None = None,
device: str | None = None,
mask_threshold: float = 0.5,
confidence_threshold: float = 0.3,
category_mapping: dict | None = None,
category_remapping: dict | None = None,
load_at_init: bool = True,
image_size: int | None = None,
scope: str = "mmdet",
)
Bases: DetectionModel
MMDetection object detection model.
Wraps MMDetection's DetInferencer for detection and instance segmentation.
Initialize MMDetection detection model.
Source code in sahi/models/mmdet.py
Attributes¶
has_mask
property
¶
Returns if model output contains segmentation mask.
Considers both single dataset and ConcatDataset scenarios.
Methods:¶
load_model
¶
Detection model is initialized and set to self.model.
Source code in sahi/models/mmdet.py
set_model
¶
Sets the underlying MMDetection model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
¶ |
Any
|
Any A MMDetection model |
required |
**kwargs
¶ |
Any
|
Any Additional keyword arguments for model setup. |
{}
|
Source code in sahi/models/mmdet.py
perform_inference
¶
perform_inference(image: ndarray) -> None
Prediction is performed using self.model and the prediction result is set to self._original_predictions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
¶ |
ndarray
|
np.ndarray A numpy array that contains the image to be predicted. 3 channel image should be in RGB order. |
required |