or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

export-deployment.mdindex.mdresults-visualization.mdspecialized-models.mdtracking.mdtraining-validation.mdutilities.mdyolo-models.md

index.mddocs/

0

# Ultralytics YOLO

1

2

Ultralytics YOLO is a comprehensive computer vision library implementing state-of-the-art YOLO (You Only Look Once) models for object detection, multi-object tracking, instance segmentation, pose estimation, and image classification. It provides a unified API for training and inference with various YOLO model versions (YOLOv8, YOLOv9, YOLOv10, YOLO11), supports multiple export formats, and includes advanced features like model pruning, quantization, and hyperparameter optimization.

3

4

## Package Information

5

6

- **Package Name**: ultralytics

7

- **Language**: Python

8

- **Installation**: `pip install ultralytics`

9

10

## Core Imports

11

12

```python

13

from ultralytics import YOLO

14

```

15

16

For specialized models:

17

18

```python

19

from ultralytics import YOLO, YOLOWorld, SAM, FastSAM, RTDETR, NAS

20

```

21

22

For utilities:

23

24

```python

25

from ultralytics import checks, download, settings

26

```

27

28

## Basic Usage

29

30

```python

31

from ultralytics import YOLO

32

from PIL import Image

33

34

# Load a model

35

model = YOLO("yolo11n.pt") # load a pretrained model

36

37

# Predict on an image

38

results = model("https://ultralytics.com/images/bus.jpg") # predict on an image

39

40

# Display the results

41

for r in results:

42

im_array = r.plot() # plot a BGR numpy array of predictions

43

im = Image.fromarray(im_array[..., ::-1]) # RGB PIL image

44

im.show() # show image

45

46

# Train the model

47

model.train(data="coco8.yaml", epochs=3) # train the model

48

49

# Validate the model

50

metrics = model.val() # evaluate model performance on the validation set

51

52

# Export the model

53

model.export(format="onnx") # export the model to ONNX format

54

```

55

56

## Architecture

57

58

The Ultralytics package is organized around several key components:

59

60

- **Model Classes**: Core model implementations (YOLO, YOLOWorld, SAM, FastSAM, RTDETR, NAS)

61

- **Engine**: Base model functionality, results handling, and training infrastructure

62

- **Utils**: Comprehensive utilities for downloads, plotting, system checks, and configuration

63

- **Data**: Dataset loaders, augmentations, and preprocessing pipelines

64

- **NN**: Neural network architectures and model definitions

65

- **Trackers**: Multi-object tracking algorithms (BOTSORT, BYTETracker)

66

- **Solutions**: Pre-built computer vision solutions and analytics tools

67

68

## Capabilities

69

70

### YOLO Models

71

72

The primary YOLO model class supporting multiple computer vision tasks including object detection, instance segmentation, image classification, pose estimation, and oriented bounding box detection.

73

74

```python { .api }

75

class YOLO:

76

def __init__(self, model="yolo11n.pt", task=None, verbose=False): ...

77

def predict(self, source, **kwargs) -> List[Results]: ...

78

def train(self, **kwargs) -> dict: ...

79

def val(self, **kwargs) -> dict: ...

80

def export(self, **kwargs) -> str: ...

81

```

82

83

[YOLO Models](./yolo-models.md)

84

85

### Specialized Models

86

87

Specialized model implementations including YOLOWorld for open-vocabulary detection, SAM for promptable segmentation, FastSAM for efficient segmentation, RTDETR for transformer-based detection, and NAS for neural architecture search.

88

89

```python { .api }

90

class YOLOWorld:

91

def set_classes(self, classes: List[str]): ...

92

93

class SAM:

94

def predict(self, source, bboxes=None, points=None, labels=None, **kwargs): ...

95

96

class FastSAM:

97

def predict(self, source, **kwargs): ...

98

```

99

100

[Specialized Models](./specialized-models.md)

101

102

### Model Training and Validation

103

104

Comprehensive training and validation capabilities with support for custom datasets, hyperparameter tuning, distributed training, and model optimization techniques.

105

106

```python { .api }

107

def train(self, data=None, epochs=100, **kwargs) -> dict: ...

108

def val(self, data=None, **kwargs) -> dict: ...

109

def tune(self, data=None, **kwargs) -> dict: ...

110

```

111

112

[Training and Validation](./training-validation.md)

113

114

### Model Export and Deployment

115

116

Export trained models to various formats for deployment including ONNX, TensorRT, CoreML, TensorFlow, OpenVINO, and mobile formats with optimization options.

117

118

```python { .api }

119

def export(self, format="torchscript", **kwargs) -> str: ...

120

def benchmark(self, **kwargs) -> dict: ...

121

```

122

123

[Export and Deployment](./export-deployment.md)

124

125

### Object Tracking

126

127

Multi-object tracking capabilities with BOTSORT and BYTETracker algorithms for tracking objects across video frames.

128

129

```python { .api }

130

def track(self, source, **kwargs) -> List[Results]: ...

131

```

132

133

[Object Tracking](./tracking.md)

134

135

### Utilities and Configuration

136

137

Comprehensive utility functions for system checks, file downloads, plotting results, configuration management, and dataset operations.

138

139

```python { .api }

140

def checks(**kwargs): ...

141

def download(url: str, **kwargs): ...

142

settings: SettingsManager

143

```

144

145

[Utilities](./utilities.md)

146

147

### Results and Visualization

148

149

Rich result objects containing detection outputs with built-in visualization, annotation, and export capabilities.

150

151

```python { .api }

152

class Results:

153

def plot(self, **kwargs) -> np.ndarray: ...

154

def save(self, filename: str): ...

155

def show(self): ...

156

```

157

158

[Results and Visualization](./results-visualization.md)