Object_Detection_HUB / scripts /base_inference.py
Panagiota Moraiti
Add scripts
d987cda
raw
history blame contribute delete
777 Bytes
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