YOLOv5 Model¶
sahi.models.yolov5
¶
YOLOv5 detection model wrapper for SAHI.
Provides integration with Ultralytics YOLOv5 for object detection.
Classes¶
Yolov5DetectionModel
¶
Bases: DetectionModel
YOLOv5 object detection model.
Wraps Ultralytics YOLOv5 for fast object detection.
Initialize YOLOv5 detection model.
Source code in sahi/models/yolov5.py
Attributes¶
Methods:¶
load_model
¶
Detection model is initialized and set to self.model.
Source code in sahi/models/yolov5.py
set_model
¶
Sets the underlying YOLOv5 model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
¶ |
Any
|
Any A YOLOv5 model |
required |
**kwargs
¶ |
Any
|
Any Additional keyword arguments for model setup. |
{}
|
Source code in sahi/models/yolov5.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 |