or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

annotators.mdcoordinate-conversion.mdcore-data-structures.mddataset-management.mddetection-tools.mddrawing-colors.mdfile-utilities.mdindex.mdiou-nms.mdkeypoint-annotators.mdmetrics.mdtracking.mdvideo-processing.mdvlm-support.md

tracking.mddocs/

0

# Tracking

1

2

Multi-object tracking algorithms for maintaining object identities across video frames.

3

4

## Capabilities

5

6

### ByteTrack Algorithm

7

8

```python { .api }

9

class ByteTrack:

10

"""

11

Multi-object tracking using the ByteTracker algorithm.

12

13

Args:

14

track_thresh (float): Detection confidence threshold for tracking

15

track_buffer (int): Number of frames to keep lost tracks

16

match_thresh (float): Matching threshold for track association

17

frame_rate (int): Video frame rate for track management

18

"""

19

def __init__(

20

self,

21

track_thresh: float = 0.25,

22

track_buffer: int = 30,

23

match_thresh: float = 0.8,

24

frame_rate: int = 30,

25

): ...

26

27

def update_with_detections(self, detections: Detections) -> Detections:

28

"""

29

Update tracker with new detections and return tracked results.

30

31

Args:

32

detections (Detections): Current frame detections

33

34

Returns:

35

Detections: Detections with assigned tracker_id values

36

"""

37

```

38

39

## Usage Example

40

41

```python

42

import supervision as sv

43

from ultralytics import YOLO

44

45

# Setup model and tracker

46

model = YOLO("yolov8n.pt")

47

tracker = sv.ByteTrack()

48

49

# Process video frames

50

for frame in sv.get_video_frames_generator("video.mp4"):

51

# Get detections

52

results = model(frame)[0]

53

detections = sv.Detections.from_ultralytics(results)

54

55

# Update tracker

56

detections = tracker.update_with_detections(detections)

57

58

# Now detections have tracker_id assigned

59

print("Tracked objects:", len(detections))

60

```