Detector
- class byotrack.api.detector.detector.Detector
Bases:
ABC,ParametrizedObjectMixinBase class for detections in videos
Detect on each frame the objects of interest.
Each detector can define a set of parameters (See ParametrizedObjectMixin)
- abstract run(video: Sequence[ndarray] | ndarray) Sequence[Detections]
Run the detector on a whole video
- Parameters:
video (Sequence[np.ndarray] | np.ndarray) – Sequence of T frames (array). Each array is expected to have a shape ([D, ]H, W, C)
- Returns:
Detections for each frame (ordered by frames)
- Return type:
Sequence[byotrack.Detections]
- class byotrack.api.detector.detector.BatchDetector(batch_size=20, add_true_frames=False)
Bases:
DetectorAbstract detector that performs detection directly by batch
Usually leads to faster implementation of the detection process when batch size is greater than 1
- add_true_frames
If the input is a Video, it will exploits the VideoReader knowledge to extract the true frame id for each detections. If False, it will register the index of the frame as the frame_id Default: False
- Type:
- run(video: Sequence[ndarray] | ndarray) List[Detections]
Run the detector on a whole video
- Parameters:
video (Sequence[np.ndarray] | np.ndarray) – Sequence of T frames (array). Each array is expected to have a shape ([D, ]H, W, C)
- Returns:
Detections for each frame (ordered by frames)
- Return type:
Sequence[byotrack.Detections]
- abstract detect(batch: ndarray) Sequence[Detections]
Apply the detection on a batch of frames
By default, the frame ids are set from 0 to n-1 with n the size of the batch. The aggregattion of batches and frame ids correction is automatically handled when called the run method.
- Parameters:
batch (np.ndarray) – Batch of video frames Shape: (B, [D, ]H, W, C)
- Returns:
Detections for each given frame
- Return type:
Sequence[byotrack.Detections]
- class byotrack.api.detector.detector.DetectionsRefiner
Bases:
ABCAbstract class for method to improve a coarse detection result
This assumes the refining can be done independently for each frame.
Warning: The class is still experimental and may change in future versions
- abstract apply(detections: Detections, frame: ndarray | None = None) Detections
Refines Detections of the given frame
- Parameters:
detections (byotrack.Detections) – Detections to refine
frame (Optional[np.ndarray]) – The associated frame of the video (optional) Shape: ([D, ]H, W, C) Default: None
- Returns:
Refined detections
- Return type:
byotrack.Detections
- run(detections_sequence: Sequence[Detections], video: Sequence[ndarray] | ndarray | None = None) List[Detections]
Run the refiner on a full video / detections sequence
- Parameters:
detections_sequence (Sequence[byotrack.Detections]) – Sequence of T detections to refine
video (Sequence[np.ndarray] | np.ndarray | None) – Optional corresponding sequence of T frames. Each frame is expected to have a shape ([D, ]H, W, C)
- Returns:
Sequence of the T refined detections
- Return type:
Sequence[byotrack.Detections]