tool

samurai tracking tool.

Functions

download_checkpoint

Classes

class SamuraiTrackingTool(model_size='tiny', use_samurai=True, yolo_model='yolo11n.pt', device='cpu', overwrite=False, verbose=True)[source]

Bases: TrackingTool

Parameters:
  • model_size (str)

  • use_samurai (bool)

  • yolo_model (str)

  • device (str)

  • overwrite (bool)

  • verbose (bool | int)

infer(video_path, mask_dir, object_class=0, max_objects=None, step_size=30)[source]

Perform object detection, segmentation, and tracking from a video file.

Parameters:
  • video_path (Union[str, Path]) – Path to the input video.

  • mask_dir (Union[str, Path]) – Path to the output mask directory.

  • object_class (Optional[int]) – Class of the object to detect according to Yolo (0 is a person).

  • max_objects (Optional[int]) – Max number of objects to detect. If None, go through the whole video.

  • step_size (Optional[int]) – Frame interval to perform detection.