Download scripts/base_inference.py from PanagiotaMoraiti/Object_Detection_HUB: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/spaces/PanagiotaMoraiti/Object_Detection_HUB/resolve/main/scripts/base_inference.py
- Command line
-
hf download hf://spaces/PanagiotaMoraiti/Object_Detection_HUB/scripts/base_inference.py
-
curl -L -o base_inference.py https://huggingface.co/spaces/PanagiotaMoraiti/Object_Detection_HUB/resolve/main/scripts/base_inference.py
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. | |
| """ | |
| 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 | |