PiSAR / pipeline /pipeline.py
eadali's picture
Test yolo onnx model
5f1587b
raw
history blame contribute delete
764 Bytes
class Pipeline:
def __init__(self, detector, tracker):
"""
Initialize the Pipeline class with a detector and tracker.
Args:
detector (object): The object detection model.
tracker (object): The object tracking model.
"""
self.detector = detector
self.tracker = tracker
def load_state_dict(self, onnx_path):
self.detector.load_state_dict(onnx_path)
def __call__(self, frame):
"""
Run the detection and tracking on the input image.
Args:
frame (np.ndarray): The input image to process.
Returns:
supervision.Detections: Detections object after tracking.
"""
return self.tracker(self.detector(frame))