[Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics), developed by [Ultralytics](https://ultralytics.com), is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection, image segmentation and image classification tasks.
[Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics), developed by [Ultralytics](https://ultralytics.com),
is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces
new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and
easy to use, making it an excellent choice for a wide range of object detection, image segmentation and image
classification tasks.
To request an Enterprise License please complete the form at [Ultralytics Licensing](https://ultralytics.com/license).
To request an Enterprise License please complete the form at [Ultralytics Licensing](https://ultralytics.com/license).
@ -50,12 +54,14 @@ To request an Enterprise License please complete the form at [Ultralytics Licens
## <divalign="center">Documentation</div>
## <divalign="center">Documentation</div>
See below for quickstart intallation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com) for full documentation on training, validation, prediction and deployment.
See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com) for full
documentation on training, validation, prediction and deployment.
<detailsopen>
<detailsopen>
<summary>Install</summary>
<summary>Install</summary>
Pip install the ultralytics package including all [requirements.txt](https://github.com/ultralytics/ultralytics/blob/main/requirements.txt) in a
Pip install the ultralytics package including
all [requirements.txt](https://github.com/ultralytics/ultralytics/blob/main/requirements.txt) in a
[**Python>=3.7.0**](https://www.python.org/) environment, including
[**Python>=3.7.0**](https://www.python.org/) environment, including
`yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See a full list of available `yolo` [arguments](https://docs.ultralytics.com/config/) in the YOLOv8 [Docs](https://docs.ultralytics.com).
`yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See a full list
of available `yolo` [arguments](https://docs.ultralytics.com/config/) in the
YOLOv8 may also be used directly in a Python environment, and accepts the same [arguments](https://docs.ultralytics.com/config/) as in the CLI example above:
YOLOv8 may also be used directly in a Python environment, and accepts the
same [arguments](https://docs.ultralytics.com/config/) as in the CLI example above:
```python
```python
from ultralytics import YOLO
from ultralytics import YOLO
@ -96,7 +105,7 @@ model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
results = model.train(data="coco128.yaml", epochs=3) # train the model
results = model.train(data="coco128.yaml", epochs=3) # train the model
results = model.val() # evaluate model performance on the validation set
results = model.val() # evaluate model performance on the validation set
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
success = YOLO("yolov8n.pt").export(format="onnx") # export a model to ONNX format
success = model.export(format="onnx") # export the model to ONNX format
```
```
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest
We are still working on several parts of YOLOv8! We aim to have these completed soon to bring the YOLOv8 feature set up to par with YOLOv5, including export and inference to all the same formats. We are also writing a YOLOv8 paper which we will submit to [arxiv.org](https://arxiv.org) once complete.
We are still working on several parts of YOLOv8! We aim to have these completed soon to bring the YOLOv8 feature set up
to par with YOLOv5, including export and inference to all the same formats. We are also writing a YOLOv8 paper which we
will submit to [arxiv.org](https://arxiv.org) once complete.
- [ ] TensorFlow exports
- [ ] TensorFlow exports
- [ ] DDP resume
- [ ] DDP resume
@ -112,15 +123,18 @@ We are still working on several parts of YOLOv8! We aim to have these completed
</details>
</details>
## <divalign="center">Checkpoints</div>
## <divalign="center">Models</div>
All YOLOv8 pretrained models are available here. Detection and Segmentation models are pretrained on the COCO dataset, while Classification models are pretrained on the ImageNet dataset.
All YOLOv8 pretrained models are available here. Detection and Segmentation models are pretrained on the COCO dataset,
while Classification models are pretrained on the ImageNet dataset.
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest
Ultralytics [release](https://github.com/ultralytics/assets/releases) on first use.
Ultralytics [release](https://github.com/ultralytics/assets/releases) on first use.
<detailsopen><summary>Detection</summary>
<detailsopen><summary>Detection</summary>
See [Detection Docs](https://docs.ultralytics.com/tasks/detection/) for usage examples with these models.
| Label and export your custom datasets directly to YOLOv8 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) | Automatically track, visualize and even remotely train YOLOv8 using [ClearML](https://cutt.ly/yolov5-readme-clearml) (open-source!) | Free forever, [Comet](https://bit.ly/yolov5-readme-comet2) lets you save YOLOv8 models, resume training, and interactively visualise and debug predictions | Run YOLOv8 inference up to 6x faster with [Neural Magic DeepSparse](https://bit.ly/yolov5-neuralmagic) |
| Label and export your custom datasets directly to YOLOv8 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) | Automatically track, visualize and even remotely train YOLOv8 using [ClearML](https://cutt.ly/yolov5-readme-clearml) (open-source!) | Free forever, [Comet](https://bit.ly/yolov5-readme-comet2) lets you save YOLOv8 models, resume training, and interactively visualize and debug predictions | Run YOLOv8 inference up to 6x faster with [Neural Magic DeepSparse](https://bit.ly/yolov5-neuralmagic) |
## <divalign="center">Ultralytics HUB</div>
## <divalign="center">Ultralytics HUB</div>
[Ultralytics HUB](https://bit.ly/ultralytics_hub) is our ⭐ **NEW** no-code solution to visualize datasets, train YOLOv8 🚀 models, and deploy to the real world in a seamless experience. Get started for **Free** now! Also run YOLOv8 models on your iOS or Android device by downloading the [Ultralytics App](https://ultralytics.com/app_install)!
[Ultralytics HUB](https://bit.ly/ultralytics_hub) is our ⭐ **NEW** no-code solution to visualize datasets, train YOLOv8
🚀 models, and deploy to the real world in a seamless experience. Get started for **Free** now! Also run YOLOv8 models on
your iOS or Android device by downloading the [Ultralytics App](https://ultralytics.com/app_install)!
We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](CONTRIBUTING.md) to get started, and fill out our [Survey](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see
our [Contributing Guide](CONTRIBUTING.md) to get started, and fill out
our [Survey](https://ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback
on your experience. Thank you 🙏 to all our contributors!
<!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
<!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
@ -216,11 +242,14 @@ We love your input! YOLOv5 and YOLOv8 would not be possible without help from ou
YOLOv8 is available under two different licenses:
YOLOv8 is available under two different licenses:
- **GPL-3.0 License**: See [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for details.
- **GPL-3.0 License**: See [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for details.
- **Enterprise License**: Provides greater flexibility for commercial product development without the open-source requirements of GPL-3.0. Typical use cases are embedding Ultralytics software and AI models in commercial products and applications. Request an Enterprise License at [Ultralytics Licensing](https://ultralytics.com/license).
- **Enterprise License**: Provides greater flexibility for commercial product development without the open-source
requirements of GPL-3.0. Typical use cases are embedding Ultralytics software and AI models in commercial products and
applications. Request an Enterprise License at [Ultralytics Licensing](https://ultralytics.com/license).
## <divalign="center">Contact</div>
## <divalign="center">Contact</div>
For YOLOv8 bugs and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues). For professional support please [Contact Us](https://ultralytics.com/contact).
For YOLOv8 bugs and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues).
For professional support please [Contact Us](https://ultralytics.com/contact).
Welcome to the Ultralytics HUB app for demonstrating YOLOv5 and YOLOv8 models! In this app, available on the [Apple App
Welcome to the Ultralytics HUB app for demonstrating YOLOv5 and YOLOv8 models! In this app, available on the [Apple App
Store](https://apps.apple.com/xk/app/ultralytics/id1583935240) and the [Google Play Store](https://play.google.com/store/apps/details?id=com.ultralytics.ultralytics_app), you will be able to see the power and capabilities of YOLOv5, a state-of-the-art object
Store](https://apps.apple.com/xk/app/ultralytics/id1583935240) and the
detection model developed by Ultralytics.
[Google Play Store](https://play.google.com/store/apps/details?id=com.ultralytics.ultralytics_app), you will be able
to see the power and capabilities of YOLOv5, a state-of-the-art object detection model developed by Ultralytics.
**To install simply scan the QR code above**. The App currently features YOLOv5 models, with YOLOv8 models coming soon.
**To install simply scan the QR code above**. The App currently features YOLOv5 models, with YOLOv8 models coming soon.
If you want to train, validate or run inference on models and don't need to make any modifications to the code, using
If you want to train, validate or run inference on models and don't need to make any modifications to the code, using YOLO command line interface is the easiest way to get started.
YOLO command line interface is the easiest way to get started.
@ -9,60 +10,76 @@ If you want to train, validate or run inference on models and don't need to make
classify val yolov8n-cls.pt
classify val yolov8n-cls.pt
```
```
The experiment arguments can be overridden directly by pass `arg=val` covered in the next section. You can run any supported task by setting `task` and `mode` in cli.
The experiment arguments can be overridden directly by pass `arg=val` covered in the next section. You can run any
supported task by setting `task` and `mode` in cli.
Both the Ultralytics YOLO command-line and python interfaces are simply a high-level abstraction on the base engine executors. Let's take a look at the Trainer engine.
Both the Ultralytics YOLO command-line and python interfaces are simply a high-level abstraction on the base engine
executors. Let's take a look at the Trainer engine.
## BaseTrainer
## BaseTrainer
BaseTrainer contains the generic boilerplate training routine. It can be customized for any task based over overidding the required functions or operations as long the as correct formats are followed. For example you can support your own custom model and dataloder by just overriding these functions:
* `get_model(cfg, weights)` - The function that builds a the model to be trained
BaseTrainer contains the generic boilerplate training routine. It can be customized for any task based over overidding
the required functions or operations as long the as correct formats are followed. For example, you can support your own
custom model and dataloder by just overriding these functions:
* `get_model(cfg, weights)` - The function that builds the model to be trained
* `get_dataloder()` - The function that builds the dataloder
* `get_dataloder()` - The function that builds the dataloder
More details and source code can be found in [`BaseTrainer` Reference](reference/base_trainer.md)
More details and source code can be found in [`BaseTrainer` Reference](reference/base_trainer.md)
## DetectionTrainer
## DetectionTrainer
Here's how you can use the YOLOv8 `DetectionTrainer` and customize it.
Here's how you can use the YOLOv8 `DetectionTrainer` and customize it.
```python
```python
from ultralytics.yolo.v8 import DetectionTrainer
from ultralytics.yolo.v8.detect import DetectionTrainer
trainer = DetectionTrainer(overrides={...})
trainer = DetectionTrainer(overrides={...})
trainer.train()
trainer.train()
@ -18,25 +24,32 @@ trained_model = trainer.best # get best model
```
```
### Customizing the DetectionTrainer
### Customizing the DetectionTrainer
Let's customize the trainer **to train a custom detection model** that is not supported directly. You can do this by simply overloading the existing the `get_model` functionality:
Let's customize the trainer **to train a custom detection model** that is not supported directly. You can do this by
simply overloading the existing the `get_model` functionality:
```python
```python
from ultralytics.yolo.v8 import DetectionTrainer
from ultralytics.yolo.v8.detect import DetectionTrainer
class CustomTrainer(DetectionTrainer):
class CustomTrainer(DetectionTrainer):
def get_model(self, cfg, weights):
def get_model(self, cfg, weights):
...
...
trainer = CustomTrainer(overrides={...})
trainer = CustomTrainer(overrides={...})
trainer.train()
trainer.train()
```
```
You now realize that you need to customize the trainer further to:
You now realize that you need to customize the trainer further to:
* Customize the `loss function`.
* Customize the `loss function`.
* Add `callback` that uploads model to your google drive after every 10 `epochs`
* Add `callback` that uploads model to your Google Drive after every 10 `epochs`
Here's how you can do it:
Here's how you can do it:
```python
```python
from ultralytics.yolo.v8 import DetectionTrainer
from ultralytics.yolo.v8.detect import DetectionTrainer
class CustomTrainer(DetectionTrainer):
class CustomTrainer(DetectionTrainer):
def get_model(self, cfg, weights):
def get_model(self, cfg, weights):
@ -49,11 +62,13 @@ class CustomTrainer(DetectionTrainer):
...
...
return loss, loss_items # see Reference-> Trainer for details on the expected format
return loss, loss_items # see Reference-> Trainer for details on the expected format
# callback to upload model weights
# callback to upload model weights
def log_model(trainer):
def log_model(trainer):
last_weight_path = trainer.last
last_weight_path = trainer.last
...
...
trainer = CustomTrainer(overrides={...})
trainer = CustomTrainer(overrides={...})
trainer.add_callback("on_train_epoch_end", log_model) # Adds to existing callback
trainer.add_callback("on_train_epoch_end", log_model) # Adds to existing callback
trainer.train()
trainer.train()
@ -62,5 +77,7 @@ trainer.train()
To know more about Callback triggering events and entry point, checkout our Callbacks guide # TODO
To know more about Callback triggering events and entry point, checkout our Callbacks guide # TODO
## Other engine components
## Other engine components
There are other componenets that can be customized similarly like `Validators` and `Predictiors`
To know more about their implementation details, go to Reference
There are other componenets that can be customized similarly like `Validators` and `Predictors`
See Reference section for more information on these.
@ -22,25 +22,33 @@ trained, it can be easily deployed and used for real-time object detection and i
Ultralytics HUB is an essential tool for anyone looking to use YOLOv5 for their object detection and image segmentation
Ultralytics HUB is an essential tool for anyone looking to use YOLOv5 for their object detection and image segmentation
projects.
projects.
**[Get started now](https://hub.ultralytics.com)** and experience the power and simplicity of Ultralytics HUB for yourself. Sign up for a free account and
**[Get started now](https://hub.ultralytics.com)** and experience the power and simplicity of Ultralytics HUB for
yourself. Sign up for a free account and
start building, training, and deploying YOLOv5 and YOLOv8 models today.
start building, training, and deploying YOLOv5 and YOLOv8 models today.
## 1. Upload a Dataset
## 1. Upload a Dataset
Ultralytics HUB datasets are just like YOLOv5 🚀 datasets, they use the same structure and the same label formats to keep everything simple.
Ultralytics HUB datasets are just like YOLOv5 🚀 datasets, they use the same structure and the same label formats to keep
everything simple.
When you upload a dataset to Ultralytics HUB, make sure to **place your dataset YAML inside the dataset root directory** as in the example shown below, and then zip for upload to https://hub.ultralytics.com/. Your **dataset YAML, directory and zip** should all share the same name. For example, if your dataset is called 'coco6' as in our example [ultralytics/hub/coco6.zip](https://github.com/ultralytics/hub/blob/master/coco6.zip), then you should have a coco6.yaml inside your coco6/ directory, which should zip to create coco6.zip for upload:
When you upload a dataset to Ultralytics HUB, make sure to **place your dataset YAML inside the dataset root directory**
as in the example shown below, and then zip for upload to https://hub.ultralytics.com/. Your **dataset YAML, directory
and zip** should all share the same name. For example, if your dataset is called 'coco6' as in our
example [ultralytics/hub/coco6.zip](https://github.com/ultralytics/hub/blob/master/coco6.zip), then you should have a
coco6.yaml inside your coco6/ directory, which should zip to create coco6.zip for upload:
```bash
```bash
zip -r coco6.zip coco6
zip -r coco6.zip coco6
```
```
The example [coco6.zip](https://github.com/ultralytics/hub/blob/master/coco6.zip) dataset in this repository can be downloaded and unzipped to see exactly how to structure your custom dataset.
The example [coco6.zip](https://github.com/ultralytics/hub/blob/master/coco6.zip) dataset in this repository can be
downloaded and unzipped to see exactly how to structure your custom dataset.
The dataset YAML is the same standard YOLOv5 YAML format. See the [YOLOv5 Train Custom Data tutorial](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data) for full details.
The dataset YAML is the same standard YOLOv5 YAML format. See
the [YOLOv5 Train Custom Data tutorial](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data) for full details.
```yaml
```yaml
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: # dataset root dir (leave empty for HUB)
path: # dataset root dir (leave empty for HUB)
@ -57,24 +65,26 @@ names:
...
...
```
```
After zipping your dataset, sign in to [Ultralytics HUB](https://bit.ly/ultralytics_hub) and click the Datasets tab. Click 'Upload Dataset' to upload, scan and visualize your new dataset before training new YOLOv5 models on it!
After zipping your dataset, sign in to [Ultralytics HUB](https://bit.ly/ultralytics_hub) and click the Datasets tab.
Click 'Upload Dataset' to upload, scan and visualize your new dataset before training new YOLOv5 models on it!
Connect to the Ultralytics HUB notebook and use your model API key to begin training! <ahref="https://colab.research.google.com/github/ultralytics/hub/blob/master/hub.ipynb"target="_blank"><imgsrc="https://colab.research.google.com/assets/colab-badge.svg"alt="Open In Colab"></a>
Connect to the Ultralytics HUB notebook and use your model API key to begin
training! <ahref="https://colab.research.google.com/github/ultralytics/hub/blob/master/hub.ipynb"target="_blank"><imgsrc="https://colab.research.google.com/assets/colab-badge.svg"alt="Open In Colab"></a>
## 3. Deploy to Real World
## 3. Deploy to Real World
Export your model to 13 different formats, including TensorFlow, ONNX, OpenVINO, CoreML, Paddle and many others. Run models directly on your mobile device by downloading the [Ultralytics App](https://ultralytics.com/app_install)!
Export your model to 13 different formats, including TensorFlow, ONNX, OpenVINO, CoreML, Paddle and many others. Run
models directly on your mobile device by downloading the [Ultralytics App](https://ultralytics.com/app_install)!
<imgwidth="100%"alt="Ultralytics mobile app"src="https://github.com/ultralytics/assets/raw/main/im/ultralytics-app.png"></a>
<imgwidth="100%"alt="Ultralytics mobile app"src="https://github.com/ultralytics/assets/raw/main/im/ultralytics-app.png"></a>
## ❓ Issues
## ❓ Issues
If you are a new [Ultralytics HUB](https://bit.ly/ultralytics_hub) user and have questions or comments, you are in the right place! Please raise a [New Issue](https://github.com/ultralytics/hub/issues/new/choose) and let us know what we can do to make your life better 😃!
If you are a new [Ultralytics HUB](https://bit.ly/ultralytics_hub) user and have questions or comments, you are in the
right place! Please raise a [New Issue](https://github.com/ultralytics/hub/issues/new/choose) and let us know what we
Welcome to the Ultralytics YOLOv8 documentation landing page! [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) is the latest version of the YOLO (You
Welcome to the Ultralytics YOLOv8 documentation landing
Only Look Once) object detection and image segmentation model developed by [Ultralytics](https://ultralytics.com). This page serves as the starting
page! [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) is the latest version of the YOLO (You Only Look
point for exploring the various resources available to help you get started with YOLOv8 and understand its features and
Once) object detection and image segmentation model developed by [Ultralytics](https://ultralytics.com). This page
capabilities.
serves as the starting point for exploring the various resources available to help you get started with YOLOv8 and
understand its features and capabilities.
The YOLOv8 model is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of
The YOLOv8 model is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of
object detection and image segmentation tasks. It can be trained on large datasets and is capable of running on a
object detection and image segmentation tasks. It can be trained on large datasets and is capable of running on a
variety of hardware platforms, from CPUs to GPUs.
variety of hardware platforms, from CPUs to GPUs.
Whether you are a seasoned machine learning practitioner or new to the field, we hope that the resources on this page
Whether you are a seasoned machine learning practitioner or new to the field, we hope that the resources on this page
will help you get the most out of YOLOv8. For any bugs and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues). For professional support please [Contact Us](https://ultralytics.com/contact).
will help you get the most out of YOLOv8. For any bugs and feature requests please
visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues). For professional support
@ -40,8 +43,8 @@ backbone network, adding a feature pyramid, and making use of focal loss.
In 2020, YOLOv4 was released which introduced a number of innovations such as the use of Mosaic data augmentation, a new
In 2020, YOLOv4 was released which introduced a number of innovations such as the use of Mosaic data augmentation, a new
anchor-free detection head, and a new loss function.
anchor-free detection head, and a new loss function.
In 2021, Ultralytics released [YOLOv5](https://github.com/ultralytics/yolov5), which further improved the model's performance and added new features such as
In 2021, Ultralytics released [YOLOv5](https://github.com/ultralytics/yolov5), which further improved the model's
support for panoptic segmentation and object tracking.
performance and added new features such as support for panoptic segmentation and object tracking.
YOLO has been widely used in a variety of applications, including autonomous vehicles, security and surveillance, and
YOLO has been widely used in a variety of applications, including autonomous vehicles, security and surveillance, and
medical imaging. It has also been used to win several competitions, such as the COCO Object Detection Challenge and the
medical imaging. It has also been used to win several competitions, such as the COCO Object Detection Challenge and the
@ -55,9 +58,10 @@ For more information about the history and development of YOLO, you can refer to
## Ultralytics YOLOv8
## Ultralytics YOLOv8
[Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) is the latest version of the YOLO object detection and image segmentation model developed by
[Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) is the latest version of the YOLO object detection and
Ultralytics. YOLOv8 is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO
image segmentation model developed by Ultralytics. YOLOv8 is a cutting-edge, state-of-the-art (SOTA) model that builds
versions and introduces new features and improvements to further boost performance and flexibility.
upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and
flexibility.
One key feature of YOLOv8 is its extensibility. It is designed as a framework that supports all previous versions of
One key feature of YOLOv8 is its extensibility. It is designed as a framework that supports all previous versions of
YOLO, making it easy to switch between different versions and compare their performance. This makes YOLOv8 an ideal
YOLO, making it easy to switch between different versions and compare their performance. This makes YOLOv8 an ideal
Install YOLOv8 via the `ultralytics` pip package for the latest stable release or by cloning the [https://github.com/ultralytics/ultralytics](https://github.com/ultralytics/ultralytics) repository for the most up-to-date version.
Install YOLOv8 via the `ultralytics` pip package for the latest stable release or by cloning
the [https://github.com/ultralytics/ultralytics](https://github.com/ultralytics/ultralytics) repository for the most
The Python API allows users to easily use YOLOv8 in their Python projects. It provides functions for loading and running the model, as well as for processing the model's output. The interface is designed to be easy to use, so that users can quickly implement object detection in their projects.
Python usage allows users to easily use YOLOv8 inside their Python projects. It provides functions for loading and
running the model, as well as for processing the model's output. The interface is designed to be easy to use, so that
users can quickly implement object detection in their projects.
Overall, the Python interface is a useful tool for anyone looking to incorporate object detection, segmentation or classification into their Python projects using YOLOv8.
Overall, the Python interface is a useful tool for anyone looking to incorporate object detection, segmentation or
classification into their Python projects using YOLOv8.
!!! example
!!! note
```python
```python
from ultralytics import YOLO
from ultralytics import YOLO
model = YOLO('yolov8n.yaml') # build a new model from scratch
# Load a model
model = YOLO('yolov8n.pt') # load a pretrained model (recommended for best training results)
model = YOLO("yolov8n.yaml") # build a new model from scratch
results = model.train(data='coco128.yaml') # train the model
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
# Use the model
results = model.train(data="coco128.yaml", epochs=3) # train the model
results = model.val() # evaluate model performance on the validation set
results = model.val() # evaluate model performance on the validation set
results = model.predict(source='bus.jpg') # predict on an image
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
success = model.export(format='onnx') # export the model to ONNX format
success = model.export(format="onnx") # export the model to ONNX format
All task Predictors are inherited from `BasePredictors` class that contains the model validation routine boilerplate. You can override any function of these Trainers to suit your needs.
All task Predictors are inherited from `BasePredictors` class that contains the model validation routine boilerplate.
You can override any function of these Trainers to suit your needs.
All task Trainers are inherited from `BaseTrainer` class that contains the model training and optimzation routine boilerplate. You can override any function of these Trainers to suit your needs.
All task Trainers are inherited from `BaseTrainer` class that contains the model training and optimzation routine
boilerplate. You can override any function of these Trainers to suit your needs.
All task Validators are inherited from `BaseValidator` class that contains the model validation routine boilerplate. You can override any function of these Trainers to suit your needs.
All task Validators are inherited from `BaseValidator` class that contains the model validation routine boilerplate. You
can override any function of these Trainers to suit your needs.