Detector

class byotrack.api.detector.detector.Detector

Bases: ABC, ParametrizedObjectMixin

Base 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: Iterable[ndarray]) Collection[Detections]

Run the detector on a whole video

Parameters:

video (Iterable[np.ndarray]) – Sequence of frames (video) Each array is expected to have a shape (H, W, C)

Returns:

Detections for each frame (ordered by frames)

Return type:

Collection[byotrack.Detections]

class byotrack.api.detector.detector.BatchDetector(batch_size=20, add_true_frames=True)

Bases: Detector

Abstract detector that performs detection directly by batch

Usually leads to faster implementation of the detection process when batch size is greater than 1

batch_size

Size of the frame batch Default: 20

Type:

int

add_true_frames

If the input is a Video, it will exploits the VideoReader knowledge to extract the true frame id for each detections. Default: True

Type:

bool

run(video: Iterable[ndarray]) List[Detections]

Run the detector on a whole video

Parameters:

video (Iterable[np.ndarray]) – Sequence of frames (video) Each array is expected to have a shape (H, W, C)

Returns:

Detections for each frame (ordered by frames)

Return type:

Collection[byotrack.Detections]

abstract detect(batch: ndarray) Collection[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, H, W, C)

Returns:

Detections for each given frame

Return type:

Collection[byotrack.Detections]