File size: 777 Bytes
d987cda | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from abc import ABC, abstractmethod
class BaseInference(ABC):
"""
Abstract base class for all model inference wrappers.
All model inference classes should inherit from this class and implement the infer() method.
"""
@abstractmethod
def infer(self, image, confidence=0.5, use_nms=False, nms_thresh=0.7):
"""
Run inference on a given image.
Args:
image (np.ndarray): Input image in BGR format.
confidence (float): Confidence threshold.
use_nms (bool): Whether to apply Non-Maximum Suppression.
nms_thresh (float): IoU threshold for NMS.
Returns:
sv.Detections: Object containing bounding boxes, class IDs, and confidence scores.
"""
pass
|