单目3D初始代码
This commit is contained in:
26
CITATION.cff
Executable file
26
CITATION.cff
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
# This CITATION.cff file was generated with https://bit.ly/cffinit
|
||||||
|
|
||||||
|
cff-version: 1.2.0
|
||||||
|
title: Ultralytics YOLO
|
||||||
|
message: >-
|
||||||
|
If you use this software, please cite it using the
|
||||||
|
metadata from this file.
|
||||||
|
type: software
|
||||||
|
authors:
|
||||||
|
- given-names: Glenn
|
||||||
|
family-names: Jocher
|
||||||
|
affiliation: Ultralytics
|
||||||
|
orcid: "https://orcid.org/0000-0001-5950-6979"
|
||||||
|
- family-names: Qiu
|
||||||
|
given-names: Jing
|
||||||
|
affiliation: Ultralytics
|
||||||
|
orcid: "https://orcid.org/0000-0003-3783-7069"
|
||||||
|
- given-names: Ayush
|
||||||
|
family-names: Chaurasia
|
||||||
|
affiliation: Ultralytics
|
||||||
|
orcid: "https://orcid.org/0000-0002-7603-6750"
|
||||||
|
repository-code: "https://github.com/ultralytics/ultralytics"
|
||||||
|
url: "https://ultralytics.com"
|
||||||
|
license: AGPL-3.0
|
||||||
|
version: 8.0.0
|
||||||
|
date-released: "2023-01-10"
|
||||||
74
CLAUDE.md
Executable file
74
CLAUDE.md
Executable file
@@ -0,0 +1,74 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Common commands
|
||||||
|
|
||||||
|
- Install editable package: `pip install -e .`
|
||||||
|
- Install a CI-like local test environment: `uv pip install --system -e ".[export,solutions]" pytest-cov --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match`
|
||||||
|
- Install docs/lint dependencies: `uv pip install --system -e ".[dev]" ruff black --extra-index-url https://download.pytorch.org/whl/cpu`
|
||||||
|
- Sanity check the environment: `yolo checks`
|
||||||
|
|
||||||
|
### Lint and docs
|
||||||
|
|
||||||
|
- Lint with the same Ruff rules used in CI: `ruff check --extend-select F,I,D,UP,RUF,FA --target-version py39 --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413,RUF001,RUF002,RUF012 .`
|
||||||
|
- Apply the same Ruff autofixes used in docs CI: `ruff check --fix --unsafe-fixes --extend-select F,I,D,UP,RUF,FA --target-version py39 --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413,RUF001,RUF002,RUF012 .`
|
||||||
|
- Rebuild autogenerated API reference docs: `python docs/build_reference.py`
|
||||||
|
- Build docs locally: `python docs/build_docs.py`
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
- Run the default test suite: `pytest --cov=ultralytics/ --cov-report=xml tests/`
|
||||||
|
- Run slow tests too: `pytest --slow --cov=ultralytics/ --cov-report=xml tests/`
|
||||||
|
- Run one test file: `pytest tests/test_engine.py -v -s`
|
||||||
|
- Run one test by node id: `pytest tests/test_engine.py::test_name -v -s`
|
||||||
|
- Run the GPU-focused test file: `pytest tests/test_cuda.py -sv`
|
||||||
|
|
||||||
|
### Repo-specific training entry points
|
||||||
|
|
||||||
|
- Ground 2D training: `python train_mono2d.py --model yolo26s.pt --data ultralytics/cfg/datasets/mono2d_ground.yaml --epochs 100 --device 0`
|
||||||
|
- Ground 2D DDP training: `python -m torch.distributed.run --nproc_per_node 4 train_mono2d.py --model yolo26s.pt --data ultralytics/cfg/datasets/mono2d_ground.yaml --epochs 100`
|
||||||
|
- Ground 3D training from pretrained 2D weights: `python train_mono3d.py --pretrained yolo26s-pretrain.pt --epochs 100 --device 0`
|
||||||
|
- Ground 3D DDP training from pretrained 2D weights: `python -m torch.distributed.run --nproc_per_node 4 train_mono3d.py --pretrained yolo26s-pretrain.pt --epochs 100`
|
||||||
|
- Resume 3D training: `python train_mono3d.py --resume runs/detect/train_mono3d/weights/last.pt`
|
||||||
|
|
||||||
|
## Big-picture architecture
|
||||||
|
|
||||||
|
- This repo still uses the standard Ultralytics split of `cfg -> engine -> task package -> nn/data/utils`, but this checkout adds a substantial custom ground-detection branch for 2D and 3D training on top of the upstream abstractions instead of replacing them.
|
||||||
|
- CLI entry is `ultralytics.cfg:entrypoint`. `ultralytics/cfg/__init__.py` defines supported tasks/modes and default task-to-model/data mappings.
|
||||||
|
- The public Python orchestration layer is `ultralytics/engine/model.py`. `Model.train()`, `val()`, `predict()`, `track()`, and `export()` all route into task-specific trainer/validator/predictor classes.
|
||||||
|
- Task binding lives in `ultralytics/models/yolo/model.py` via `task_map`. That is the main switchboard from a high-level `YOLO(...)` object to the task-specific model/trainer/validator/predictor implementations.
|
||||||
|
- Model YAMLs under `ultralytics/cfg/models/` are converted into PyTorch graphs by `ultralytics/nn/tasks.py`. Standard heads live in `ultralytics/nn/modules/head.py`; this fork adds `Detect3D` there.
|
||||||
|
- Shared runtime loops are in `ultralytics/engine/trainer.py`, `ultralytics/engine/validator.py`, and `ultralytics/engine/predictor.py`. Most repo-specific behavior plugs in by subclassing these rather than rewriting the loops.
|
||||||
|
- Dataset selection and dataloader wiring are in `ultralytics/data/build.py`. Core dataset classes are in `ultralytics/data/dataset.py`.
|
||||||
|
|
||||||
|
## Ground 2D custom path
|
||||||
|
|
||||||
|
- `train_mono2d.py` is the practical entry point for the custom ground 2D workflow.
|
||||||
|
- `ultralytics/models/yolo/detect/train.py` defines `GroundDetectionModel`, `GroundDetectionTrainer`, and `GroundDetectionValidator`.
|
||||||
|
- `ultralytics/data/dataset.py` adds `YOLOGroundDataset`, which extends the normal YOLO dataset flow with class mapping, difficulty-aware targets, min-box filtering, and optional YUV444 support.
|
||||||
|
- Dataset YAMLs that include `class_map` are routed into `YOLOGroundDataset` by `ultralytics/data/build.py`.
|
||||||
|
- Ground-specific losses live in `ultralytics/utils/loss.py` (`v8DetectionLossGround` / `E2EGroundLoss`).
|
||||||
|
- YUV444 images are not converted in the loader; they are converted to BGR in trainer/validator preprocessing. If image colors or TensorBoard examples look wrong, inspect `GroundDetectionTrainer.preprocess_batch()` and `GroundDetectionValidator.preprocess()` before touching the dataset loader.
|
||||||
|
|
||||||
|
## Ground 3D custom path
|
||||||
|
|
||||||
|
- `train_mono3d.py` is the main entry point for the joint 2D+3D workflow.
|
||||||
|
- `ultralytics/models/yolo/detect/train.py` also defines `Ground3DDetectionModel`, `Ground3DDetectionTrainer`, and `Ground3DDetectionValidator`.
|
||||||
|
- The 3D model config is `ultralytics/cfg/models/26/yolo26-3d.yaml`; it uses `Detect3D` from `ultralytics/nn/modules/head.py`, which extends the normal detection head with a dedicated 3D branch.
|
||||||
|
- `ultralytics/data/dataset.py` adds `YOLOGround3DDataset`, which loads mixed 2D/3D labels, performs ROI crop or virtual-camera transforms, and returns standard 2D fields plus `labels_3d` and calibration data.
|
||||||
|
- Geometry-heavy preprocessing lives in `ultralytics/data/ground3d_augment.py`. That file is the source of truth for ROI cropping, virtual-camera simulation, calibration updates, cut-in/cut-out handling, and depth scaling.
|
||||||
|
- 3D loss, validation metrics, and visualization are split across `ultralytics/utils/loss.py`, `ultralytics/utils/metrics_3d.py`, and `ultralytics/utils/plotting_3d.py`.
|
||||||
|
- 3D metrics and TensorBoard visualizations depend on calibration stored in `batch["calib"]`. Do not re-read calibration from disk inside callbacks or validators.
|
||||||
|
|
||||||
|
## Fast navigation hints
|
||||||
|
|
||||||
|
- If a command or API call is being routed somewhere unexpected, start with `ultralytics/cfg/__init__.py`, then `ultralytics/engine/model.py`, then `ultralytics/models/yolo/model.py`.
|
||||||
|
- If a model YAML change is not taking effect, inspect `ultralytics/nn/tasks.py` and the relevant head in `ultralytics/nn/modules/`.
|
||||||
|
- If a batch field looks wrong, trace `ultralytics/data/dataset.py` -> `ultralytics/data/build.py` -> the relevant trainer `preprocess_batch()`.
|
||||||
|
- If 3D training, metrics, or TensorBoard visualizations look inconsistent, trace `YOLOGround3DDataset.get_image_and_label()` -> `Ground3DDetectionTrainer` / `Ground3DDetectionValidator` -> `Detect3D` -> `ultralytics/utils/loss.py` / `ultralytics/utils/metrics_3d.py` / `ultralytics/utils/plotting_3d.py`.
|
||||||
|
|
||||||
|
## Repository notes
|
||||||
|
|
||||||
|
- There is no `Makefile` or committed `.pre-commit-config.yaml` in this repo. The most authoritative local commands come from `pyproject.toml`, `train_mono2d.py`, `train_mono3d.py`, and the GitHub Actions workflows.
|
||||||
|
- API reference docs under `docs/en/reference/` are generated; if source signatures or docstrings change, rebuild them with `python docs/build_reference.py`.
|
||||||
267
CONTRIBUTING.md
Executable file
267
CONTRIBUTING.md
Executable file
@@ -0,0 +1,267 @@
|
|||||||
|
<a href="https://www.ultralytics.com/" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
|
||||||
|
|
||||||
|
# Contributing to Ultralytics Open-Source Projects
|
||||||
|
|
||||||
|
Welcome! We're thrilled that you're considering contributing to our [Ultralytics](https://www.ultralytics.com/) [open-source](https://github.com/ultralytics) projects. Your involvement not only helps enhance the quality of our repositories but also benefits the entire [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. This guide provides clear guidelines and best practices to help you get started.
|
||||||
|
|
||||||
|
[](https://github.com/ultralytics/ultralytics/graphs/contributors)
|
||||||
|
|
||||||
|
## 🤝 Code of Conduct
|
||||||
|
|
||||||
|
To ensure a welcoming and inclusive environment for everyone, all contributors must adhere to our [Code of Conduct](https://docs.ultralytics.com/help/code-of-conduct/). **Respect**, **kindness**, and **professionalism** are at the heart of our community.
|
||||||
|
|
||||||
|
## 🚀 Contributing via Pull Requests
|
||||||
|
|
||||||
|
We greatly appreciate contributions in the form of [pull requests (PRs)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests). To make the review process as smooth as possible, please follow these steps:
|
||||||
|
|
||||||
|
1. **[Fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo):** Start by forking the relevant Ultralytics repository (e.g., [ultralytics/ultralytics](https://github.com/ultralytics/ultralytics)) to your GitHub account.
|
||||||
|
2. **[Create a branch](https://docs.github.com/en/desktop/making-changes-in-a-branch/managing-branches-in-github-desktop):** Create a new branch in your forked repository with a clear, descriptive name reflecting your changes (e.g., `fix-issue-123`, `add-feature-xyz`).
|
||||||
|
3. **Make your changes:** Implement your improvements or fixes. Ensure your code adheres to the project's style guidelines and doesn't introduce new errors or warnings.
|
||||||
|
4. **Test your changes:** Before submitting, test your changes locally to confirm they work as expected and don't cause [regressions](https://en.wikipedia.org/wiki/Software_regression). Add tests if you're introducing new functionality.
|
||||||
|
5. **[Commit your changes](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop):** Commit your changes with concise and descriptive commit messages. If your changes address a specific issue, include the issue number (e.g., `Fix #123: Corrected calculation error.`).
|
||||||
|
6. **[Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request):** Submit a pull request from your branch to the `main` branch of the original Ultralytics repository. Provide a clear title and a detailed description explaining the purpose and scope of your changes.
|
||||||
|
|
||||||
|
### 📏 Contribution Scope & PR Size Guidelines
|
||||||
|
|
||||||
|
#### First-time Contributors
|
||||||
|
|
||||||
|
First-time contributors are expected to submit small, well-scoped pull requests. Large PRs (more than ~50 lines of change) are generally not accepted at this stage, except when the size is driven primarily by docstrings, documentation, or formatting rather than substantive code changes. Contributions should focus on speed improvements, bug fixes, documentation updates, and other minor issues. Feature PRs are not encouraged for first-time contributors. However, if you still wish to contribute a feature, follow the guidelines outlined in the [Feature PRs](#feature-prs) section below.
|
||||||
|
|
||||||
|
#### Established Contributors
|
||||||
|
|
||||||
|
Pull requests from established contributors generally receive higher review priority. Actions and results are fundamental to the [Ultralytics Mission & Values](https://handbook.ultralytics.com/mission-vision-values/). There is no specific threshold to becoming an 'established contributor' as it's impossible to fit all individuals to the same standard. The Ultralytics Team notices those who make consistent, high-quality contributions that follow the Ultralytics standards.
|
||||||
|
|
||||||
|
Following our [contributing guidelines](./CONTRIBUTING.md) and [our Development Workflow](https://handbook.ultralytics.com/workflows/development/) is the best way to improve your chances for your work to be reviewed, accepted, and/or recognized; this is not a guarantee. In addition, contributors with a strong track record of meaningful contributions to notable open-source projects may be treated as established contributors, even if they are technically first-time contributors to Ultralytics.
|
||||||
|
|
||||||
|
#### Feature PRs
|
||||||
|
|
||||||
|
Feature pull requests must be preceded by a feature request GitHub issue that has been sufficiently discussed and explicitly approved by the maintainers. This process helps avoid unnecessary effort on changes that are unlikely to be merged. Even after approval, feature PRs are expected to remain well-scoped and focused. All feature contributions are evaluated with attention to long-term maintenance costs and their overall usefulness to the Ultralytics user base.
|
||||||
|
|
||||||
|
#### PR Size and Review Time
|
||||||
|
|
||||||
|
The larger the proposed changes to the code, the longer the review process will take. Smaller, narrowly-scoped PRs that align with the style and structure of the Ultralytics codebase have significantly higher likelihood of timely review and merge.
|
||||||
|
|
||||||
|
### 📝 CLA Signing
|
||||||
|
|
||||||
|
Before we can merge your pull request, you must sign our [Contributor License Agreement (CLA)](https://docs.ultralytics.com/help/CLA/). This legal agreement ensures that your contributions are properly licensed, allowing the project to continue being distributed under the [AGPL-3.0 license](https://www.ultralytics.com/legal/agpl-3-0-software-license).
|
||||||
|
|
||||||
|
After submitting your pull request, the CLA bot will guide you through the signing process. To sign the CLA, simply add a comment in your PR stating:
|
||||||
|
|
||||||
|
```text
|
||||||
|
I have read the CLA Document and I sign the CLA
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✍️ Google-Style Docstrings
|
||||||
|
|
||||||
|
When adding new functions or classes, please include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html). These docstrings provide clear, standardized documentation that helps other developers understand and maintain your code.
|
||||||
|
|
||||||
|
#### Example Google-style
|
||||||
|
|
||||||
|
This example illustrates a Google-style docstring. Ensure that both input and output `types` are always enclosed in parentheses, e.g., `(bool)`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def example_function(arg1, arg2=4):
|
||||||
|
"""Example function demonstrating Google-style docstrings.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
arg1 (int): The first argument.
|
||||||
|
arg2 (int): The second argument, with a default value of 4.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
(bool): True if successful, False otherwise.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
>>> result = example_function(1, 2) # returns False
|
||||||
|
"""
|
||||||
|
if arg1 == arg2:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example Google-style with type hints
|
||||||
|
|
||||||
|
This example includes both a Google-style docstring and [type hints](https://docs.python.org/3/library/typing.html) for arguments and returns, though using either independently is also acceptable.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def example_function(arg1: int, arg2: int = 4) -> bool:
|
||||||
|
"""Example function demonstrating Google-style docstrings.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
arg1: The first argument.
|
||||||
|
arg2: The second argument, with a default value of 4.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True if successful, False otherwise.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
>>> result = example_function(1, 2) # returns False
|
||||||
|
"""
|
||||||
|
if arg1 == arg2:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example Single-line
|
||||||
|
|
||||||
|
For smaller or simpler functions, a single-line docstring may be sufficient. The docstring must use three double-quotes, be a complete sentence, start with a capital letter, and end with a period.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def example_small_function(arg1: int, arg2: int = 4) -> bool:
|
||||||
|
"""Example function with a single-line docstring."""
|
||||||
|
return arg1 == arg2
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✅ GitHub Actions CI Tests
|
||||||
|
|
||||||
|
All pull requests must pass the [GitHub Actions](https://github.com/features/actions) [Continuous Integration](https://docs.ultralytics.com/help/CI/) (CI) tests before they can be merged. These tests include linting, unit tests, and other checks to ensure that your changes meet the project's quality standards. Review the CI output and address any issues that arise.
|
||||||
|
|
||||||
|
## ✨ Best Practices for Code Contributions
|
||||||
|
|
||||||
|
When contributing code to Ultralytics projects, keep these best practices in mind:
|
||||||
|
|
||||||
|
- **Avoid code duplication:** Reuse existing code wherever possible and minimize unnecessary arguments.
|
||||||
|
- **Make smaller, focused changes:** Focus on targeted modifications rather than large-scale changes. Smaller, narrow-scope pull requests are easier to review, less error-prone, and have a higher chance of being merged.
|
||||||
|
- **Simplify when possible:** Look for opportunities to simplify the code or remove unnecessary parts.
|
||||||
|
- **Consider compatibility:** Before making changes, consider whether they might break existing code using Ultralytics.
|
||||||
|
- **Use consistent formatting:** Tools like [Ruff Formatter](https://github.com/astral-sh/ruff) can help maintain stylistic consistency.
|
||||||
|
- **Add appropriate tests:** Include [tests](https://docs.ultralytics.com/guides/model-testing/) for new features to ensure they work as expected. New tests should be added to existing test files rather than creating new test files. Tests do not need to be exhaustive, but must be able to reasonably confirm correct behavior and detect regressions.
|
||||||
|
|
||||||
|
## 👀 Reviewing Pull Requests
|
||||||
|
|
||||||
|
Reviewing pull requests is another valuable way to contribute. When reviewing PRs:
|
||||||
|
|
||||||
|
- **Check for unit tests:** Verify that the PR includes tests for new features or changes.
|
||||||
|
- **Review documentation updates:** Ensure [documentation](https://docs.ultralytics.com/) is updated to reflect changes.
|
||||||
|
- **Evaluate performance impact:** Consider how changes might affect [performance](https://docs.ultralytics.com/guides/yolo-performance-metrics/).
|
||||||
|
- **Verify CI tests:** Confirm all [Continuous Integration tests](https://docs.ultralytics.com/help/CI/) are passing.
|
||||||
|
- **Provide constructive feedback:** Offer specific, clear feedback about any issues or concerns.
|
||||||
|
- **Recognize effort:** Acknowledge the author's work to maintain a positive collaborative atmosphere.
|
||||||
|
|
||||||
|
### 🤖 Automated Review
|
||||||
|
|
||||||
|
All pull requests undergo an automatic review by Ultralytics Assistant. Each suggestion from Ultralytics Assistant includes an associated level of importance. Contributors are expected to review all suggestions and either apply them or explicitly explain in a PR comment why a given suggestion is not applicable or should not be adopted.
|
||||||
|
|
||||||
|
If needed, you may re-request a review from Ultralytics Assistant via the GitHub reviewers panel.
|
||||||
|
|
||||||
|
## 🐞 Reporting Bugs
|
||||||
|
|
||||||
|
We highly value bug reports as they help us improve the quality and reliability of our projects. When reporting a bug via [GitHub Issues](https://github.com/ultralytics/ultralytics/issues):
|
||||||
|
|
||||||
|
- **Check existing issues:** Search first to see if the bug has already been reported.
|
||||||
|
- **Provide a [Minimum Reproducible Example](https://docs.ultralytics.com/help/minimum-reproducible-example/):** Create a small, self-contained code snippet that consistently reproduces the issue. This is crucial for efficient debugging.
|
||||||
|
- **Describe the environment:** Specify your operating system, Python version, relevant library versions (e.g., [`torch`](https://pytorch.org/), [`ultralytics`](https://github.com/ultralytics/ultralytics)), and hardware ([CPU](https://en.wikipedia.org/wiki/Central_processing_unit)/[GPU](https://www.ultralytics.com/glossary/gpu-graphics-processing-unit)).
|
||||||
|
- **Explain expected vs. actual behavior:** Clearly state what you expected to happen and what actually occurred. Include any error messages or tracebacks.
|
||||||
|
|
||||||
|
## 📜 License
|
||||||
|
|
||||||
|
Ultralytics uses the [GNU Affero General Public License v3.0 (AGPL-3.0)](https://www.ultralytics.com/legal/agpl-3-0-software-license) for its repositories. This license promotes [openness](https://en.wikipedia.org/wiki/Openness), [transparency](https://www.ultralytics.com/glossary/transparency-in-ai), and [collaborative improvement](https://en.wikipedia.org/wiki/Collaborative_software) in software development. It ensures that all users have the freedom to use, modify, and share the software, fostering a strong community of collaboration and innovation.
|
||||||
|
|
||||||
|
We encourage all contributors to familiarize themselves with the terms of the [AGPL-3.0 license](https://opensource.org/license/agpl-v3) to contribute effectively and ethically to the Ultralytics open-source community.
|
||||||
|
|
||||||
|
## 🌍 Open-Sourcing Your YOLO Project Under AGPL-3.0
|
||||||
|
|
||||||
|
Using Ultralytics YOLO models or code in your project? The [AGPL-3.0 license](https://opensource.org/license/agpl-v3) requires that your entire derivative work also be open-sourced under AGPL-3.0. This ensures modifications and larger projects built upon open-source foundations remain open.
|
||||||
|
|
||||||
|
### Why AGPL-3.0 Compliance Matters
|
||||||
|
|
||||||
|
- **Keeps Software Open:** Ensures that improvements and derivative works benefit the community.
|
||||||
|
- **Legal Requirement:** Using AGPL-3.0 licensed code binds your project to its terms.
|
||||||
|
- **Fosters Collaboration:** Encourages sharing and transparency.
|
||||||
|
|
||||||
|
If you prefer not to open-source your project, consider obtaining an [Enterprise License](https://www.ultralytics.com/license).
|
||||||
|
|
||||||
|
### How to Comply with AGPL-3.0
|
||||||
|
|
||||||
|
Complying means making the **complete corresponding source code** of your project publicly available under the AGPL-3.0 license.
|
||||||
|
|
||||||
|
1. **Choose Your Starting Point:**
|
||||||
|
- **Fork Ultralytics YOLO:** Directly fork the [Ultralytics YOLO repository](https://github.com/ultralytics/ultralytics) if building closely upon it.
|
||||||
|
- **Use Ultralytics Template:** Start with the [Ultralytics template repository](https://github.com/ultralytics/template) for a clean, modular setup integrating YOLO.
|
||||||
|
|
||||||
|
2. **License Your Project:**
|
||||||
|
- Add a `LICENSE` file containing the full text of the [AGPL-3.0 license](https://opensource.org/license/agpl-v3).
|
||||||
|
- Add a notice at the top of each source file indicating the license.
|
||||||
|
|
||||||
|
3. **Publish Your Source Code:**
|
||||||
|
- Make your **entire project's source code** publicly accessible (e.g., on GitHub). This includes:
|
||||||
|
- The complete larger application or system that incorporates the YOLO model or code.
|
||||||
|
- Any modifications made to the original Ultralytics YOLO code.
|
||||||
|
- Scripts for training, validation, inference.
|
||||||
|
- [Model weights](https://www.ultralytics.com/glossary/model-weights) if modified or fine-tuned.
|
||||||
|
- [Configuration files](https://docs.ultralytics.com/usage/cfg/), environment setups (`requirements.txt`, [`Dockerfiles`](https://docs.docker.com/reference/dockerfile/)).
|
||||||
|
- Backend and frontend code if it's part of a [web application](https://en.wikipedia.org/wiki/Web_application).
|
||||||
|
- Any [third-party libraries](<https://en.wikipedia.org/wiki/Library_(computing)#Third-party>) you've modified.
|
||||||
|
- [Training data](https://www.ultralytics.com/glossary/training-data) if required to run/retrain _and_ redistributable.
|
||||||
|
|
||||||
|
4. **Document Clearly:**
|
||||||
|
- Update your `README.md` to state that the project is licensed under AGPL-3.0.
|
||||||
|
- Include clear instructions on how to set up, build, and run your project from the source code.
|
||||||
|
- Attribute Ultralytics YOLO appropriately, linking back to the [original repository](https://github.com/ultralytics/ultralytics). Example:
|
||||||
|
```markdown
|
||||||
|
This project utilizes code from [Ultralytics YOLO](https://github.com/ultralytics/ultralytics), licensed under AGPL-3.0.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Repository Structure
|
||||||
|
|
||||||
|
Refer to the [Ultralytics Template Repository](https://github.com/ultralytics/template) for a practical example structure:
|
||||||
|
|
||||||
|
```
|
||||||
|
my-yolo-project/
|
||||||
|
│
|
||||||
|
├── LICENSE # Full AGPL-3.0 license text
|
||||||
|
├── README.md # Project description, setup, usage, license info & attribution
|
||||||
|
├── pyproject.toml # Dependencies (or requirements.txt)
|
||||||
|
├── scripts/ # Training/inference scripts
|
||||||
|
│ └── train.py
|
||||||
|
├── src/ # Your project's source code
|
||||||
|
│ ├── __init__.py
|
||||||
|
│ ├── data_loader.py
|
||||||
|
│ └── model_wrapper.py # Code interacting with YOLO
|
||||||
|
├── tests/ # Unit/integration tests
|
||||||
|
├── configs/ # YAML/JSON config files
|
||||||
|
├── docker/ # Dockerfiles, if used
|
||||||
|
│ └── Dockerfile
|
||||||
|
└── .github/ # GitHub specific files (e.g., workflows for CI)
|
||||||
|
└── workflows/
|
||||||
|
└── ci.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
By following these guidelines, you ensure compliance with AGPL-3.0, supporting the open-source ecosystem that enables powerful tools like Ultralytics YOLO.
|
||||||
|
|
||||||
|
## 🎉 Conclusion
|
||||||
|
|
||||||
|
Thank you for your interest in contributing to [Ultralytics](https://www.ultralytics.com/) [open-source](https://github.com/ultralytics) YOLO projects. Your participation is essential in shaping the future of our software and building a vibrant community of innovation and collaboration. Whether you're enhancing code, reporting bugs, or suggesting new features, your contributions are invaluable.
|
||||||
|
|
||||||
|
We're excited to see your ideas come to life and appreciate your commitment to advancing [object detection](https://www.ultralytics.com/glossary/object-detection) technology. Together, let's continue to grow and innovate in this exciting open-source journey. Happy coding! 🚀🌟
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Why should I contribute to Ultralytics YOLO open-source repositories?
|
||||||
|
|
||||||
|
Contributing to Ultralytics YOLO open-source repositories improves the software, making it more robust and feature-rich for the entire community. Contributions can include code enhancements, bug fixes, documentation improvements, and new feature implementations. Additionally, contributing allows you to collaborate with other skilled developers and experts in the field, enhancing your own skills and reputation. For details on how to get started, refer to the [Contributing via Pull Requests](#-contributing-via-pull-requests) section.
|
||||||
|
|
||||||
|
### How do I sign the Contributor License Agreement (CLA) for Ultralytics YOLO?
|
||||||
|
|
||||||
|
To sign the Contributor License Agreement (CLA), follow the instructions provided by the CLA bot after submitting your pull request. This process ensures that your contributions are properly licensed under the AGPL-3.0 license, maintaining the legal integrity of the open-source project. Add a comment in your pull request stating:
|
||||||
|
|
||||||
|
```text
|
||||||
|
I have read the CLA Document and I sign the CLA
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, see the [CLA Signing](#-cla-signing) section.
|
||||||
|
|
||||||
|
### What are Google-style docstrings, and why are they required for Ultralytics YOLO contributions?
|
||||||
|
|
||||||
|
Google-style docstrings provide clear, concise documentation for functions and classes, improving code readability and maintainability. These docstrings outline the function's purpose, arguments, and return values with specific formatting rules. When contributing to Ultralytics YOLO, following Google-style docstrings ensures that your additions are well-documented and easily understood. For examples and guidelines, visit the [Google-Style Docstrings](#-google-style-docstrings) section.
|
||||||
|
|
||||||
|
### How can I ensure my changes pass the GitHub Actions CI tests?
|
||||||
|
|
||||||
|
Before your pull request can be merged, it must pass all GitHub Actions Continuous Integration (CI) tests. These tests include linting, unit tests, and other checks to ensure the code meets the project's quality standards. Review the CI output and fix any issues. For detailed information on the CI process and troubleshooting tips, see the [GitHub Actions CI Tests](#-github-actions-ci-tests) section.
|
||||||
|
|
||||||
|
### How do I report a bug in Ultralytics YOLO repositories?
|
||||||
|
|
||||||
|
To report a bug, provide a clear and concise [Minimum Reproducible Example](https://docs.ultralytics.com/help/minimum-reproducible-example/) along with your bug report. This helps developers quickly identify and fix the issue. Ensure your example is minimal yet sufficient to replicate the problem. For more detailed steps on reporting bugs, refer to the [Reporting Bugs](#-reporting-bugs) section.
|
||||||
|
|
||||||
|
### What does the AGPL-3.0 license mean if I use Ultralytics YOLO in my own project?
|
||||||
|
|
||||||
|
If you use Ultralytics YOLO code or models (licensed under AGPL-3.0) in your project, the AGPL-3.0 license requires that your entire project (the derivative work) must also be licensed under AGPL-3.0 and its complete source code must be made publicly available. This ensures that the open-source nature of the software is preserved throughout its derivatives. If you cannot meet these requirements, you need to obtain an [Enterprise License](https://www.ultralytics.com/license). See the [Open-Sourcing Your Project](#-open-sourcing-your-yolo-project-under-agpl-30) section for details.
|
||||||
206
GROUND_DETECTION_GUIDE.md
Executable file
206
GROUND_DETECTION_GUIDE.md
Executable file
@@ -0,0 +1,206 @@
|
|||||||
|
# Ground 2D Detection Training Guide
|
||||||
|
|
||||||
|
This guide explains how to train YOLO26 models on custom ground 2D detection datasets with difficulty-based loss weighting.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The ground 2D detection implementation supports:
|
||||||
|
- Custom annotation format with string class names
|
||||||
|
- Difficulty scores for each bounding box
|
||||||
|
- Difficulty-based loss weighting (loss_weight = 1.0 / (1.0 + difficulty))
|
||||||
|
- Minimum box size filtering
|
||||||
|
- Optional YUV444 color space support
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
### Directory Layout
|
||||||
|
```
|
||||||
|
dataset/
|
||||||
|
├── images/
|
||||||
|
│ ├── train/
|
||||||
|
│ │ ├── img001.jpg
|
||||||
|
│ │ ├── img002.jpg
|
||||||
|
│ │ └── ...
|
||||||
|
│ └── val/
|
||||||
|
│ ├── img101.jpg
|
||||||
|
│ ├── img102.jpg
|
||||||
|
│ └── ...
|
||||||
|
├── labels/
|
||||||
|
│ ├── train/
|
||||||
|
│ │ ├── img001.txt
|
||||||
|
│ │ ├── img002.txt
|
||||||
|
│ │ └── ...
|
||||||
|
│ └── val/
|
||||||
|
│ ├── img101.txt
|
||||||
|
│ ├── img102.txt
|
||||||
|
│ └── ...
|
||||||
|
└── dataset.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Label Format
|
||||||
|
|
||||||
|
Each label file contains one line per object with 7 columns:
|
||||||
|
```
|
||||||
|
class_name x_center y_center width height difficulty1 difficulty2
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
car 0.5 0.5 0.3 0.2 0.0 0.0
|
||||||
|
pedestrian 0.3 0.4 0.1 0.15 0.5 0.5
|
||||||
|
bicycle 0.7 0.6 0.15 0.2 1.0 1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Where:
|
||||||
|
- `class_name`: String class name (e.g., "car", "pedestrian")
|
||||||
|
- `x_center, y_center, width, height`: Normalized coordinates [0, 1]
|
||||||
|
- `difficulty1, difficulty2`: Difficulty values that will be combined (difficulty = difficulty1 + difficulty2)
|
||||||
|
|
||||||
|
### Dataset YAML Configuration
|
||||||
|
|
||||||
|
Create a `dataset.yaml` file:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Dataset paths
|
||||||
|
path: /path/to/dataset
|
||||||
|
train: images/train
|
||||||
|
val: images/val
|
||||||
|
|
||||||
|
# Class mapping: string names to numeric IDs
|
||||||
|
class_map:
|
||||||
|
car: 0
|
||||||
|
pedestrian: 1
|
||||||
|
bicycle: 2
|
||||||
|
truck: 3
|
||||||
|
|
||||||
|
# Optional parameters
|
||||||
|
min_wh: 2.0 # Keep boxes whose width or height is at least this many pixels
|
||||||
|
use_yuv444: false # Use YUV444 color space (default: false)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Training
|
||||||
|
|
||||||
|
### Python API
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.models.yolo.detect import GroundDetectionTrainer
|
||||||
|
|
||||||
|
# Initialize trainer
|
||||||
|
trainer = GroundDetectionTrainer(
|
||||||
|
overrides={
|
||||||
|
"model": "yolo26n.pt", # or yolo26s.pt, yolo26m.pt, etc.
|
||||||
|
"data": "path/to/dataset.yaml",
|
||||||
|
"epochs": 100,
|
||||||
|
"imgsz": 640,
|
||||||
|
"batch": 16,
|
||||||
|
"device": 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Start training
|
||||||
|
trainer.train()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Command Line
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Using GroundDetectionTrainer directly
|
||||||
|
python -c "from ultralytics.models.yolo.detect import GroundDetectionTrainer; \
|
||||||
|
trainer = GroundDetectionTrainer(overrides={'model': 'yolo26n.pt', 'data': 'dataset.yaml', 'epochs': 100}); \
|
||||||
|
trainer.train()"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Difficulty-Based Loss Weighting
|
||||||
|
|
||||||
|
The implementation applies difficulty-based weighting to all loss components:
|
||||||
|
|
||||||
|
```python
|
||||||
|
loss_weight = 1.0 / (1.0 + difficulty)
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
- difficulty = 0.0 (easy): weight = 1.0
|
||||||
|
- difficulty = 1.0 (medium): weight = 0.5
|
||||||
|
- difficulty = 2.0 (hard): weight = 0.33
|
||||||
|
|
||||||
|
This allows the model to focus more on easier, more detectable objects while still learning from harder examples.
|
||||||
|
|
||||||
|
## Class Mapping
|
||||||
|
|
||||||
|
The `class_map` in the YAML allows flexible class merging:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
class_map:
|
||||||
|
car: 0
|
||||||
|
suv: 0 # Maps to same class as car
|
||||||
|
van: 0 # Maps to same class as car
|
||||||
|
bus: 1
|
||||||
|
truck: 2
|
||||||
|
pedestrian: 3
|
||||||
|
```
|
||||||
|
|
||||||
|
## Minimum Box Size Filtering
|
||||||
|
|
||||||
|
Boxes are filtered out only when both width and height are smaller than `min_wh` pixels:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
min_wh: 2.0 # Filter boxes only if both sides are smaller than 2 px
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful for removing very small objects that are difficult to detect.
|
||||||
|
|
||||||
|
## YUV444 Color Space
|
||||||
|
|
||||||
|
If your images are in YUV444 format, enable conversion:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
use_yuv444: true
|
||||||
|
```
|
||||||
|
|
||||||
|
The dataset will automatically convert images from YUV444 to BGR during loading.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
The trained model can be validated using the standard YOLO validation:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("runs/detect/train/weights/best.pt")
|
||||||
|
results = model.val(data="dataset.yaml")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference
|
||||||
|
|
||||||
|
Use the trained model for inference:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("runs/detect/train/weights/best.pt")
|
||||||
|
results = model.predict("path/to/image.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Implementation Files
|
||||||
|
|
||||||
|
- `ultralytics/utils/instance.py`: Extended `Instances` class with difficulty support
|
||||||
|
- `ultralytics/data/utils.py`: Added `verify_image_label_ground()` function
|
||||||
|
- `ultralytics/data/dataset.py`: Added `YOLOGroundDataset` class
|
||||||
|
- `ultralytics/utils/loss.py`: Added `v8DetectionLossGround` class
|
||||||
|
- `ultralytics/data/build.py`: Modified `build_yolo_dataset()` to detect ground datasets
|
||||||
|
- `ultralytics/models/yolo/detect/train.py`: Added `GroundDetectionTrainer` class
|
||||||
|
- `ultralytics/cfg/datasets/ground_template.yaml`: Dataset configuration template
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Issue: "class_map not found in data"
|
||||||
|
Make sure your dataset YAML has a `class_map` dictionary instead of a `names` list.
|
||||||
|
|
||||||
|
### Issue: "labels require 6 columns"
|
||||||
|
Check that your label files have exactly 7 columns (class_name + 4 coords + 2 difficulties).
|
||||||
|
|
||||||
|
### Issue: "negative label values"
|
||||||
|
Ensure all coordinates and difficulty values are non-negative.
|
||||||
|
|
||||||
|
### Issue: "non-normalized coordinates"
|
||||||
|
Coordinates must be normalized to [0, 1] range.
|
||||||
661
LICENSE
Executable file
661
LICENSE
Executable file
@@ -0,0 +1,661 @@
|
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
277
README.zh-CN.md
Executable file
277
README.zh-CN.md
Executable file
@@ -0,0 +1,277 @@
|
|||||||
|
<div align="center">
|
||||||
|
<p>
|
||||||
|
<a href="https://platform.ultralytics.com/ultralytics/yolo26" target="_blank">
|
||||||
|
<img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png" alt="Ultralytics YOLO banner"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
[中文](https://docs.ultralytics.com/zh/) | [한국어](https://docs.ultralytics.com/ko/) | [日本語](https://docs.ultralytics.com/ja/) | [Русский](https://docs.ultralytics.com/ru/) | [Deutsch](https://docs.ultralytics.com/de/) | [Français](https://docs.ultralytics.com/fr/) | [Español](https://docs.ultralytics.com/es) | [Português](https://docs.ultralytics.com/pt/) | [Türkçe](https://docs.ultralytics.com/tr/) | [Tiếng Việt](https://docs.ultralytics.com/vi/) | [العربية](https://docs.ultralytics.com/ar/) <br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml/badge.svg" alt="Ultralytics CI"></a>
|
||||||
|
<a href="https://clickpy.clickhouse.com/dashboard/ultralytics"><img src="https://static.pepy.tech/badge/ultralytics" alt="Ultralytics Downloads"></a>
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img alt="Ultralytics Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
|
||||||
|
<a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>
|
||||||
|
<a href="https://www.reddit.com/r/ultralytics/"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
|
||||||
|
<br>
|
||||||
|
<a href="https://console.paperspace.com/github/ultralytics/ultralytics"><img src="https://assets.paperspace.io/img/gradient-badge.svg" alt="Run Ultralytics on Gradient"></a>
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Ultralytics In Colab"></a>
|
||||||
|
<a href="https://www.kaggle.com/models/ultralytics/yolo26"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open Ultralytics In Kaggle"></a>
|
||||||
|
<a href="https://mybinder.org/v2/gh/ultralytics/ultralytics/HEAD?labpath=examples%2Ftutorial.ipynb"><img src="https://mybinder.org/badge_logo.svg" alt="Open Ultralytics In Binder"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) 基于多年在计算机视觉和人工智能领域的基础研究,创造了尖端的、最先进的 (SOTA) [YOLO 模型](https://www.ultralytics.com/yolo)。我们的模型不断更新以提高性能和灵活性,具有**速度快**、**精度高**和**易于使用**的特点。它们在[目标检测](https://docs.ultralytics.com/tasks/detect/)、[跟踪](https://docs.ultralytics.com/modes/track/)、[实例分割](https://docs.ultralytics.com/tasks/segment/)、[图像分类](https://docs.ultralytics.com/tasks/classify/)和[姿态估计](https://docs.ultralytics.com/tasks/pose/)任务中表现出色。
|
||||||
|
|
||||||
|
在 [Ultralytics 文档](https://docs.ultralytics.com/)中查找详细文档。通过 [GitHub Issues](https://github.com/ultralytics/ultralytics/issues/new/choose) 获取支持。加入 [Discord](https://discord.com/invite/ultralytics)、[Reddit](https://www.reddit.com/r/ultralytics/) 和 [Ultralytics 社区论坛](https://community.ultralytics.com/)参与讨论!
|
||||||
|
|
||||||
|
如需商业用途,请在 [Ultralytics 授权许可](https://www.ultralytics.com/license)申请企业许可证。
|
||||||
|
|
||||||
|
<a href="https://platform.ultralytics.com/ultralytics/yolo26" target="_blank">
|
||||||
|
<img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/refs/heads/main/yolo/performance-comparison.png" alt="YOLO26 performance plots">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="2%" alt="Ultralytics GitHub"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="2%" alt="Ultralytics LinkedIn"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="2%" alt="Ultralytics Twitter"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://www.youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="2%" alt="Ultralytics YouTube"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="2%" alt="Ultralytics TikTok"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="2%" alt="Ultralytics BiliBili"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="2%" alt="space">
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="2%" alt="Ultralytics Discord"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 📄 文档
|
||||||
|
|
||||||
|
请参阅下文了解快速安装和使用示例。有关训练、验证、预测和部署的全面指南,请参阅我们的完整 [Ultralytics 文档](https://docs.ultralytics.com/)。
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>安装</summary>
|
||||||
|
|
||||||
|
在 [**Python>=3.8**](https://www.python.org/) 环境中安装 `ultralytics` 包,包括所有[依赖项](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml),并确保 [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/)。
|
||||||
|
|
||||||
|
[](https://pypi.org/project/ultralytics/) [](https://clickpy.clickhouse.com/dashboard/ultralytics) [](https://pypi.org/project/ultralytics/)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
有关其他安装方法,包括 [Conda](https://anaconda.org/conda-forge/ultralytics)、[Docker](https://hub.docker.com/r/ultralytics/ultralytics) 以及通过 Git 从源代码构建,请查阅[快速入门指南](https://docs.ultralytics.com/quickstart/)。
|
||||||
|
|
||||||
|
[](https://anaconda.org/conda-forge/ultralytics) [](https://hub.docker.com/r/ultralytics/ultralytics) [](https://hub.docker.com/r/ultralytics/ultralytics)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>使用方法</summary>
|
||||||
|
|
||||||
|
### CLI
|
||||||
|
|
||||||
|
您可以直接通过命令行界面 (CLI) 使用 `yolo` 命令来运行 Ultralytics YOLO:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用预训练的 YOLO 模型 (例如 YOLO26n) 对图像进行预测
|
||||||
|
yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
|
||||||
|
```
|
||||||
|
|
||||||
|
`yolo` 命令支持各种任务和模式,并接受额外的参数,如 `imgsz=640`。浏览 YOLO [CLI 文档](https://docs.ultralytics.com/usage/cli/)获取更多示例。
|
||||||
|
|
||||||
|
### Python
|
||||||
|
|
||||||
|
Ultralytics YOLO 也可以直接集成到您的 Python 项目中。它接受与 CLI 相同的[配置参数](https://docs.ultralytics.com/usage/cfg/):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# 加载一个预训练的 YOLO26n 模型
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# 在 COCO8 数据集上训练模型 100 个周期
|
||||||
|
train_results = model.train(
|
||||||
|
data="coco8.yaml", # 数据集配置文件路径
|
||||||
|
epochs=100, # 训练周期数
|
||||||
|
imgsz=640, # 训练图像尺寸
|
||||||
|
device="cpu", # 运行设备 (例如 'cpu', 0, [0,1,2,3])
|
||||||
|
)
|
||||||
|
|
||||||
|
# 评估模型在验证集上的性能
|
||||||
|
metrics = model.val()
|
||||||
|
|
||||||
|
# 对图像执行目标检测
|
||||||
|
results = model("path/to/image.jpg") # 对图像进行预测
|
||||||
|
results[0].show() # 显示结果
|
||||||
|
|
||||||
|
# 将模型导出为 ONNX 格式以进行部署
|
||||||
|
path = model.export(format="onnx") # 返回导出模型的路径
|
||||||
|
```
|
||||||
|
|
||||||
|
在 YOLO [Python 文档](https://docs.ultralytics.com/usage/python/)中发现更多示例。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## ✨ 模型
|
||||||
|
|
||||||
|
Ultralytics 支持广泛的 YOLO 模型,从早期的版本如 [YOLOv3](https://docs.ultralytics.com/models/yolov3/) 到最新的 [YOLO26](https://docs.ultralytics.com/models/yolo26/)。下表展示了在 [COCO](https://docs.ultralytics.com/datasets/detect/coco/) 数据集上预训练的 YOLO26 模型,用于[检测](https://docs.ultralytics.com/tasks/detect/)、[分割](https://docs.ultralytics.com/tasks/segment/)和[姿态估计](https://docs.ultralytics.com/tasks/pose/)任务。此外,还提供了在 [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) 数据集上预训练的[分类](https://docs.ultralytics.com/tasks/classify/)模型。[跟踪](https://docs.ultralytics.com/modes/track/)模式与所有检测、分割和姿态模型兼容。所有[模型](https://docs.ultralytics.com/models/)在首次使用时都会自动从最新的 Ultralytics [发布版本](https://github.com/ultralytics/assets/releases)下载。
|
||||||
|
|
||||||
|
<a href="https://docs.ultralytics.com/tasks/" target="_blank">
|
||||||
|
<img width="100%" src="https://github.com/ultralytics/docs/releases/download/0/ultralytics-yolov8-tasks-banner.avif" alt="Ultralytics YOLO supported tasks">
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<details open><summary>检测 (COCO)</summary>
|
||||||
|
|
||||||
|
浏览[检测文档](https://docs.ultralytics.com/tasks/detect/)获取使用示例。这些模型在 [COCO 数据集](https://cocodataset.org/)上训练,包含 80 个对象类别。
|
||||||
|
|
||||||
|
| 模型 | 尺寸<br><sup>(像素) | mAP<sup>val<br>50-95 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>T4 TensorRT10<br>(毫秒) | 参数<br><sup>(百万) | FLOPs<br><sup>(十亿) |
|
||||||
|
| ------------------------------------------------------------------------------------ | ------------------- | -------------------- | ------------------------------- | ------------------------------------ | ------------------- | -------------------- |
|
||||||
|
| [YOLO26n](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt) | 640 | 40.9 | 38.9 ± 0.7 | 1.7 ± 0.0 | 2.4 | 5.4 |
|
||||||
|
| [YOLO26s](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt) | 640 | 48.6 | 87.2 ± 0.9 | 2.5 ± 0.0 | 9.5 | 20.7 |
|
||||||
|
| [YOLO26m](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m.pt) | 640 | 53.1 | 220.0 ± 1.4 | 4.7 ± 0.1 | 20.4 | 68.2 |
|
||||||
|
| [YOLO26l](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l.pt) | 640 | 55.0 | 286.2 ± 2.0 | 6.2 ± 0.2 | 24.8 | 86.4 |
|
||||||
|
| [YOLO26x](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x.pt) | 640 | 57.5 | 525.8 ± 4.0 | 11.8 ± 0.2 | 55.7 | 193.9 |
|
||||||
|
|
||||||
|
- **mAP<sup>val</sup>** 值指的是在 [COCO val2017](https://cocodataset.org/) 数据集上的单模型单尺度性能。详见 [YOLO 性能指标](https://docs.ultralytics.com/guides/yolo-performance-metrics/)。<br>使用 `yolo val detect data=coco.yaml device=0` 复现结果。
|
||||||
|
- **速度** 指标是在 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例上对 COCO val 图像进行平均测量的。CPU 速度使用 [ONNX](https://onnx.ai/) 导出进行测量。GPU 速度使用 [TensorRT](https://developer.nvidia.com/tensorrt) 导出进行测量。<br>使用 `yolo val detect data=coco.yaml batch=1 device=0|cpu` 复现结果。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>分割 (COCO)</summary>
|
||||||
|
|
||||||
|
请参阅[分割文档](https://docs.ultralytics.com/tasks/segment/)获取使用示例。这些模型在 [COCO-Seg](https://docs.ultralytics.com/datasets/segment/coco/) 数据集上训练,包含 80 个类别。
|
||||||
|
|
||||||
|
| 模型 | 尺寸<br><sup>(像素) | mAP<sup>box<br>50-95 | mAP<sup>mask<br>50-95 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>T4 TensorRT10<br>(毫秒) | 参数<br><sup>(百万) | FLOPs<br><sup>(十亿) |
|
||||||
|
| -------------------------------------------------------------------------------------------- | ------------------- | -------------------- | --------------------- | ------------------------------- | ------------------------------------ | ------------------- | -------------------- |
|
||||||
|
| [YOLO26n-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-seg.pt) | 640 | 39.6 | 33.9 | 53.3 ± 0.5 | 2.1 ± 0.0 | 2.7 | 9.1 |
|
||||||
|
| [YOLO26s-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-seg.pt) | 640 | 47.3 | 40.0 | 118.4 ± 0.9 | 3.3 ± 0.0 | 10.4 | 34.2 |
|
||||||
|
| [YOLO26m-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-seg.pt) | 640 | 52.5 | 44.1 | 328.2 ± 2.4 | 6.7 ± 0.1 | 23.6 | 121.5 |
|
||||||
|
| [YOLO26l-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-seg.pt) | 640 | 54.4 | 45.5 | 387.0 ± 3.7 | 8.0 ± 0.1 | 28.0 | 139.8 |
|
||||||
|
| [YOLO26x-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-seg.pt) | 640 | 56.5 | 47.0 | 787.0 ± 6.8 | 16.4 ± 0.1 | 62.8 | 313.5 |
|
||||||
|
|
||||||
|
- **mAP<sup>val</sup>** 值指的是在 [COCO val2017](https://cocodataset.org/) 数据集上的单模型单尺度性能。详见 [YOLO 性能指标](https://docs.ultralytics.com/guides/yolo-performance-metrics/)。<br>使用 `yolo val segment data=coco.yaml device=0` 复现结果。
|
||||||
|
- **速度** 指标是在 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例上对 COCO val 图像进行平均测量的。CPU 速度使用 [ONNX](https://onnx.ai/) 导出进行测量。GPU 速度使用 [TensorRT](https://developer.nvidia.com/tensorrt) 导出进行测量。<br>使用 `yolo val segment data=coco.yaml batch=1 device=0|cpu` 复现结果。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>分类 (ImageNet)</summary>
|
||||||
|
|
||||||
|
请查阅[分类文档](https://docs.ultralytics.com/tasks/classify/)获取使用示例。这些模型在 [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) 数据集上训练,涵盖 1000 个类别。
|
||||||
|
|
||||||
|
| 模型 | 尺寸<br><sup>(像素) | acc<br><sup>top1 | acc<br><sup>top5 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>T4 TensorRT10<br>(毫秒) | 参数<br><sup>(百万) | FLOPs<br><sup>(十亿) @ 224 |
|
||||||
|
| -------------------------------------------------------------------------------------------- | ------------------- | ---------------- | ---------------- | ------------------------------- | ------------------------------------ | ------------------- | -------------------------- |
|
||||||
|
| [YOLO26n-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-cls.pt) | 224 | 71.4 | 90.1 | 5.0 ± 0.3 | 1.1 ± 0.0 | 2.8 | 0.5 |
|
||||||
|
| [YOLO26s-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-cls.pt) | 224 | 76.0 | 92.9 | 7.9 ± 0.2 | 1.3 ± 0.0 | 6.7 | 1.6 |
|
||||||
|
| [YOLO26m-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-cls.pt) | 224 | 78.1 | 94.2 | 17.2 ± 0.4 | 2.0 ± 0.0 | 11.6 | 4.9 |
|
||||||
|
| [YOLO26l-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-cls.pt) | 224 | 79.0 | 94.6 | 23.2 ± 0.3 | 2.8 ± 0.0 | 14.1 | 6.2 |
|
||||||
|
| [YOLO26x-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-cls.pt) | 224 | 79.9 | 95.0 | 41.4 ± 0.9 | 3.8 ± 0.0 | 29.6 | 13.6 |
|
||||||
|
|
||||||
|
- **acc** 值表示模型在 [ImageNet](https://www.image-net.org/) 数据集验证集上的准确率。<br>使用 `yolo val classify data=path/to/ImageNet device=0` 复现结果。
|
||||||
|
- **速度** 指标是在 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例上对 ImageNet val 图像进行平均测量的。CPU 速度使用 [ONNX](https://onnx.ai/) 导出进行测量。GPU 速度使用 [TensorRT](https://developer.nvidia.com/tensorrt) 导出进行测量。<br>使用 `yolo val classify data=path/to/ImageNet batch=1 device=0|cpu` 复现结果。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>姿态估计 (COCO)</summary>
|
||||||
|
|
||||||
|
请参阅[姿态估计文档](https://docs.ultralytics.com/tasks/pose/)获取使用示例。这些模型在 [COCO-Pose](https://docs.ultralytics.com/datasets/pose/coco/) 数据集上训练,专注于 'person' 类别。
|
||||||
|
|
||||||
|
| 模型 | 尺寸<br><sup>(像素) | mAP<sup>pose<br>50-95 | mAP<sup>pose<br>50 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>T4 TensorRT10<br>(毫秒) | 参数<br><sup>(百万) | FLOPs<br><sup>(十亿) |
|
||||||
|
| ---------------------------------------------------------------------------------------------- | ------------------- | --------------------- | ------------------ | ------------------------------- | ------------------------------------ | ------------------- | -------------------- |
|
||||||
|
| [YOLO26n-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-pose.pt) | 640 | 57.2 | 83.3 | 40.3 ± 0.5 | 1.8 ± 0.0 | 2.9 | 7.5 |
|
||||||
|
| [YOLO26s-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-pose.pt) | 640 | 63.0 | 86.6 | 85.3 ± 0.9 | 2.7 ± 0.0 | 10.4 | 23.9 |
|
||||||
|
| [YOLO26m-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-pose.pt) | 640 | 68.8 | 89.6 | 218.0 ± 1.5 | 5.0 ± 0.1 | 21.5 | 73.1 |
|
||||||
|
| [YOLO26l-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-pose.pt) | 640 | 70.4 | 90.5 | 275.4 ± 2.4 | 6.5 ± 0.1 | 25.9 | 91.3 |
|
||||||
|
| [YOLO26x-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-pose.pt) | 640 | 71.7 | 91.6 | 565.4 ± 3.0 | 12.2 ± 0.2 | 57.6 | 201.7 |
|
||||||
|
|
||||||
|
- **mAP<sup>val</sup>** 值指的是在 [COCO Keypoints val2017](https://docs.ultralytics.com/datasets/pose/coco/) 数据集上的单模型单尺度性能。详见 [YOLO 性能指标](https://docs.ultralytics.com/guides/yolo-performance-metrics/)。<br>使用 `yolo val pose data=coco-pose.yaml device=0` 复现结果。
|
||||||
|
- **速度** 指标是在 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例上对 COCO val 图像进行平均测量的。CPU 速度使用 [ONNX](https://onnx.ai/) 导出进行测量。GPU 速度使用 [TensorRT](https://developer.nvidia.com/tensorrt) 导出进行测量。<br>使用 `yolo val pose data=coco-pose.yaml batch=1 device=0|cpu` 复现结果。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>定向边界框 (DOTAv1)</summary>
|
||||||
|
|
||||||
|
请查阅 [OBB 文档](https://docs.ultralytics.com/tasks/obb/)获取使用示例。这些模型在 [DOTAv1](https://docs.ultralytics.com/datasets/obb/dota-v2/#dota-v10) 数据集上训练,包含 15 个类别。
|
||||||
|
|
||||||
|
| 模型 | 尺寸<br><sup>(像素) | mAP<sup>test<br>50 | 速度<br><sup>CPU ONNX<br>(毫秒) | 速度<br><sup>T4 TensorRT10<br>(毫秒) | 参数<br><sup>(百万) | FLOPs<br><sup>(十亿) |
|
||||||
|
| -------------------------------------------------------------------------------------------- | ------------------- | ------------------ | ------------------------------- | ------------------------------------ | ------------------- | -------------------- |
|
||||||
|
| [YOLO26n-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-obb.pt) | 1024 | 78.9 | 97.7 ± 0.9 | 2.8 ± 0.0 | 2.5 | 14.0 |
|
||||||
|
| [YOLO26s-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-obb.pt) | 1024 | 80.9 | 218.0 ± 1.4 | 4.9 ± 0.1 | 9.8 | 55.1 |
|
||||||
|
| [YOLO26m-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-obb.pt) | 1024 | 81.0 | 579.2 ± 3.8 | 10.2 ± 0.3 | 21.2 | 183.3 |
|
||||||
|
| [YOLO26l-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-obb.pt) | 1024 | 81.6 | 735.6 ± 3.1 | 13.0 ± 0.2 | 25.6 | 230.0 |
|
||||||
|
| [YOLO26x-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-obb.pt) | 1024 | 81.7 | 1485.7 ± 11.5 | 30.5 ± 0.9 | 57.6 | 516.5 |
|
||||||
|
|
||||||
|
- **mAP<sup>test</sup>** 值指的是在 [DOTAv1 测试集](https://captain-whu.github.io/DOTA/dataset.html)上的单模型多尺度性能。<br>通过 `yolo val obb data=DOTAv1.yaml device=0 split=test` 复现结果,并将合并后的结果提交到 [DOTA 评估服务器](https://captain-whu.github.io/DOTA/evaluation.html)。
|
||||||
|
- **速度** 指标是在 [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) 实例上对 [DOTAv1 val 图像](https://docs.ultralytics.com/datasets/obb/dota-v2/#dota-v10)进行平均测量的。CPU 速度使用 [ONNX](https://onnx.ai/) 导出进行测量。GPU 速度使用 [TensorRT](https://developer.nvidia.com/tensorrt) 导出进行测量。<br>通过 `yolo val obb data=DOTAv1.yaml batch=1 device=0|cpu` 复现结果。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🧩 集成
|
||||||
|
|
||||||
|
我们与领先 AI 平台的关键集成扩展了 Ultralytics 产品的功能,增强了数据集标注、训练、可视化和模型管理等任务。了解 Ultralytics 如何与 [Weights & Biases](https://docs.ultralytics.com/integrations/weights-biases/)、[Comet ML](https://docs.ultralytics.com/integrations/comet/)、[Roboflow](https://docs.ultralytics.com/integrations/roboflow/) 和 [Intel OpenVINO](https://docs.ultralytics.com/integrations/openvino/) 等合作伙伴协作,优化您的 AI 工作流程。在 [Ultralytics 集成](https://docs.ultralytics.com/integrations/)了解更多信息。
|
||||||
|
|
||||||
|
<a href="https://docs.ultralytics.com/integrations/" target="_blank">
|
||||||
|
<img width="100%" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png" alt="Ultralytics active learning integrations">
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://platform.ultralytics.com/ultralytics/yolo26">
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/partners/logo-ultralytics-hub.png" width="10%" alt="Ultralytics Platform logo"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
|
||||||
|
<a href="https://docs.ultralytics.com/integrations/weights-biases/">
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/partners/logo-wb.png" width="10%" alt="Weights & Biases logo"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
|
||||||
|
<a href="https://docs.ultralytics.com/integrations/comet/">
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/partners/logo-comet.png" width="10%" alt="Comet ML logo"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="15%" height="0" alt="space">
|
||||||
|
<a href="https://docs.ultralytics.com/integrations/neural-magic/">
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/partners/logo-neuralmagic.png" width="10%" alt="Neural Magic logo"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
| Ultralytics Platform 🌟 | Weights & Biases | Comet | Neural Magic |
|
||||||
|
| :-----------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------: |
|
||||||
|
| 简化 YOLO 工作流程:使用 [Ultralytics 平台](https://platform.ultralytics.com/ultralytics/yolo26) 轻松进行标注、训练和部署。立即试用! | 使用 [Weights & Biases](https://docs.ultralytics.com/integrations/weights-biases/) 跟踪实验、超参数和结果。 | 永久免费的 [Comet ML](https://docs.ultralytics.com/integrations/comet/) 让您能够保存 YOLO 模型、恢复训练并交互式地可视化预测结果。 | 使用 [Neural Magic DeepSparse](https://docs.ultralytics.com/integrations/neural-magic/),将 YOLO 推理速度提高多达 6 倍。 |
|
||||||
|
|
||||||
|
## 🤝 贡献
|
||||||
|
|
||||||
|
我们依靠社区协作蓬勃发展!没有像您这样的开发者的贡献,Ultralytics YOLO 就不会成为如今最先进的框架。请参阅我们的[贡献指南](https://docs.ultralytics.com/help/contributing/)开始贡献。我们也欢迎您的反馈——通过完成我们的[调查问卷](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey)分享您的体验。非常**感谢** 🙏 每一位贡献者!
|
||||||
|
|
||||||
|
<!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=1280 -->
|
||||||
|
|
||||||
|
[](https://github.com/ultralytics/ultralytics/graphs/contributors)
|
||||||
|
|
||||||
|
我们期待您的贡献,帮助 Ultralytics 生态系统变得更好!
|
||||||
|
|
||||||
|
## 📜 许可证
|
||||||
|
|
||||||
|
Ultralytics 提供两种许可选项以满足不同需求:
|
||||||
|
|
||||||
|
- **AGPL-3.0 许可证**:这种经 [OSI 批准](https://opensource.org/license/agpl-v3)的开源许可证非常适合学生、研究人员和爱好者。它鼓励开放协作和知识共享。有关完整详细信息,请参阅 [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) 文件。
|
||||||
|
- **Ultralytics 企业许可证**:专为商业用途设计,此许可证允许将 Ultralytics 软件和 AI 模型无缝集成到商业产品和服务中,绕过 AGPL-3.0 的开源要求。如果您的使用场景涉及商业部署,请通过 [Ultralytics 授权许可](https://www.ultralytics.com/license)与我们联系。
|
||||||
|
|
||||||
|
## 📞 联系方式
|
||||||
|
|
||||||
|
有关 Ultralytics 软件的错误报告和功能请求,请访问 [GitHub Issues](https://github.com/ultralytics/ultralytics/issues)。如有疑问、讨论和社区支持,请加入我们在 [Discord](https://discord.com/invite/ultralytics)、[Reddit](https://www.reddit.com/r/ultralytics/?rdt=44154) 和 [Ultralytics 社区论坛](https://community.ultralytics.com/)上的活跃社区。我们随时为您提供有关 Ultralytics 的所有帮助!
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
|
||||||
|
</div>
|
||||||
59
docker/Dockerfile
Executable file
59
docker/Dockerfile
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Image is CUDA-optimized for YOLO single/multi-GPU training and inference
|
||||||
|
|
||||||
|
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:25.02-py3
|
||||||
|
FROM pytorch/pytorch:2.9.1-cuda12.8-cudnn9-runtime
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
# Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library"
|
||||||
|
# Suppress TensorFlow cuDNN, cuBLAS, and cuFFT Registration Warnings and PyTorch NNPACK warnings
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
||||||
|
MKL_THREADING_LAYER=GNU \
|
||||||
|
OMP_NUM_THREADS=1 \
|
||||||
|
TF_CPP_MIN_LOG_LEVEL=3 \
|
||||||
|
TORCH_CPP_LOG_LEVEL=ERROR
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install linux packages
|
||||||
|
# gnupg required for Edge TPU install
|
||||||
|
# libsm6 required by libqxcb to create QT-based windows for visualization; set 'QT_DEBUG_PLUGINS=1' to test in docker
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
gcc git zip unzip wget curl htop libgl1 libglib2.0-0 gnupg libsm6 && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Install pip packages (uv already installed in base image)
|
||||||
|
RUN uv pip install --system -e "." albumentations faster-coco-eval nvidia-ml-py && \
|
||||||
|
# Remove extra build files \
|
||||||
|
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest && docker build -f docker/Dockerfile -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest && docker pull $t
|
||||||
|
# Example (run-gpu): docker run -it --ipc=host --runtime=nvidia --gpus all $t
|
||||||
|
# Example (run-gpu-subset): docker run -it --ipc=host --runtime=nvidia --gpus "device=2,3" $t
|
||||||
|
# Note: device=2,3 maps to CUDA 0,1 inside the container.
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia --gpus all -v "$PWD/shared/datasets:/datasets" $t
|
||||||
|
# Example (tag-release): t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:vX.Y && docker tag $t $tnew && docker push $tnew
|
||||||
55
docker/Dockerfile-arm64
Executable file
55
docker/Dockerfile-arm64
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-arm64 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Image is aarch64-compatible for Apple M1, M2, M3, Raspberry Pi and other ARM architectures
|
||||||
|
|
||||||
|
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu with "FROM arm64v8/ubuntu:22.04" (deprecated)
|
||||||
|
# Start FROM Debian image for arm64v8 https://hub.docker.com/r/arm64v8/debian (deprecated)
|
||||||
|
# Start FROM official arm64v8 Ubuntu 24.04 image https://hub.docker.com/layers/arm64v8/ubuntu/24.04/
|
||||||
|
FROM arm64v8/ubuntu:24.04
|
||||||
|
|
||||||
|
# Set environment variables (suppress PyTorch NNPACK warnings)
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
||||||
|
TORCH_CPP_LOG_LEVEL=ERROR
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install linux packages
|
||||||
|
# TensorFlow on aarch64 may require pkg-config and libhdf5-dev if h5py builds from source.
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3-pip git zip unzip wget curl htop gcc libgl1 libglib2.0-0 gnupg && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Install pip packages, create python symlink, and remove build files
|
||||||
|
RUN python3 -m pip install uv && \
|
||||||
|
uv pip install --system -e ".[export]" --break-system-packages && \
|
||||||
|
# Creates a symbolic link to make 'python' point to 'python3'
|
||||||
|
ln -sf /usr/bin/python3 /usr/bin/python && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-arm64 && docker build --platform linux/arm64 -f docker/Dockerfile-arm64 -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-arm64 && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t
|
||||||
43
docker/Dockerfile-conda
Executable file
43
docker/Dockerfile-conda
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-conda image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Image is optimized for Ultralytics Anaconda (https://anaconda.org/conda-forge/ultralytics) installation and usage
|
||||||
|
|
||||||
|
# Start FROM miniconda3 image https://hub.docker.com/r/continuumio/miniconda3
|
||||||
|
FROM continuumio/miniconda3:latest
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install linux packages and conda packages
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libgl1 && \
|
||||||
|
apt-get clean && \
|
||||||
|
# Install conda packages
|
||||||
|
# mkl required to fix 'OSError: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory'
|
||||||
|
conda config --set solver libmamba && \
|
||||||
|
conda install -y pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia && \
|
||||||
|
conda install -y -c conda-forge ultralytics mkl && \
|
||||||
|
conda clean -afy && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf /var/lib/apt/lists/* /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Copy model
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-conda && docker build -f docker/Dockerfile-conda -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-conda && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t
|
||||||
19
docker/Dockerfile-cpu
Executable file
19
docker/Dockerfile-cpu
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Lightweight CPU image optimized for inference (extends latest-python)
|
||||||
|
|
||||||
|
# Build from Ultralytics Python image
|
||||||
|
FROM ultralytics/ultralytics:latest-python
|
||||||
|
|
||||||
|
# Set default command to bash
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-cpu && docker build -f docker/Dockerfile-cpu -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-cpu && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t
|
||||||
26
docker/Dockerfile-export
Executable file
26
docker/Dockerfile-export
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-export image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Export-optimized derivative of ultralytics/ultralytics:latest for testing and benchmarks
|
||||||
|
# Includes all export format dependencies and pre-installed export packages
|
||||||
|
|
||||||
|
FROM ultralytics/ultralytics:latest
|
||||||
|
|
||||||
|
# Install export dependencies and run exports to AutoInstall packages
|
||||||
|
# Numpy 1.26.4 required for TensorFlow export compatibility
|
||||||
|
# Note tensorrt installed on-demand as depends on runtime environment CUDA version
|
||||||
|
RUN uv pip install --system -e ".[export]" "onnxruntime-gpu" paddlepaddle x2paddle numpy==1.26.4 && \
|
||||||
|
# Run exports to AutoInstall packages \
|
||||||
|
yolo export model=tmp/yolo26n.pt format=edgetpu imgsz=32 && \
|
||||||
|
yolo export model=tmp/yolo26n.pt format=ncnn imgsz=32 && \
|
||||||
|
# Remove temporary files \
|
||||||
|
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-export && docker build -f docker/Dockerfile-export -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-export && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host --runtime=nvidia --gpus all $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia --gpus all -v "$PWD/shared/datasets:/datasets" $t
|
||||||
69
docker/Dockerfile-jetson-jetpack4
Executable file
69
docker/Dockerfile-jetson-jetpack4
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-jetson-jetpack4 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Supports JetPack4.x for YOLO on Jetson Nano, TX2, Xavier NX, AGX Xavier
|
||||||
|
|
||||||
|
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-cuda
|
||||||
|
FROM nvcr.io/nvidia/l4t-cuda:10.2.460-runtime
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Add NVIDIA repositories for TensorRT dependencies
|
||||||
|
RUN wget -q -O - https://repo.download.nvidia.com/jetson/jetson-ota-public.asc | apt-key add - && \
|
||||||
|
echo "deb https://repo.download.nvidia.com/jetson/common r32.7 main" > /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
|
||||||
|
echo "deb https://repo.download.nvidia.com/jetson/t194 r32.7 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
# pkg-config and libhdf5-dev (not included) are needed to build 'h5py==3.11.0' aarch64 wheel required by 'tensorflow'
|
||||||
|
# gnupg required for Edge TPU install
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
git python3.8 python3.8-dev python3-pip python3-libnvinfer libopenmpi-dev libopenblas-base libomp-dev gcc && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create symbolic links for python3.8 and pip3
|
||||||
|
RUN ln -sf /usr/bin/python3.8 /usr/bin/python3 && \
|
||||||
|
ln -sf /usr/bin/pip3 /usr/bin/pip
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Replace pyproject.toml TF.js version with 'tensorflowjs>=3.9.0' for JetPack4 compatibility
|
||||||
|
RUN sed -i 's/^\( *"tensorflowjs\)>=.*\(".*\)/\1>=3.9.0\2/' pyproject.toml
|
||||||
|
|
||||||
|
# Install pip packages (pip must be upgraded first before installing uv due to missing setuptools)
|
||||||
|
RUN python3 -m pip install --upgrade pip && \
|
||||||
|
python3 -m pip install uv
|
||||||
|
# Install pip packages and remove extra build files
|
||||||
|
# Onnxruntime and TensorRT from https://elinux.org/Jetson_Zoo and https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
|
||||||
|
RUN uv pip install --system \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.8.0-cp38-cp38-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/tensorrt-8.2.0.6-cp38-none-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-1.11.0a0+gitbc2c6ed-cp38-cp38-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.12.0a0+9b5a3fe-cp38-cp38-linux_aarch64.whl && \
|
||||||
|
uv pip install --system -e ".[export]" && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack4 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack4 -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack4 && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t
|
||||||
58
docker/Dockerfile-jetson-jetpack5
Executable file
58
docker/Dockerfile-jetson-jetpack5
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-jetson-jetpack5 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Supports JetPack5.1.2 for YOLO on Jetson Xavier NX, AGX Xavier, AGX Orin, Orin Nano and Orin NX
|
||||||
|
|
||||||
|
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
|
||||||
|
FROM nvcr.io/nvidia/l4t-jetpack:r35.4.1
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
git python3-pip libopenmpi-dev libopenblas-base libomp-dev \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Replace pyproject.toml TF.js version with 'tensorflowjs>=3.9.0' for JetPack5 compatibility and install packages
|
||||||
|
RUN sed -i 's/^\( *"tensorflowjs\)>=.*\(".*\)/\1>=3.9.0\2/' pyproject.toml && \
|
||||||
|
python3 -m pip install --upgrade pip uv
|
||||||
|
|
||||||
|
# Pip install onnxruntime-gpu, torch, torchvision and ultralytics, then remove build files
|
||||||
|
RUN uv pip install --system \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.18.0-cp38-cp38-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.2.0-cp38-cp38-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.17.2+c1d70fe-cp38-cp38-linux_aarch64.whl && \
|
||||||
|
# Need lower version of 'numpy' for TensorRT export
|
||||||
|
uv pip install --system numpy==1.23.5 && \
|
||||||
|
uv pip install --system -e ".[export]" && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack5 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack5 -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack5 && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t
|
||||||
55
docker/Dockerfile-jetson-jetpack6
Executable file
55
docker/Dockerfile-jetson-jetpack6
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-jetson-jetpack6 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Supports JetPack6.1 for YOLO on Jetson AGX Orin, Orin NX and Orin Nano Series
|
||||||
|
|
||||||
|
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
|
||||||
|
FROM nvcr.io/nvidia/l4t-jetpack:r36.4.0
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install dependencies and cleanup
|
||||||
|
ADD https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/arm64/cuda-keyring_1.1-1_all.deb .
|
||||||
|
RUN dpkg -i cuda-keyring_1.1-1_all.deb && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
git python3-pip libopenmpi-dev libopenblas-base libomp-dev libcusparselt0 libcusparselt-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* cuda-keyring_1.1-1_all.deb
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Pip install onnxruntime-gpu, torch, torchvision and ultralytics, then remove build files
|
||||||
|
RUN python3 -m pip install --upgrade pip uv && \
|
||||||
|
uv pip install --system \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.20.0-cp310-cp310-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.5.0a0+872d972e41.nv24.08-cp310-cp310-linux_aarch64.whl \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.20.0a0+afc54f7-cp310-cp310-linux_aarch64.whl && \
|
||||||
|
uv pip install --system -e ".[export]" && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack6 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack6 -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack6 && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t
|
||||||
27
docker/Dockerfile-jupyter
Executable file
27
docker/Dockerfile-jupyter
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-jupyter image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Image provides JupyterLab interface for interactive YOLO development and includes tutorial notebooks
|
||||||
|
|
||||||
|
# Start from Python-based Ultralytics image for full Python environment
|
||||||
|
FROM ultralytics/ultralytics:latest-python
|
||||||
|
|
||||||
|
# Install JupyterLab for interactive development
|
||||||
|
RUN uv pip install --system jupyterlab && \
|
||||||
|
# Create persistent data directory structure
|
||||||
|
mkdir -p /data/{datasets,weights,runs} && \
|
||||||
|
# Configure YOLO directories
|
||||||
|
yolo settings datasets_dir="/data/datasets" weights_dir="/data/weights" runs_dir="/data/runs" && \
|
||||||
|
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Start JupyterLab with tutorial notebook
|
||||||
|
ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "/ultralytics/examples/tutorial.ipynb"]
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-jupyter && docker build -f docker/Dockerfile-jupyter -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-jupyter && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host -p 8888:8888 $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -p 8888:8888 -v "$PWD/datasets:/data/datasets" $t
|
||||||
51
docker/Dockerfile-nvidia-arm64
Executable file
51
docker/Dockerfile-nvidia-arm64
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-nvidia-arm64 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Supports JetPack 7.0 and DGX OS for YOLO on Jetson AGX Thor (T5000) and DGX Spark
|
||||||
|
|
||||||
|
# Start FROM PyTorch image nvcr.io/nvidia/pytorch:25.10-py3
|
||||||
|
FROM nvcr.io/nvidia/pytorch:25.10-py3
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install linux packages
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libgl1 && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Install pip packages (uv already installed in base image)
|
||||||
|
RUN uv pip install --system \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.24.0-cp312-cp312-linux_aarch64.whl --break-system-packages && \
|
||||||
|
# Reinstall torch and torchvision to ensure CUDA 13.0 compatibility
|
||||||
|
uv pip install --system --force-reinstall torch torchvision --index-url https://download.pytorch.org/whl/cu130 --break-system-packages && \
|
||||||
|
uv pip install --system -e ".[export]" --break-system-packages && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-nvidia-arm64 && docker build --platform linux/arm64 -f docker/Dockerfile-nvidia-arm64 -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-nvidia-arm64 && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t && docker push $tnew
|
||||||
50
docker/Dockerfile-python
Executable file
50
docker/Dockerfile-python
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-python image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Lightweight CPU image optimized for YOLO inference
|
||||||
|
|
||||||
|
# Use official Python base image for reproducibility (3.11.10 for export and 3.12.10 for inference)
|
||||||
|
FROM python:3.11.10-slim-bookworm
|
||||||
|
|
||||||
|
# Set environment variables (suppress PyTorch NNPACK warnings)
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
||||||
|
TORCH_CPP_LOG_LEVEL=ERROR
|
||||||
|
|
||||||
|
# Downloads to user config dir
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||||
|
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||||
|
/root/.config/Ultralytics/
|
||||||
|
|
||||||
|
# Install linux packages
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /ultralytics
|
||||||
|
|
||||||
|
# Copy contents and configure git
|
||||||
|
COPY . .
|
||||||
|
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||||
|
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||||
|
ADD https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt .
|
||||||
|
|
||||||
|
# Install pip packages
|
||||||
|
RUN pip install uv && \
|
||||||
|
uv pip install --system -e . --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf tmp ~/.cache /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-python && docker build -f docker/Dockerfile-python -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-python && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t
|
||||||
34
docker/Dockerfile-python-export
Executable file
34
docker/Dockerfile-python-export
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds ultralytics/ultralytics:latest-python-export image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Full-featured image with export capabilities for YOLO model conversion
|
||||||
|
|
||||||
|
# Build from lightweight Ultralytics Python image
|
||||||
|
FROM ultralytics/ultralytics:latest-python
|
||||||
|
|
||||||
|
# Install export-specific system packages
|
||||||
|
# gnupg required for Edge TPU install
|
||||||
|
# Java runtime environment (default-jre-headless) required for Sony IMX export
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends gnupg default-jre-headless && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install export dependencies and run exports to AutoInstall packages
|
||||||
|
RUN uv pip install --system -e ".[export]" && \
|
||||||
|
# Run exports to AutoInstall packages (IMX can only export to YOLO11)
|
||||||
|
yolo export model=tmp/yolo26n.pt format=edgetpu imgsz=32 && \
|
||||||
|
yolo export model=tmp/yolo26n.pt format=ncnn imgsz=32 && \
|
||||||
|
yolo export model=tmp/yolo11n.pt format=imx imgsz=32 && \
|
||||||
|
uv pip install --system paddlepaddle x2paddle && \
|
||||||
|
# Remove extra build files
|
||||||
|
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-python-export && docker build -f docker/Dockerfile-python-export -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-python-export && docker pull $t
|
||||||
|
# Example (run): docker run -it --ipc=host $t
|
||||||
|
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t
|
||||||
39
docker/Dockerfile-runner
Executable file
39
docker/Dockerfile-runner
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
|
||||||
|
# Builds GitHub actions CI runner image for deployment to DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||||
|
# Image is CUDA-optimized for YOLO single/multi-GPU training and inference tests
|
||||||
|
|
||||||
|
# Start FROM Ultralytics GPU image
|
||||||
|
FROM ultralytics/ultralytics:latest
|
||||||
|
|
||||||
|
# Set additional environment variables for runner
|
||||||
|
ARG RUNNER_VERSION=2.329.0
|
||||||
|
ENV RUNNER_ALLOW_RUNASROOT=1 \
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /actions-runner
|
||||||
|
|
||||||
|
# Download and unpack the runner from https://github.com/actions/runner and install dependencies
|
||||||
|
RUN FILENAME=actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz && \
|
||||||
|
curl -fLso "$FILENAME" "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/${FILENAME}" && \
|
||||||
|
tar xzf "$FILENAME" && \
|
||||||
|
rm "$FILENAME" && \
|
||||||
|
# Install runner dependencies \
|
||||||
|
uv pip install --system pytest-cov && \
|
||||||
|
./bin/installdependencies.sh && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libicu-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# JSON ENTRYPOINT command to configure and start runner with default TOKEN and NAME
|
||||||
|
ENTRYPOINT ["sh", "-c", "./config.sh --url https://github.com/ultralytics/ultralytics --token ${GITHUB_RUNNER_TOKEN:-TOKEN} --name ${GITHUB_RUNNER_NAME:-NAME} --labels gpu-latest --replace && ./run.sh"]
|
||||||
|
|
||||||
|
# Usage --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
|
||||||
|
# Example (build): t=ultralytics/ultralytics:latest-runner && docker build -f docker/Dockerfile-runner -t $t .
|
||||||
|
# Example (push): docker push $t
|
||||||
|
# Example (pull): t=ultralytics/ultralytics:latest-runner && docker pull $t
|
||||||
|
# Example (run): docker run -d --restart unless-stopped -e GITHUB_RUNNER_TOKEN=TOKEN -e GITHUB_RUNNER_NAME=NAME --ipc=host --runtime=nvidia --gpus all $t
|
||||||
145
docs/README_yolo.md
Executable file
145
docs/README_yolo.md
Executable file
@@ -0,0 +1,145 @@
|
|||||||
|
<a href="https://www.ultralytics.com/" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
|
||||||
|
|
||||||
|
# 📚 Ultralytics Docs
|
||||||
|
|
||||||
|
Welcome to Ultralytics Docs, your comprehensive resource for understanding and utilizing our state-of-the-art [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) tools and models, including [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo26/). These documents are actively maintained and deployed to [https://docs.ultralytics.com](https://docs.ultralytics.com/) for easy access.
|
||||||
|
|
||||||
|
[](https://github.com/ultralytics/docs/actions/workflows/pages/pages-build-deployment)
|
||||||
|
[](https://github.com/ultralytics/docs/actions/workflows/links.yml)
|
||||||
|
[](https://github.com/ultralytics/docs/actions/workflows/check_domains.yml)
|
||||||
|
[](https://github.com/ultralytics/docs/actions/workflows/format.yml)
|
||||||
|
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://www.reddit.com/r/ultralytics/"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
|
||||||
|
|
||||||
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
[](https://pypi.org/project/ultralytics/)
|
||||||
|
[](https://clickpy.clickhouse.com/dashboard/ultralytics)
|
||||||
|
[](https://pypi.org/project/ultralytics/)
|
||||||
|
|
||||||
|
To install the `ultralytics` package in developer mode, which allows you to modify the source code directly, ensure you have [Git](https://git-scm.com/) and [Python](https://www.python.org/) 3.8 or later installed on your system. Then, follow these steps:
|
||||||
|
|
||||||
|
1. Clone the `ultralytics` repository to your local machine using Git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/ultralytics/ultralytics.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Navigate to the cloned repository's root directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install the package in editable mode (`-e`) along with its development dependencies (`[dev]`) using [pip](https://pip.pypa.io/en/stable/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -e '.[dev]'
|
||||||
|
```
|
||||||
|
|
||||||
|
This command installs the `ultralytics` package such that changes to the source code are immediately reflected in your environment, ideal for development.
|
||||||
|
|
||||||
|
## 🚀 Building and Serving Locally
|
||||||
|
|
||||||
|
The `mkdocs serve` command builds and serves a local version of your [MkDocs](https://www.mkdocs.org/) documentation. This is highly useful during development and testing to preview changes.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdocs serve
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Command Breakdown:**
|
||||||
|
- `mkdocs`: The main MkDocs command-line interface tool.
|
||||||
|
- `serve`: The subcommand used to build and locally serve your documentation site.
|
||||||
|
- **Note:**
|
||||||
|
- `mkdocs serve` includes live reloading, automatically updating the preview in your browser as you save changes to the documentation files.
|
||||||
|
- To stop the local server, simply press `CTRL+C` in your terminal.
|
||||||
|
|
||||||
|
## 🌍 Building and Serving Multi-Language
|
||||||
|
|
||||||
|
If your documentation supports multiple languages, follow these steps to build and preview all versions:
|
||||||
|
|
||||||
|
1. Stage all new or modified language Markdown (`.md`) files using Git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add docs/**/*.md -f
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Build all language versions into the `/site` directory. This script ensures that relevant root-level files are included and clears the previous build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clear existing /site directory to prevent conflicts
|
||||||
|
rm -rf site
|
||||||
|
|
||||||
|
# Build the default language site using the primary config file
|
||||||
|
mkdocs build -f docs/mkdocs.yml
|
||||||
|
|
||||||
|
# Loop through each language-specific config file and build its site
|
||||||
|
for file in docs/mkdocs_*.yml; do
|
||||||
|
echo "Building MkDocs site with $file"
|
||||||
|
mkdocs build -f "$file"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
3. To preview the complete multi-language site locally, navigate into the build output directory and start a simple [Python HTTP server](https://docs.python.org/3/library/http.server.html):
|
||||||
|
```bash
|
||||||
|
cd site
|
||||||
|
python -m http.server
|
||||||
|
# Open http://localhost:8000 in your preferred web browser
|
||||||
|
```
|
||||||
|
Access the live preview site at `http://localhost:8000`.
|
||||||
|
|
||||||
|
## 📤 Deploying Your Documentation Site
|
||||||
|
|
||||||
|
To deploy your MkDocs documentation site, choose a hosting provider and configure your deployment method. Common options include [GitHub Pages](https://pages.github.com/), GitLab Pages, or other static site hosting services.
|
||||||
|
|
||||||
|
- Configure deployment settings within your `mkdocs.yml` file.
|
||||||
|
- Use your hosting provider's recommended workflow (for example running `mkdocs build` in CI or `mkdocs gh-deploy` for GitHub Pages) to publish the generated `site/` directory.
|
||||||
|
|
||||||
|
* **GitHub Pages Deployment Example:**
|
||||||
|
If deploying to GitHub Pages, you can use the built-in command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdocs gh-deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
After deployment, you might need to update the "Custom domain" settings in your repository's settings page if you wish to use a personalized URL.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- For detailed instructions on various deployment methods, consult the official [MkDocs Deploying your docs guide](https://www.mkdocs.org/user-guide/deploying-your-docs/).
|
||||||
|
|
||||||
|
## 💡 Contribute
|
||||||
|
|
||||||
|
We deeply value contributions from the open-source community to enhance Ultralytics projects. Your input helps drive innovation! Please review our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) for detailed information on how to get involved. You can also share your feedback and ideas through our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A heartfelt thank you 🙏 to all our contributors for their dedication and support!
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
We look forward to your contributions!
|
||||||
|
|
||||||
|
## 📜 License
|
||||||
|
|
||||||
|
Ultralytics Docs are available under two licensing options to accommodate different usage scenarios:
|
||||||
|
|
||||||
|
- **AGPL-3.0 License**: Ideal for students, researchers, and enthusiasts involved in academic pursuits and open collaboration. See the [LICENSE](https://github.com/ultralytics/docs/blob/main/LICENSE) file for full details. This license promotes sharing improvements back with the community.
|
||||||
|
- **Enterprise License**: Designed for commercial applications, this license allows seamless integration of Ultralytics software and [AI models](https://docs.ultralytics.com/models/) into commercial products and services. Visit [Ultralytics Licensing](https://www.ultralytics.com/license) for more information on obtaining an Enterprise License.
|
||||||
|
|
||||||
|
## ✉️ Contact
|
||||||
|
|
||||||
|
For bug reports, feature requests, and other issues related to the documentation, please use [GitHub Issues](https://github.com/ultralytics/docs/issues). For discussions, questions, and community support, join the conversation with peers and the Ultralytics team on our [Discord server](https://discord.com/invite/ultralytics)!
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
|
||||||
|
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
|
||||||
|
</div>
|
||||||
691
docs/build_docs.py
Executable file
691
docs/build_docs.py
Executable file
@@ -0,0 +1,691 @@
|
|||||||
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||||
|
"""
|
||||||
|
Automates building and post-processing of MkDocs documentation, especially for multilingual projects.
|
||||||
|
|
||||||
|
This script streamlines generating localized documentation and updating HTML links for correct formatting.
|
||||||
|
|
||||||
|
Key Features:
|
||||||
|
- Automated building of MkDocs documentation: Compiles main documentation and localized versions from separate
|
||||||
|
MkDocs configuration files.
|
||||||
|
- Post-processing of generated HTML files: Updates HTML files to remove '.md' from internal links, ensuring
|
||||||
|
correct navigation in web-based documentation.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
- Run from the root directory of your MkDocs project.
|
||||||
|
- Ensure MkDocs is installed and configuration files (main and localized) are present.
|
||||||
|
- The script builds documentation using MkDocs, then scans HTML files in 'site' to update links.
|
||||||
|
- Ideal for projects with Markdown documentation served as a static website.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
- Requires Python and MkDocs to be installed and configured.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from minijinja import Environment, load_from_path
|
||||||
|
|
||||||
|
try:
|
||||||
|
from plugin import postprocess_site # mkdocs-ultralytics-plugin
|
||||||
|
except ImportError:
|
||||||
|
postprocess_site = None
|
||||||
|
|
||||||
|
from build_reference import build_reference_docs
|
||||||
|
|
||||||
|
from ultralytics.utils import LINUX, LOGGER, MACOS
|
||||||
|
from ultralytics.utils.tqdm import TQDM
|
||||||
|
|
||||||
|
os.environ["JUPYTER_PLATFORM_DIRS"] = "1" # fix DeprecationWarning: Jupyter is migrating to use standard platformdirs
|
||||||
|
DOCS = Path(__file__).parent.resolve()
|
||||||
|
SITE = DOCS.parent / "site"
|
||||||
|
LINK_PATTERN = re.compile(r"(https?://[^\s()<>]*[^\s()<>.,:;!?\'\"])")
|
||||||
|
TITLE_PATTERN = re.compile(r"<title>(.*?)</title>", flags=re.IGNORECASE | re.DOTALL)
|
||||||
|
MD_LINK_PATTERN = re.compile(r'(["\']?)([^"\'>\s]+?)\.md(["\']?)')
|
||||||
|
DOC_KIND_LABELS = {"Class", "Function", "Method", "Property"}
|
||||||
|
DOC_KIND_COLORS = {
|
||||||
|
"Class": "#039dfc", # blue
|
||||||
|
"Method": "#ef5eff", # magenta
|
||||||
|
"Function": "#fc9803", # orange
|
||||||
|
"Property": "#02e835", # green
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_docs_markdown(clone_repos: bool = True):
|
||||||
|
"""Build docs using mkdocs."""
|
||||||
|
LOGGER.info("Removing existing build artifacts")
|
||||||
|
shutil.rmtree(SITE, ignore_errors=True)
|
||||||
|
shutil.rmtree(DOCS / "repos", ignore_errors=True)
|
||||||
|
|
||||||
|
if clone_repos:
|
||||||
|
# Get docs repo
|
||||||
|
repo = "https://github.com/ultralytics/docs"
|
||||||
|
local_dir = DOCS / "repos" / Path(repo).name
|
||||||
|
subprocess.run(
|
||||||
|
["git", "clone", "-q", "--depth=1", "--single-branch", "-b", "main", repo, str(local_dir)], check=True
|
||||||
|
)
|
||||||
|
shutil.rmtree(DOCS / "en/compare", ignore_errors=True) # delete if exists
|
||||||
|
shutil.copytree(local_dir / "docs/en/compare", DOCS / "en/compare") # for docs
|
||||||
|
LOGGER.info(f"Cloned/Updated {repo} in {local_dir}")
|
||||||
|
|
||||||
|
# Add frontmatter
|
||||||
|
for file in TQDM((DOCS / "en").rglob("*.md"), desc="Adding frontmatter"):
|
||||||
|
update_markdown_files(file)
|
||||||
|
|
||||||
|
|
||||||
|
def update_markdown_files(md_filepath: Path):
|
||||||
|
"""Create or update a Markdown file, ensuring frontmatter is present."""
|
||||||
|
if md_filepath.exists():
|
||||||
|
content = md_filepath.read_text().strip()
|
||||||
|
|
||||||
|
# Replace apostrophes
|
||||||
|
content = content.replace("‘", "'").replace("’", "'")
|
||||||
|
|
||||||
|
# Add frontmatter if missing
|
||||||
|
if not content.strip().startswith("---\n"):
|
||||||
|
header = "---\ncomments: true\ndescription: TODO ADD DESCRIPTION\nkeywords: TODO ADD KEYWORDS\n---\n\n"
|
||||||
|
content = header + content
|
||||||
|
|
||||||
|
# Ensure MkDocs admonitions "=== " lines are preceded and followed by empty newlines
|
||||||
|
lines = content.split("\n")
|
||||||
|
new_lines = []
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
stripped_line = line.strip()
|
||||||
|
if stripped_line.startswith("=== "):
|
||||||
|
if i > 0 and new_lines[-1] != "":
|
||||||
|
new_lines.append("")
|
||||||
|
new_lines.append(line)
|
||||||
|
if i < len(lines) - 1 and lines[i + 1].strip() != "":
|
||||||
|
new_lines.append("")
|
||||||
|
else:
|
||||||
|
new_lines.append(line)
|
||||||
|
content = "\n".join(new_lines)
|
||||||
|
|
||||||
|
# Add EOF newline if missing
|
||||||
|
if not content.endswith("\n"):
|
||||||
|
content += "\n"
|
||||||
|
|
||||||
|
# Save page
|
||||||
|
md_filepath.write_text(content)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def update_docs_html():
|
||||||
|
"""Update titles, edit links, and convert plaintext links in HTML documentation in one pass."""
|
||||||
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
|
||||||
|
html_files = list(SITE.rglob("*.html"))
|
||||||
|
if not html_files:
|
||||||
|
LOGGER.info("Updated HTML files: 0")
|
||||||
|
return
|
||||||
|
desc = f"Updating HTML at {SITE}"
|
||||||
|
max_workers = os.cpu_count() or 1
|
||||||
|
with ProcessPoolExecutor(max_workers=max_workers) as executor:
|
||||||
|
pbar = TQDM(executor.map(_process_html_file, html_files), total=len(html_files), desc=desc)
|
||||||
|
updated = 0
|
||||||
|
for res in pbar:
|
||||||
|
updated += bool(res)
|
||||||
|
pbar.set_description(f"{desc} ({updated}/{len(html_files)} updated)")
|
||||||
|
|
||||||
|
|
||||||
|
def _process_html_file(html_file: Path) -> bool:
|
||||||
|
"""Process a single HTML file; returns True if modified."""
|
||||||
|
try:
|
||||||
|
content = html_file.read_text(encoding="utf-8")
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Could not read {html_file}: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
changed = False
|
||||||
|
try:
|
||||||
|
rel_path = html_file.relative_to(SITE).as_posix()
|
||||||
|
except ValueError:
|
||||||
|
rel_path = html_file.name
|
||||||
|
|
||||||
|
# For pages sourced from external repos (compare), drop edit/copy buttons to avoid wrong links
|
||||||
|
if rel_path.startswith("compare/"):
|
||||||
|
before = content
|
||||||
|
content = re.sub(
|
||||||
|
r'<a[^>]*class="[^"]*md-content__button[^"]*"[^>]*>.*?</a>',
|
||||||
|
"",
|
||||||
|
content,
|
||||||
|
flags=re.IGNORECASE | re.DOTALL,
|
||||||
|
)
|
||||||
|
if content != before:
|
||||||
|
changed = True
|
||||||
|
|
||||||
|
if rel_path == "404.html":
|
||||||
|
new_content = re.sub(r"<title>.*?</title>", "<title>Ultralytics Docs - Not Found</title>", content)
|
||||||
|
if new_content != content:
|
||||||
|
content, changed = new_content, True
|
||||||
|
|
||||||
|
new_content = update_docs_soup(content, html_file=html_file)
|
||||||
|
if new_content != content:
|
||||||
|
content, changed = new_content, True
|
||||||
|
|
||||||
|
new_content = _rewrite_md_links(content)
|
||||||
|
if new_content != content:
|
||||||
|
content, changed = new_content, True
|
||||||
|
|
||||||
|
if changed:
|
||||||
|
try:
|
||||||
|
html_file.write_text(content, encoding="utf-8")
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Could not write {html_file}: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def update_docs_soup(content: str, html_file: Path | None = None, max_title_length: int = 70) -> str:
|
||||||
|
"""Convert plaintext links to HTML hyperlinks, truncate long meta titles, and remove code line hrefs."""
|
||||||
|
title_match = TITLE_PATTERN.search(content)
|
||||||
|
needs_title_trim = bool(
|
||||||
|
title_match and len(title_match.group(1)) > max_title_length and "-" in title_match.group(1)
|
||||||
|
)
|
||||||
|
needs_link_conversion = ("<p" in content or "<li" in content) and bool(LINK_PATTERN.search(content))
|
||||||
|
needs_codelineno_cleanup = "__codelineno-" in content
|
||||||
|
rel_path = ""
|
||||||
|
if html_file:
|
||||||
|
try:
|
||||||
|
rel_path = html_file.relative_to(SITE).as_posix()
|
||||||
|
except Exception:
|
||||||
|
rel_path = html_file.as_posix()
|
||||||
|
needs_kind_highlight = "reference" in rel_path or "reference" in content
|
||||||
|
|
||||||
|
if not (needs_title_trim or needs_link_conversion or needs_codelineno_cleanup or needs_kind_highlight):
|
||||||
|
return content
|
||||||
|
|
||||||
|
try:
|
||||||
|
soup = BeautifulSoup(content, "lxml")
|
||||||
|
except Exception:
|
||||||
|
soup = BeautifulSoup(content, "html.parser")
|
||||||
|
modified = False
|
||||||
|
|
||||||
|
# Truncate long meta title if needed
|
||||||
|
title_tag = soup.find("title") if needs_title_trim else None
|
||||||
|
if title_tag and len(title_tag.text) > max_title_length and "-" in title_tag.text:
|
||||||
|
title_tag.string = title_tag.text.rsplit("-", 1)[0].strip()
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
# Find the main content area
|
||||||
|
main_content = soup.find("main") or soup.find("div", class_="md-content")
|
||||||
|
if not main_content:
|
||||||
|
return str(soup) if modified else content
|
||||||
|
|
||||||
|
# Convert plaintext links to HTML hyperlinks
|
||||||
|
if needs_link_conversion:
|
||||||
|
for paragraph in main_content.select("p, li"):
|
||||||
|
for text_node in paragraph.find_all(string=True, recursive=False):
|
||||||
|
if text_node.parent.name not in {"a", "code"}:
|
||||||
|
new_text = LINK_PATTERN.sub(r'<a href="\1">\1</a>', str(text_node))
|
||||||
|
if "<a href=" in new_text:
|
||||||
|
text_node.replace_with(BeautifulSoup(new_text, "html.parser"))
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
# Remove href attributes from code line numbers in code blocks
|
||||||
|
if needs_codelineno_cleanup:
|
||||||
|
for a in soup.select('a[href^="#__codelineno-"], a[id^="__codelineno-"]'):
|
||||||
|
if a.string: # If the a tag has text (the line number)
|
||||||
|
# Check if parent is a span with class="normal"
|
||||||
|
if a.parent and a.parent.name == "span" and "normal" in a.parent.get("class", []):
|
||||||
|
del a.parent["class"]
|
||||||
|
a.replace_with(a.string) # Replace with just the text
|
||||||
|
else: # If it has no text
|
||||||
|
a.replace_with(soup.new_tag("span")) # Replace with an empty span
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
def highlight_labels(nodes):
|
||||||
|
"""Inject doc-kind badges into headings and nav entries."""
|
||||||
|
nonlocal modified
|
||||||
|
|
||||||
|
for node in nodes:
|
||||||
|
if not node.contents:
|
||||||
|
continue
|
||||||
|
first = node.contents[0]
|
||||||
|
if hasattr(first, "get") and "doc-kind" in (first.get("class") or []):
|
||||||
|
continue
|
||||||
|
text = first if isinstance(first, str) else getattr(first, "string", "")
|
||||||
|
if not text:
|
||||||
|
continue
|
||||||
|
stripped = str(text).strip()
|
||||||
|
if not stripped:
|
||||||
|
continue
|
||||||
|
kind = stripped.split()[0].rstrip(":")
|
||||||
|
if kind not in DOC_KIND_LABELS:
|
||||||
|
continue
|
||||||
|
span = soup.new_tag("span", attrs={"class": f"doc-kind doc-kind-{kind.lower()}"})
|
||||||
|
span.string = kind.lower()
|
||||||
|
first.replace_with(span)
|
||||||
|
tail = str(text)[len(kind) :]
|
||||||
|
tail_stripped = tail.lstrip()
|
||||||
|
if tail_stripped.startswith(kind):
|
||||||
|
tail = tail_stripped[len(kind) :]
|
||||||
|
if not tail and len(node.contents) > 0:
|
||||||
|
tail = " "
|
||||||
|
if tail:
|
||||||
|
span.insert_after(tail)
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
highlight_labels(soup.select("main h1, main h2, main h3, main h4, main h5"))
|
||||||
|
highlight_labels(soup.select("nav.md-nav--secondary .md-ellipsis, nav.md-nav__list .md-ellipsis"))
|
||||||
|
|
||||||
|
if "reference" in rel_path:
|
||||||
|
for ellipsis in soup.select("nav.md-nav--secondary .md-ellipsis"):
|
||||||
|
kind = ellipsis.find(class_=lambda c: c and "doc-kind" in c.split())
|
||||||
|
text = str(kind.next_sibling).strip() if kind and kind.next_sibling else ellipsis.get_text(strip=True)
|
||||||
|
if "." not in text:
|
||||||
|
continue
|
||||||
|
ellipsis.clear()
|
||||||
|
short = text.rsplit(".", 1)[-1]
|
||||||
|
if kind:
|
||||||
|
ellipsis.append(kind)
|
||||||
|
ellipsis.append(f" {short}")
|
||||||
|
else:
|
||||||
|
ellipsis.append(short)
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
if needs_kind_highlight and not modified and soup.select(".doc-kind"):
|
||||||
|
# Ensure style injection when pre-existing badges are present
|
||||||
|
modified = True
|
||||||
|
|
||||||
|
if modified:
|
||||||
|
head = soup.find("head")
|
||||||
|
if head and not soup.select("style[data-doc-kind]"):
|
||||||
|
style = soup.new_tag("style", attrs={"data-doc-kind": "true"})
|
||||||
|
style.string = (
|
||||||
|
".doc-kind{display:inline-flex;align-items:center;gap:0.25em;padding:0.21em 0.59em;border-radius:999px;"
|
||||||
|
"font-weight:700;font-size:0.81em;letter-spacing:0.06em;text-transform:uppercase;"
|
||||||
|
"line-height:1;color:var(--doc-kind-color,#f8fafc);"
|
||||||
|
"background:var(--doc-kind-bg,rgba(255,255,255,0.12));}"
|
||||||
|
f".doc-kind-class{{--doc-kind-color:{DOC_KIND_COLORS['Class']};--doc-kind-bg:rgba(3,157,252,0.22);}}"
|
||||||
|
f".doc-kind-function{{--doc-kind-color:{DOC_KIND_COLORS['Function']};--doc-kind-bg:rgba(252,152,3,0.22);}}"
|
||||||
|
f".doc-kind-method{{--doc-kind-color:{DOC_KIND_COLORS['Method']};--doc-kind-bg:rgba(239,94,255,0.22);}}"
|
||||||
|
f".doc-kind-property{{--doc-kind-color:{DOC_KIND_COLORS['Property']};--doc-kind-bg:rgba(2,232,53,0.22);}}"
|
||||||
|
)
|
||||||
|
head.append(style)
|
||||||
|
|
||||||
|
return str(soup) if modified else content
|
||||||
|
|
||||||
|
|
||||||
|
def _rewrite_md_links(content: str) -> str:
|
||||||
|
"""Replace .md references with trailing slashes in HTML content, skipping GitHub links."""
|
||||||
|
if ".md" not in content:
|
||||||
|
return content
|
||||||
|
|
||||||
|
lines = []
|
||||||
|
for line in content.split("\n"):
|
||||||
|
if "github.com" not in line:
|
||||||
|
line = line.replace("index.md", "")
|
||||||
|
line = MD_LINK_PATTERN.sub(r"\1\2/\3", line)
|
||||||
|
lines.append(line)
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
# Precompiled regex patterns for minification
|
||||||
|
HTML_COMMENT = re.compile(r"<!--[\s\S]*?-->")
|
||||||
|
HTML_PRESERVE = re.compile(r"<(pre|code|textarea|script)[^>]*>[\s\S]*?</\1>", re.IGNORECASE)
|
||||||
|
HTML_TAG_SPACE = re.compile(r">\s+<")
|
||||||
|
HTML_MULTI_SPACE = re.compile(r"\s{2,}")
|
||||||
|
HTML_EMPTY_LINE = re.compile(r"^\s*$\n", re.MULTILINE)
|
||||||
|
CSS_COMMENT = re.compile(r"/\*[\s\S]*?\*/")
|
||||||
|
|
||||||
|
|
||||||
|
def remove_comments_and_empty_lines(content: str, file_type: str) -> str:
|
||||||
|
"""Remove comments and empty lines from a string of code, preserving newlines and URLs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content (str): Code content to process.
|
||||||
|
file_type (str): Type of file ('html', 'css', or 'js').
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
(str): Cleaned content with comments and empty lines removed.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Typical reductions for Ultralytics Docs are:
|
||||||
|
- Total HTML reduction: 2.83% (1301.56 KB saved)
|
||||||
|
- Total CSS reduction: 1.75% (2.61 KB saved)
|
||||||
|
- Total JS reduction: 13.51% (99.31 KB saved)
|
||||||
|
"""
|
||||||
|
if file_type == "html":
|
||||||
|
content = HTML_COMMENT.sub("", content) # Remove HTML comments
|
||||||
|
# Preserve whitespace in <pre>, <code>, <textarea> tags
|
||||||
|
preserved = []
|
||||||
|
|
||||||
|
def preserve(match):
|
||||||
|
"""Mark HTML blocks that should not be minified."""
|
||||||
|
preserved.append(match.group(0))
|
||||||
|
return f"___PRESERVE_{len(preserved) - 1}___"
|
||||||
|
|
||||||
|
content = HTML_PRESERVE.sub(preserve, content)
|
||||||
|
content = HTML_TAG_SPACE.sub("><", content) # Remove whitespace between tags
|
||||||
|
content = HTML_MULTI_SPACE.sub(" ", content) # Collapse multiple spaces
|
||||||
|
content = HTML_EMPTY_LINE.sub("", content) # Remove empty lines
|
||||||
|
# Restore preserved content
|
||||||
|
for i, text in enumerate(preserved):
|
||||||
|
content = content.replace(f"___PRESERVE_{i}___", text)
|
||||||
|
elif file_type == "css":
|
||||||
|
content = CSS_COMMENT.sub("", content) # Remove CSS comments
|
||||||
|
# Remove whitespace around specific characters
|
||||||
|
content = re.sub(r"\s*([{}:;,])\s*", r"\1", content)
|
||||||
|
# Remove empty lines
|
||||||
|
content = re.sub(r"^\s*\n", "", content, flags=re.MULTILINE)
|
||||||
|
# Collapse multiple spaces to single space
|
||||||
|
content = re.sub(r"\s{2,}", " ", content)
|
||||||
|
# Remove all newlines
|
||||||
|
content = re.sub(r"\n", "", content)
|
||||||
|
elif file_type == "js":
|
||||||
|
# Handle JS single-line comments (preserving http:// and https://)
|
||||||
|
lines = content.split("\n")
|
||||||
|
processed_lines = []
|
||||||
|
for line in lines:
|
||||||
|
# Only remove comments if they're not part of a URL
|
||||||
|
if "//" in line and "http://" not in line and "https://" not in line:
|
||||||
|
processed_lines.append(line.partition("//")[0])
|
||||||
|
else:
|
||||||
|
processed_lines.append(line)
|
||||||
|
content = "\n".join(processed_lines)
|
||||||
|
|
||||||
|
# Remove JS multi-line comments and clean whitespace
|
||||||
|
content = re.sub(r"/\*[\s\S]*?\*/", "", content)
|
||||||
|
# Remove empty lines
|
||||||
|
content = re.sub(r"^\s*\n", "", content, flags=re.MULTILINE)
|
||||||
|
# Collapse multiple spaces to single space
|
||||||
|
content = re.sub(r"\s{2,}", " ", content)
|
||||||
|
|
||||||
|
# Safe space removal around punctuation and operators (never include colons - breaks JS)
|
||||||
|
content = re.sub(r"\s*([;{}])\s*", r"\1", content)
|
||||||
|
content = re.sub(r"(\w)\s*\(|\)\s*{|\s*([+\-*/=])\s*", lambda m: m.group(0).replace(" ", ""), content)
|
||||||
|
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
def minify_files(html: bool = True, css: bool = True, js: bool = True):
|
||||||
|
"""Minify HTML, CSS, and JS files and print total reduction stats."""
|
||||||
|
minify, compress, jsmin = None, None, None
|
||||||
|
try:
|
||||||
|
if html:
|
||||||
|
from minify_html import minify
|
||||||
|
if css:
|
||||||
|
from csscompressor import compress
|
||||||
|
if js:
|
||||||
|
import jsmin
|
||||||
|
except ImportError as e:
|
||||||
|
LOGGER.info(f"Missing required package: {e}")
|
||||||
|
return
|
||||||
|
|
||||||
|
stats = {}
|
||||||
|
for ext, minifier in {
|
||||||
|
"html": (lambda x: minify(x, keep_closing_tags=True, minify_css=True, minify_js=True)) if html else None,
|
||||||
|
"css": compress if css else None,
|
||||||
|
"js": jsmin.jsmin if js else None,
|
||||||
|
}.items():
|
||||||
|
orig = minified = 0
|
||||||
|
files = list(SITE.rglob(f"*.{ext}"))
|
||||||
|
if not files:
|
||||||
|
continue
|
||||||
|
pbar = TQDM(files, desc=f"Minifying {ext.upper()} - reduced 0.00% (0.00 KB saved)")
|
||||||
|
for f in pbar:
|
||||||
|
content = f.read_text(encoding="utf-8")
|
||||||
|
out = minifier(content) if minifier else remove_comments_and_empty_lines(content, ext)
|
||||||
|
orig += len(content)
|
||||||
|
minified += len(out)
|
||||||
|
f.write_text(out, encoding="utf-8")
|
||||||
|
saved = orig - minified
|
||||||
|
pct = (saved / orig) * 100 if orig else 0.0
|
||||||
|
pbar.set_description(f"Minifying {ext.upper()} - reduced {pct:.2f}% ({saved / 1024:.2f} KB saved)")
|
||||||
|
stats[ext] = {"original": orig, "minified": minified}
|
||||||
|
|
||||||
|
|
||||||
|
def render_jinja_macros() -> None:
|
||||||
|
"""Render MiniJinja macros in Markdown files before building with MkDocs."""
|
||||||
|
mkdocs_yml = DOCS.parent / "mkdocs.yml"
|
||||||
|
default_yaml = DOCS.parent / "ultralytics" / "cfg" / "default.yaml"
|
||||||
|
|
||||||
|
class SafeFallbackLoader(yaml.SafeLoader):
|
||||||
|
"""SafeLoader that gracefully skips unknown tags (required for mkdocs.yml)."""
|
||||||
|
|
||||||
|
def _ignore_unknown(loader, tag_suffix, node):
|
||||||
|
"""Gracefully handle YAML tags that aren't registered."""
|
||||||
|
if isinstance(node, yaml.ScalarNode):
|
||||||
|
return loader.construct_scalar(node)
|
||||||
|
if isinstance(node, yaml.SequenceNode):
|
||||||
|
return loader.construct_sequence(node)
|
||||||
|
if isinstance(node, yaml.MappingNode):
|
||||||
|
return loader.construct_mapping(node)
|
||||||
|
return None
|
||||||
|
|
||||||
|
SafeFallbackLoader.add_multi_constructor("", _ignore_unknown)
|
||||||
|
|
||||||
|
def load_yaml(path: Path, *, safe_loader: yaml.Loader = yaml.SafeLoader) -> dict:
|
||||||
|
"""Load YAML safely, returning an empty dict on errors."""
|
||||||
|
if not path.exists():
|
||||||
|
return {}
|
||||||
|
try:
|
||||||
|
with open(path, encoding="utf-8") as f:
|
||||||
|
return yaml.load(f, Loader=safe_loader) or {}
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Could not load {path}: {e}")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
mkdocs_cfg = load_yaml(mkdocs_yml, safe_loader=SafeFallbackLoader)
|
||||||
|
extra_vars = mkdocs_cfg.get("extra", {}) or {}
|
||||||
|
site_name = mkdocs_cfg.get("site_name", "Ultralytics Docs")
|
||||||
|
extra_vars.update(load_yaml(default_yaml))
|
||||||
|
|
||||||
|
env = Environment(
|
||||||
|
loader=load_from_path([DOCS / "en", DOCS]),
|
||||||
|
auto_escape_callback=lambda _: False,
|
||||||
|
trim_blocks=True,
|
||||||
|
lstrip_blocks=True,
|
||||||
|
keep_trailing_newline=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def indent_filter(value: str, width: int = 4, first: bool = False, blank: bool = False) -> str:
|
||||||
|
"""Mimic Jinja's indent filter to preserve macros compatibility."""
|
||||||
|
prefix = " " * int(width)
|
||||||
|
result = []
|
||||||
|
for i, line in enumerate(str(value).splitlines(keepends=True)):
|
||||||
|
if not line.strip() and not blank:
|
||||||
|
result.append(line)
|
||||||
|
continue
|
||||||
|
if i == 0 and not first:
|
||||||
|
result.append(line)
|
||||||
|
else:
|
||||||
|
result.append(prefix + line)
|
||||||
|
return "".join(result)
|
||||||
|
|
||||||
|
env.add_filter("indent", indent_filter)
|
||||||
|
reserved_keys = {"name"}
|
||||||
|
base_context = {**extra_vars, "page": {"meta": {}}, "config": {"site_name": site_name}}
|
||||||
|
|
||||||
|
files_processed = 0
|
||||||
|
files_with_macros = 0
|
||||||
|
macros_total = 0
|
||||||
|
|
||||||
|
pbar = TQDM((DOCS / "en").rglob("*.md"), desc="MiniJinja: 0 macros, 0 pages")
|
||||||
|
for md_file in pbar:
|
||||||
|
if "macros" in md_file.parts or "reference" in md_file.parts:
|
||||||
|
continue
|
||||||
|
files_processed += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
content = md_file.read_text(encoding="utf-8")
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Could not read {md_file}: {e}")
|
||||||
|
continue
|
||||||
|
if "{{" not in content and "{%" not in content:
|
||||||
|
continue
|
||||||
|
|
||||||
|
parts = content.split("---\n")
|
||||||
|
frontmatter = ""
|
||||||
|
frontmatter_data = {}
|
||||||
|
markdown_content = content
|
||||||
|
if content.startswith("---\n") and len(parts) >= 3:
|
||||||
|
frontmatter = f"---\n{parts[1]}---\n"
|
||||||
|
markdown_content = "---\n".join(parts[2:])
|
||||||
|
try:
|
||||||
|
frontmatter_data = yaml.safe_load(parts[1]) or {}
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Could not parse frontmatter in {md_file}: {e}")
|
||||||
|
|
||||||
|
macro_hits = markdown_content.count("{{") + markdown_content.count("{%")
|
||||||
|
if not macro_hits:
|
||||||
|
continue
|
||||||
|
|
||||||
|
context = {k: v for k, v in base_context.items() if k not in reserved_keys}
|
||||||
|
context.update({k: v for k, v in frontmatter_data.items() if k not in reserved_keys})
|
||||||
|
context["page"] = context.get("page", {})
|
||||||
|
context["page"]["meta"] = frontmatter_data
|
||||||
|
|
||||||
|
try:
|
||||||
|
rendered = env.render_str(markdown_content, name=str(md_file.relative_to(DOCS)), **context)
|
||||||
|
except Exception as e:
|
||||||
|
LOGGER.warning(f"Error rendering macros in {md_file}: {e}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
md_file.write_text(frontmatter + rendered, encoding="utf-8")
|
||||||
|
files_with_macros += 1
|
||||||
|
macros_total += macro_hits
|
||||||
|
pbar.set_description(f"MiniJinja: {macros_total} macros, {files_with_macros} pages")
|
||||||
|
|
||||||
|
|
||||||
|
def backup_docs_sources() -> tuple[Path, list[tuple[Path, Path]]]:
|
||||||
|
"""Create a temporary backup of docs sources so we can fully restore after building."""
|
||||||
|
backup_root = Path(tempfile.mkdtemp(prefix="docs_backup_", dir=str(DOCS.parent)))
|
||||||
|
sources = [DOCS / "en", DOCS / "macros"]
|
||||||
|
copied: list[tuple[Path, Path]] = []
|
||||||
|
for src in sources:
|
||||||
|
if not src.exists():
|
||||||
|
continue
|
||||||
|
dst = backup_root / src.name
|
||||||
|
shutil.copytree(src, dst)
|
||||||
|
copied.append((src, dst))
|
||||||
|
return backup_root, copied
|
||||||
|
|
||||||
|
|
||||||
|
def restore_docs_sources(backup_root: Path, backups: list[tuple[Path, Path]]):
|
||||||
|
"""Restore docs sources from the temporary backup."""
|
||||||
|
for src, dst in backups:
|
||||||
|
shutil.rmtree(src, ignore_errors=True)
|
||||||
|
if dst.exists():
|
||||||
|
shutil.copytree(dst, src)
|
||||||
|
shutil.rmtree(backup_root, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Build docs, update titles and edit links, minify HTML, and print local server command."""
|
||||||
|
start_time = time.perf_counter()
|
||||||
|
backup_root: Path | None = None
|
||||||
|
docs_backups: list[tuple[Path, Path]] = []
|
||||||
|
restored = False
|
||||||
|
|
||||||
|
def restore_all():
|
||||||
|
"""Restore docs sources from backup once build steps complete."""
|
||||||
|
nonlocal restored
|
||||||
|
if backup_root:
|
||||||
|
LOGGER.info("Restoring docs directory from backup")
|
||||||
|
restore_docs_sources(backup_root, docs_backups)
|
||||||
|
restored = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
backup_root, docs_backups = backup_docs_sources()
|
||||||
|
prepare_docs_markdown()
|
||||||
|
build_reference_docs(update_nav=False)
|
||||||
|
render_jinja_macros()
|
||||||
|
|
||||||
|
# Remove cloned repos before serving/building to keep the tree lean during mkdocs processing
|
||||||
|
shutil.rmtree(DOCS / "repos", ignore_errors=True)
|
||||||
|
|
||||||
|
# Build the main documentation
|
||||||
|
LOGGER.info(f"Building docs from {DOCS}")
|
||||||
|
subprocess.run(["zensical", "build", "-f", str(DOCS.parent / "mkdocs.yml")], check=True)
|
||||||
|
LOGGER.info(f"Site built at {SITE}")
|
||||||
|
|
||||||
|
# Remove search index JSON files to disable search
|
||||||
|
Path(SITE / "search.json").unlink(missing_ok=True)
|
||||||
|
|
||||||
|
# Update docs HTML pages
|
||||||
|
update_docs_html()
|
||||||
|
|
||||||
|
# Post-process site for meta tags, authors, social cards, and mkdocstrings polish
|
||||||
|
if postprocess_site:
|
||||||
|
postprocess_site(
|
||||||
|
site_dir=SITE,
|
||||||
|
docs_dir=DOCS / "en",
|
||||||
|
site_url="https://docs.ultralytics.com",
|
||||||
|
default_image="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png",
|
||||||
|
default_author="glenn.jocher@ultralytics.com",
|
||||||
|
add_desc=False,
|
||||||
|
add_image=True,
|
||||||
|
add_authors=True,
|
||||||
|
add_json_ld=True,
|
||||||
|
add_share_buttons=True,
|
||||||
|
add_css=False,
|
||||||
|
verbose=True,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
LOGGER.warning("postprocess_site not available; skipping mkdocstrings postprocessing")
|
||||||
|
|
||||||
|
# Minify files
|
||||||
|
minify_files(html=False, css=False, js=False)
|
||||||
|
|
||||||
|
# Add missing pages to sitemap
|
||||||
|
sitemap = SITE / "sitemap.xml"
|
||||||
|
if sitemap.exists():
|
||||||
|
content = sitemap.read_text()
|
||||||
|
in_sitemap = set(re.findall(r"<loc>([^<]+)</loc>", content))
|
||||||
|
all_pages = {
|
||||||
|
f"https://docs.ultralytics.com/{f.relative_to(SITE).as_posix().replace('index.html', '')}"
|
||||||
|
for f in SITE.rglob("*.html")
|
||||||
|
if f.name != "404.html"
|
||||||
|
}
|
||||||
|
if missing := (all_pages - in_sitemap):
|
||||||
|
entries = "\n".join(f" <url>\n <loc>{u}</loc>\n </url>" for u in sorted(missing))
|
||||||
|
sitemap.write_text(content.replace("</urlset>", f"{entries}\n</urlset>"))
|
||||||
|
LOGGER.info(
|
||||||
|
f"{len(all_pages)}/{len(all_pages)} pages in sitemap.xml ✅ (+{len(missing)} added)"
|
||||||
|
if missing
|
||||||
|
else f"{len(in_sitemap)}/{len(all_pages)} pages in sitemap.xml ✅"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Print results and auto-serve on macOS
|
||||||
|
size = sum(f.stat().st_size for f in SITE.rglob("*") if f.is_file()) >> 20
|
||||||
|
duration = time.perf_counter() - start_time
|
||||||
|
LOGGER.info(f"Docs built correctly ✅ ({size:.1f}MB, {duration:.1f}s)")
|
||||||
|
|
||||||
|
# Restore sources before optionally serving
|
||||||
|
restore_all()
|
||||||
|
|
||||||
|
if (MACOS or LINUX) and not os.getenv("GITHUB_ACTIONS"):
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
url = "http://localhost:8000"
|
||||||
|
LOGGER.info(f"Opening browser at {url}")
|
||||||
|
webbrowser.open(url)
|
||||||
|
try:
|
||||||
|
subprocess.run(["python", "-m", "http.server", "--directory", str(SITE), "8000"], check=True)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
LOGGER.info(f"\n✅ Server stopped. Restart at {url}")
|
||||||
|
except Exception as e:
|
||||||
|
if "Address already in use" in str(e):
|
||||||
|
LOGGER.info("Port 8000 in use; skipping auto-serve. Serve manually if needed.")
|
||||||
|
else:
|
||||||
|
LOGGER.info(f"\n❌ Server failed: {e}")
|
||||||
|
else:
|
||||||
|
LOGGER.info('Serve site at http://localhost:8000 with "python -m http.server --directory site"')
|
||||||
|
finally:
|
||||||
|
if not restored:
|
||||||
|
restore_all()
|
||||||
|
shutil.rmtree(DOCS / "repos", ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
1201
docs/build_reference.py
Executable file
1201
docs/build_reference.py
Executable file
File diff suppressed because it is too large
Load Diff
210
docs/cncap_2021_2024_scenarios.md
Executable file
210
docs/cncap_2021_2024_scenarios.md
Executable file
@@ -0,0 +1,210 @@
|
|||||||
|
# C-NCAP 2021 / 2024 场景代号整理
|
||||||
|
|
||||||
|
## 说明
|
||||||
|
|
||||||
|
- 本文重点整理 `C-NCAP 2021` 与 `C-NCAP 2024` 中**带场景代号的主动安全 / AEB VRU / ADAS 项目**,因为像 `CPNA`、`CCRs`、`C2C SCPO` 这类简称主要集中在这部分。
|
||||||
|
- 乘员保护、行人被动保护、灯光等板块也很重要,但通常不使用 `CPNA` 这种短代号,所以本文不展开。
|
||||||
|
- `C-NCAP 2021` 正式发布于 `2020-08-25`,正式实施日期为 `2022-01-01`。
|
||||||
|
- `C-NCAP 2024` 文中涉及的主动安全 / AEB VRU 规则,官方解读明确说明自 `2024-07-01` 起实施。
|
||||||
|
- 表中“英文展开”优先采用公开资料中已明确给出的写法;若公开中文解读只给中文场景名,则按 C-NCAP / Euro NCAP 常见命名规则整理,并标注为 `[推断]`。
|
||||||
|
- `2024` 的官方中文解读公开得更完整;`2021` 中个别速度点、重叠率和审核项细节来自公开二次整理。若后续要做正式对外引用,建议再与原规程 PDF 逐项核对。
|
||||||
|
|
||||||
|
## 命名速查
|
||||||
|
|
||||||
|
这些代号大体可以这样拆:
|
||||||
|
|
||||||
|
- `C` = `Car`
|
||||||
|
- `P` = `Pedestrian`
|
||||||
|
- `B` = `Bicycle / Bicyclist`。在 `2024` 里很多二轮车场景实际目标物已经换成了电动自行车 `EBTA`
|
||||||
|
- `S` = `Scooter`
|
||||||
|
- `R` = `Rear`
|
||||||
|
- `F` = `Farside`,远端
|
||||||
|
- `N` = `Nearside`,近端
|
||||||
|
- `L` = `Longitudinal`,纵向同向
|
||||||
|
- `O` = `Obstructed / Obstruction`,有遮挡
|
||||||
|
- `TA` = `Turn Across`,转弯穿越类场景
|
||||||
|
- `SCP` = `Straight Crossing Path`,直行与横穿路径冲突
|
||||||
|
|
||||||
|
例如:
|
||||||
|
|
||||||
|
- `CPNA` = `Car-to-Pedestrian Nearside Adult`,车对近端成人行人横穿
|
||||||
|
- `CPFA` = `Car-to-Pedestrian Farside Adult`,车对远端成人行人横穿
|
||||||
|
- `CPLA` = `Car-to-Pedestrian Longitudinal Adult`,车对前方同向成人行人
|
||||||
|
- `CCRs` = `Car-to-Car Rear Stationary`,车对静止前车追尾
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C-NCAP 2021
|
||||||
|
|
||||||
|
### 2021 版整体特点
|
||||||
|
|
||||||
|
- 主动安全评价项核心是 `AEB CCR`、`AEB VRU_Ped`、`AEB VRU_TW`、`LKA`、`HMI`
|
||||||
|
- 可选审核项主要是 `LDW`、`SAS`、`BSD C2C`、`BSD C2TW`
|
||||||
|
- 相比更早版本,`2021` 明显加强了对行人、二轮车、夜间行人和车道辅助的考察
|
||||||
|
|
||||||
|
### 2021 版 AEB 车对车场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CCRs` | 前车静止 | `Car-to-Car Rear Stationary` | 自车直行追向静止目标车。`AEB` 主要在 `20-40 km/h`,`FCW` 主要在 `50-80 km/h`。2021 版还引入了 `-50% / 100% / +50%` 重叠率。 |
|
||||||
|
| `CCRm` | 前车慢行 | `Car-to-Car Rear moving` | 自车直行追向前方慢行目标车。`AEB` 主要在 `30-50 km/h`,`FCW` 主要在 `60-80 km/h`。同样关注重叠率和偏置。 |
|
||||||
|
|
||||||
|
### 2021 版 AEB 行人场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CPFA-25` | 远端成人横穿,25% 撞击位置 | `Car-to-Pedestrian Farside Adult` | 行人以 `6.5 km/h` 横穿,自车以 `20-60 km/h` 测。`2021` 中该场景含白天和夜晚测试。 |
|
||||||
|
| `CPFA-50` | 远端成人横穿,50% 撞击位置 | `Car-to-Pedestrian Farside Adult` | 同样是远端成人横穿,区别主要在碰撞位置。通常用于考察横穿成人目标识别和制动能力。 |
|
||||||
|
| `CPNA-25` | 近端成人横穿,25% 撞击位置 | `Car-to-Pedestrian Nearside Adult` | 行人以 `5 km/h` 横穿,自车以 `20-60 km/h` 测。近端意味着目标更突然进入本车路径。 |
|
||||||
|
| `CPNA-75` | 近端成人横穿,75% 撞击位置 | `Car-to-Pedestrian Nearside Adult` | 与 `CPNA-25` 同类,重点是近端切入,只是碰撞位置更靠车宽另一侧。 |
|
||||||
|
| `CPLA-50` | 前方同向行人,50% 撞击位置 | `Car-to-Pedestrian Longitudinal Adult` | 行人以 `5 km/h` 同向前行,自车以 `20-60 km/h` 测 `AEB`。`2021` 中含白天和夜晚测试。 |
|
||||||
|
| `CPLA-25` | 前方同向行人,25% 撞击位置 | `Car-to-Pedestrian Longitudinal Adult` | 行人以 `5 km/h` 同向前行,自车以 `50-80 km/h` 主要测 `FCW`,更偏高速预警能力。 |
|
||||||
|
|
||||||
|
补充说明:
|
||||||
|
|
||||||
|
- `2021` 的 `VRU_Ped` 重点还是直行工况,尚未像 `2024` 那样大规模加入转弯路口和遮挡“鬼探头”。
|
||||||
|
- `CPFA`、`CPLA` 中都引入了夜间测试,是 2021 版的一大增强点。
|
||||||
|
|
||||||
|
### 2021 版 AEB 二轮车场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CBNA-50` | 近端自行车横穿 | `[推断] Car-to-Bicyclist Nearside Adult` | 自行车目标物 `BTA` 以 `15 km/h` 横穿,自车以 `20-60 km/h` 测,碰撞位置 `50%`。 |
|
||||||
|
| `CSFA-50` | 远端踏板摩托车横穿 | `[推断] Car-to-Scooter Farside Adult` | 踏板摩托车目标物 `STA` 以 `20 km/h` 横穿,自车以 `30-60 km/h` 测。 |
|
||||||
|
| `CBLA-50` | 前方同向自行车 | `[推断] Car-to-Bicyclist Longitudinal Adult` | 自行车与自车同向,目标速度 `15 km/h`,自车以 `20-60 km/h` 主要测 `AEB`。 |
|
||||||
|
| `CBLA-25` | 前方同向自行车,高速预警 | `[推断] Car-to-Bicyclist Longitudinal Adult` | 同向自行车,目标速度 `15 km/h`,自车以 `50-80 km/h` 主要测 `FCW`。 |
|
||||||
|
|
||||||
|
补充说明:
|
||||||
|
|
||||||
|
- `2021` 二轮车测试是较大的升级点,尤其加入了更符合中国道路特征的 `踏板式摩托车` 目标。
|
||||||
|
- 这一版二轮车测试以白天为主,没有像 `2024` 那样加入大量转弯 / 遮挡组合。
|
||||||
|
|
||||||
|
### 2021 版其它 ADAS / 审核项目
|
||||||
|
|
||||||
|
| 项目 | 是否有固定代号 | 场景 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `LKA` | 无单独短代号 | 左偏虚线、右偏虚线、左偏实线、右偏实线 | 自车大约 `80 km/h` 行驶,以 `0.2-0.5 m/s` 偏离速度逐渐压线,要求系统把车纠回,轮胎最外缘不应超过车道线外侧 `0.2 m`。 |
|
||||||
|
| `LDW` | 无单独短代号 | 左偏实线、右偏实线 | 可选审核项。自车约 `80 km/h`,偏离速度 `0.6 / 0.7 m/s`,要求报警时间不晚于轮胎最外缘越线外 `0.2 m`。 |
|
||||||
|
| `SAS` | 无单独短代号 | 限速识别、超速报警 | 可选审核项。主要设置 `40 km/h`、`60 km/h` 限速牌;以 `40 / 60 km/h` 做识别,以 `50 / 70 km/h` 做超速报警验证。 |
|
||||||
|
| `BSD C2C` | 有系统代号,无更细短码 | 目标车超越、目标车并道 | 可选审核项。超越场景中,自车 `50 km/h`,目标车 `60 / 65 / 70 km/h` 从侧后超越;并道场景中两车都 `50 km/h`,目标车从侧后变道切入。 |
|
||||||
|
| `BSD C2TW` | 有系统代号,无更细短码 | 二轮车超越、二轮车并道 | 可选审核项。超越场景中自车 `40 km/h`、二轮车 `50 km/h`;并道场景中二者都 `50 km/h`,二轮车从侧后并道进入盲区。 |
|
||||||
|
| `HMI` | 无单独短代号 | `AEB CCR`、`AEB VRU_Ped`、`AEB VRU_TW` 的交互检查 | 重点看默认开启状态、关闭逻辑、声光触觉报警、主动式安全带等人机交互要求。 |
|
||||||
|
|
||||||
|
### 2021 版一句话总结
|
||||||
|
|
||||||
|
- `2021` 更像“直行基础盘 + 夜间行人 + 二轮车引入 + LKA / BSD / SAS / LDW 起步”。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C-NCAP 2024
|
||||||
|
|
||||||
|
### 2024 版整体特点
|
||||||
|
|
||||||
|
- 主动安全被拆得更细,评价项不再只是“直行 AEB”
|
||||||
|
- 新增大量 `交叉路口`、`转弯`、`遮挡`、`误触发`、`驾驶员监控` 场景
|
||||||
|
- `AEB VRU` 从主动安全中单独抽出,作为 `VRU 保护` 的独立附录
|
||||||
|
- 可选审核项扩展到 `TSR`、`ISLS`、`DOW`、`RCTA` 等,明显更贴近量产智驾体验
|
||||||
|
|
||||||
|
### 2024 版 AEB 车对车场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CCRs` | 前车静止 | `Car-to-Car Rear Stationary` | 自车沿规划路径追向静止目标车。`AEB` 主要在 `20 / 30 / 40 km/h`,`FCW` 在 `50 / 60 / 70 / 80 km/h`。 |
|
||||||
|
| `CCRH` | 高速前车静止 / 前遮挡车切出 | `High Speed Car-to-Car Rear` | 自车与前方遮挡车 `VT` 同速行驶,`VT` 突然切出后暴露静止目标车 `GVT`。测试速度 `80 / 120 km/h`,重点看高速识别切换与预警能力,可引入 `C-V2X`。 |
|
||||||
|
| `C2C SCP` | 直行与横穿目标车冲突 | `Car-to-Car Straight Crossing Path` | 典型无信号路口十字横穿冲突。自车 `30 / 40 km/h` 主要测 `AEB`,`50 / 60 km/h` 主要测 `FCW`;目标车 `20 / 30 / 40 / 50 km/h`。 |
|
||||||
|
| `C2C SCPO` | 有遮挡的横穿目标车冲突 | `Car-to-Car Straight Crossing Path with Obstruction` | 交叉路口前方有遮挡车,横穿目标车突然出现。自车 `50 / 60 km/h`,目标车 `40 / 50 km/h`,也是 `C-V2X` 重点适用场景。 |
|
||||||
|
| `CCFT` | 左转与对向直行车冲突 | `Car-to-Car Front Turn-Across-Path` | 自车左转、对向目标车直行。自车 `10 / 20 / 30 km/h`,目标车 `20 / 40 / 50 km/h`,要求左转提前开灯。 |
|
||||||
|
| `HMI` | 人机交互项 | `Human Machine Interface` | 检查 `AEB / FCW` 的默认启用、关闭逻辑、报警方式、安全带预紧等。 |
|
||||||
|
|
||||||
|
### 2024 版 AEB False Reaction
|
||||||
|
|
||||||
|
这部分没有像 `CPNA` 那样统一短代号,但场景非常重要,因为它专门考察“**不该触发时不要误触发**”。
|
||||||
|
|
||||||
|
| 场景 | 测试方式简述 |
|
||||||
|
| --- | --- |
|
||||||
|
| 车辆直行经过前方运动的行人 | 车辆低速直行,从右侧擦身经过同向运动的行人,检查不要误触发。 |
|
||||||
|
| 车辆直行经过对向运动的二轮车 | 左侧有对向二轮车掠过,检查横向距离识别能力和误触发抑制。 |
|
||||||
|
| 车辆直行避让本车道前方静止车辆 | 模拟驾驶员正常绕开前方静止车。 |
|
||||||
|
| 车辆直行经过单侧顺序停放的车辆 | 狭窄道路单侧连续停车,检查不要把路边静态目标都当危险物。 |
|
||||||
|
| 车辆直行经过双侧顺序停放的车辆 | 更窄、更拥挤的内部道路工况。 |
|
||||||
|
| 车辆转弯经过弯道外侧行人 | 既考察行人,也考察护栏 / 曲线道路上的误识别。 |
|
||||||
|
| 车辆直行前方行人横穿终止 | 行人本来横穿,但最后停在护栏后,系统要有合理轨迹判断。 |
|
||||||
|
| 车辆交叉路口左转遇到前方静止车辆 | 左转时对向有等待车辆,考察对本车姿态和目标位置的稳定理解。 |
|
||||||
|
| 车辆直行遇到前方右转车辆 | 前车在右转减速,自车系统不能过度激进误制动。 |
|
||||||
|
| 车辆弯道行驶超越相邻车道车辆 | 弯道中前方 / 侧前方有邻车道车辆,考察弯道空间关系识别。 |
|
||||||
|
|
||||||
|
### 2024 版 AEB VRU 行人场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 / 命名规则 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CPLA` | 前方同向行走行人 | `Car-to-Pedestrian Longitudinal Adult` | 行人 `5 km/h` 同向前行;自车 `20 / 40 km/h` 测 `AEB`,`60 / 80 km/h` 测 `FCW`。含白天和夜晚,夜间还加了对向障碍车灯光干扰。 |
|
||||||
|
| `CPNCO` | 近端被遮挡穿行儿童 | `[推断] Car-to-Pedestrian Nearside Child Obstructed` | 儿童 `5 km/h` 横穿;自车 `20 / 40 / 60 km/h`。重点是“鬼探头”式近端遮挡儿童。 |
|
||||||
|
| `CPFAO` | 远端被遮挡穿行行人 | `[推断] Car-to-Pedestrian Farside Adult Obstructed` | 成人行人 `6.5 km/h` 横穿;自车 `20 / 40 / 60 km/h`。相比 `CPNCO` 目标更大,但仍有遮挡。 |
|
||||||
|
| `CPTA-LN` | 左转遇前方近端穿行行人 | `[推断] Car-to-Pedestrian Turn-Across, Left Turn Nearside` | 自车左转,行人 `5 km/h` 从相对右侧向左侧穿行;自车 `10 / 20 / 30 km/h`。 |
|
||||||
|
| `CPTA-LF` | 左转遇前方远端穿行行人 | `[推断] Car-to-Pedestrian Turn-Across, Left Turn Farside` | 自车左转,行人 `6.5 km/h` 从相对左侧向右侧穿行;自车 `10 / 20 / 30 km/h`。 |
|
||||||
|
| `CPTA-RF` | 右转遇前方远端穿行行人 | `[推断] Car-to-Pedestrian Turn-Across, Right Turn Farside` | 自车右转,行人 `6.5 km/h` 穿行;自车 `10 / 20 km/h`。 |
|
||||||
|
|
||||||
|
### 2024 版 AEB VRU 二轮车场景
|
||||||
|
|
||||||
|
| 代号 | 中文含义 | 英文展开 / 命名规则 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `CBNAO` | 近端被遮挡穿行电动自行车 | `[推断] Car-to-Bicyclist Nearside Adult Obstructed` | 电动自行车 `15 km/h` 横穿;自车 `20 / 40 / 60 km/h`。2024 把普通自行车更换为更符合中国交通特征的 `EBTA`。 |
|
||||||
|
| `CSFAO` | 远端被遮挡穿行踏板摩托车 | `[推断] Car-to-Scooter Farside Adult Obstructed` | 踏板摩托车 `20 km/h` 横穿;自车 `20 / 40 / 60 km/h`。 |
|
||||||
|
| `CBLA` | 前方同向电动自行车 | `[推断] Car-to-Bicyclist Longitudinal Adult` | 电动自行车 `15 km/h` 同向前行;自车 `20 / 40 km/h` 测 `AEB`,`60 / 80 km/h` 测 `FCW`。 |
|
||||||
|
| `CSTA-LN` | 左转遇对向踏板摩托车 | `CSTA` 为踏板摩托车转弯冲突类命名 | 踏板摩托车 `20 km/h` 对向驶来;自车左转,速度 `10 / 20 / 30 km/h`。 |
|
||||||
|
| `CSTA-RN` | 右转遇近端踏板摩托车 | `CSTA` 为踏板摩托车转弯冲突类命名 | 踏板摩托车 `20 km/h` 与自车同向 / 近端穿行;自车右转,速度 `10 / 20 km/h`。 |
|
||||||
|
|
||||||
|
### 2024 版其它 ADAS / 可选审核项目
|
||||||
|
|
||||||
|
| 项目 | 是否有固定代号 | 场景 | 测试方式简述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `LKA` | 无更细短码 | 左偏虚线、右偏虚线、左偏实线、右偏实线 | 自车以 `0.3 / 0.5 m/s` 横向偏离速度逐渐压线,重点看保持 / 纠偏能力。 |
|
||||||
|
| `ELK` | 无更细短码 | 左侧有超车目标车时的有意识变道 | 自车 `70 km/h`、目标车 `80 km/h`,自车向左偏离并提前开灯,考察紧急车道保持干预。 |
|
||||||
|
| `DFM` | 系统代号 | 驾驶员疲劳监测 | 关注闭眼、疲劳等状态下系统是否及时提示。 |
|
||||||
|
| `DAM` | 系统代号 | 驾驶员注意力监测 | 包含头动和头不动工况,例如看左右后视镜、内后视镜、中控、仪表、右膝等。 |
|
||||||
|
| `TSR` | 系统代号 | 红灯识别 / 闯红灯预警 | 直行道 `40 / 50 / 60 km/h` 应预警;右转道 `20 km/h` 且提前开右灯时不应误报。 |
|
||||||
|
| `LDW` | 系统代号 | 直道偏离、弯道偏离 | 一般在 `80 km/h` 左右,以 `0.6 / 0.7 m/s` 偏离速度测试,要求报警不能太晚。 |
|
||||||
|
| `ISLS` | 系统代号 | `ISLD` 限速显示、`ISLI` 限速提醒 | 使用 `40 / 80 km/h` 限速牌,检查车辆能否及时显示和提醒当前限速。 |
|
||||||
|
| `BSD` | 系统代号 | 车辆超车、车辆变道、踏板摩托车超车、踏板摩托车变道 | 表格化测试点分别是:`50/60` 车车超车、`50/50` 车车变道、`30/40` 车摩超车、`25/25` 车摩变道。 |
|
||||||
|
| `DOW` | 系统代号 | 乘用车超越、电动自行车超越、踏板摩托车超越 | 车门即将开启时,从静止车旁通过的目标物分别为:乘用车 `30 km/h`、电动自行车 `15 km/h`、踏板摩托车 `25 km/h`。考察开门前预警。 |
|
||||||
|
| `RCTA` | 系统代号 | 后方儿童穿行、后方踏板摩托车穿行、后方电动自行车穿行 | 车辆倒车出库,且两侧有障碍车遮挡。官方公开文本明确给出儿童 `5 km/h`、踏板摩托车 `20 km/h`,并包含电动自行车横穿工况。 |
|
||||||
|
|
||||||
|
### 2024 版一句话总结
|
||||||
|
|
||||||
|
- `2024` 更像“路口化、遮挡化、转向化、误触发化、交互化”的主动安全规程,明显比 `2021` 更接近真实中国道路流量结构。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2021 vs 2024 变化重点
|
||||||
|
|
||||||
|
| 维度 | 2021 | 2024 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 车对车 AEB | 以追尾为主,`CCRs`、`CCRm` | 扩展到高速追尾、横穿、遮挡横穿、左转对向车 |
|
||||||
|
| 行人 AEB | `CPFA`、`CPNA`、`CPLA`,以直行为主 | 大量加入遮挡儿童、遮挡成人、左 / 右转行人 |
|
||||||
|
| 二轮车 AEB | `CBNA`、`CSFA`、`CBLA` | 换成更贴近中国交通的电动自行车 / 踏板摩托车,增加遮挡和转弯 |
|
||||||
|
| 误触发评价 | 基本没有单独成体系项目 | 新增 `AEB False Reaction`,一口气引入 10 类场景 |
|
||||||
|
| 车道辅助 | `LKA` 起步,`LDW` 为可选审核项 | `LKA + ELK + LDW` 更完整 |
|
||||||
|
| 人因监测 | 几乎未成体系引入 | 新增 `DMS`,包括 `DFM`、`DAM` |
|
||||||
|
| 低速泊车周边安全 | 主要是 `BSD / SAS / LDW` | 进一步扩展到 `DOW`、`RCTA`、`TSR`、`ISLS` |
|
||||||
|
| 网联支持 | 无明显引入 | `CCRH`、`C2C SCPO`、`TSR` 明确支持 `C-V2X` 路线 |
|
||||||
|
|
||||||
|
## 参考来源
|
||||||
|
|
||||||
|
1. C-NCAP 官方:`C-NCAP管理规则(2021年版)正式发布`
|
||||||
|
https://c-ncap.org.cn/article-detail/632e3f0d18ab42d0b43dd1aee98eed18?type=2
|
||||||
|
2. 中汽研科技:`规程解读丨C-NCAP管理规则(2024年版)附录O VRU保护--AEB VRU试验规程解读`
|
||||||
|
https://www.castc.net/news/9797.cshtml
|
||||||
|
3. 中汽研科技:`规程解读 | C-NCAP管理规则(2024年版)附录L主动安全ADAS试验规程解读`
|
||||||
|
https://www.castc.net/news/9786.cshtml
|
||||||
|
4. 中汽测评 / 汽车测试网:`《C-NCAP管理规则(2021年版)》解读——主动安全`
|
||||||
|
https://www.auto-testing.net/news/show-108044.html
|
||||||
|
5. 汽车测试网:`法规标准-C-NCAP评测标准解析(2024版)` 多页解读
|
||||||
|
https://www.auto-testing.net/news/show-125016.html
|
||||||
|
6. 与非网镜像:`C-NCAP 2024版管理规则(草案版)`,用于补充 `BSD / DOW / RCTA / TSR` 场景细节
|
||||||
|
https://www.eefocus.com/article/1641234.html
|
||||||
|
7. CSDN 资料整理:`CNCAP2021版 主动安全ADAS系统试验方法`
|
||||||
|
https://blog.csdn.net/qq_39764867/article/details/108384924
|
||||||
|
|
||||||
|
## 备注
|
||||||
|
|
||||||
|
- 如果后面你希望把这份再细化成“**只保留场景代号表**”或者“**再补每个场景的速度点和碰撞位置图示**”,可以在这份基础上继续拆成更适合做开发需求对照的版本。
|
||||||
34
docs/coming_soon_template.md
Executable file
34
docs/coming_soon_template.md
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
description: Discover what's next for Ultralytics with our under-construction page, previewing new, groundbreaking AI and ML features coming soon.
|
||||||
|
keywords: Ultralytics, coming soon, under construction, new features, AI updates, ML advancements, YOLO, technology preview
|
||||||
|
---
|
||||||
|
|
||||||
|
# Under Construction 🏗️🌟
|
||||||
|
|
||||||
|
Welcome to the [Ultralytics](https://www.ultralytics.com/) "Under Construction" page! Here, we're hard at work developing the [next generation](https://www.ultralytics.com/glossary/foundation-model) of [AI](https://www.ultralytics.com/glossary/artificial-intelligence-ai) and [ML](https://www.ultralytics.com/glossary/machine-learning-ml) innovations. This page serves as a teaser for the exciting updates and new features we're eager to share with you!
|
||||||
|
|
||||||
|
## Exciting New Features on the Way 🎉
|
||||||
|
|
||||||
|
- **Innovative Breakthroughs:** Get ready for [advanced features](https://docs.ultralytics.com/) and services designed to [transform your AI and ML experience](https://www.ultralytics.com/solutions).
|
||||||
|
- **New Horizons:** Anticipate novel products that [redefine AI and ML capabilities](https://docs.ultralytics.com/tasks/).
|
||||||
|
- **Enhanced Services:** We're upgrading our [services](https://platform.ultralytics.com) for greater [efficiency](https://docs.ultralytics.com/modes/benchmark/) and user-friendliness.
|
||||||
|
|
||||||
|
## Stay Updated 🚧
|
||||||
|
|
||||||
|
This page is your go-to resource for the latest integration updates and feature rollouts. Stay connected through:
|
||||||
|
|
||||||
|
- **Newsletter:** Subscribe to [our Ultralytics newsletter](https://www.ultralytics.com/#newsletter) for announcements, releases, and early access updates.
|
||||||
|
- **Social Media:** Follow [Ultralytics on LinkedIn](https://www.linkedin.com/company/ultralytics) for behind-the-scenes content, product news, and community highlights.
|
||||||
|
- **Blog:** Dive into the [Ultralytics AI blog](https://www.ultralytics.com/blog) for in-depth articles, tutorials, and use-case spotlights.
|
||||||
|
|
||||||
|
## We Value Your Input 🗣️
|
||||||
|
|
||||||
|
Help shape the future of Ultralytics Platform by sharing your ideas, feedback, and integration requests through our [official contact form](https://www.ultralytics.com/contact).
|
||||||
|
|
||||||
|
## Thank You, Community! 🌍
|
||||||
|
|
||||||
|
Your [contributions](https://docs.ultralytics.com/help/contributing/) and ongoing support fuel our commitment to pushing the boundaries of [AI innovation](https://github.com/ultralytics/ultralytics). Stay tuned—exciting things are just around the corner!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Excited for what's coming? Bookmark this page and check out our [Quickstart Guide](https://docs.ultralytics.com/quickstart/) to get started with our current tools while you wait. Get ready for a transformative AI and ML journey with Ultralytics! 🛠️🤖
|
||||||
1
docs/en/CNAME
Executable file
1
docs/en/CNAME
Executable file
@@ -0,0 +1 @@
|
|||||||
|
docs.ultralytics.com
|
||||||
167
docs/en/datasets/classify/caltech101.md
Executable file
167
docs/en/datasets/classify/caltech101.md
Executable file
@@ -0,0 +1,167 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the widely-used Caltech-101 dataset with 9,000 images across 101 categories. Ideal for object recognition tasks in machine learning and computer vision.
|
||||||
|
keywords: Caltech-101, dataset, object recognition, machine learning, computer vision, YOLO, deep learning, research, AI
|
||||||
|
---
|
||||||
|
|
||||||
|
# Caltech-101 Dataset
|
||||||
|
|
||||||
|
The [Caltech-101](https://data.caltech.edu/records/mzrjq-6wc02) dataset is a widely used dataset for object recognition tasks, containing around 9,000 images from 101 object categories. The categories were chosen to reflect a variety of real-world objects, and the images themselves were carefully selected and annotated to provide a challenging benchmark for object recognition algorithms.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/isc06_9qnM0"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train <a href="https://www.ultralytics.com/glossary/image-classification">Image Classification</a> Model using Caltech-256 Dataset with Ultralytics Platform
|
||||||
|
</p>
|
||||||
|
|
||||||
|
!!! note "Automatic Data Splitting"
|
||||||
|
|
||||||
|
The Caltech-101 dataset, as provided, does not come with pre-defined train/validation splits. However, when you use the training commands provided in the usage examples below, the Ultralytics framework will automatically split the dataset for you. The default split used is 80% for the training set and 20% for the validation set.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- The Caltech-101 dataset comprises around 9,000 color images divided into 101 categories.
|
||||||
|
- The categories encompass a wide variety of objects, including animals, vehicles, household items, and people.
|
||||||
|
- The number of images per category varies, with about 40 to 800 images in each category.
|
||||||
|
- Images are of variable sizes, with most images being medium resolution.
|
||||||
|
- Caltech-101 is widely used for training and testing in the field of machine learning, particularly for object recognition tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
Unlike many other datasets, the Caltech-101 dataset is not formally split into training and testing sets. Users typically create their own splits based on their specific needs. However, a common practice is to use a random subset of images for training (e.g., 30 images per category) and the remaining images for testing.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Caltech-101 dataset is extensively used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object recognition tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. Its wide variety of categories and high-quality images make it an excellent dataset for research and development in the field of [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO model on the Caltech-101 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch), you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="caltech101", epochs=100, imgsz=416)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=caltech101 model=yolo26n-cls.pt epochs=100 imgsz=416
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The Caltech-101 dataset contains high-quality color images of various objects, providing a well-structured dataset for [image classification](https://www.ultralytics.com/glossary/image-classification) tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the objects in the Caltech-101 dataset, emphasizing the significance of a diverse dataset for training robust object recognition models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Caltech-101 dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{fei2007learning,
|
||||||
|
title={Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories},
|
||||||
|
author={Fei-Fei, Li and Fergus, Rob and Perona, Pietro},
|
||||||
|
journal={Computer vision and Image understanding},
|
||||||
|
volume={106},
|
||||||
|
number={1},
|
||||||
|
pages={59--70},
|
||||||
|
year={2007},
|
||||||
|
publisher={Elsevier}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Li Fei-Fei, Rob Fergus, and Pietro Perona for creating and maintaining the Caltech-101 dataset as a valuable resource for the machine learning and computer vision research community. For more information about the Caltech-101 dataset and its creators, visit the [Caltech-101 dataset website](https://data.caltech.edu/records/mzrjq-6wc02).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Caltech-101 dataset used for in machine learning?
|
||||||
|
|
||||||
|
The [Caltech-101](https://data.caltech.edu/records/mzrjq-6wc02) dataset is widely used in machine learning for object recognition tasks. It contains around 9,000 images across 101 categories, providing a challenging benchmark for evaluating object recognition algorithms. Researchers leverage it to train and test models, especially Convolutional [Neural Networks](https://www.ultralytics.com/glossary/neural-network-nn) (CNNs) and Support Vector Machines (SVMs), in computer vision.
|
||||||
|
|
||||||
|
### How can I train an Ultralytics YOLO model on the Caltech-101 dataset?
|
||||||
|
|
||||||
|
To train an Ultralytics YOLO model on the Caltech-101 dataset, you can use the provided code snippets. For example, to train for 100 epochs:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="caltech101", epochs=100, imgsz=416)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=caltech101 model=yolo26n-cls.pt epochs=100 imgsz=416
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed arguments and options, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the key features of the Caltech-101 dataset?
|
||||||
|
|
||||||
|
The Caltech-101 dataset includes:
|
||||||
|
|
||||||
|
- Around 9,000 color images across 101 categories.
|
||||||
|
- Categories covering a diverse range of objects, including animals, vehicles, and household items.
|
||||||
|
- Variable number of images per category, typically between 40 and 800.
|
||||||
|
- Variable image sizes, with most being medium resolution.
|
||||||
|
|
||||||
|
These features make it an excellent choice for training and evaluating object recognition models in machine learning and computer vision.
|
||||||
|
|
||||||
|
### Why should I cite the Caltech-101 dataset in my research?
|
||||||
|
|
||||||
|
Citing the Caltech-101 dataset in your research acknowledges the creators' contributions and provides a reference for others who might use the dataset. The recommended citation is:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{fei2007learning,
|
||||||
|
title={Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories},
|
||||||
|
author={Fei-Fei, Li and Fergus, Rob and Perona, Pietro},
|
||||||
|
journal={Computer vision and Image understanding},
|
||||||
|
volume={106},
|
||||||
|
number={1},
|
||||||
|
pages={59--70},
|
||||||
|
year={2007},
|
||||||
|
publisher={Elsevier}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Citing helps in maintaining the integrity of academic work and assists peers in locating the original resource.
|
||||||
|
|
||||||
|
### Can I use Ultralytics Platform for training models on the Caltech-101 dataset?
|
||||||
|
|
||||||
|
Yes, you can use [Ultralytics Platform](https://platform.ultralytics.com) for training models on the Caltech-101 dataset. Ultralytics Platform provides an intuitive platform for managing datasets, training models, and deploying them without extensive coding. For a detailed guide, refer to the [how to train your custom models with Ultralytics Platform](https://www.ultralytics.com/blog/how-to-train-your-custom-models-with-ultralytics-hub) blog post.
|
||||||
148
docs/en/datasets/classify/caltech256.md
Executable file
148
docs/en/datasets/classify/caltech256.md
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Caltech-256 dataset, featuring 30,000 images across 257 categories, ideal for training and testing object recognition algorithms.
|
||||||
|
keywords: Caltech-256 dataset, object classification, image dataset, machine learning, computer vision, deep learning, YOLO, training dataset
|
||||||
|
---
|
||||||
|
|
||||||
|
# Caltech-256 Dataset
|
||||||
|
|
||||||
|
The [Caltech-256](https://data.caltech.edu/records/nyy15-4j048) dataset is an extensive collection of images used for object classification tasks. It contains around 30,000 images divided into 257 categories (256 object categories and 1 background category). The images are carefully curated and annotated to provide a challenging and diverse benchmark for object recognition algorithms.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/isc06_9qnM0"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train <a href="https://www.ultralytics.com/glossary/image-classification">Image Classification</a> Model using Caltech-256 Dataset with Ultralytics Platform
|
||||||
|
</p>
|
||||||
|
|
||||||
|
!!! note "Automatic Data Splitting"
|
||||||
|
|
||||||
|
The Caltech-256 dataset, as provided, does not come with pre-defined train/validation splits. However, when you use the training commands provided in the usage examples below, the Ultralytics framework will automatically split the dataset for you. The default split used is 80% for the training set and 20% for the validation set.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- The Caltech-256 dataset comprises around 30,000 color images divided into 257 categories.
|
||||||
|
- Each category contains a minimum of 80 images.
|
||||||
|
- The categories encompass a wide variety of real-world objects, including animals, vehicles, household items, and people.
|
||||||
|
- Images are of variable sizes and resolutions.
|
||||||
|
- Caltech-256 is widely used for training and testing in the field of machine learning, particularly for object recognition tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
Like [Caltech-101](../classify/caltech101.md), the Caltech-256 dataset does not have a formal split between training and testing sets. Users typically create their own splits according to their specific needs. A common practice is to use a random subset of images for training and the remaining images for testing.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Caltech-256 dataset is extensively used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object recognition tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. Its diverse set of categories and high-quality images make it an invaluable dataset for research and development in the field of machine learning and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO model on the Caltech-256 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch), you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="caltech256", epochs=100, imgsz=416)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=caltech256 model=yolo26n-cls.pt epochs=100 imgsz=416
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The Caltech-256 dataset contains high-quality color images of various objects, providing a comprehensive dataset for object recognition tasks. Here are some examples of images from the dataset ([credit](https://ml4a.github.io/demos/tsne_viewer.html)):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the diversity and complexity of the objects in the Caltech-256 dataset, emphasizing the importance of a varied dataset for training robust object recognition models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Caltech-256 dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{griffin2007caltech,
|
||||||
|
title={Caltech-256 object category dataset},
|
||||||
|
author={Griffin, Gregory and Holub, Alex and Perona, Pietro},
|
||||||
|
year={2007}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Gregory Griffin, Alex Holub, and Pietro Perona for creating and maintaining the Caltech-256 dataset as a valuable resource for the [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision research community. For more information about the Caltech-256 dataset and its creators, visit the [Caltech-256 dataset website](https://data.caltech.edu/records/nyy15-4j048).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Caltech-256 dataset and why is it important for machine learning?
|
||||||
|
|
||||||
|
The [Caltech-256](https://data.caltech.edu/records/nyy15-4j048) dataset is a large image dataset used primarily for object classification tasks in machine learning and computer vision. It consists of around 30,000 color images divided into 257 categories, covering a wide range of real-world objects. The dataset's diverse and high-quality images make it an excellent benchmark for evaluating object recognition algorithms, which is crucial for developing robust machine learning models.
|
||||||
|
|
||||||
|
### How can I train a YOLO model on the Caltech-256 dataset using Python or CLI?
|
||||||
|
|
||||||
|
To train a YOLO model on the Caltech-256 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch), you can use the following code snippets. Refer to the model [Training](../../modes/train.md) page for additional options.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="caltech256", epochs=100, imgsz=416)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=caltech256 model=yolo26n-cls.pt epochs=100 imgsz=416
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are the most common use cases for the Caltech-256 dataset?
|
||||||
|
|
||||||
|
The Caltech-256 dataset is widely used for various object recognition tasks such as:
|
||||||
|
|
||||||
|
- Training Convolutional [Neural Networks](https://www.ultralytics.com/glossary/neural-network-nn) (CNNs)
|
||||||
|
- Evaluating the performance of Support Vector Machines (SVMs)
|
||||||
|
- Benchmarking new deep learning algorithms
|
||||||
|
- Developing [object detection](https://www.ultralytics.com/glossary/object-detection) models using frameworks like Ultralytics YOLO
|
||||||
|
|
||||||
|
Its diversity and comprehensive annotations make it ideal for research and development in machine learning and computer vision.
|
||||||
|
|
||||||
|
### How is the Caltech-256 dataset structured and split for training and testing?
|
||||||
|
|
||||||
|
The Caltech-256 dataset does not come with a predefined split for training and testing. Users typically create their own splits according to their specific needs. A common approach is to randomly select a subset of images for training and use the remaining images for testing. This flexibility allows users to tailor the dataset to their specific project requirements and experimental setups.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO for training models on the Caltech-256 dataset?
|
||||||
|
|
||||||
|
Ultralytics YOLO models offer several advantages for training on the Caltech-256 dataset:
|
||||||
|
|
||||||
|
- **High Accuracy**: YOLO models are known for their state-of-the-art performance in object detection tasks.
|
||||||
|
- **Speed**: They provide real-time inference capabilities, making them suitable for applications requiring quick predictions.
|
||||||
|
- **Ease of Use**: With [Ultralytics Platform](https://platform.ultralytics.com), users can train, validate, and deploy models without extensive coding.
|
||||||
|
- **Pretrained Models**: Starting from pretrained models, like `yolo26n-cls.pt`, can significantly reduce training time and improve model [accuracy](https://www.ultralytics.com/glossary/accuracy).
|
||||||
|
|
||||||
|
For more details, explore our [comprehensive training guide](../../modes/train.md) and learn about [image classification](../../tasks/classify.md) with Ultralytics YOLO.
|
||||||
173
docs/en/datasets/classify/cifar10.md
Executable file
173
docs/en/datasets/classify/cifar10.md
Executable file
@@ -0,0 +1,173 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the CIFAR-10 dataset, featuring 60,000 color images in 10 classes. Learn about its structure, applications, and how to train models using YOLO.
|
||||||
|
keywords: CIFAR-10, dataset, machine learning, computer vision, image classification, YOLO, deep learning, neural networks
|
||||||
|
---
|
||||||
|
|
||||||
|
# CIFAR-10 Dataset
|
||||||
|
|
||||||
|
The [CIFAR-10](https://www.cs.toronto.edu/~kriz/cifar.html) (Canadian Institute For Advanced Research) dataset is a collection of images used widely for [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision algorithms. It was developed by researchers at the CIFAR institute and consists of 60,000 32x32 color images in 10 different classes.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/fLBbyhPbWzY"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train an <a href="https://www.ultralytics.com/glossary/image-classification">Image Classification</a> Model with CIFAR-10 Dataset using Ultralytics YOLO26
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- The CIFAR-10 dataset consists of 60,000 images, divided into 10 classes.
|
||||||
|
- Each class contains 6,000 images, split into 5,000 for training and 1,000 for testing.
|
||||||
|
- The images are colored and of size 32x32 pixels.
|
||||||
|
- The 10 different classes represent airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks.
|
||||||
|
- CIFAR-10 is commonly used for training and testing in the field of machine learning and computer vision.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The CIFAR-10 dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains 50,000 images used for training machine learning models.
|
||||||
|
2. **Testing Set**: This subset consists of 10,000 images used for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The CIFAR-10 dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in image classification tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. The diversity of the dataset in terms of classes and the presence of color images make it a well-rounded dataset for research and development in the field of machine learning and computer vision.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO model on the CIFAR-10 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 32x32, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="cifar10", epochs=100, imgsz=32)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=cifar10 model=yolo26n-cls.pt epochs=100 imgsz=32
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The CIFAR-10 dataset contains color images of various objects, providing a well-structured dataset for image classification tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the objects in the CIFAR-10 dataset, highlighting the importance of a diverse dataset for training robust image classification models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the CIFAR-10 dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@TECHREPORT{Krizhevsky09learningmultiple,
|
||||||
|
author={Alex Krizhevsky},
|
||||||
|
title={Learning multiple layers of features from tiny images},
|
||||||
|
institution={},
|
||||||
|
year={2009}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Alex Krizhevsky for creating and maintaining the CIFAR-10 dataset as a valuable resource for the machine learning and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) research community. For more information about the CIFAR-10 dataset and its creator, visit the [CIFAR-10 dataset website](https://www.cs.toronto.edu/~kriz/cifar.html).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How can I train a YOLO model on the CIFAR-10 dataset?
|
||||||
|
|
||||||
|
To train a YOLO model on the CIFAR-10 dataset using Ultralytics, you can follow the examples provided for both Python and CLI. Here is a basic example to train your model for 100 epochs with an image size of 32x32 pixels:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="cifar10", epochs=100, imgsz=32)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=cifar10 model=yolo26n-cls.pt epochs=100 imgsz=32
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the key features of the CIFAR-10 dataset?
|
||||||
|
|
||||||
|
The CIFAR-10 dataset consists of 60,000 color images divided into 10 classes. Each class contains 6,000 images, with 5,000 for training and 1,000 for testing. The images are 32x32 pixels in size and vary across the following categories:
|
||||||
|
|
||||||
|
- Airplanes
|
||||||
|
- Cars
|
||||||
|
- Birds
|
||||||
|
- Cats
|
||||||
|
- Deer
|
||||||
|
- Dogs
|
||||||
|
- Frogs
|
||||||
|
- Horses
|
||||||
|
- Ships
|
||||||
|
- Trucks
|
||||||
|
|
||||||
|
This diverse dataset is essential for training image classification models in fields such as machine learning and computer vision. For more information, visit the CIFAR-10 sections on [dataset structure](#dataset-structure) and [applications](#applications).
|
||||||
|
|
||||||
|
### Why use the CIFAR-10 dataset for image classification tasks?
|
||||||
|
|
||||||
|
The CIFAR-10 dataset is an excellent benchmark for image classification due to its diversity and structure. It contains a balanced mix of 60,000 labeled images across 10 different categories, which helps in training robust and generalized models. It is widely used for evaluating deep learning models, including Convolutional [Neural Networks](https://www.ultralytics.com/glossary/neural-network-nn) (CNNs) and other machine learning algorithms. The dataset is relatively small, making it suitable for quick experimentation and algorithm development. Explore its numerous applications in the [applications](#applications) section.
|
||||||
|
|
||||||
|
### How is the CIFAR-10 dataset structured?
|
||||||
|
|
||||||
|
The CIFAR-10 dataset is structured into two main subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: Contains 50,000 images used for training machine learning models.
|
||||||
|
2. **Testing Set**: Consists of 10,000 images for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
Each subset comprises images categorized into 10 classes, with their annotations readily available for model training and evaluation. For more detailed information, refer to the [dataset structure](#dataset-structure) section.
|
||||||
|
|
||||||
|
### How can I cite the CIFAR-10 dataset in my research?
|
||||||
|
|
||||||
|
If you use the CIFAR-10 dataset in your research or development projects, make sure to cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@TECHREPORT{Krizhevsky09learningmultiple,
|
||||||
|
author={Alex Krizhevsky},
|
||||||
|
title={Learning multiple layers of features from tiny images},
|
||||||
|
institution={},
|
||||||
|
year={2009}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Acknowledging the dataset's creators helps support continued research and development in the field. For more details, see the [citations and acknowledgments](#citations-and-acknowledgments) section.
|
||||||
|
|
||||||
|
### What are some practical examples of using the CIFAR-10 dataset?
|
||||||
|
|
||||||
|
The CIFAR-10 dataset is often used for training image classification models, such as Convolutional Neural Networks (CNNs) and Support Vector Machines (SVMs). These models can be employed in various computer vision tasks including [object detection](https://www.ultralytics.com/glossary/object-detection), [image recognition](https://www.ultralytics.com/glossary/image-recognition), and automated tagging. To see some practical examples, check the code snippets in the [usage](#usage) section.
|
||||||
141
docs/en/datasets/classify/cifar100.md
Executable file
141
docs/en/datasets/classify/cifar100.md
Executable file
@@ -0,0 +1,141 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the CIFAR-100 dataset, consisting of 60,000 32x32 color images across 100 classes. Ideal for machine learning and computer vision tasks.
|
||||||
|
keywords: CIFAR-100, dataset, machine learning, computer vision, image classification, deep learning, YOLO, training, testing, Alex Krizhevsky
|
||||||
|
---
|
||||||
|
|
||||||
|
# CIFAR-100 Dataset
|
||||||
|
|
||||||
|
The [CIFAR-100](https://www.cs.toronto.edu/~kriz/cifar.html) (Canadian Institute For Advanced Research) dataset is a significant extension of the CIFAR-10 dataset, composed of 60,000 32x32 color images in 100 different classes. It was developed by researchers at the CIFAR institute, offering a more challenging dataset for more complex machine learning and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/6bZeCs0xwO4"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on CIFAR-100 | Step-by-Step Image Classification Tutorial 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- The CIFAR-100 dataset consists of 60,000 images, divided into 100 classes.
|
||||||
|
- Each class contains 600 images, split into 500 for training and 100 for testing.
|
||||||
|
- The images are colored and of size 32x32 pixels.
|
||||||
|
- The 100 different classes are grouped into 20 coarse categories for higher level classification.
|
||||||
|
- CIFAR-100 is commonly used for training and testing in the field of machine learning and computer vision.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The CIFAR-100 dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains 50,000 images used for training machine learning models.
|
||||||
|
2. **Testing Set**: This subset consists of 10,000 images used for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The CIFAR-100 dataset is extensively used for training and evaluating deep learning models in [image classification](https://www.ultralytics.com/glossary/image-classification) tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. The diversity of the dataset in terms of classes and the presence of color images make it a more challenging and comprehensive dataset for research and development in the field of [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO model on the CIFAR-100 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 32x32, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="cifar100", epochs=100, imgsz=32)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=cifar100 model=yolo26n-cls.pt epochs=100 imgsz=32
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The CIFAR-100 dataset contains color images of various objects, providing a well-structured dataset for image classification tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the objects in the CIFAR-100 dataset, highlighting the importance of a diverse dataset for training robust image classification models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the CIFAR-100 dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@TECHREPORT{Krizhevsky09learningmultiple,
|
||||||
|
author={Alex Krizhevsky},
|
||||||
|
title={Learning multiple layers of features from tiny images},
|
||||||
|
institution={},
|
||||||
|
year={2009}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Alex Krizhevsky for creating and maintaining the CIFAR-100 dataset as a valuable resource for the machine learning and computer vision research community. For more information about the CIFAR-100 dataset and its creator, visit the [CIFAR-100 dataset website](https://www.cs.toronto.edu/~kriz/cifar.html).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the CIFAR-100 dataset and why is it significant?
|
||||||
|
|
||||||
|
The [CIFAR-100 dataset](https://www.cs.toronto.edu/~kriz/cifar.html) is a large collection of 60,000 32x32 color images classified into 100 classes. Developed by the Canadian Institute For Advanced Research (CIFAR), it provides a challenging dataset ideal for complex machine learning and computer vision tasks. Its significance lies in the diversity of classes and the small size of the images, making it a valuable resource for training and testing [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models, like Convolutional [Neural Networks](https://www.ultralytics.com/glossary/neural-network-nn) (CNNs), using frameworks such as [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo26/).
|
||||||
|
|
||||||
|
### How do I train a YOLO model on the CIFAR-100 dataset?
|
||||||
|
|
||||||
|
You can train a YOLO model on the CIFAR-100 dataset using either Python or CLI commands. Here's how:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="cifar100", epochs=100, imgsz=32)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=cifar100 model=yolo26n-cls.pt epochs=100 imgsz=32
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of available arguments, please refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the primary applications of the CIFAR-100 dataset?
|
||||||
|
|
||||||
|
The CIFAR-100 dataset is extensively used in training and evaluating deep learning models for image classification. Its diverse set of 100 classes, grouped into 20 coarse categories, provides a challenging environment for testing algorithms such as Convolutional Neural Networks (CNNs), Support Vector Machines (SVMs), and various other machine learning approaches. This dataset is a key resource in research and development within machine learning and computer vision fields, particularly for [object recognition](https://docs.ultralytics.com/tasks/classify/) and classification tasks.
|
||||||
|
|
||||||
|
### How is the CIFAR-100 dataset structured?
|
||||||
|
|
||||||
|
The CIFAR-100 dataset is split into two main subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: Contains 50,000 images used for training machine learning models.
|
||||||
|
2. **Testing Set**: Consists of 10,000 images used for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
Each of the 100 classes contains 600 images, with 500 images for training and 100 for testing, making it uniquely suited for rigorous academic and industrial research.
|
||||||
|
|
||||||
|
### Where can I find sample images and annotations from the CIFAR-100 dataset?
|
||||||
|
|
||||||
|
The CIFAR-100 dataset includes a variety of color images of various objects, making it a structured dataset for image classification tasks. You can refer to the documentation page to see [sample images and annotations](#sample-images-and-annotations). These examples highlight the dataset's diversity and complexity, important for training robust image classification models. For more datasets suitable for classification tasks, check out [Ultralytics' classification datasets overview](https://docs.ultralytics.com/datasets/classify/).
|
||||||
141
docs/en/datasets/classify/fashion-mnist.md
Executable file
141
docs/en/datasets/classify/fashion-mnist.md
Executable file
@@ -0,0 +1,141 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Fashion-MNIST dataset, a modern replacement for MNIST with 70,000 Zalando article images. Ideal for benchmarking machine learning models.
|
||||||
|
keywords: Fashion-MNIST, image classification, Zalando dataset, machine learning, deep learning, CNN, dataset overview
|
||||||
|
---
|
||||||
|
|
||||||
|
# Fashion-MNIST Dataset
|
||||||
|
|
||||||
|
The [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) dataset is a database of Zalando's article images—consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. Fashion-MNIST is intended to serve as a direct drop-in replacement for the original MNIST dataset for benchmarking [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) algorithms.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/eX5ad6udQ9Q"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to do <a href="https://www.ultralytics.com/glossary/image-classification">Image Classification</a> on Fashion MNIST Dataset using Ultralytics YOLO26
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- Fashion-MNIST contains 60,000 training images and 10,000 testing images of Zalando's article images.
|
||||||
|
- The dataset comprises grayscale images of size 28x28 pixels.
|
||||||
|
- Each pixel has a single pixel-value associated with it, indicating the lightness or darkness of that pixel, with higher numbers meaning darker. This pixel-value is an integer between 0 and 255.
|
||||||
|
- Fashion-MNIST is widely used for training and testing in the field of machine learning, especially for image classification tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Fashion-MNIST dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains 60,000 images used for training machine learning models.
|
||||||
|
2. **Testing Set**: This subset consists of 10,000 images used for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
## Labels
|
||||||
|
|
||||||
|
Each training and test example is assigned to one of the following labels:
|
||||||
|
|
||||||
|
```
|
||||||
|
0. T-shirt/top
|
||||||
|
1. Trouser
|
||||||
|
2. Pullover
|
||||||
|
3. Dress
|
||||||
|
4. Coat
|
||||||
|
5. Sandal
|
||||||
|
6. Shirt
|
||||||
|
7. Sneaker
|
||||||
|
8. Bag
|
||||||
|
9. Ankle boot
|
||||||
|
```
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Fashion-MNIST dataset is widely used for training and evaluating deep learning models in image classification tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. The dataset's simple and well-structured format makes it an essential resource for researchers and practitioners in the field of machine learning and computer vision.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a CNN model on the Fashion-MNIST dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 28x28, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="fashion-mnist", epochs=100, imgsz=28)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=fashion-mnist model=yolo26n-cls.pt epochs=100 imgsz=28
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The Fashion-MNIST dataset contains grayscale images of Zalando's article images, providing a well-structured dataset for image classification tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the Fashion-MNIST dataset, highlighting the importance of a diverse dataset for training robust image classification models.
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
If you use the Fashion-MNIST dataset in your research or development work, please acknowledge the dataset by linking to the [GitHub repository](https://github.com/zalandoresearch/fashion-mnist). This dataset was made available by Zalando Research.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Fashion-MNIST dataset and how is it different from MNIST?
|
||||||
|
|
||||||
|
The [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) dataset is a collection of 70,000 grayscale images of Zalando's article images, intended as a modern replacement for the original MNIST dataset. It serves as a benchmark for machine learning models in the context of image classification tasks. Unlike MNIST, which contains handwritten digits, Fashion-MNIST consists of 28x28-pixel images categorized into 10 fashion-related classes, such as T-shirt/top, trouser, and ankle boot.
|
||||||
|
|
||||||
|
### How can I train a YOLO model on the Fashion-MNIST dataset?
|
||||||
|
|
||||||
|
To train an Ultralytics YOLO model on the Fashion-MNIST dataset, you can use both Python and CLI commands. Here's a quick example to get you started:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model
|
||||||
|
model = YOLO("yolo26n-cls.pt")
|
||||||
|
|
||||||
|
# Train the model on Fashion-MNIST
|
||||||
|
results = model.train(data="fashion-mnist", epochs=100, imgsz=28)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo classify train data=fashion-mnist model=yolo26n-cls.pt epochs=100 imgsz=28
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed training parameters, refer to the [Training page](../../modes/train.md).
|
||||||
|
|
||||||
|
### Why should I use the Fashion-MNIST dataset for benchmarking my machine learning models?
|
||||||
|
|
||||||
|
The [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) dataset is widely recognized in the [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) community as a robust alternative to MNIST. It offers a more complex and varied set of images, making it an excellent choice for benchmarking image classification models. The dataset's structure, comprising 60,000 training images and 10,000 testing images, each labeled with one of 10 classes, makes it ideal for evaluating the performance of different machine learning algorithms in a more challenging context.
|
||||||
|
|
||||||
|
### Can I use Ultralytics YOLO for image classification tasks like Fashion-MNIST?
|
||||||
|
|
||||||
|
Yes, Ultralytics YOLO models can be used for image classification tasks, including those involving the Fashion-MNIST dataset. YOLO26, for example, supports various vision tasks such as detection, segmentation, and classification. To get started with image classification tasks, refer to the [Classification page](https://docs.ultralytics.com/tasks/classify/).
|
||||||
|
|
||||||
|
### What are the key features and structure of the Fashion-MNIST dataset?
|
||||||
|
|
||||||
|
The Fashion-MNIST dataset is divided into two main subsets: 60,000 training images and 10,000 testing images. Each image is a 28x28-pixel grayscale picture representing one of 10 fashion-related classes. The simplicity and well-structured format make it ideal for training and evaluating models in machine learning and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks. For more details on the dataset structure, see the [Dataset Structure section](#dataset-structure).
|
||||||
|
|
||||||
|
### How can I acknowledge the use of the Fashion-MNIST dataset in my research?
|
||||||
|
|
||||||
|
If you utilize the Fashion-MNIST dataset in your research or development projects, it's important to acknowledge it by linking to the [GitHub repository](https://github.com/zalandoresearch/fashion-mnist). This helps in attributing the data to Zalando Research, who made the dataset available for public use.
|
||||||
132
docs/en/datasets/classify/imagenet.md
Executable file
132
docs/en/datasets/classify/imagenet.md
Executable file
@@ -0,0 +1,132 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the extensive ImageNet dataset and discover its role in advancing deep learning in computer vision. Access pretrained models and training examples.
|
||||||
|
keywords: ImageNet, deep learning, visual recognition, computer vision, pretrained models, YOLO, dataset, object detection, image classification
|
||||||
|
---
|
||||||
|
|
||||||
|
# ImageNet Dataset
|
||||||
|
|
||||||
|
[ImageNet](https://www.image-net.org/) is a large-scale database of annotated images designed for use in visual object recognition research. It contains over 14 million images, with each image annotated using WordNet synsets, making it one of the most extensive resources available for training [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks.
|
||||||
|
|
||||||
|
## ImageNet Pretrained Models
|
||||||
|
|
||||||
|
{% include "macros/yolo-cls-perf.md" %}
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- ImageNet contains over 14 million high-resolution images spanning thousands of object categories.
|
||||||
|
- The dataset is organized according to the WordNet hierarchy, with each synset representing a category.
|
||||||
|
- ImageNet is widely used for training and benchmarking in the field of computer vision, particularly for [image classification](https://www.ultralytics.com/glossary/image-classification) and [object detection](https://www.ultralytics.com/glossary/object-detection) tasks.
|
||||||
|
- The annual ImageNet Large Scale Visual Recognition Challenge (ILSVRC) has been instrumental in advancing computer vision research.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The ImageNet dataset is organized using the WordNet hierarchy. Each node in the hierarchy represents a category, and each category is described by a synset (a collection of synonymous terms). The images in ImageNet are annotated with one or more synsets, providing a rich resource for training models to recognize various objects and their relationships.
|
||||||
|
|
||||||
|
## ImageNet Large Scale Visual Recognition Challenge (ILSVRC)
|
||||||
|
|
||||||
|
The annual [ImageNet Large Scale Visual Recognition Challenge (ILSVRC)](https://image-net.org/challenges/LSVRC/) has been an important event in the field of computer vision. It has provided a platform for researchers and developers to evaluate their algorithms and models on a large-scale dataset with standardized evaluation metrics. The ILSVRC has led to significant advancements in the development of deep learning models for image classification, object detection, and other computer vision tasks.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The ImageNet dataset is widely used for training and evaluating deep learning models in various computer vision tasks, such as image classification, object detection, and object localization. Some popular deep learning architectures, such as [AlexNet](https://en.wikipedia.org/wiki/AlexNet), [VGG](https://arxiv.org/abs/1409.1556), and [ResNet](https://arxiv.org/abs/1512.03385), were developed and benchmarked using the ImageNet dataset.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a deep learning model on the ImageNet dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 224x224, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenet", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenet model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The ImageNet dataset contains high-resolution images spanning thousands of object categories, providing a diverse and extensive dataset for training and evaluating computer vision models. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the ImageNet dataset, highlighting the importance of a diverse dataset for training robust computer vision models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the ImageNet dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{ILSVRC15,
|
||||||
|
author = {Olga Russakovsky and Jia Deng and Hao Su and Jonathan Krause and Sanjeev Satheesh and Sean Ma and Zhiheng Huang and Andrej Karpathy and Aditya Khosla and Michael Bernstein and Alexander C. Berg and Li Fei-Fei},
|
||||||
|
title={ImageNet Large Scale Visual Recognition Challenge},
|
||||||
|
year={2015},
|
||||||
|
journal={International Journal of Computer Vision (IJCV)},
|
||||||
|
volume={115},
|
||||||
|
number={3},
|
||||||
|
pages={211-252}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the ImageNet team, led by Olga Russakovsky, Jia Deng, and Li Fei-Fei, for creating and maintaining the ImageNet dataset as a valuable resource for the [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision research community. For more information about the ImageNet dataset and its creators, visit the [ImageNet website](https://www.image-net.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the ImageNet dataset and how is it used in computer vision?
|
||||||
|
|
||||||
|
The [ImageNet dataset](https://www.image-net.org/) is a large-scale database consisting of over 14 million high-resolution images categorized using WordNet synsets. It is extensively used in visual object recognition research, including image classification and object detection. The dataset's annotations and sheer volume provide a rich resource for training deep learning models. Notably, models like AlexNet, VGG, and ResNet have been trained and benchmarked using ImageNet, showcasing its role in advancing computer vision.
|
||||||
|
|
||||||
|
### How can I use a pretrained YOLO model for image classification on the ImageNet dataset?
|
||||||
|
|
||||||
|
To use a pretrained Ultralytics YOLO model for image classification on the ImageNet dataset, follow these steps:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenet", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenet model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
For more in-depth training instruction, refer to our [Training page](../../modes/train.md).
|
||||||
|
|
||||||
|
### Why should I use the Ultralytics YOLO26 pretrained models for my ImageNet dataset projects?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 pretrained models offer state-of-the-art performance in terms of speed and [accuracy](https://www.ultralytics.com/glossary/accuracy) for various computer vision tasks. For example, the YOLO26n-cls model, with a top-1 accuracy of 70.0% and a top-5 accuracy of 89.4%, is optimized for real-time applications. Pretrained models reduce the computational resources required for training from scratch and accelerate development cycles. Learn more about the performance metrics of YOLO26 models in the [ImageNet Pretrained Models section](#imagenet-pretrained-models).
|
||||||
|
|
||||||
|
### How is the ImageNet dataset structured, and why is it important?
|
||||||
|
|
||||||
|
The ImageNet dataset is organized using the WordNet hierarchy, where each node in the hierarchy represents a category described by a synset (a collection of synonymous terms). This structure allows for detailed annotations, making it ideal for training models to recognize a wide variety of objects. The diversity and annotation richness of ImageNet make it a valuable dataset for developing robust and generalizable deep learning models. More about this organization can be found in the [Dataset Structure](#dataset-structure) section.
|
||||||
|
|
||||||
|
### What role does the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) play in computer vision?
|
||||||
|
|
||||||
|
The annual [ImageNet Large Scale Visual Recognition Challenge (ILSVRC)](https://image-net.org/challenges/LSVRC/) has been pivotal in driving advancements in computer vision by providing a competitive platform for evaluating algorithms on a large-scale, standardized dataset. It offers standardized evaluation metrics, fostering innovation and development in areas such as image classification, object detection, and [image segmentation](https://www.ultralytics.com/glossary/image-segmentation). The challenge has continuously pushed the boundaries of what is possible with deep learning and computer vision technologies.
|
||||||
129
docs/en/datasets/classify/imagenet10.md
Executable file
129
docs/en/datasets/classify/imagenet10.md
Executable file
@@ -0,0 +1,129 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover ImageNet10 a compact version of ImageNet for rapid model testing and CI checks. Perfect for quick evaluations in computer vision tasks.
|
||||||
|
keywords: ImageNet10, ImageNet, Ultralytics, CI tests, sanity checks, training pipelines, computer vision, deep learning, dataset
|
||||||
|
---
|
||||||
|
|
||||||
|
# ImageNet10 Dataset
|
||||||
|
|
||||||
|
The [ImageNet10](https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/imagenet10.zip) dataset is a small-scale subset of the [ImageNet](https://www.image-net.org/) database, developed by [Ultralytics](https://www.ultralytics.com/) and designed for CI tests, sanity checks, and fast testing of training pipelines. This dataset is composed of the first image in the training set and the first image from the validation set of the first 10 classes in ImageNet. Although significantly smaller, it retains the structure and diversity of the original ImageNet dataset.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- ImageNet10 is a compact version of ImageNet, with 20 images representing the first 10 classes of the original dataset.
|
||||||
|
- The dataset is organized according to the WordNet hierarchy, mirroring the structure of the full ImageNet dataset.
|
||||||
|
- It is ideally suited for CI tests, sanity checks, and rapid testing of training pipelines in [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks.
|
||||||
|
- Although not designed for model benchmarking, it can provide a quick indication of a model's basic functionality and correctness.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The ImageNet10 dataset, like the original [ImageNet](../classify/imagenet.md), is organized using the WordNet hierarchy. Each of the 10 classes in ImageNet10 is described by a synset (a collection of synonymous terms). The images in ImageNet10 are annotated with one or more synsets, providing a compact resource for testing models to recognize various objects and their relationships.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The ImageNet10 dataset is useful for quickly testing and debugging computer vision models and pipelines. Its small size allows for rapid iteration, making it ideal for [continuous integration](../../help/CI.md) tests and sanity checks. It can also be used for fast preliminary testing of new models or changes to existing models before moving on to full-scale testing with the complete [ImageNet dataset](../classify/imagenet.md).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To test a deep learning model on the ImageNet10 dataset with an image size of 224x224, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Test Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenet10", epochs=5, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenet10 model=yolo26n-cls.pt epochs=5 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The ImageNet10 dataset contains a subset of images from the original ImageNet dataset. These images are chosen to represent the first 10 classes in the dataset, providing a diverse yet compact dataset for quick testing and evaluation.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the ImageNet10 dataset, highlighting its usefulness for sanity checks and quick testing of computer vision models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the ImageNet10 dataset in your research or development work, please cite the original ImageNet paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{ILSVRC15,
|
||||||
|
author = {Olga Russakovsky and Jia Deng and Hao Su and Jonathan Krause and Sanjeev Satheesh and Sean Ma and Zhiheng Huang and Andrej Karpathy and Aditya Khosla and Michael Bernstein and Alexander C. Berg and Li Fei-Fei},
|
||||||
|
title={ImageNet Large Scale Visual Recognition Challenge},
|
||||||
|
year={2015},
|
||||||
|
journal={International Journal of Computer Vision (IJCV)},
|
||||||
|
volume={115},
|
||||||
|
number={3},
|
||||||
|
pages={211-252}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the ImageNet team, led by Olga Russakovsky, Jia Deng, and Li Fei-Fei, for creating and maintaining the ImageNet dataset. The ImageNet10 dataset, while a compact subset, is a valuable resource for quick testing and debugging in the [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision research community. For more information about the ImageNet dataset and its creators, visit the [ImageNet website](https://www.image-net.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the ImageNet10 dataset and how is it different from the full ImageNet dataset?
|
||||||
|
|
||||||
|
The [ImageNet10](https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/imagenet10.zip) dataset is a compact subset of the original [ImageNet](https://www.image-net.org/) database, created by Ultralytics for rapid CI tests, sanity checks, and training pipeline evaluations. ImageNet10 comprises only 20 images, representing the first image in the training and validation sets of the first 10 classes in ImageNet. Despite its small size, it maintains the structure and diversity of the full dataset, making it ideal for quick testing but not for benchmarking models.
|
||||||
|
|
||||||
|
### How can I use the ImageNet10 dataset to test my deep learning model?
|
||||||
|
|
||||||
|
To test your deep learning model on the ImageNet10 dataset with an image size of 224x224, use the following code snippets.
|
||||||
|
|
||||||
|
!!! example "Test Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenet10", epochs=5, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenet10 model=yolo26n-cls.pt epochs=5 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [Training](../../modes/train.md) page for a comprehensive list of available arguments.
|
||||||
|
|
||||||
|
### Why should I use the ImageNet10 dataset for CI tests and sanity checks?
|
||||||
|
|
||||||
|
The ImageNet10 dataset is designed specifically for CI tests, sanity checks, and quick evaluations in [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) pipelines. Its small size allows for rapid iteration and testing, making it perfect for continuous integration processes where speed is crucial. By maintaining the structural complexity and diversity of the original ImageNet dataset, ImageNet10 provides a reliable indication of a model's basic functionality and correctness without the overhead of processing a large dataset.
|
||||||
|
|
||||||
|
### What are the main features of the ImageNet10 dataset?
|
||||||
|
|
||||||
|
The ImageNet10 dataset has several key features:
|
||||||
|
|
||||||
|
- **Compact Size**: With only 20 images, it allows for rapid testing and debugging.
|
||||||
|
- **Structured Organization**: Follows the WordNet hierarchy, similar to the full ImageNet dataset.
|
||||||
|
- **CI and Sanity Checks**: Ideally suited for continuous integration tests and sanity checks.
|
||||||
|
- **Not for Benchmarking**: While useful for quick model evaluations, it is not designed for extensive benchmarking.
|
||||||
|
|
||||||
|
### How does ImageNet10 compare to other small datasets like ImageNette?
|
||||||
|
|
||||||
|
While both [ImageNet10](imagenet10.md) and [ImageNette](imagenette.md) are subsets of ImageNet, they serve different purposes. ImageNet10 contains just 20 images (2 per class) from the first 10 classes of ImageNet, making it extremely lightweight for CI testing and quick sanity checks. In contrast, ImageNette contains thousands of images across 10 easily distinguishable classes, making it more suitable for actual model training and development. ImageNet10 is designed for verification of pipeline functionality, while ImageNette is better for meaningful but faster-than-full-ImageNet training experiments.
|
||||||
193
docs/en/datasets/classify/imagenette.md
Executable file
193
docs/en/datasets/classify/imagenette.md
Executable file
@@ -0,0 +1,193 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the ImageNette dataset, a subset of ImageNet with 10 classes for efficient training and evaluation of image classification models. Ideal for ML and CV projects.
|
||||||
|
keywords: ImageNette dataset, ImageNet subset, image classification, machine learning, deep learning, YOLO, Convolutional Neural Networks, ML dataset, education, training
|
||||||
|
---
|
||||||
|
|
||||||
|
# ImageNette Dataset
|
||||||
|
|
||||||
|
The [ImageNette](https://github.com/fastai/imagenette) dataset is a subset of the larger [ImageNet](https://www.image-net.org/) dataset, but it only includes 10 easily distinguishable classes. It was created to provide a quicker, easier-to-use version of ImageNet for software development and education.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- ImageNette contains images from 10 different classes such as tench, English springer, cassette player, chain saw, church, French horn, garbage truck, gas pump, golf ball, parachute.
|
||||||
|
- The dataset comprises colored images of varying dimensions.
|
||||||
|
- ImageNette is widely used for training and testing in the field of machine learning, especially for image classification tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The ImageNette dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains several thousands of images used for training machine learning models. The exact number varies per class.
|
||||||
|
2. **Validation Set**: This subset consists of several hundreds of images used for validating and benchmarking the trained models. Again, the exact number varies per class.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The ImageNette dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in image classification tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), and various other machine learning algorithms. The dataset's straightforward format and well-chosen classes make it a handy resource for both beginner and experienced practitioners in the field of [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a model on the ImageNette dataset for 100 epochs with a standard image size of 224x224, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenette", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenette model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The ImageNette dataset contains colored images of various objects and scenes, providing a diverse dataset for [image classification](https://www.ultralytics.com/glossary/image-classification) tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the ImageNette dataset, highlighting the importance of a diverse dataset for training robust image classification models.
|
||||||
|
|
||||||
|
## ImageNette160 and ImageNette320
|
||||||
|
|
||||||
|
For faster prototyping and training, the ImageNette dataset is also available in two reduced sizes: [ImageNette160](https://github.com/fastai/imagenette) and [ImageNette320](https://github.com/fastai/imagenette). These datasets maintain the same classes and structure as the full ImageNette dataset, but the images are resized to a smaller dimension. As such, these versions of the dataset are particularly useful for preliminary model testing, or when computational resources are limited.
|
||||||
|
|
||||||
|
To use these datasets, simply replace 'imagenette' with 'imagenette160' or 'imagenette320' in the training command. The following code snippets illustrate this:
|
||||||
|
|
||||||
|
!!! example "Train Example with ImageNette160"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model with ImageNette160
|
||||||
|
results = model.train(data="imagenette160", epochs=100, imgsz=160)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model with ImageNette160
|
||||||
|
yolo classify train data=imagenette160 model=yolo26n-cls.pt epochs=100 imgsz=160
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! example "Train Example with ImageNette320"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model with ImageNette320
|
||||||
|
results = model.train(data="imagenette320", epochs=100, imgsz=320)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model with ImageNette320
|
||||||
|
yolo classify train data=imagenette320 model=yolo26n-cls.pt epochs=100 imgsz=320
|
||||||
|
```
|
||||||
|
|
||||||
|
These smaller versions of the dataset allow for rapid iterations during the development process while still providing valuable and realistic image classification tasks.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the ImageNette dataset in your research or development work, please acknowledge it appropriately. For more information about the ImageNette dataset, visit the [ImageNette dataset GitHub page](https://github.com/fastai/imagenette).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the ImageNette dataset?
|
||||||
|
|
||||||
|
The [ImageNette dataset](https://github.com/fastai/imagenette) is a simplified subset of the larger [ImageNet dataset](https://www.image-net.org/), featuring only 10 easily distinguishable classes such as tench, English springer, and French horn. It was created to offer a more manageable dataset for efficient training and evaluation of image classification models. This dataset is particularly useful for quick software development and educational purposes in [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision.
|
||||||
|
|
||||||
|
### How can I use the ImageNette dataset for training a YOLO model?
|
||||||
|
|
||||||
|
To train a YOLO model on the ImageNette dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch), you can use the following commands. Make sure to have the Ultralytics YOLO environment set up.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagenette", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagenette model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, see the [Training](../../modes/train.md) documentation page.
|
||||||
|
|
||||||
|
### Why should I use ImageNette for image classification tasks?
|
||||||
|
|
||||||
|
The ImageNette dataset is advantageous for several reasons:
|
||||||
|
|
||||||
|
- **Quick and Simple**: It contains only 10 classes, making it less complex and time-consuming compared to larger datasets.
|
||||||
|
- **Educational Use**: Ideal for learning and teaching the basics of image classification since it requires less computational power and time.
|
||||||
|
- **Versatility**: Widely used to train and benchmark various machine learning models, especially in image classification.
|
||||||
|
|
||||||
|
For more details on model training and dataset management, explore the [Dataset Structure](#dataset-structure) section.
|
||||||
|
|
||||||
|
### Can the ImageNette dataset be used with different image sizes?
|
||||||
|
|
||||||
|
Yes, the ImageNette dataset is also available in two resized versions: ImageNette160 and ImageNette320. These versions help in faster prototyping and are especially useful when computational resources are limited.
|
||||||
|
|
||||||
|
!!! example "Train Example with ImageNette160"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt")
|
||||||
|
|
||||||
|
# Train the model with ImageNette160
|
||||||
|
results = model.train(data="imagenette160", epochs=100, imgsz=160)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model with ImageNette160
|
||||||
|
yolo classify train data=imagenette160 model=yolo26n-cls.pt epochs=100 imgsz=160
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, refer to [Training with ImageNette160 and ImageNette320](#imagenette160-and-imagenette320).
|
||||||
|
|
||||||
|
### What are some practical applications of the ImageNette dataset?
|
||||||
|
|
||||||
|
The ImageNette dataset is extensively used in:
|
||||||
|
|
||||||
|
- **Educational Settings**: To educate beginners in machine learning and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
- **Software Development**: For rapid prototyping and development of image classification models.
|
||||||
|
- **Deep Learning Research**: To evaluate and benchmark the performance of various deep learning models, especially Convolutional [Neural Networks](https://www.ultralytics.com/glossary/neural-network-nn) (CNNs).
|
||||||
|
|
||||||
|
Explore the [Applications](#applications) section for detailed use cases.
|
||||||
153
docs/en/datasets/classify/imagewoof.md
Executable file
153
docs/en/datasets/classify/imagewoof.md
Executable file
@@ -0,0 +1,153 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the ImageWoof dataset, a challenging subset of ImageNet focusing on 10 dog breeds, designed to enhance image classification models. Learn more on Ultralytics Docs.
|
||||||
|
keywords: ImageWoof dataset, ImageNet subset, dog breeds, image classification, deep learning, machine learning, Ultralytics, training dataset, noisy labels
|
||||||
|
---
|
||||||
|
|
||||||
|
# ImageWoof Dataset
|
||||||
|
|
||||||
|
The [ImageWoof](https://github.com/fastai/imagenette) dataset is a subset of the [ImageNet](imagenet.md) consisting of 10 classes that are challenging to classify, since they're all dog breeds. It was created as a more difficult task for [image classification](https://www.ultralytics.com/glossary/image-classification) algorithms to solve, aiming at encouraging development of more advanced models.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- ImageWoof contains images of 10 different dog breeds: Australian terrier, Border terrier, Samoyed, Beagle, Shih-Tzu, English foxhound, Rhodesian ridgeback, Dingo, Golden retriever, and Old English sheepdog.
|
||||||
|
- The dataset provides images at various resolutions (full size, 320px, 160px), accommodating for different computational capabilities and research needs.
|
||||||
|
- It also includes a version with noisy labels, providing a more realistic scenario where labels might not always be reliable.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The ImageWoof dataset structure is based on the dog breed classes, with each breed having its own directory of images. Similar to other classification datasets, it follows a split-directory format with separate folders for training and validation sets.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The ImageWoof dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in image classification tasks, especially when it comes to more complex and similar classes. The dataset's challenge lies in the subtle differences between the dog breeds, pushing the limits of model performance and generalization. It's particularly valuable for:
|
||||||
|
|
||||||
|
- Benchmarking classification model performance on fine-grained categories
|
||||||
|
- Testing model robustness against similar-looking classes
|
||||||
|
- Developing algorithms that can distinguish subtle visual differences
|
||||||
|
- Evaluating transfer learning capabilities from general to specific domains
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a CNN model on the ImageWoof dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 224x224, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="imagewoof", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=imagewoof model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dataset Variants
|
||||||
|
|
||||||
|
ImageWoof dataset comes in three different sizes to accommodate various research needs and computational capabilities:
|
||||||
|
|
||||||
|
1. **Full Size (imagewoof)**: This is the original version of the ImageWoof dataset. It contains full-sized images and is ideal for final training and performance benchmarking.
|
||||||
|
|
||||||
|
2. **Medium Size (imagewoof320)**: This version contains images resized to have a maximum edge length of 320 pixels. It's suitable for faster training without significantly sacrificing model performance.
|
||||||
|
|
||||||
|
3. **Small Size (imagewoof160)**: This version contains images resized to have a maximum edge length of 160 pixels. It's designed for rapid prototyping and experimentation where training speed is a priority.
|
||||||
|
|
||||||
|
To use these variants in your training, simply replace 'imagewoof' in the dataset argument with 'imagewoof320' or 'imagewoof160'. For example:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# For medium-sized dataset
|
||||||
|
model.train(data="imagewoof320", epochs=100, imgsz=224)
|
||||||
|
|
||||||
|
# For small-sized dataset
|
||||||
|
model.train(data="imagewoof160", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Load a pretrained model and train on the medium-sized dataset
|
||||||
|
yolo classify train model=yolo26n-cls.pt data=imagewoof320 epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
It's important to note that using smaller images will likely yield lower performance in terms of classification accuracy. However, it's an excellent way to iterate quickly in the early stages of model development and prototyping.
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The ImageWoof dataset contains colorful images of various dog breeds, providing a challenging dataset for image classification tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the subtle differences and similarities among the different dog breeds in the ImageWoof dataset, highlighting the complexity and difficulty of the classification task.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the ImageWoof dataset in your research or development work, please make sure to acknowledge the creators of the dataset by linking to the [official dataset repository](https://github.com/fastai/imagenette).
|
||||||
|
|
||||||
|
We would like to acknowledge the [FastAI](https://www.fast.ai/) team for creating and maintaining the ImageWoof dataset as a valuable resource for the [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) research community. For more information about the ImageWoof dataset, visit the [ImageWoof dataset repository](https://github.com/fastai/imagenette).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the ImageWoof dataset in Ultralytics?
|
||||||
|
|
||||||
|
The [ImageWoof](https://github.com/fastai/imagenette) dataset is a challenging subset of ImageNet focusing on 10 specific dog breeds. Created to push the limits of image classification models, it features breeds like Beagle, Shih-Tzu, and Golden Retriever. The dataset includes images at various resolutions (full size, 320px, 160px) and even noisy labels for more realistic training scenarios. This complexity makes ImageWoof ideal for developing more advanced deep learning models.
|
||||||
|
|
||||||
|
### How can I train a model using the ImageWoof dataset with Ultralytics YOLO?
|
||||||
|
|
||||||
|
To train a [Convolutional Neural Network](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNN) model on the ImageWoof dataset using Ultralytics YOLO for 100 epochs at an image size of 224x224, you can use the following code:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n-cls.pt") # Load a pretrained model
|
||||||
|
results = model.train(data="imagewoof", epochs=100, imgsz=224)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo classify train data=imagewoof model=yolo26n-cls.pt epochs=100 imgsz=224
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on available training arguments, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What versions of the ImageWoof dataset are available?
|
||||||
|
|
||||||
|
The ImageWoof dataset comes in three sizes:
|
||||||
|
|
||||||
|
1. **Full Size (imagewoof)**: Ideal for final training and benchmarking, containing full-sized images.
|
||||||
|
2. **Medium Size (imagewoof320)**: Resized images with a maximum edge length of 320 pixels, suited for faster training.
|
||||||
|
3. **Small Size (imagewoof160)**: Resized images with a maximum edge length of 160 pixels, perfect for rapid prototyping.
|
||||||
|
|
||||||
|
Use these versions by replacing 'imagewoof' in the dataset argument accordingly. Note, however, that smaller images may yield lower classification [accuracy](https://www.ultralytics.com/glossary/accuracy) but can be useful for quicker iterations.
|
||||||
|
|
||||||
|
### How do noisy labels in the ImageWoof dataset benefit training?
|
||||||
|
|
||||||
|
Noisy labels in the ImageWoof dataset simulate real-world conditions where labels might not always be accurate. Training models with this data helps develop robustness and generalization in image classification tasks. This prepares the models to handle ambiguous or mislabeled data effectively, which is often encountered in practical applications.
|
||||||
|
|
||||||
|
### What are the key challenges of using the ImageWoof dataset?
|
||||||
|
|
||||||
|
The primary challenge of the ImageWoof dataset lies in the subtle differences among the dog breeds it includes. Since it focuses on 10 closely related breeds, distinguishing between them requires more advanced and fine-tuned image classification models. This makes ImageWoof an excellent benchmark to test the capabilities and improvements of [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models.
|
||||||
210
docs/en/datasets/classify/index.md
Executable file
210
docs/en/datasets/classify/index.md
Executable file
@@ -0,0 +1,210 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to structure datasets for YOLO classification tasks. Detailed folder structure and usage examples for effective training.
|
||||||
|
keywords: YOLO, image classification, dataset structure, CIFAR-10, Ultralytics, machine learning, training data, model evaluation
|
||||||
|
---
|
||||||
|
|
||||||
|
# Image Classification Datasets Overview
|
||||||
|
|
||||||
|
## Dataset Structure for YOLO Classification Tasks
|
||||||
|
|
||||||
|
For [Ultralytics](https://www.ultralytics.com/) YOLO classification tasks, the dataset must be organized in a specific split-directory structure under the `root` directory to facilitate proper training, testing, and optional validation processes. This structure includes separate directories for training (`train`) and testing (`test`) phases, with an optional directory for validation (`val`).
|
||||||
|
|
||||||
|
Each of these directories should contain one subdirectory for each class in the dataset. The subdirectories are named after the corresponding class and contain all the images for that class. Ensure that each image file is named uniquely and stored in a common format such as JPEG or PNG.
|
||||||
|
|
||||||
|
### Folder Structure Example
|
||||||
|
|
||||||
|
Consider the [CIFAR-10](cifar10.md) dataset as an example. The folder structure should look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
cifar-10-/
|
||||||
|
|
|
||||||
|
|-- train/
|
||||||
|
| |-- airplane/
|
||||||
|
| | |-- 10008_airplane.png
|
||||||
|
| | |-- 10009_airplane.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- automobile/
|
||||||
|
| | |-- 1000_automobile.png
|
||||||
|
| | |-- 1001_automobile.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- bird/
|
||||||
|
| | |-- 10014_bird.png
|
||||||
|
| | |-- 10015_bird.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- ...
|
||||||
|
|
|
||||||
|
|-- test/
|
||||||
|
| |-- airplane/
|
||||||
|
| | |-- 10_airplane.png
|
||||||
|
| | |-- 11_airplane.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- automobile/
|
||||||
|
| | |-- 100_automobile.png
|
||||||
|
| | |-- 101_automobile.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- bird/
|
||||||
|
| | |-- 1000_bird.png
|
||||||
|
| | |-- 1001_bird.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- ...
|
||||||
|
|
|
||||||
|
|-- val/ (optional)
|
||||||
|
| |-- airplane/
|
||||||
|
| | |-- 105_airplane.png
|
||||||
|
| | |-- 106_airplane.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- automobile/
|
||||||
|
| | |-- 102_automobile.png
|
||||||
|
| | |-- 103_automobile.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- bird/
|
||||||
|
| | |-- 1045_bird.png
|
||||||
|
| | |-- 1046_bird.png
|
||||||
|
| | |-- ...
|
||||||
|
| |
|
||||||
|
| |-- ...
|
||||||
|
```
|
||||||
|
|
||||||
|
This structured approach ensures that the model can effectively learn from well-organized classes during the training phase and accurately evaluate performance during testing and validation phases.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="path/to/dataset", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=path/to/data model=yolo26n-cls.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Most built-in dataset names (for example `cifar10`, `imagenette`, or `mnist160`) will automatically download and cache the data the first time you reference them. Point `data` to a folder path only when you have curated a custom dataset.
|
||||||
|
|
||||||
|
## Supported Datasets
|
||||||
|
|
||||||
|
Ultralytics supports the following datasets with automatic download:
|
||||||
|
|
||||||
|
- [Caltech 101](caltech101.md): A dataset containing images of 101 object categories for [image classification](https://www.ultralytics.com/glossary/image-classification) tasks.
|
||||||
|
- [Caltech 256](caltech256.md): An extended version of Caltech 101 with 256 object categories and more challenging images.
|
||||||
|
- [CIFAR-10](cifar10.md): A dataset of 60K 32x32 color images in 10 classes, with 6K images per class.
|
||||||
|
- [CIFAR-100](cifar100.md): An extended version of CIFAR-10 with 100 object categories and 600 images per class.
|
||||||
|
- [Fashion-MNIST](fashion-mnist.md): A dataset consisting of 70,000 grayscale images of 10 fashion categories for image classification tasks.
|
||||||
|
- [ImageNet](imagenet.md): A large-scale dataset for [object detection](https://www.ultralytics.com/glossary/object-detection) and image classification with over 14 million images and 20,000 categories.
|
||||||
|
- [ImageNet-10](imagenet10.md): A smaller subset of ImageNet with 10 categories for faster experimentation and testing.
|
||||||
|
- [Imagenette](imagenette.md): A smaller subset of ImageNet that contains 10 easily distinguishable classes for quicker training and testing.
|
||||||
|
- [Imagewoof](imagewoof.md): A more challenging subset of ImageNet containing 10 dog breed categories for image classification tasks.
|
||||||
|
- [MNIST](mnist.md): A dataset of 70,000 grayscale images of handwritten digits for image classification tasks.
|
||||||
|
- [MNIST160](mnist.md): First 8 images of each MNIST category from the MNIST dataset. Dataset contains 160 images total.
|
||||||
|
|
||||||
|
### Adding your own dataset
|
||||||
|
|
||||||
|
If you have your own dataset and would like to use it for training classification models with Ultralytics YOLO, ensure that it follows the format specified above under "Dataset Structure" and then point your `data` argument to the dataset directory when initializing your training script.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I structure my dataset for YOLO classification tasks?
|
||||||
|
|
||||||
|
To structure your dataset for Ultralytics YOLO classification tasks, you should follow a specific split-directory format. Organize your dataset into separate directories for `train`, `test`, and optionally `val`. Each of these directories should contain subdirectories named after each class, with the corresponding images inside. This facilitates smooth training and evaluation processes. For an example, consider the [CIFAR-10](cifar10.md) dataset format:
|
||||||
|
|
||||||
|
```
|
||||||
|
cifar-10-/
|
||||||
|
|-- train/
|
||||||
|
| |-- airplane/
|
||||||
|
| |-- automobile/
|
||||||
|
| |-- bird/
|
||||||
|
| ...
|
||||||
|
|-- test/
|
||||||
|
| |-- airplane/
|
||||||
|
| |-- automobile/
|
||||||
|
| |-- bird/
|
||||||
|
| ...
|
||||||
|
|-- val/ (optional)
|
||||||
|
| |-- airplane/
|
||||||
|
| |-- automobile/
|
||||||
|
| |-- bird/
|
||||||
|
| ...
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, visit the [Dataset Structure for YOLO Classification Tasks](#dataset-structure-for-yolo-classification-tasks) section.
|
||||||
|
|
||||||
|
### What datasets are supported by Ultralytics YOLO for image classification?
|
||||||
|
|
||||||
|
Ultralytics YOLO supports automatic downloading of several datasets for image classification, including [Caltech 101](caltech101.md), [Caltech 256](caltech256.md), [CIFAR-10](cifar10.md), [CIFAR-100](cifar100.md), [Fashion-MNIST](fashion-mnist.md), [ImageNet](imagenet.md), [ImageNet-10](imagenet10.md), [Imagenette](imagenette.md), [Imagewoof](imagewoof.md), and [MNIST](mnist.md). These datasets are structured in a way that makes them easy to use with YOLO. Each dataset's page provides further details about its structure and applications.
|
||||||
|
|
||||||
|
### How do I add my own dataset for YOLO image classification?
|
||||||
|
|
||||||
|
To use your own dataset with Ultralytics YOLO, ensure it follows the specified directory format required for the classification task, with separate `train`, `test`, and optionally `val` directories, and subdirectories for each class containing the respective images. Once your dataset is structured correctly, point the `data` argument to your dataset's root directory when initializing the training script. Here's an example in Python:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="path/to/your/dataset", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
More details can be found in the [Adding your own dataset](#adding-your-own-dataset) section.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO for image classification?
|
||||||
|
|
||||||
|
Ultralytics YOLO offers several benefits for image classification, including:
|
||||||
|
|
||||||
|
- **Pretrained Models**: Load pretrained models like `yolo26n-cls.pt` to jump-start your training process.
|
||||||
|
- **Ease of Use**: Simple API and CLI commands for training and evaluation.
|
||||||
|
- **High Performance**: State-of-the-art [accuracy](https://www.ultralytics.com/glossary/accuracy) and speed, ideal for real-time applications.
|
||||||
|
- **Support for Multiple Datasets**: Seamless integration with various popular datasets like [CIFAR-10](cifar10.md), [ImageNet](imagenet.md), and more.
|
||||||
|
- **Community and Support**: Access to extensive documentation and an active community for troubleshooting and improvements.
|
||||||
|
|
||||||
|
For additional insights and real-world applications, you can explore [Ultralytics YOLO](https://www.ultralytics.com/yolo).
|
||||||
|
|
||||||
|
### How can I train a model using Ultralytics YOLO?
|
||||||
|
|
||||||
|
Training a model using Ultralytics YOLO can be done easily in both Python and CLI. Here's an example:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="path/to/dataset", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=path/to/data model=yolo26n-cls.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
These examples demonstrate the straightforward process of training a YOLO model using either approach. For more information, visit the [Usage](#usage) section and the [Train](https://docs.ultralytics.com/tasks/classify/#train) page for classification tasks.
|
||||||
157
docs/en/datasets/classify/mnist.md
Executable file
157
docs/en/datasets/classify/mnist.md
Executable file
@@ -0,0 +1,157 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the MNIST dataset, a cornerstone in machine learning for handwritten digit recognition. Learn about its structure, features, and applications.
|
||||||
|
keywords: MNIST, dataset, handwritten digits, image classification, deep learning, machine learning, training set, testing set, NIST
|
||||||
|
---
|
||||||
|
|
||||||
|
# MNIST Dataset
|
||||||
|
|
||||||
|
The [MNIST](https://en.wikipedia.org/wiki/MNIST_database) (Modified National Institute of Standards and Technology) dataset is a large database of handwritten digits that is commonly used for training various image processing systems and machine learning models. It was created by "re-mixing" the samples from NIST's original datasets and has become a benchmark for evaluating the performance of [image classification](https://www.ultralytics.com/glossary/image-classification) algorithms.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- MNIST contains 60,000 training images and 10,000 testing images of handwritten digits.
|
||||||
|
- The dataset comprises grayscale images of size 28×28 pixels.
|
||||||
|
- The images are normalized to fit into a 28×28 pixel [bounding box](https://www.ultralytics.com/glossary/bounding-box) and anti-aliased, introducing grayscale levels.
|
||||||
|
- MNIST is widely used for training and testing in the field of machine learning, especially for image classification tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The MNIST dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains 60,000 images of handwritten digits used for training machine learning models.
|
||||||
|
2. **Testing Set**: This subset consists of 10,000 images used for testing and benchmarking the trained models.
|
||||||
|
|
||||||
|
## Dataset Access
|
||||||
|
|
||||||
|
- **Original files**: Download the gzip archives from [Yann LeCun's MNIST page](http://yann.lecun.com/exdb/mnist/) if you want direct control over preprocessing.
|
||||||
|
- **Ultralytics loader**: Use `data="mnist"` (or `data="mnist160"` for the subset below) in your command and the dataset will be downloaded, converted to PNG, and cached automatically.
|
||||||
|
|
||||||
|
Each image in the dataset is labeled with the corresponding digit (0-9), making it a supervised learning dataset ideal for classification tasks.
|
||||||
|
|
||||||
|
## Extended MNIST (EMNIST)
|
||||||
|
|
||||||
|
Extended MNIST (EMNIST) is a newer dataset developed and released by NIST to be the successor to MNIST. While MNIST included images only of handwritten digits, EMNIST includes all the images from NIST Special Database 19, which is a large database of handwritten uppercase and lowercase letters as well as digits. The images in EMNIST were converted into the same 28×28 pixel format, by the same process, as were the MNIST images. Accordingly, tools that work with the older, smaller MNIST dataset will likely work unmodified with EMNIST.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The MNIST dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in image classification tasks, such as [Convolutional Neural Networks](https://www.ultralytics.com/glossary/convolutional-neural-network-cnn) (CNNs), [Support Vector Machines](https://www.ultralytics.com/glossary/support-vector-machine-svm) (SVMs), and various other machine learning algorithms. The dataset's simple and well-structured format makes it an essential resource for researchers and practitioners in the field of [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
Some common applications include:
|
||||||
|
|
||||||
|
- Benchmarking new classification algorithms
|
||||||
|
- Educational purposes for teaching machine learning concepts
|
||||||
|
- Prototyping image recognition systems
|
||||||
|
- Testing model optimization techniques
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a CNN model on the MNIST dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 28×28, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="mnist", epochs=100, imgsz=28)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=mnist model=yolo26n-cls.pt epochs=100 imgsz=28
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The MNIST dataset contains grayscale images of handwritten digits, providing a well-structured dataset for image classification tasks. Here are some examples of images from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the handwritten digits in the MNIST dataset, highlighting the importance of a diverse dataset for training robust image classification models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the MNIST dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{lecun2010mnist,
|
||||||
|
title={MNIST handwritten digit database},
|
||||||
|
author={LeCun, Yann and Cortes, Corinna and Burges, CJ},
|
||||||
|
journal={ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist},
|
||||||
|
volume={2},
|
||||||
|
year={2010}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Yann LeCun, Corinna Cortes, and Christopher J.C. Burges for creating and maintaining the MNIST dataset as a valuable resource for the machine learning and computer vision research community. For more information about the MNIST dataset and its creators, visit the [MNIST dataset website](https://en.wikipedia.org/wiki/MNIST_database).
|
||||||
|
|
||||||
|
## MNIST160 Quick Tests
|
||||||
|
|
||||||
|
Need a lightning-fast regression test? Ultralytics also exposes `data="mnist160"`, a 160-image slice containing the first eight samples from each digit class. It mirrors the MNIST directory structure, so you can swap datasets without changing any other arguments:
|
||||||
|
|
||||||
|
!!! example "Train Example with MNIST160"
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo classify train data=mnist160 model=yolo26n-cls.pt epochs=5 imgsz=28
|
||||||
|
```
|
||||||
|
|
||||||
|
Use this subset for CI pipelines or sanity checks before committing to the full 70,000-image dataset.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the MNIST dataset, and why is it important in machine learning?
|
||||||
|
|
||||||
|
The [MNIST](https://en.wikipedia.org/wiki/MNIST_database) dataset, or Modified National Institute of Standards and Technology dataset, is a widely-used collection of handwritten digits designed for training and testing image classification systems. It includes 60,000 training images and 10,000 testing images, all of which are grayscale and 28×28 pixels in size. The dataset's importance lies in its role as a standard benchmark for evaluating image classification algorithms, helping researchers and engineers to compare methods and track progress in the field.
|
||||||
|
|
||||||
|
### How can I use Ultralytics YOLO to train a model on the MNIST dataset?
|
||||||
|
|
||||||
|
To train a model on the MNIST dataset using Ultralytics YOLO, you can follow these steps:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-cls.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="mnist", epochs=100, imgsz=28)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo classify train data=mnist model=yolo26n-cls.pt epochs=100 imgsz=28
|
||||||
|
```
|
||||||
|
|
||||||
|
For a detailed list of available training arguments, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What is the difference between the MNIST and EMNIST datasets?
|
||||||
|
|
||||||
|
The MNIST dataset contains only handwritten digits, whereas the Extended MNIST (EMNIST) dataset includes both digits and uppercase and lowercase letters. EMNIST was developed as a successor to MNIST and utilizes the same 28×28 pixel format for the images, making it compatible with tools and models designed for the original MNIST dataset. This broader range of characters in EMNIST makes it useful for a wider variety of machine learning applications.
|
||||||
|
|
||||||
|
### Can I use Ultralytics Platform to train models on custom datasets like MNIST?
|
||||||
|
|
||||||
|
Yes, you can use [Ultralytics Platform](https://docs.ultralytics.com/platform/) to train models on custom datasets like MNIST. Ultralytics Platform offers a user-friendly interface for uploading datasets, training models, and managing projects without needing extensive coding knowledge. For more details on how to get started, check out the [Ultralytics Platform Quickstart](https://docs.ultralytics.com/platform/quickstart/) page.
|
||||||
|
|
||||||
|
### How does MNIST compare to other image classification datasets?
|
||||||
|
|
||||||
|
MNIST is simpler than many modern datasets like [CIFAR-10](../classify/cifar10.md) or [ImageNet](../classify/imagenet.md), making it ideal for beginners and quick experimentation. While more complex datasets offer greater challenges with color images and diverse object categories, MNIST remains valuable for its simplicity, small file size, and historical significance in the development of machine learning algorithms. For more advanced classification tasks, consider using [Fashion-MNIST](../classify/fashion-mnist.md), which maintains the same structure but features clothing items instead of digits.
|
||||||
166
docs/en/datasets/detect/african-wildlife.md
Executable file
166
docs/en/datasets/detect/african-wildlife.md
Executable file
@@ -0,0 +1,166 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore our African Wildlife Dataset featuring images of buffalo, elephant, rhino, and zebra for training computer vision models. Ideal for research and conservation.
|
||||||
|
keywords: African Wildlife Dataset, South African animals, object detection, computer vision, YOLO26, wildlife research, conservation, dataset
|
||||||
|
---
|
||||||
|
|
||||||
|
# African Wildlife Dataset
|
||||||
|
|
||||||
|
This dataset showcases four common animal classes typically found in South African nature reserves. It includes images of African wildlife such as buffalo, elephant, rhino, and zebra, providing valuable insights into their characteristics. Essential for training [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) algorithms, this dataset aids in identifying animals in various habitats, from zoos to forests, and supports wildlife research.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/EXYB-dbgJjY"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the African Wildlife Dataset | Inference, Metrics & ONNX Export 🐘
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The African wildlife objects detection dataset is split into three subsets:
|
||||||
|
|
||||||
|
- **Training set**: Contains 1052 images, each with corresponding annotations.
|
||||||
|
- **Validation set**: Includes 225 images, each with paired annotations.
|
||||||
|
- **Testing set**: Comprises 227 images, each with paired annotations.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
This dataset can be applied in various computer vision tasks such as [object detection](https://www.ultralytics.com/glossary/object-detection), object tracking, and research. Specifically, it can be used to train and evaluate models for identifying African wildlife objects in images, which can have applications in wildlife conservation, ecological research, and monitoring efforts in natural reserves and protected areas. Additionally, it can serve as a valuable resource for educational purposes, enabling students and researchers to study and understand the characteristics and behaviors of different animal species.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file defines the dataset configuration, including paths, classes, and other pertinent details. For the African wildlife dataset, the `african-wildlife.yaml` file is located at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/african-wildlife.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/african-wildlife.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/african-wildlife.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/african-wildlife.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the African wildlife dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the provided code samples. For a comprehensive list of available parameters, refer to the model's [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="african-wildlife.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=african-wildlife.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load an African wildlife fine-tuned model
|
||||||
|
|
||||||
|
# Inference using the model
|
||||||
|
results = model.predict("https://ultralytics.com/assets/african-wildlife-sample.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start prediction with a finetuned *.pt model
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/african-wildlife-sample.jpg"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The African wildlife dataset comprises a wide variety of images showcasing diverse animal species and their natural habitats. Below are examples of images from the dataset, each accompanied by its corresponding annotations.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: Here, we present a training batch consisting of mosaiced dataset images. Mosaicing, a training technique, combines multiple images into one, enriching batch diversity. This method helps enhance the model's ability to generalize across different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
This example illustrates the variety and complexity of images in the African wildlife dataset, emphasizing the benefits of including mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations, License and Acknowledgments
|
||||||
|
|
||||||
|
We'd like to thank the original dataset author, [Bianca Ferreira](https://www.kaggle.com/biancaferreira/datasets), for releasing this dataset to the community. The Ultralytics team has updated and adapted it internally so it can be used seamlessly with [Ultralytics YOLO](https://www.ultralytics.com/yolo) models. This dataset is available under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE).
|
||||||
|
|
||||||
|
If you use this dataset in your research, please cite it using the mentioned details:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
|
||||||
|
@dataset{Ferreira_African_Wildlife_Ultralytics_Adaptation_2024,
|
||||||
|
author = {Ferreira, Bianca},
|
||||||
|
title = {African Wildlife Detection Dataset (Ultralytics YOLO Adaptation)},
|
||||||
|
url = {https://docs.ultralytics.com/datasets/detect/african-wildlife/},
|
||||||
|
note = {Original dataset by Bianca Ferreira; adapted for Ultralytics YOLO by Glenn Jocher and Muhammad Rizwan Munawar},
|
||||||
|
license = {AGPL-3.0},
|
||||||
|
version = {1.0.0},
|
||||||
|
year = {2024}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the African Wildlife Dataset, and how can it be used in computer vision projects?
|
||||||
|
|
||||||
|
The African Wildlife Dataset includes images of four common animal species found in South African nature reserves: buffalo, elephant, rhino, and zebra. It is a valuable resource for training computer vision algorithms in object detection and animal identification. The dataset supports various tasks like object tracking, research, and conservation efforts. For more information on its structure and applications, refer to the [Dataset Structure](#dataset-structure) section and [Applications](#applications) of the dataset.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the African Wildlife Dataset?
|
||||||
|
|
||||||
|
You can train a YOLO26 model on the African Wildlife Dataset by using the `african-wildlife.yaml` configuration file. Below is an example of how to train the YOLO26n model for 100 epochs with an image size of 640:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="african-wildlife.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=african-wildlife.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For additional training parameters and options, refer to the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration file for the African Wildlife Dataset?
|
||||||
|
|
||||||
|
The YAML configuration file for the African Wildlife Dataset, named `african-wildlife.yaml`, can be found at [this GitHub link](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/african-wildlife.yaml). This file defines the dataset configuration, including paths, classes, and other details crucial for training [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models. See the [Dataset YAML](#dataset-yaml) section for more details.
|
||||||
|
|
||||||
|
### Can I see sample images and annotations from the African Wildlife Dataset?
|
||||||
|
|
||||||
|
Yes, the African Wildlife Dataset includes a wide variety of images showcasing diverse animal species in their natural habitats. You can view sample images and their corresponding annotations in the [Sample Images and Annotations](#sample-images-and-annotations) section. This section also illustrates the use of mosaicing technique to combine multiple images into one for enriched batch diversity, enhancing the model's generalization ability.
|
||||||
|
|
||||||
|
### How can the African Wildlife Dataset be used to support wildlife conservation and research?
|
||||||
|
|
||||||
|
The African Wildlife Dataset is ideal for supporting wildlife conservation and research by enabling the training and evaluation of models to identify African wildlife in different habitats. These models can assist in [monitoring animal populations](https://docs.ultralytics.com/solutions/), studying their behavior, and recognizing conservation needs. Additionally, the dataset can be utilized for educational purposes, helping students and researchers understand the characteristics and behaviors of different animal species. More details can be found in the [Applications](#applications) section.
|
||||||
153
docs/en/datasets/detect/argoverse.md
Executable file
153
docs/en/datasets/detect/argoverse.md
Executable file
@@ -0,0 +1,153 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the comprehensive Argoverse dataset by Argo AI for 3D tracking, motion forecasting, and stereo depth estimation in autonomous driving research.
|
||||||
|
keywords: Argoverse dataset, autonomous driving, 3D tracking, motion forecasting, stereo depth estimation, Argo AI, LiDAR point clouds, high-resolution images, HD maps
|
||||||
|
---
|
||||||
|
|
||||||
|
# Argoverse Dataset
|
||||||
|
|
||||||
|
The [Argoverse](https://www.argoverse.org/) dataset is a collection of data designed to support research in autonomous driving tasks, such as 3D tracking, motion forecasting, and stereo depth estimation. Developed by Argo AI, the dataset provides a wide range of high-quality sensor data, including high-resolution images, LiDAR point clouds, and map data.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
The Argoverse dataset `*.zip` file required for training was removed from Amazon S3 after the shutdown of Argo AI by Ford, but we have made it available for manual download on [Google Drive](https://drive.google.com/file/d/1st9qW3BeIwQsnR0t8mRpvbsSWIo16ACi/view?usp=drive_link).
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- Argoverse contains over 290K labeled 3D object tracks and 5 million object instances across 1,263 distinct scenes.
|
||||||
|
- The dataset includes high-resolution camera images, LiDAR point clouds, and richly annotated HD maps.
|
||||||
|
- Annotations include 3D bounding boxes for objects, object tracks, and trajectory information.
|
||||||
|
- Argoverse provides multiple subsets for different tasks, such as 3D tracking, motion forecasting, and stereo depth estimation.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Argoverse dataset is organized into three main subsets:
|
||||||
|
|
||||||
|
1. **Argoverse 3D Tracking**: This subset contains 113 scenes with over 290K labeled 3D object tracks, focusing on 3D object tracking tasks. It includes LiDAR point clouds, camera images, and sensor calibration information.
|
||||||
|
2. **Argoverse Motion Forecasting**: This subset consists of 324K vehicle trajectories collected from 60 hours of driving data, suitable for motion forecasting tasks.
|
||||||
|
3. **Argoverse Stereo Depth Estimation**: This subset is designed for stereo depth estimation tasks and includes over 10K stereo image pairs with corresponding LiDAR point clouds for ground truth depth estimation.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Argoverse dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in autonomous driving tasks such as 3D object tracking, motion forecasting, and stereo depth estimation. The dataset's diverse set of sensor data, object annotations, and map information make it a valuable resource for researchers and practitioners in the field of autonomous driving.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. For the case of the Argoverse dataset, the `Argoverse.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Argoverse.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Argoverse.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/Argoverse.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/Argoverse.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Argoverse dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="Argoverse.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=Argoverse.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Argoverse dataset contains a diverse set of sensor data, including camera images, LiDAR point clouds, and HD map information, providing rich context for autonomous driving tasks. Here are some examples of data from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Argoverse 3D Tracking**: This image demonstrates an example of 3D object tracking, where objects are annotated with 3D bounding boxes. The dataset provides LiDAR point clouds and camera images to facilitate the development of models for this task.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the Argoverse dataset and highlights the importance of high-quality sensor data for autonomous driving tasks.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Argoverse dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{chang2019argoverse,
|
||||||
|
title={Argoverse: 3D Tracking and Forecasting with Rich Maps},
|
||||||
|
author={Chang, Ming-Fang and Lambert, John and Sangkloy, Patsorn and Singh, Jagjeet and Bak, Slawomir and Hartnett, Andrew and Wang, Dequan and Carr, Peter and Lucey, Simon and Ramanan, Deva and others},
|
||||||
|
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
||||||
|
pages={8748--8757},
|
||||||
|
year={2019}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Argo AI for creating and maintaining the Argoverse dataset as a valuable resource for the autonomous driving research community. For more information about the Argoverse dataset and its creators, visit the [Argoverse dataset website](https://www.argoverse.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Argoverse dataset and its key features?
|
||||||
|
|
||||||
|
The [Argoverse](https://www.argoverse.org/) dataset, developed by Argo AI, supports autonomous driving research. It includes over 290K labeled 3D object tracks and 5 million object instances across 1,263 distinct scenes. The dataset provides high-resolution camera images, LiDAR point clouds, and annotated HD maps, making it valuable for tasks like 3D tracking, motion forecasting, and stereo depth estimation.
|
||||||
|
|
||||||
|
### How can I train an Ultralytics YOLO model using the Argoverse dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model with the Argoverse dataset, use the provided YAML configuration file and the following code:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="Argoverse.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=Argoverse.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a detailed explanation of the arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What types of data and annotations are available in the Argoverse dataset?
|
||||||
|
|
||||||
|
The Argoverse dataset includes various sensor data types such as high-resolution camera images, LiDAR point clouds, and HD map data. Annotations include 3D bounding boxes, object tracks, and trajectory information. These comprehensive annotations are essential for accurate model training in tasks like 3D object tracking, motion forecasting, and stereo depth estimation.
|
||||||
|
|
||||||
|
### How is the Argoverse dataset structured?
|
||||||
|
|
||||||
|
The dataset is divided into three main subsets:
|
||||||
|
|
||||||
|
1. **Argoverse 3D Tracking**: Contains 113 scenes with over 290K labeled 3D object tracks, focusing on 3D object tracking tasks. It includes LiDAR point clouds, camera images, and sensor calibration information.
|
||||||
|
2. **Argoverse Motion Forecasting**: Consists of 324K vehicle trajectories collected from 60 hours of driving data, suitable for motion forecasting tasks.
|
||||||
|
3. **Argoverse Stereo Depth Estimation**: Includes over 10K stereo image pairs with corresponding LiDAR point clouds for ground truth depth estimation.
|
||||||
|
|
||||||
|
### Where can I download the Argoverse dataset now that it has been removed from Amazon S3?
|
||||||
|
|
||||||
|
The Argoverse dataset `*.zip` file, previously available on Amazon S3, can now be manually downloaded from [Google Drive](https://drive.google.com/file/d/1st9qW3BeIwQsnR0t8mRpvbsSWIo16ACi/view?usp=drive_link).
|
||||||
|
|
||||||
|
### What is the YAML configuration file used for with the Argoverse dataset?
|
||||||
|
|
||||||
|
A YAML file contains the dataset's paths, classes, and other essential information. For the Argoverse dataset, the configuration file, `Argoverse.yaml`, can be found at the following link: [Argoverse.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Argoverse.yaml).
|
||||||
|
|
||||||
|
For more information about YAML configurations, see our [datasets](../index.md) guide.
|
||||||
198
docs/en/datasets/detect/brain-tumor.md
Executable file
198
docs/en/datasets/detect/brain-tumor.md
Executable file
@@ -0,0 +1,198 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the brain tumor detection dataset with MRI/CT images. Essential for training AI models for early diagnosis and treatment planning.
|
||||||
|
keywords: brain tumor dataset, MRI scans, CT scans, brain tumor detection, medical imaging, AI in healthcare, computer vision, early diagnosis, treatment planning
|
||||||
|
---
|
||||||
|
|
||||||
|
# Brain Tumor Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-brain-tumor-detection-dataset.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Brain Tumor Dataset In Colab"></a>
|
||||||
|
|
||||||
|
A brain tumor detection dataset consists of medical images from MRI or CT scans, containing information about brain tumor presence, location, and characteristics. This dataset is essential for training [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) algorithms to automate brain tumor identification, aiding in early diagnosis and treatment planning in [healthcare applications](https://www.ultralytics.com/solutions/ai-in-healthcare).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/ogTBBD8McRk"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Brain Tumor Detection using Ultralytics Platform
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The brain tumor dataset is divided into two subsets:
|
||||||
|
|
||||||
|
- **Training set**: Consisting of 893 images, each accompanied by corresponding annotations.
|
||||||
|
- **Testing set**: Comprising 223 images, with annotations paired for each one.
|
||||||
|
|
||||||
|
The dataset contains two classes:
|
||||||
|
|
||||||
|
- **Negative**: Images without brain tumors
|
||||||
|
- **Positive**: Images with brain tumors
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The application of brain tumor detection using computer vision enables [early diagnosis](https://www.ultralytics.com/blog/ai-and-radiology-a-new-era-of-precision-and-efficiency), treatment planning, and monitoring of tumor progression. By analyzing medical imaging data like MRI or CT scans, [computer vision systems](https://docs.ultralytics.com/tasks/detect/) assist in accurately identifying brain tumors, aiding in timely medical intervention and personalized treatment strategies.
|
||||||
|
|
||||||
|
Medical professionals can leverage this technology to:
|
||||||
|
|
||||||
|
- Reduce diagnostic time and improve accuracy
|
||||||
|
- Assist in surgical planning by precisely locating tumors
|
||||||
|
- Monitor treatment effectiveness over time
|
||||||
|
- Support research in oncology and neurology
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the brain tumor dataset, the `brain-tumor.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/brain-tumor.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/brain-tumor.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/brain-tumor.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/brain-tumor.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a [YOLO26](https://docs.ultralytics.com/models/yolo26/) model on the brain tumor dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, utilize the provided code snippets. For a detailed list of available arguments, consult the model's [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=brain-tumor.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a brain-tumor fine-tuned model
|
||||||
|
|
||||||
|
# Inference using the model
|
||||||
|
results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start prediction with a finetuned *.pt model
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/brain-tumor-sample.jpg"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The brain tumor dataset encompasses a wide array of medical images featuring brain scans with and without tumors. Presented below are examples of images from the dataset, accompanied by their respective annotations.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: Displayed here is a training batch comprising mosaiced dataset images. Mosaicing, a training technique, consolidates multiple images into one, enhancing batch diversity. This approach aids in improving the model's capacity to generalize across various tumor sizes, shapes, and locations within brain scans.
|
||||||
|
|
||||||
|
This example highlights the diversity and intricacy of images within the brain tumor dataset, underscoring the advantages of incorporating mosaicing during the training phase for [medical image analysis](https://www.ultralytics.com/blog/using-yolo11-for-tumor-detection-in-medical-imaging).
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
The dataset has been made available under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE).
|
||||||
|
|
||||||
|
If you use this dataset in your research or development work, please cite it appropriately:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@dataset{Ultralytics_Brain_Tumor_Dataset_2023,
|
||||||
|
author = {Ultralytics},
|
||||||
|
title = {Brain Tumor Detection Dataset},
|
||||||
|
year = {2023},
|
||||||
|
publisher = {Ultralytics},
|
||||||
|
url = {https://docs.ultralytics.com/datasets/detect/brain-tumor/}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the structure of the brain tumor dataset available in Ultralytics documentation?
|
||||||
|
|
||||||
|
The brain tumor dataset is divided into two subsets: the **training set** consists of 893 images with corresponding annotations, while the **testing set** comprises 223 images with paired annotations. This structured division aids in developing robust and accurate computer vision models for detecting brain tumors. For more information on the dataset structure, visit the [Dataset Structure](#dataset-structure) section.
|
||||||
|
|
||||||
|
### How can I train a YOLO26 model on the brain tumor dataset using Ultralytics?
|
||||||
|
|
||||||
|
You can train a YOLO26 model on the brain tumor dataset for 100 epochs with an image size of 640px using both Python and CLI methods. Below are the examples for both:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=brain-tumor.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a detailed list of available arguments, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the benefits of using the brain tumor dataset for AI in healthcare?
|
||||||
|
|
||||||
|
Using the brain tumor dataset in AI projects enables early diagnosis and treatment planning for brain tumors. It helps in automating brain tumor identification through computer vision, facilitating accurate and timely medical interventions, and supporting personalized treatment strategies. This application holds significant potential in improving patient outcomes and medical efficiencies. For more insights on AI applications in healthcare, see [Ultralytics' healthcare solutions](https://www.ultralytics.com/solutions/ai-in-healthcare).
|
||||||
|
|
||||||
|
### How do I perform inference using a fine-tuned YOLO26 model on the brain tumor dataset?
|
||||||
|
|
||||||
|
Inference using a fine-tuned YOLO26 model can be performed with either Python or CLI approaches. Here are the examples:
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a brain-tumor fine-tuned model
|
||||||
|
|
||||||
|
# Inference using the model
|
||||||
|
results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start prediction with a finetuned *.pt model
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/brain-tumor-sample.jpg"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration for the brain tumor dataset?
|
||||||
|
|
||||||
|
The YAML configuration file for the brain tumor dataset can be found at [brain-tumor.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/brain-tumor.yaml). This file includes paths, classes, and additional relevant information necessary for training and evaluating models on this dataset.
|
||||||
173
docs/en/datasets/detect/coco.md
Executable file
173
docs/en/datasets/detect/coco.md
Executable file
@@ -0,0 +1,173 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the COCO dataset for object detection and segmentation. Learn about its structure, usage, pretrained models, and key features.
|
||||||
|
keywords: COCO dataset, object detection, segmentation, benchmarking, computer vision, pose estimation, YOLO models, COCO annotations
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO Dataset
|
||||||
|
|
||||||
|
The [COCO](https://cocodataset.org/#home) (Common Objects in Context) dataset is a large-scale object detection, segmentation, and captioning dataset. It is designed to encourage research on a wide variety of object categories and is commonly used for benchmarking [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) models. It is an essential dataset for researchers and developers working on object detection, segmentation, and pose estimation tasks.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/uDrn9QZJ2lk"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics COCO Dataset Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## COCO Pretrained Models
|
||||||
|
|
||||||
|
{% include "macros/yolo-det-perf.md" %}
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- COCO contains 330K images, with 200K images having annotations for object detection, segmentation, and captioning tasks.
|
||||||
|
- The dataset comprises 80 object categories, including common objects like cars, bicycles, and animals, as well as more specific categories such as umbrellas, handbags, and sports equipment.
|
||||||
|
- Annotations include object bounding boxes, segmentation masks, and captions for each image.
|
||||||
|
- COCO provides standardized evaluation metrics like [mean Average Precision](https://www.ultralytics.com/glossary/mean-average-precision-map) (mAP) for object detection, and mean Average [Recall](https://www.ultralytics.com/glossary/recall) (mAR) for segmentation tasks, making it suitable for comparing model performance.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The COCO dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Train2017**: This subset contains 118K images for training object detection, segmentation, and captioning models.
|
||||||
|
2. **Val2017**: This subset has 5K images used for validation purposes during model training.
|
||||||
|
3. **Test2017**: This subset consists of 20K images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results are submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7384) for performance evaluation.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The COCO dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection (such as [Ultralytics YOLO](../../models/yolo26.md), [Faster R-CNN](https://arxiv.org/abs/1506.01497), and [SSD](https://arxiv.org/abs/1512.02325)), [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) (such as [Mask R-CNN](https://arxiv.org/abs/1703.06870)), and keypoint detection (such as [OpenPose](https://arxiv.org/abs/1812.08008)). The dataset's diverse set of object categories, large number of annotated images, and standardized evaluation metrics make it an essential resource for computer vision researchers and practitioners.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO dataset, the `coco.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the COCO dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=coco.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The COCO dataset contains a diverse set of images with various object categories and complex scenes. Here are some examples of images from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO dataset and why is it important for computer vision?
|
||||||
|
|
||||||
|
The [COCO dataset](https://cocodataset.org/#home) (Common Objects in Context) is a large-scale dataset used for [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and captioning. It contains 330K images with detailed annotations for 80 object categories, making it essential for benchmarking and training computer vision models. Researchers use COCO due to its diverse categories and standardized evaluation metrics like mean Average [Precision](https://www.ultralytics.com/glossary/precision) (mAP).
|
||||||
|
|
||||||
|
### How can I train a YOLO model using the COCO dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model using the COCO dataset, you can use the following code snippets:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=coco.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [Training page](../../modes/train.md) for more details on available arguments.
|
||||||
|
|
||||||
|
### What are the key features of the COCO dataset?
|
||||||
|
|
||||||
|
The COCO dataset includes:
|
||||||
|
|
||||||
|
- 330K images, with 200K annotated for object detection, segmentation, and captioning.
|
||||||
|
- 80 object categories ranging from common items like cars and animals to specific ones like handbags and sports equipment.
|
||||||
|
- Standardized evaluation metrics for object detection (mAP) and segmentation (mean Average Recall, mAR).
|
||||||
|
- **Mosaicing** technique in training batches to enhance model generalization across various object sizes and contexts.
|
||||||
|
|
||||||
|
### Where can I find pretrained YOLO26 models trained on the COCO dataset?
|
||||||
|
|
||||||
|
Pretrained YOLO26 models on the COCO dataset can be downloaded from the links provided in the documentation. Examples include:
|
||||||
|
|
||||||
|
- [YOLO26n](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt)
|
||||||
|
- [YOLO26s](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt)
|
||||||
|
- [YOLO26m](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m.pt)
|
||||||
|
- [YOLO26l](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l.pt)
|
||||||
|
- [YOLO26x](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x.pt)
|
||||||
|
|
||||||
|
These models vary in size, mAP, and inference speed, providing options for different performance and resource requirements.
|
||||||
|
|
||||||
|
### How is the COCO dataset structured and how do I use it?
|
||||||
|
|
||||||
|
The COCO dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Train2017**: 118K images for training.
|
||||||
|
2. **Val2017**: 5K images for validation during training.
|
||||||
|
3. **Test2017**: 20K images for benchmarking trained models. Results need to be submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7384) for performance evaluation.
|
||||||
|
|
||||||
|
The dataset's YAML configuration file is available at [coco.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml), which defines paths, classes, and dataset details.
|
||||||
219
docs/en/datasets/detect/coco12-formats.md
Executable file
219
docs/en/datasets/detect/coco12-formats.md
Executable file
@@ -0,0 +1,219 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics COCO12-Formats dataset, a test dataset featuring all 12 supported image formats (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) for validating image loading pipelines.
|
||||||
|
keywords: COCO12-Formats, Ultralytics, dataset, image formats, object detection, YOLO, AVIF, BMP, DNG, HEIC, JP2, JPEG, PNG, TIFF, WebP, MPO
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO12-Formats Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The [Ultralytics](https://www.ultralytics.com/) COCO12-Formats dataset is a specialized test dataset designed to validate image loading across all 12 supported image format extensions. It contains 12 images (6 for training, 6 for validation), each saved in a different format to ensure comprehensive testing of the image loading pipeline.
|
||||||
|
|
||||||
|
This dataset is invaluable for:
|
||||||
|
|
||||||
|
- **Testing image format support**: Verify that all supported formats load correctly
|
||||||
|
- **CI/CD pipelines**: Automated testing of format compatibility
|
||||||
|
- **Debugging**: Isolate format-specific issues in training pipelines
|
||||||
|
- **Development**: Validate new format additions or changes
|
||||||
|
|
||||||
|
## Supported Formats
|
||||||
|
|
||||||
|
The dataset includes one image for each of the 12 supported format extensions defined in `ultralytics/data/utils.py`:
|
||||||
|
|
||||||
|
| Format | Extension | Description | Train/Val |
|
||||||
|
| ------ | --------- | ------------------------------------ | --------- |
|
||||||
|
| AVIF | `.avif` | AV1 Image File Format (modern) | Train |
|
||||||
|
| BMP | `.bmp` | Bitmap - uncompressed raster format | Train |
|
||||||
|
| DNG | `.dng` | Digital Negative - Adobe RAW format | Train |
|
||||||
|
| HEIC | `.heic` | High Efficiency Image Coding | Train |
|
||||||
|
| JPEG | `.jpeg` | JPEG with full extension | Train |
|
||||||
|
| JPG | `.jpg` | JPEG with short extension | Train |
|
||||||
|
| JP2 | `.jp2` | JPEG 2000 - medical/geospatial | Val |
|
||||||
|
| MPO | `.mpo` | Multi-Picture Object (stereo images) | Val |
|
||||||
|
| PNG | `.png` | Portable Network Graphics | Val |
|
||||||
|
| TIF | `.tif` | TIFF with short extension | Val |
|
||||||
|
| TIFF | `.tiff` | Tagged Image File Format | Val |
|
||||||
|
| WebP | `.webp` | Modern web image format | Val |
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
coco12-formats/
|
||||||
|
├── images/
|
||||||
|
│ ├── train/ # 6 images (avif, bmp, dng, heic, jpeg, jpg)
|
||||||
|
│ └── val/ # 6 images (jp2, mpo, png, tif, tiff, webp)
|
||||||
|
├── labels/
|
||||||
|
│ ├── train/ # Corresponding YOLO format labels
|
||||||
|
│ └── val/
|
||||||
|
└── coco12-formats.yaml # Dataset configuration
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The COCO12-Formats dataset is configured using a YAML file that defines dataset paths and class names. You can review the official `coco12-formats.yaml` file in the [Ultralytics GitHub repository](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco12-formats.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco12-formats.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco12-formats.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
Some formats require additional dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install pillow pillow-heif pillow-avif-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
#### AVIF System Library (Optional)
|
||||||
|
|
||||||
|
For OpenCV to read AVIF files directly, `libavif` must be installed **before** building OpenCV:
|
||||||
|
|
||||||
|
=== "macOS"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install libavif
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Ubuntu/Debian"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install libavif-dev libavif-bin
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone -b v1.2.1 https://github.com/AOMediaCodec/libavif.git
|
||||||
|
cd libavif
|
||||||
|
cmake -B build -DAVIF_CODEC_AOM=SYSTEM -DAVIF_BUILD_APPS=ON
|
||||||
|
cmake --build build --config Release --parallel
|
||||||
|
sudo cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
The pip-installed `opencv-python` package may not include AVIF support since it's pre-built. Ultralytics uses Pillow with `pillow-avif-plugin` as a fallback for AVIF images when OpenCV lacks support.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO model on the COCO12-Formats dataset, use the following examples:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train on COCO12-Formats to test all image formats
|
||||||
|
results = model.train(data="coco12-formats.yaml", epochs=1, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train YOLO on COCO12-Formats
|
||||||
|
yolo detect train data=coco12-formats.yaml model=yolo26n.pt epochs=1 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Format-Specific Notes
|
||||||
|
|
||||||
|
### AVIF (AV1 Image File Format)
|
||||||
|
|
||||||
|
AVIF is a modern image format based on the AV1 video codec, offering excellent compression. Requires `pillow-avif-plugin`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install pillow-avif-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
### DNG (Digital Negative)
|
||||||
|
|
||||||
|
DNG is Adobe's open RAW format based on TIFF. For testing purposes, the dataset uses TIFF-based files with the `.dng` extension.
|
||||||
|
|
||||||
|
### JP2 (JPEG 2000)
|
||||||
|
|
||||||
|
JPEG 2000 is a wavelet-based image compression standard offering better compression and quality than traditional JPEG. Commonly used in medical imaging (DICOM), geospatial applications, and digital cinema. Natively supported by both OpenCV and Pillow.
|
||||||
|
|
||||||
|
### MPO (Multi-Picture Object)
|
||||||
|
|
||||||
|
MPO files are used for stereoscopic (3D) images. The dataset stores standard JPEG data with the `.mpo` extension for format testing.
|
||||||
|
|
||||||
|
### HEIC (High Efficiency Image Coding)
|
||||||
|
|
||||||
|
HEIC requires the `pillow-heif` package for proper encoding:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install pillow-heif
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use Cases
|
||||||
|
|
||||||
|
### CI/CD Testing
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
|
||||||
|
def test_all_image_formats():
|
||||||
|
"""Test that all image formats load correctly."""
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
results = model.train(data="coco12-formats.yaml", epochs=1, imgsz=64)
|
||||||
|
assert results is not None
|
||||||
|
```
|
||||||
|
|
||||||
|
### Format Validation
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from ultralytics.data.utils import IMG_FORMATS
|
||||||
|
|
||||||
|
# Verify all formats are represented
|
||||||
|
dataset_dir = Path("datasets/coco12-formats/images")
|
||||||
|
found_formats = {f.suffix[1:].lower() for f in dataset_dir.rglob("*.*")}
|
||||||
|
assert found_formats == IMG_FORMATS, f"Missing formats: {IMG_FORMATS - found_formats}"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research, please cite:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Doll{\'a}r},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What Is the COCO12-Formats Dataset Used For?
|
||||||
|
|
||||||
|
The COCO12-Formats dataset is designed for testing image format compatibility in Ultralytics YOLO training pipelines. It ensures all 12 supported image formats (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) load and process correctly.
|
||||||
|
|
||||||
|
### Why Test Multiple Image Formats?
|
||||||
|
|
||||||
|
Different image formats have unique characteristics (compression, bit depth, color spaces). Testing all formats ensures:
|
||||||
|
|
||||||
|
- Robust image loading code
|
||||||
|
- Compatibility across diverse datasets
|
||||||
|
- Early detection of format-specific bugs
|
||||||
|
|
||||||
|
### Which Formats Require Special Dependencies?
|
||||||
|
|
||||||
|
- **AVIF**: Requires `pillow-avif-plugin`
|
||||||
|
- **HEIC**: Requires `pillow-heif`
|
||||||
154
docs/en/datasets/detect/coco128.md
Executable file
154
docs/en/datasets/detect/coco128.md
Executable file
@@ -0,0 +1,154 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics COCO128 dataset, a versatile and manageable set of 128 images perfect for testing object detection models and training pipelines.
|
||||||
|
keywords: COCO128, Ultralytics, dataset, object detection, YOLO26, training, validation, machine learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO128 Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) COCO128 is a small, but versatile [object detection](https://www.ultralytics.com/glossary/object-detection) dataset composed of the first 128 images of the COCO train 2017 set. This dataset is ideal for testing and debugging object detection models, or for experimenting with new detection approaches. With 128 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/uDrn9QZJ2lk"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics COCO Dataset Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO128 dataset, the `coco128.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco128.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco128.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the COCO128 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco128.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=coco128.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the COCO128 dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-1.avif" alt="COCO128 object detection dataset mosaic training batch" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO128 dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Ultralytics COCO128 dataset used for?
|
||||||
|
|
||||||
|
The Ultralytics COCO128 dataset is a compact subset containing the first 128 images from the COCO train 2017 dataset. It's primarily used for testing and debugging [object detection](https://www.ultralytics.com/glossary/object-detection) models, experimenting with new detection approaches, and validating training pipelines before scaling to larger datasets. Its manageable size makes it perfect for quick iterations while still providing enough diversity to be a meaningful test case.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the COCO128 dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model on the COCO128 dataset, you can use either Python or CLI commands. Here's how:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco128.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=coco128.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For more training options and parameters, refer to the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### What are the benefits of using mosaic augmentation with COCO128?
|
||||||
|
|
||||||
|
Mosaic augmentation, as shown in the sample images, combines multiple training images into a single composite image. This technique offers several benefits when training with COCO128:
|
||||||
|
|
||||||
|
- Increases the variety of objects and contexts within each training batch
|
||||||
|
- Improves model generalization across different object sizes and aspect ratios
|
||||||
|
- Enhances detection performance for objects at various scales
|
||||||
|
- Maximizes the utility of a small dataset by creating more diverse training samples
|
||||||
|
|
||||||
|
This technique is particularly valuable for smaller datasets like COCO128, helping models learn more robust features from limited data.
|
||||||
|
|
||||||
|
### How does COCO128 compare to other COCO dataset variants?
|
||||||
|
|
||||||
|
COCO128 (128 images) sits between [COCO8](../detect/coco8.md) (8 images) and the full [COCO](../detect/coco.md) dataset (118K+ images) in terms of size:
|
||||||
|
|
||||||
|
- **COCO8**: Contains just 8 images (4 train, 4 val) - ideal for quick tests and debugging
|
||||||
|
- **COCO128**: Contains 128 images - balanced between size and diversity
|
||||||
|
- **Full COCO**: Contains 118K+ training images - comprehensive but resource-intensive
|
||||||
|
|
||||||
|
COCO128 provides a good middle ground, offering more diversity than COCO8 while remaining much more manageable than the full COCO dataset for experimentation and initial model development.
|
||||||
|
|
||||||
|
### Can I use COCO128 for tasks other than object detection?
|
||||||
|
|
||||||
|
While COCO128 is primarily designed for object detection, the dataset's annotations can be adapted for other computer vision tasks:
|
||||||
|
|
||||||
|
- **Instance segmentation**: Using the segmentation masks provided in the annotations
|
||||||
|
- **Keypoint detection**: For images containing people with keypoint annotations
|
||||||
|
- **Transfer learning**: As a starting point for fine-tuning models for custom tasks
|
||||||
|
|
||||||
|
For specialized tasks like [segmentation](../../tasks/segment.md), consider using purpose-built variants like [COCO8-seg](../segment/coco8-seg.md) which include the appropriate annotations.
|
||||||
138
docs/en/datasets/detect/coco8-grayscale.md
Executable file
138
docs/en/datasets/detect/coco8-grayscale.md
Executable file
@@ -0,0 +1,138 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics COCO8-Grayscale dataset, a versatile and manageable set of 8 images perfect for testing object detection models and training pipelines.
|
||||||
|
keywords: COCO8-Grayscale, Ultralytics, dataset, object detection, YOLO26, training, validation, machine learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO8-Grayscale Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The [Ultralytics](https://www.ultralytics.com/) COCO8-Grayscale dataset is a compact yet powerful [object detection](https://www.ultralytics.com/glossary/object-detection) dataset, consisting of the first 8 images from the COCO train 2017 set and converted to grayscale format—4 for training and 4 for validation. This dataset is specifically designed for rapid testing, debugging, and experimentation with [YOLO](https://docs.ultralytics.com/models/yolo26/) grayscale models and training pipelines. Its small size makes it highly manageable, while its diversity ensures it serves as an effective sanity check before scaling up to larger datasets.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/yw2Fo6qjJU4"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on Grayscale Datasets 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
COCO8-Grayscale is fully compatible with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](../../models/yolo26.md), enabling seamless integration into your computer vision workflows.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The COCO8-Grayscale dataset configuration is defined in a YAML (Yet Another Markup Language) file, which specifies dataset paths, class names, and other essential metadata. You can review the official `coco8-grayscale.yaml` file in the [Ultralytics GitHub repository](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-grayscale.yaml).
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
To train your RGB images in grayscale, you could simply add `channels: 1` to your dataset YAML file. This converts all images to grayscale during training, enabling you to utilize grayscale benefits without requiring a separate dataset.
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-grayscale.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-grayscale.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the COCO8-Grayscale dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following examples. For a full list of training options, see the [YOLO Training documentation](../../modes/train.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on COCO8-Grayscale
|
||||||
|
results = model.train(data="coco8-grayscale.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train YOLO26n on COCO8-Grayscale using the command line
|
||||||
|
yolo detect train data=coco8-grayscale.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Below is an example of a mosaiced training batch from the COCO8-Grayscale dataset:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/grayscale-mosaic.avif" alt="COCO8 grayscale dataset mosaic training batch" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image illustrates a training batch where multiple dataset images are combined using mosaic augmentation. Mosaic augmentation increases the diversity of objects and scenes within each batch, helping the model generalize better to various object sizes, aspect ratios, and backgrounds.
|
||||||
|
|
||||||
|
This technique is especially useful for small datasets like COCO8-Grayscale, as it maximizes the value of each image during training.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Special thanks to the [COCO Consortium](https://cocodataset.org/#home) for their ongoing contributions to the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What Is the Ultralytics COCO8-Grayscale Dataset Used For?
|
||||||
|
|
||||||
|
The Ultralytics COCO8-Grayscale dataset is designed for rapid testing and debugging of [object detection](https://www.ultralytics.com/glossary/object-detection) models. With only 8 images (4 for training, 4 for validation), it is ideal for verifying your [YOLO](https://docs.ultralytics.com/models/yolo26/) training pipelines and ensuring everything works as expected before scaling to larger datasets. Explore the [COCO8-Grayscale YAML configuration](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-grayscale.yaml) for more details.
|
||||||
|
|
||||||
|
### How Do I Train a YOLO26 Model Using the COCO8-Grayscale Dataset?
|
||||||
|
|
||||||
|
You can train a YOLO26 model on COCO8-Grayscale using either Python or the CLI:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on COCO8-Grayscale
|
||||||
|
results = model.train(data="coco8-grayscale.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=coco8-grayscale.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For additional training options, refer to the [YOLO Training documentation](../../modes/train.md).
|
||||||
|
|
||||||
|
### Why Should I Use Ultralytics Platform for Managing My COCO8-Grayscale Training?
|
||||||
|
|
||||||
|
[Ultralytics Platform](https://platform.ultralytics.com/) streamlines dataset management, training, and deployment for [YOLO](https://docs.ultralytics.com/models/yolo26/) models—including COCO8-Grayscale. With features like cloud training, real-time monitoring, and intuitive dataset handling, HUB enables you to launch experiments with a single click and eliminates manual setup hassles. Learn more about [Ultralytics Platform](https://platform.ultralytics.com/) and how it can accelerate your computer vision projects.
|
||||||
|
|
||||||
|
### What Are the Benefits of Using Mosaic Augmentation in Training With the COCO8-Grayscale Dataset?
|
||||||
|
|
||||||
|
Mosaic augmentation, as used in COCO8-Grayscale training, combines multiple images into one during each batch. This increases the diversity of objects and backgrounds, helping your [YOLO](https://docs.ultralytics.com/models/yolo26/) model generalize better to new scenarios. Mosaic augmentation is especially valuable for small datasets, as it maximizes the information available in each training step. For more on this, see the [training guide](#usage).
|
||||||
|
|
||||||
|
### How Can I Validate My YOLO26 Model Trained on the COCO8-Grayscale Dataset?
|
||||||
|
|
||||||
|
To validate your YOLO26 model after training on COCO8-Grayscale, use the model's validation commands in either Python or CLI. This evaluates your model's performance using standard metrics. For step-by-step instructions, visit the [YOLO Validation documentation](../../modes/val.md).
|
||||||
146
docs/en/datasets/detect/coco8-multispectral.md
Executable file
146
docs/en/datasets/detect/coco8-multispectral.md
Executable file
@@ -0,0 +1,146 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics COCO8-Multispectral dataset, an enhanced version of COCO8 with interpolated spectral channels, ideal for testing multispectral object detection models and training pipelines.
|
||||||
|
keywords: COCO8-Multispectral, Ultralytics, dataset, multispectral, object detection, YOLO26, training, validation, machine learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO8-Multispectral Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The [Ultralytics](https://www.ultralytics.com/) COCO8-Multispectral dataset is an advanced variant of the original COCO8 dataset, designed to facilitate experimentation with multispectral object detection models. It consists of the same 8 images from the COCO train 2017 set—4 for training and 4 for validation—but with each image transformed into a 10-channel multispectral format. By expanding beyond standard RGB channels, COCO8-Multispectral enables the development and evaluation of models that can leverage richer spectral information.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/coco8-multispectral-overview.avif" alt="Multispectral imaging for object detection">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
COCO8-Multispectral is fully compatible with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](../../models/yolo26.md), ensuring seamless integration into your [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) workflows.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/yw2Fo6qjJU4"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on Multispectral Datasets | Multi-Channel VisionAI 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Generation
|
||||||
|
|
||||||
|
The multispectral images in COCO8-Multispectral were created by interpolating the original RGB images across 10 evenly spaced spectral channels within the visible spectrum. The process includes:
|
||||||
|
|
||||||
|
- **Wavelength Assignment**: Assigning nominal wavelengths to the RGB channels—Red: 650 nm, Green: 510 nm, Blue: 475 nm.
|
||||||
|
- **Interpolation**: Using linear interpolation to estimate pixel values at intermediate wavelengths between 450 nm and 700 nm, resulting in 10 spectral channels.
|
||||||
|
- **Extrapolation**: Applying extrapolation with SciPy's `interp1d` function to estimate values beyond the original RGB wavelengths, ensuring a complete spectral representation.
|
||||||
|
|
||||||
|
This approach simulates a multispectral imaging process, providing a more diverse set of data for model training and evaluation. For further reading on multispectral imaging, see the [Multispectral Imaging Wikipedia article](https://en.wikipedia.org/wiki/Multispectral_imaging).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The COCO8-Multispectral dataset is configured using a YAML file, which defines dataset paths, class names, and essential metadata. You can review the official `coco8-multispectral.yaml` file in the [Ultralytics GitHub repository](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-multispectral.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-multispectral.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-multispectral.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
Prepare your TIFF images in `(channel, height, width)` order, saved with `.tiff` or `.tif` extension, and ensure they are `uint8` for use with Ultralytics:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# Create and write 10-channel TIFF
|
||||||
|
image = np.ones((10, 640, 640), dtype=np.uint8) # CHW-order
|
||||||
|
cv2.imwritemulti("example.tiff", image)
|
||||||
|
|
||||||
|
# Read TIFF
|
||||||
|
success, frames_list = cv2.imreadmulti("example.tiff")
|
||||||
|
image = np.stack(frames_list, axis=2)
|
||||||
|
print(image.shape) # (640, 640, 10) HWC-order for training and inference
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the COCO8-Multispectral dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following examples. For a comprehensive list of training options, refer to the [YOLO Training documentation](../../modes/train.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on COCO8-Multispectral
|
||||||
|
results = model.train(data="coco8-multispectral.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train YOLO26n on COCO8-Multispectral using the command line
|
||||||
|
yolo detect train data=coco8-multispectral.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on model selection and best practices, explore the [Ultralytics YOLO model documentation](../../models/yolo26.md) and the [YOLO Model Training Tips guide](https://docs.ultralytics.com/guides/model-training-tips/).
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Below is an example of a mosaiced training batch from the COCO8-Multispectral dataset:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/coco8-multispectral-mosaic-batch.avif" alt="COCO8 multispectral dataset mosaic training batch" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch where multiple dataset images are combined using [mosaic augmentation](https://docs.ultralytics.com/reference/data/augment/). Mosaic augmentation increases the diversity of objects and scenes within each batch, helping the model generalize better to various object sizes, aspect ratios, and backgrounds.
|
||||||
|
|
||||||
|
This technique is especially valuable for small datasets like COCO8-Multispectral, as it maximizes the utility of each image during training.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Special thanks to the [COCO Consortium](https://cocodataset.org/#home) for their ongoing contributions to the [computer vision community](https://www.ultralytics.com/blog/a-history-of-vision-models).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What Is the Ultralytics COCO8-Multispectral Dataset Used For?
|
||||||
|
|
||||||
|
The Ultralytics COCO8-Multispectral dataset is designed for rapid testing and debugging of [multispectral object detection](https://www.ultralytics.com/glossary/object-detection) models. With only 8 images (4 for training, 4 for validation), it is ideal for verifying your [YOLO26](../../models/yolo26.md) training pipelines and ensuring everything works as expected before scaling to larger datasets. For more datasets to experiment with, visit the [Ultralytics Datasets Catalog](https://docs.ultralytics.com/datasets/).
|
||||||
|
|
||||||
|
### How Does Multispectral Data Improve Object Detection?
|
||||||
|
|
||||||
|
Multispectral data provides additional spectral information beyond standard RGB, enabling models to distinguish objects based on subtle differences in reflectance across wavelengths. This can enhance detection accuracy, especially in challenging scenarios. Learn more about [multispectral imaging](https://en.wikipedia.org/wiki/Multispectral_imaging) and its applications in [advanced computer vision](https://www.ultralytics.com/blog/ai-in-aviation-a-runway-to-smarter-airports).
|
||||||
|
|
||||||
|
### Is COCO8-Multispectral Compatible With Ultralytics Platform and YOLO Models?
|
||||||
|
|
||||||
|
Yes, COCO8-Multispectral is fully compatible with [Ultralytics Platform](https://platform.ultralytics.com/) and all [YOLO models](../../models/yolo26.md), including the latest YOLO26. This allows you to easily integrate the dataset into your training and validation workflows.
|
||||||
|
|
||||||
|
### Where Can I Find More Information on Data Augmentation Techniques?
|
||||||
|
|
||||||
|
For a deeper understanding of data augmentation methods such as mosaic and their impact on model performance, refer to the [YOLO Data Augmentation Guide](https://docs.ultralytics.com/guides/yolo-data-augmentation/) and the [Ultralytics Blog on Data Augmentation](https://www.ultralytics.com/blog/the-ultimate-guide-to-data-augmentation-in-2025).
|
||||||
|
|
||||||
|
### Can I Use COCO8-Multispectral for Benchmarking or Educational Purposes?
|
||||||
|
|
||||||
|
Absolutely! The small size and multispectral nature of COCO8-Multispectral make it ideal for benchmarking, educational demonstrations, and prototyping new model architectures. For more benchmarking datasets, see the [Ultralytics Benchmark Dataset Collection](https://docs.ultralytics.com/datasets/).
|
||||||
134
docs/en/datasets/detect/coco8.md
Executable file
134
docs/en/datasets/detect/coco8.md
Executable file
@@ -0,0 +1,134 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics COCO8 dataset, a versatile and manageable set of 8 images perfect for testing object detection models and training pipelines.
|
||||||
|
keywords: COCO8, Ultralytics, dataset, object detection, YOLO26, training, validation, machine learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO8 Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The [Ultralytics](https://www.ultralytics.com/) COCO8 dataset is a compact yet powerful [object detection](https://www.ultralytics.com/glossary/object-detection) dataset, consisting of the first 8 images from the COCO train 2017 set—4 for training and 4 for validation. This dataset is specifically designed for rapid testing, debugging, and experimentation with [YOLO](https://docs.ultralytics.com/models/yolo26/) models and training pipelines. Its small size makes it highly manageable, while its diversity ensures it serves as an effective sanity check before scaling up to larger datasets.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/uDrn9QZJ2lk"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics COCO Dataset Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
COCO8 is fully compatible with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](../../models/yolo26.md), enabling seamless integration into your computer vision workflows.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The COCO8 dataset configuration is defined in a YAML (Yet Another Markup Language) file, which specifies dataset paths, class names, and other essential metadata. You can review the official `coco8.yaml` file in the [Ultralytics GitHub repository](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the COCO8 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following examples. For a full list of training options, see the [YOLO Training documentation](../../modes/train.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on COCO8
|
||||||
|
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train YOLO26n on COCO8 using the command line
|
||||||
|
yolo detect train data=coco8.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Below is an example of a mosaiced training batch from the COCO8 dataset:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-1.avif" alt="COCO8 object detection dataset mosaic training batch" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image illustrates a training batch where multiple dataset images are combined using mosaic augmentation. Mosaic augmentation increases the diversity of objects and scenes within each batch, helping the model generalize better to various object sizes, aspect ratios, and backgrounds.
|
||||||
|
|
||||||
|
This technique is especially useful for small datasets like COCO8, as it maximizes the value of each image during training.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Special thanks to the [COCO Consortium](https://cocodataset.org/#home) for their ongoing contributions to the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What Is the Ultralytics COCO8 Dataset Used For?
|
||||||
|
|
||||||
|
The Ultralytics COCO8 dataset is designed for rapid testing and debugging of [object detection](https://www.ultralytics.com/glossary/object-detection) models. With only 8 images (4 for training, 4 for validation), it is ideal for verifying your [YOLO](https://docs.ultralytics.com/models/yolo26/) training pipelines and ensuring everything works as expected before scaling to larger datasets. Explore the [COCO8 YAML configuration](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8.yaml) for more details.
|
||||||
|
|
||||||
|
### How Do I Train a YOLO26 Model Using the COCO8 Dataset?
|
||||||
|
|
||||||
|
You can train a YOLO26 model on COCO8 using either Python or the CLI:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on COCO8
|
||||||
|
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=coco8.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For additional training options, refer to the [YOLO Training documentation](../../modes/train.md).
|
||||||
|
|
||||||
|
### Why Should I Use Ultralytics Platform for Managing My COCO8 Training?
|
||||||
|
|
||||||
|
[Ultralytics Platform](https://platform.ultralytics.com/) streamlines dataset management, training, and deployment for [YOLO](https://docs.ultralytics.com/models/yolo26/) models—including COCO8. With features like cloud training, real-time monitoring, and intuitive dataset handling, HUB enables you to launch experiments with a single click and eliminates manual setup hassles. Learn more about [Ultralytics Platform](https://platform.ultralytics.com/) and how it can accelerate your computer vision projects.
|
||||||
|
|
||||||
|
### What Are the Benefits of Using Mosaic Augmentation in Training With the COCO8 Dataset?
|
||||||
|
|
||||||
|
Mosaic augmentation, as used in COCO8 training, combines multiple images into one during each batch. This increases the diversity of objects and backgrounds, helping your [YOLO](https://docs.ultralytics.com/models/yolo26/) model generalize better to new scenarios. Mosaic augmentation is especially valuable for small datasets, as it maximizes the information available in each training step. For more on this, see the [training guide](#usage).
|
||||||
|
|
||||||
|
### How Can I Validate My YOLO26 Model Trained on the COCO8 Dataset?
|
||||||
|
|
||||||
|
To validate your YOLO26 model after training on COCO8, use the model's validation commands in either Python or CLI. This evaluates your model's performance using standard metrics. For step-by-step instructions, visit the [YOLO Validation documentation](../../modes/val.md).
|
||||||
157
docs/en/datasets/detect/construction-ppe.md
Executable file
157
docs/en/datasets/detect/construction-ppe.md
Executable file
@@ -0,0 +1,157 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover Construction-PPE, a specialized dataset for detecting helmets, vests, gloves, boots, and goggles in real-world construction sites. Includes compliant and non-compliant scenarios for AI-powered safety monitoring.
|
||||||
|
keywords: Construction-PPE, PPE dataset, safety compliance, construction workers, object detection, YOLO26, workplace safety, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# Construction-PPE Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-construction-ppe-detection-dataset.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Construction-PPE Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The Construction-PPE dataset is designed to improve safety compliance in construction sites by enabling detection of essential protective gear such as helmets, vests, gloves, boots, and goggles, along with annotations for missing equipment. Curated from real construction environments, it includes both compliant and non-compliant cases, making it a valuable resource for training AI models that monitor workplace safety.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/lFaVnrhMmaE"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to train Ultralytics YOLO on Personal Protective Equipment Dataset | VisionAI in Construction 👷
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Construction-PPE dataset is organized into three main subsets:
|
||||||
|
|
||||||
|
- **Training Set**: The primary collection of annotated construction images featuring workers with both complete and partial PPE usage.
|
||||||
|
- **Validation Set**: A designated subset used to fine-tune and assess model performance during PPE detection and compliance monitoring.
|
||||||
|
- **Test Set**: An independent subset reserved for evaluating the final model's effectiveness in detecting PPE and identifying compliance issues.
|
||||||
|
|
||||||
|
Each image is annotated in the [Ultralytics YOLO](../detect/index.md/#what-is-the-ultralytics-yolo-dataset-format-and-how-to-structure-it) format ensuring compatibility with state-of-the-art [object detection](../../tasks/detect.md) and [tracking](../../modes/track.md) pipelines.
|
||||||
|
|
||||||
|
The dataset provides **11 classes** divided into positive (worn PPE) and negative (missing PPE) categories. This dual-positive/negative structure enables models to detect properly worn gear **and** identify safety violations.
|
||||||
|
|
||||||
|
## Business Value
|
||||||
|
|
||||||
|
- Construction remains one of the most hazardous industries in the world, with over 51 out of 123 work related **fatal injuries** in the UK in 2023/2024 happening in construction. However, the issue is no longer an issue with lack of regulation with 42% of construction workers admitting to not always adhering to processes.
|
||||||
|
- Construction is already governed by an extensive framework of health and safety (HSE) standards, but HSE teams are challenged with consistent enforcement. HSE teams are often stretched thin, balancing paperwork and audits and lacking the ability to monitor every corner of a busy and ever-changing environment in real time.
|
||||||
|
- This is where computer vision based personal protective equipment (PPE) detection becomes invaluable. By automatically checking whether workers are wearing **helmets, vests and other personal protective equipment**, you can ensure HSE rules are not just present but effectively enforced consistently across all sites. Beyond compliance, computer vision provides leading indicators of risk by revealing how well crews follow safety practices, enabling organizations to spot downward trends in compliance and prevent incidents before they happen.
|
||||||
|
- As a bonus, personal protective equipment detection has also been known to identify unauthorized site intruders, since **those not equipped with proper safety gear** are the first to trigger a notification. Ultimately, PPE detection is a simple yet powerful computer vision use-case that delivers full oversight, actionable insights and standardized reporting, empowering construction firms to reduce risk, protect workers and safeguard their projects.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Construction-PPE powers a variety of safety-focused computer vision applications:
|
||||||
|
|
||||||
|
- **Automated compliance monitoring**: Train AI models to instantly check if workers are wearing required safety gear like helmets, vests, or gloves, reducing risks on site.
|
||||||
|
- **Workplace safety analytics**: Track PPE usage over time, spot frequent violations, and generate insights to improve safety culture.
|
||||||
|
- **Smart surveillance systems**: Connect detection models with cameras to send real-time alerts when PPE is missing, preventing accidents before they happen.
|
||||||
|
- **Robotics and autonomous systems**: Enable drones or robots to perform PPE checks across large sites, supporting faster and safer inspections.
|
||||||
|
- **Research and education**: Provide a real-world dataset for students and researchers exploring workplace safety and human-object interactions.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The Construction-PPE dataset includes a YAML configuration file that defines the training and validation image paths along with the full list of object classes. You can access the `construction-ppe.yaml` file directly in the Ultralytics repository here: [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/construction-ppe.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/construction-ppe.yaml)
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/construction-ppe.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/construction-ppe.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
You can train a YOLO26n model on the Construction-PPE dataset for 100 epochs with an image size of 640. The following examples show how to get started quickly. For more options and advanced configurations, see the [Training guide](../../modes/train.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on Construction-PPE dataset
|
||||||
|
model.train(data="construction-ppe.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=construction-ppe.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The dataset captures construction workers across varied environments, lighting conditions, and postures. Both **compliant** and **non-compliant** cases are included.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## License and Attribution
|
||||||
|
|
||||||
|
Construction-PPE is developed and released under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE), supporting open-source research and commercial applications with proper attribution.
|
||||||
|
|
||||||
|
If you use this dataset in your research, please cite it:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@dataset{Dalvi_Construction_PPE_Dataset_2025,
|
||||||
|
author = {Mrunmayee Dalvi and Niyati Singh and Sahil Bhingarde and Ketaki Chalke},
|
||||||
|
title = {Construction-PPE: Personal Protective Equipment Detection Dataset},
|
||||||
|
month = {January},
|
||||||
|
year = {2025},
|
||||||
|
version = {1.0.0},
|
||||||
|
license = {AGPL-3.0},
|
||||||
|
url = {https://docs.ultralytics.com/datasets/detect/construction-ppe/},
|
||||||
|
publisher = {Ultralytics}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What makes the Construction-PPE dataset unique?
|
||||||
|
|
||||||
|
Unlike generic construction datasets, Construction-PPE explicitly includes **missing equipment classes**. This dual-labeling approach allows models to not only detect PPE but also flag violations in real-time.
|
||||||
|
|
||||||
|
### Which object categories are included?
|
||||||
|
|
||||||
|
The dataset covers helmets, vests, gloves, boots, goggles, and workers, along with their “missing PPE” counterparts. This ensures comprehensive compliance coverage.
|
||||||
|
|
||||||
|
### How can I train a YOLO model using the Construction-PPE dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model using the Construction-PPE dataset, you can use the following code snippets:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="construction-ppe.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=construction-ppe.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### Is this dataset suitable for real-world applications?
|
||||||
|
|
||||||
|
Yes. Images are curated from real construction sites under diverse conditions. This makes it highly effective for building deployable workplace safety monitoring systems.
|
||||||
|
|
||||||
|
### What are the benefits of using the Construction-PPE dataset in AI projects?
|
||||||
|
|
||||||
|
The dataset enables real-time detection of personal protective equipment, helping monitor worker safety on construction sites. With classes for both worn and missing gear, it supports AI systems that can automatically flag safety violations, generate compliance insights, and reduce risks. It also provides a practical resource for developing computer vision solutions in workplace safety, robotics, and academic research.
|
||||||
145
docs/en/datasets/detect/globalwheat2020.md
Executable file
145
docs/en/datasets/detect/globalwheat2020.md
Executable file
@@ -0,0 +1,145 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Global Wheat Head Dataset to develop accurate wheat head detection models. Includes training images, annotations, and usage for crop management.
|
||||||
|
keywords: Global Wheat Head Dataset, wheat head detection, wheat phenotyping, crop management, deep learning, object detection, training datasets
|
||||||
|
---
|
||||||
|
|
||||||
|
# Global Wheat Head Dataset
|
||||||
|
|
||||||
|
The [Global Wheat Head Dataset](https://www.global-wheat.com/) is a collection of images designed to support the development of accurate wheat head detection models for applications in wheat phenotyping and crop management. Wheat heads, also known as spikes, are the grain-bearing parts of the wheat plant. Accurate estimation of wheat head density and size is essential for assessing crop health, maturity, and yield potential. The dataset, created by a collaboration of nine research institutes from seven countries, covers multiple growing regions to ensure models generalize well across different environments.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- The dataset contains over 3,000 training images from Europe (France, UK, Switzerland) and North America (Canada).
|
||||||
|
- It includes approximately 1,000 test images from Australia, Japan, and China.
|
||||||
|
- Images are outdoor field images, capturing the natural variability in wheat head appearances.
|
||||||
|
- Annotations include wheat head bounding boxes to support [object detection](https://docs.ultralytics.com/tasks/detect/) tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Global Wheat Head Dataset is organized into two main subsets:
|
||||||
|
|
||||||
|
1. **Training Set**: This subset contains over 3,000 images from Europe and North America. The images are labeled with wheat head bounding boxes, providing ground truth for training object detection models.
|
||||||
|
2. **Test Set**: This subset consists of approximately 1,000 images from Australia, Japan, and China. These images are used for evaluating the performance of trained models on unseen genotypes, environments, and observational conditions.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Global Wheat Head Dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in wheat head detection tasks. The dataset's diverse set of images, capturing a wide range of appearances, environments, and conditions, make it a valuable resource for researchers and practitioners in the field of [plant phenotyping](https://www.ultralytics.com/blog/computer-vision-in-agriculture-transforming-fruit-detection-and-precision-farming) and crop management.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. For the case of the Global Wheat Head Dataset, the `GlobalWheat2020.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/GlobalWheat2020.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/GlobalWheat2020.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/GlobalWheat2020.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/GlobalWheat2020.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Global Wheat Head Dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="GlobalWheat2020.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=GlobalWheat2020.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Global Wheat Head Dataset contains a diverse set of outdoor field images, capturing the natural variability in wheat head appearances, environments, and conditions. Here are some examples of data from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Wheat Head Detection**: This image demonstrates an example of wheat head detection, where wheat heads are annotated with bounding boxes. The dataset provides a variety of images to facilitate the development of models for this task.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the Global Wheat Head Dataset and highlights the importance of accurate wheat head detection for applications in wheat phenotyping and crop management.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Global Wheat Head Dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{david2020global,
|
||||||
|
title={Global Wheat Head Detection (GWHD) Dataset: A Large and Diverse Dataset of High-Resolution RGB-Labelled Images to Develop and Benchmark Wheat Head Detection Methods},
|
||||||
|
author={David, Etienne and Madec, Simon and Sadeghi-Tehran, Pouria and Aasen, Helge and Zheng, Bangyou and Liu, Shouyang and Kirchgessner, Norbert and Ishikawa, Goro and Nagasawa, Koichi and Badhon, Minhajul and others},
|
||||||
|
journal={arXiv preprint arXiv:2005.02162},
|
||||||
|
year={2020}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the researchers and institutions that contributed to the creation and maintenance of the Global Wheat Head Dataset as a valuable resource for the plant phenotyping and crop management research community. For more information about the dataset and its creators, visit the [Global Wheat Head Dataset website](https://www.global-wheat.com/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Global Wheat Head Dataset used for?
|
||||||
|
|
||||||
|
The Global Wheat Head Dataset is primarily used for developing and training deep learning models aimed at wheat head detection. This is crucial for applications in [wheat phenotyping](https://www.ultralytics.com/blog/from-farm-to-table-how-ai-drives-innovation-in-agriculture) and crop management, allowing for more accurate estimations of wheat head density, size, and overall crop yield potential. Accurate detection methods help in assessing crop health and maturity, essential for efficient crop management.
|
||||||
|
|
||||||
|
### How do I train a YOLO26n model on the Global Wheat Head Dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Global Wheat Head Dataset, you can use the following code snippets. Make sure you have the `GlobalWheat2020.yaml` configuration file specifying dataset paths and classes:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model (recommended for training)
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="GlobalWheat2020.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=GlobalWheat2020.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the key features of the Global Wheat Head Dataset?
|
||||||
|
|
||||||
|
Key features of the Global Wheat Head Dataset include:
|
||||||
|
|
||||||
|
- Over 3,000 training images from Europe (France, UK, Switzerland) and North America (Canada).
|
||||||
|
- Approximately 1,000 test images from Australia, Japan, and China.
|
||||||
|
- High variability in wheat head appearances due to different growing environments.
|
||||||
|
- Detailed annotations with wheat head bounding boxes to aid [object detection](https://www.ultralytics.com/glossary/object-detection) models.
|
||||||
|
|
||||||
|
These features facilitate the development of robust models capable of generalization across multiple regions.
|
||||||
|
|
||||||
|
### Where can I find the configuration YAML file for the Global Wheat Head Dataset?
|
||||||
|
|
||||||
|
The configuration YAML file for the Global Wheat Head Dataset, named `GlobalWheat2020.yaml`, is available on GitHub. You can access it at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/GlobalWheat2020.yaml>. This file contains necessary information about dataset paths, classes, and other configuration details needed for model training in [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo26/).
|
||||||
|
|
||||||
|
### Why is wheat head detection important in crop management?
|
||||||
|
|
||||||
|
Wheat head detection is critical in crop management because it enables accurate estimation of wheat head density and size, which are essential for evaluating crop health, maturity, and yield potential. By leveraging [deep learning models](https://docs.ultralytics.com/models/) trained on datasets like the Global Wheat Head Dataset, farmers and researchers can better monitor and manage crops, leading to improved productivity and optimized resource use in agricultural practices. This technological advancement supports [sustainable agriculture](https://www.ultralytics.com/blog/real-time-crop-health-monitoring-with-ultralytics-yolo11) and food security initiatives.
|
||||||
|
|
||||||
|
For more information on applications of AI in agriculture, visit [AI in Agriculture](https://www.ultralytics.com/solutions/ai-in-agriculture).
|
||||||
169
docs/en/datasets/detect/homeobjects-3k.md
Executable file
169
docs/en/datasets/detect/homeobjects-3k.md
Executable file
@@ -0,0 +1,169 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover HomeObjects-3K, a rich indoor object detection dataset with 12 classes like bed, sofa, TV, and laptop. Ideal for computer vision in smart homes, robotics, and AR.
|
||||||
|
keywords: HomeObjects-3K, indoor dataset, household items, object detection, computer vision, YOLO26, smart home AI, robotics dataset
|
||||||
|
---
|
||||||
|
|
||||||
|
# HomeObjects-3K Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-homeobjects-dataset.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="HomeObjects-3K Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The HomeObjects-3K dataset is a curated collection of common household object images, designed for training, testing, and [benchmarking](../../modes/benchmark.md) [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) models. Featuring ~3,000 images and 12 distinct object classes, this dataset is ideal for research and applications in indoor scene understanding, smart home devices, [robotics](https://www.ultralytics.com/glossary/robotics), and augmented reality.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/v3iqOYoRBFQ"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on HomeObjects-3K Dataset | Detection, Validation & ONNX Export 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The HomeObjects-3K dataset is organized into the following subsets:
|
||||||
|
|
||||||
|
- **Training Set**: Comprises 2,285 annotated images featuring objects such as sofas, chairs, tables, lamps, and more.
|
||||||
|
- **Validation Set**: Includes 404 annotated images designated for evaluating model performance.
|
||||||
|
|
||||||
|
Each image is labeled using bounding boxes aligned with the [Ultralytics YOLO](../detect/index.md/#what-is-the-ultralytics-yolo-dataset-format-and-how-to-structure-it) format. The diversity of indoor lighting, object scale, and orientations makes it robust for real-world deployment scenarios.
|
||||||
|
|
||||||
|
## Object Classes
|
||||||
|
|
||||||
|
The dataset supports 12 everyday object categories, covering furniture, electronics, and decorative items. These classes are chosen to reflect common items encountered in indoor domestic environments and support vision tasks like [object detection](../../tasks/detect.md) and [object tracking](../../modes/track.md).
|
||||||
|
|
||||||
|
!!! Tip "HomeObjects-3K classes"
|
||||||
|
|
||||||
|
0. bed
|
||||||
|
1. sofa
|
||||||
|
2. chair
|
||||||
|
3. table
|
||||||
|
4. lamp
|
||||||
|
5. tv
|
||||||
|
6. laptop
|
||||||
|
7. wardrobe
|
||||||
|
8. window
|
||||||
|
9. door
|
||||||
|
10. potted plant
|
||||||
|
11. photo frame
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
HomeObjects-3K enables a wide spectrum of applications in indoor computer vision, spanning both research and real-world product development:
|
||||||
|
|
||||||
|
- **Indoor object detection**: Use models like [Ultralytics YOLO26](../../models/yolo26.md) to find and locate common home items like beds, chairs, lamps, and laptops in images. This helps with real-time understanding of indoor scenes.
|
||||||
|
|
||||||
|
- **Scene layout parsing**: In robotics and smart home systems, this helps devices understand how rooms are arranged, where objects like doors, windows, and furniture are, so they can navigate safely and interact with their environment properly.
|
||||||
|
|
||||||
|
- **AR applications**: Power [object recognition](http://ultralytics.com/glossary/image-recognition) features in apps that use augmented reality. For example, detect TVs or wardrobes and show extra information or effects on them.
|
||||||
|
|
||||||
|
- **Education and research**: Support learning and academic projects by giving students and researchers a ready-to-use dataset for practicing indoor object detection with real-world examples.
|
||||||
|
|
||||||
|
- **Home inventory and asset tracking**: Automatically detect and list home items in photos or videos, useful for managing belongings, organizing spaces, or visualizing furniture in real estate.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
The configuration for the HomeObjects-3K dataset is provided through a YAML file. This file outlines essential information such as image paths for train and validation directories, and the list of object classes.
|
||||||
|
You can access the `HomeObjects-3K.yaml` file directly from the Ultralytics repository at: [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/HomeObjects-3K.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/HomeObjects-3K.yaml)
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/HomeObjects-3K.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/HomeObjects-3K.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
You can train a YOLO26n model on the HomeObjects-3K dataset for 100 epochs using an image size of 640. The examples below show how to get started. For more training options and detailed settings, check the [Training](../../modes/train.md) guide.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on HomeObjects-3K dataset
|
||||||
|
model.train(data="HomeObjects-3K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=HomeObjects-3K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The dataset features a rich collection of indoor scene images that capture a wide range of household objects in natural home environments. Below are sample visuals from the dataset, each paired with its corresponding annotations to illustrate object positions, scales, and spatial relationships.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## License and Attribution
|
||||||
|
|
||||||
|
HomeObjects-3K is developed and released by the **[Ultralytics team](https://www.ultralytics.com/about)** under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE), supporting open-source research and commercial use with proper attribution.
|
||||||
|
|
||||||
|
If you use this dataset in your research, please cite it using the mentioned details:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@dataset{Jocher_Ultralytics_Datasets_2025,
|
||||||
|
author = {Jocher, Glenn and Rizwan, Muhammad},
|
||||||
|
license = {AGPL-3.0},
|
||||||
|
month = {May},
|
||||||
|
title = {Ultralytics Datasets: HomeObjects-3K Detection Dataset},
|
||||||
|
url = {https://docs.ultralytics.com/datasets/detect/homeobjects-3k/},
|
||||||
|
version = {1.0.0},
|
||||||
|
year = {2025}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the HomeObjects-3K dataset designed for?
|
||||||
|
|
||||||
|
HomeObjects-3K is crafted for advancing AI understanding of indoor scenes. It focuses on detecting everyday household items—like beds, sofas, TVs, and lamps—making it ideal for applications in smart homes, robotics, augmented reality, and interior monitoring systems. Whether you're training models for real-time edge devices or academic research, this dataset provides a balanced foundation.
|
||||||
|
|
||||||
|
### Which object categories are included, and why were they selected?
|
||||||
|
|
||||||
|
The dataset includes 12 of the most commonly encountered household items: bed, sofa, chair, table, lamp, tv, laptop, wardrobe, window, door, potted plant, and photo frame. These objects were chosen to reflect realistic indoor environments and to support multipurpose tasks such as robotic navigation, or scene generation in AR/VR applications.
|
||||||
|
|
||||||
|
### How can I train a YOLO model using the HomeObjects-3K dataset?
|
||||||
|
|
||||||
|
To train a YOLO model like YOLO26n, you'll just need the `HomeObjects-3K.yaml` configuration file and the [pretrained model](../../models/index.md) weights. Whether you're using Python or the CLI, training can be launched with a single command. You can customize parameters such as epochs, image size, and batch size depending on your target performance and hardware setup.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on HomeObjects-3K dataset
|
||||||
|
model.train(data="HomeObjects-3K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=HomeObjects-3K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### Is this dataset suitable for beginner-level projects?
|
||||||
|
|
||||||
|
Absolutely. With clean labeling, and standardized YOLO-compatible annotations, HomeObjects-3K is an excellent entry point for students and hobbyists who want to explore real-world object detection in indoor scenarios. It also scales well for more complex applications in commercial environments.
|
||||||
|
|
||||||
|
### Where can I find the annotation format and YAML?
|
||||||
|
|
||||||
|
Refer to the [Dataset YAML](#dataset-yaml) section. The format is standard YOLO, making it compatible with most object detection pipelines.
|
||||||
343
docs/en/datasets/detect/index.md
Executable file
343
docs/en/datasets/detect/index.md
Executable file
@@ -0,0 +1,343 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn about dataset formats compatible with Ultralytics YOLO for robust object detection. Explore supported datasets and learn how to convert formats.
|
||||||
|
keywords: Ultralytics, YOLO, object detection datasets, dataset formats, COCO, dataset conversion, training datasets
|
||||||
|
---
|
||||||
|
|
||||||
|
# Object Detection Datasets Overview
|
||||||
|
|
||||||
|
Training a robust and accurate [object detection](https://www.ultralytics.com/glossary/object-detection) model requires a comprehensive dataset. This guide introduces various formats of datasets that are compatible with the Ultralytics YOLO model and provides insights into their structure, usage, and how to convert between different formats.
|
||||||
|
|
||||||
|
## Supported Dataset Formats
|
||||||
|
|
||||||
|
### Ultralytics YOLO format
|
||||||
|
|
||||||
|
The Ultralytics YOLO format is a dataset configuration format that allows you to define the dataset root directory, the relative paths to training/validation/testing image directories or `*.txt` files containing image paths, and a dictionary of class names. Here is an example:
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
Labels for this format should be exported to YOLO format with one `*.txt` file per image. If there are no objects in an image, no `*.txt` file is required. The `*.txt` file should be formatted with one row per object in `class x_center y_center width height` format. Box coordinates must be in **normalized xywh** format (from 0 to 1). If your boxes are in pixels, you should divide `x_center` and `width` by image width, and `y_center` and `height` by image height. Class numbers should be zero-indexed (start with 0).
|
||||||
|
|
||||||
|
<p align="center"><img width="750" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/two-persons-tie.avif" alt="YOLO labeled image with bounding boxes on persons and tie"></p>
|
||||||
|
|
||||||
|
The label file corresponding to the above image contains 2 persons (class `0`) and a tie (class `27`):
|
||||||
|
|
||||||
|
<p align="center"><img width="428" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/two-persons-tie-1.avif" alt="YOLO format label file with normalized coordinates"></p>
|
||||||
|
|
||||||
|
When using the Ultralytics YOLO format, organize your training and validation images and labels as shown in the [COCO8 dataset](coco8.md) example below.
|
||||||
|
|
||||||
|
<p align="center"><img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/two-persons-tie-2.avif" alt="YOLO dataset directory structure with train and val folders"></p>
|
||||||
|
|
||||||
|
#### Usage Example
|
||||||
|
|
||||||
|
Here's how you can use YOLO format datasets to train your model:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=coco8.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ultralytics NDJSON format
|
||||||
|
|
||||||
|
The NDJSON (Newline Delimited JSON) format provides an alternative way to define datasets for Ultralytics YOLO models. This format stores dataset metadata and annotations in a single file where each line contains a separate JSON object.
|
||||||
|
|
||||||
|
An NDJSON dataset file contains:
|
||||||
|
|
||||||
|
1. **Dataset record** (first line): Contains dataset metadata including task type, class names, and general information
|
||||||
|
2. **Image records** (subsequent lines): Contains individual image data including dimensions, annotations, and file paths
|
||||||
|
|
||||||
|
!!! example "NDJSON Example"
|
||||||
|
|
||||||
|
=== "Dataset record (line 1)"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "dataset",
|
||||||
|
"task": "detect",
|
||||||
|
"name": "Example",
|
||||||
|
"description": "COCO NDJSON example dataset",
|
||||||
|
"url": "https://app.ultralytics.com/user/datasets/example",
|
||||||
|
"class_names": { "0": "person", "1": "bicycle", "2": "car" },
|
||||||
|
"bytes": 426342,
|
||||||
|
"version": 0,
|
||||||
|
"created_at": "2024-01-01T00:00:00Z",
|
||||||
|
"updated_at": "2025-01-01T00:00:00Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Detect"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"file": "image1.jpg",
|
||||||
|
"url": "https://www.url.com/path/to/image1.jpg",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"split": "train",
|
||||||
|
"annotations": {
|
||||||
|
"boxes": [
|
||||||
|
[0, 0.525, 0.376, 0.284, 0.418],
|
||||||
|
[1, 0.735, 0.298, 0.193, 0.337]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Format: `[class_id, x_center, y_center, width, height]`
|
||||||
|
|
||||||
|
=== "Segment"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"file": "image1.jpg",
|
||||||
|
"url": "https://www.url.com/path/to/image1.jpg",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"split": "train",
|
||||||
|
"annotations": {
|
||||||
|
"segments": [
|
||||||
|
[0, 0.681, 0.485, 0.670, 0.487, 0.676, 0.487, 0.688, 0.515],
|
||||||
|
[1, 0.422, 0.315, 0.438, 0.330, 0.445, 0.328, 0.450, 0.320]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Format: `[class_id, x1, y1, x2, y2, x3, y3, ...]`
|
||||||
|
|
||||||
|
=== "Pose"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"file": "image1.jpg",
|
||||||
|
"url": "https://www.url.com/path/to/image1.jpg",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"split": "train",
|
||||||
|
"annotations": {
|
||||||
|
"pose": [
|
||||||
|
[0, 0.523, 0.376, 0.283, 0.418, 0.374, 0.169, 2, 0.364, 0.178, 2],
|
||||||
|
[0, 0.735, 0.298, 0.193, 0.337, 0.412, 0.225, 2, 0.408, 0.231, 2]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Format: `[class_id, x_center, y_center, width, height, x1, y1, v1, x2, y2, v2, ...]`
|
||||||
|
|
||||||
|
Keypoints follow bbox as repeated `(x, y, v)` triplets where `v` is visibility: 0=not labeled, 1=labeled but occluded, 2=labeled and visible. The keypoint count is dataset-specific (e.g., COCO pose has 17 keypoints = 51 values after bbox).
|
||||||
|
|
||||||
|
=== "OBB"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"file": "image1.jpg",
|
||||||
|
"url": "https://www.url.com/path/to/image1.jpg",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"split": "train",
|
||||||
|
"annotations": {
|
||||||
|
"obb": [
|
||||||
|
[0, 0.480, 0.352, 0.568, 0.356, 0.572, 0.400, 0.484, 0.396],
|
||||||
|
[1, 0.711, 0.274, 0.759, 0.278, 0.755, 0.322, 0.707, 0.318]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Format: `[class_id, x1, y1, x2, y2, x3, y3, x4, y4]`
|
||||||
|
|
||||||
|
The four corner points define the oriented bounding box in clockwise order starting from the top-left corner. All coordinates are normalized (0-1).
|
||||||
|
|
||||||
|
=== "Classify"
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"file": "image1.jpg",
|
||||||
|
"url": "https://www.url.com/path/to/image1.jpg",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"split": "train",
|
||||||
|
"annotations": {
|
||||||
|
"classification": [0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Format: `[class_id]`
|
||||||
|
|
||||||
|
#### Usage Example
|
||||||
|
|
||||||
|
To use an NDJSON dataset with YOLO26, simply specify the path to the `.ndjson` file:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train using NDJSON dataset
|
||||||
|
results = model.train(data="path/to/dataset.ndjson", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training with NDJSON dataset
|
||||||
|
yolo detect train data=path/to/dataset.ndjson model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Advantages of NDJSON format
|
||||||
|
|
||||||
|
- **Single file**: All dataset information contained in one file
|
||||||
|
- **Streaming**: Can process large datasets line-by-line without loading everything into memory
|
||||||
|
- **Cloud integration**: Supports remote image URLs for cloud-based training
|
||||||
|
- **Extensible**: Easy to add custom metadata fields
|
||||||
|
- **Version control**: Single file format works well with git and version control systems
|
||||||
|
|
||||||
|
## Supported Datasets
|
||||||
|
|
||||||
|
Here is a list of the supported datasets and a brief description for each:
|
||||||
|
|
||||||
|
- [African-wildlife](african-wildlife.md): A dataset featuring images of African wildlife, including buffalo, elephant, rhino, and zebras.
|
||||||
|
- [Argoverse](argoverse.md): A dataset containing 3D tracking and motion forecasting data from urban environments with rich annotations.
|
||||||
|
- [Brain-tumor](brain-tumor.md): A dataset for detecting brain tumors includes MRI or CT scan images with details on tumor presence, location, and characteristics.
|
||||||
|
- [COCO](coco.md): Common Objects in Context (COCO) is a large-scale [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and captioning dataset with 80 object categories.
|
||||||
|
- [COCO8](coco8.md): A smaller subset of the first 4 images from COCO train and COCO val, suitable for quick tests.
|
||||||
|
- [COCO8-Grayscale](coco8-grayscale.md): A grayscale version of COCO8 created by converting RGB to grayscale, useful for single-channel model evaluation.
|
||||||
|
- [COCO8-Multispectral](coco8-multispectral.md): A 10-channel multispectral version of COCO8 created by interpolating RGB wavelengths, useful for spectral-aware model evaluation.
|
||||||
|
- [COCO12-Formats](coco12-formats.md): A test dataset with 12 images covering all supported image formats (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) for validating image loading pipelines.
|
||||||
|
- [COCO128](coco128.md): A smaller subset of the first 128 images from COCO train and COCO val, suitable for tests.
|
||||||
|
- [Construction-PPE](construction-ppe.md): A dataset featuring construction site workers with labeled safety gear such as helmets, vests, gloves, boots, and goggles, including missing-equipment annotations like no_helmet, no_googles for real-world compliance monitoring.
|
||||||
|
- [Global Wheat 2020](globalwheat2020.md): A dataset containing images of wheat heads for the Global Wheat Challenge 2020.
|
||||||
|
- [HomeObjects-3K](homeobjects-3k.md): A dataset of indoor household items including beds, chairs, TVs, and more—ideal for applications in smart home automation, robotics, augmented reality, and room layout analysis.
|
||||||
|
- [KITTI](kitti.md): A dataset featuring real-world driving scenes with stereo, LiDAR, and GPS/IMU data, used here for **2D object detection** tasks such as identifying cars, pedestrians, and cyclists in urban, rural, and highway environments.
|
||||||
|
- [LVIS](lvis.md): A large-scale object detection, segmentation, and captioning dataset with 1203 object categories.
|
||||||
|
- [Medical-pills](medical-pills.md): A dataset featuring images of medical-pills, annotated for applications such as pharmaceutical quality assurance, pill sorting, and regulatory compliance.
|
||||||
|
- [Objects365](objects365.md): A high-quality, large-scale dataset for object detection with 365 object categories and over 600K annotated images.
|
||||||
|
- [OpenImagesV7](open-images-v7.md): A comprehensive dataset by Google with 1.7M train images and 42k validation images.
|
||||||
|
- [Roboflow 100](roboflow-100.md): A diverse object detection benchmark with 100 datasets spanning seven imagery domains for comprehensive model evaluation.
|
||||||
|
- [Signature](signature.md): A dataset featuring images of various documents with annotated signatures, supporting document verification and fraud detection research.
|
||||||
|
- [SKU-110K](sku-110k.md): A dataset featuring dense object detection in retail environments with over 11K images and 1.7 million [bounding boxes](https://www.ultralytics.com/glossary/bounding-box).
|
||||||
|
- [TT100K](tt100k.md): Explore the Tsinghua-Tencent 100K (TT100K) traffic sign dataset with 100,000 street view images and 30,000+ annotated traffic signs for robust detection and classification.
|
||||||
|
- [VisDrone](visdrone.md): A dataset containing object detection and multi-object tracking data from drone-captured imagery with over 10K images and video sequences.
|
||||||
|
- [VOC](voc.md): The Pascal Visual Object Classes (VOC) dataset for object detection and segmentation with 20 object classes and over 11K images.
|
||||||
|
- [xView](xview.md): A dataset for object detection in overhead imagery with 60 object categories and over 1 million annotated objects.
|
||||||
|
|
||||||
|
### Adding your own dataset
|
||||||
|
|
||||||
|
If you have your own dataset and would like to use it for training detection models with Ultralytics YOLO format, ensure that it follows the format specified above under "Ultralytics YOLO format". Convert your annotations to the required format and specify the paths, number of classes, and class names in the YAML configuration file.
|
||||||
|
|
||||||
|
## Port or Convert Label Formats
|
||||||
|
|
||||||
|
### COCO Dataset Format to YOLO Format
|
||||||
|
|
||||||
|
You can easily convert labels from the popular [COCO dataset](coco.md) format to the YOLO format using the following code snippet:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/")
|
||||||
|
```
|
||||||
|
|
||||||
|
This conversion tool can be used to convert the COCO dataset or any dataset in the COCO format to the Ultralytics YOLO format. The process transforms the JSON-based COCO annotations into the simpler text-based YOLO format, making it compatible with [Ultralytics YOLO models](../../models/yolo26.md).
|
||||||
|
|
||||||
|
Remember to double-check if the dataset you want to use is compatible with your model and follows the necessary format conventions. Properly formatted datasets are crucial for training successful object detection models.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Ultralytics YOLO dataset format and how to structure it?
|
||||||
|
|
||||||
|
The Ultralytics YOLO format is a structured configuration for defining datasets in your training projects. It involves setting paths to your training, validation, and testing images and corresponding labels. For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
Labels are saved in `*.txt` files with one file per image, formatted as `class x_center y_center width height` with normalized coordinates. For a detailed guide, see the [COCO8 dataset example](coco8.md).
|
||||||
|
|
||||||
|
### How do I convert a COCO dataset to the YOLO format?
|
||||||
|
|
||||||
|
You can convert a COCO dataset to the YOLO format using the [Ultralytics conversion tools](../../reference/data/converter.md). Here's a quick method:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/")
|
||||||
|
```
|
||||||
|
|
||||||
|
This code will convert your COCO annotations to YOLO format, enabling seamless integration with Ultralytics YOLO models. For additional details, visit the [Port or Convert Label Formats](#port-or-convert-label-formats) section.
|
||||||
|
|
||||||
|
### Which datasets are supported by Ultralytics YOLO for object detection?
|
||||||
|
|
||||||
|
Ultralytics YOLO supports a wide range of datasets, including:
|
||||||
|
|
||||||
|
- [Argoverse](argoverse.md)
|
||||||
|
- [COCO](coco.md)
|
||||||
|
- [LVIS](lvis.md)
|
||||||
|
- [COCO8](coco8.md)
|
||||||
|
- [Global Wheat 2020](globalwheat2020.md)
|
||||||
|
- [Objects365](objects365.md)
|
||||||
|
- [OpenImagesV7](open-images-v7.md)
|
||||||
|
|
||||||
|
Each dataset page provides detailed information on the structure and usage tailored for efficient YOLO26 training. Explore the full list in the [Supported Datasets](#supported-datasets) section.
|
||||||
|
|
||||||
|
### How do I start training a YOLO26 model using my dataset?
|
||||||
|
|
||||||
|
To start training a YOLO26 model, ensure your dataset is formatted correctly and the paths are defined in a YAML file. Use the following script to begin training:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt") # Load a pretrained model
|
||||||
|
results = model.train(data="path/to/your_dataset.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=path/to/your_dataset.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [Usage](#usage-example) section for more details on utilizing different modes, including CLI commands.
|
||||||
|
|
||||||
|
### Where can I find practical examples of using Ultralytics YOLO for object detection?
|
||||||
|
|
||||||
|
Ultralytics provides numerous examples and practical guides for using YOLO26 in diverse applications. For a comprehensive overview, visit the [Ultralytics Blog](https://www.ultralytics.com/blog) where you can find case studies, detailed tutorials, and community stories showcasing object detection, segmentation, and more with YOLO26. For specific examples, check the [Usage](../../modes/predict.md) section in the documentation.
|
||||||
127
docs/en/datasets/detect/kitti.md
Executable file
127
docs/en/datasets/detect/kitti.md
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics kitti dataset, a benchmark dataset for computer vision tasks such as 3D object detection, depth estimation, and autonomous driving perception.
|
||||||
|
keywords: kitti, Ultralytics, dataset, object detection, 3D vision, YOLO26, training, validation, self-driving cars, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# KITTI Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-kitti-detection-dataset.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open KITTI Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The kitti dataset is one of the most influential benchmark datasets for autonomous driving and computer vision. Released by the Karlsruhe Institute of Technology and Toyota Technological Institute at Chicago, it contains stereo camera, LiDAR, and GPS/IMU data collected from real-world driving scenarios.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/NNeDlTbq9pA"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the KITTI Dataset 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
It is widely used for evaluating algorithms in object detection, depth estimation, optical flow, and visual odometry. The dataset is fully compatible with Ultralytics YOLO26 for 2D object detection tasks and can be easily integrated into the Ultralytics platform for training and evaluation.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
|
||||||
|
Kitti original test set is excluded here since it does not contain ground-truth annotations.
|
||||||
|
|
||||||
|
In total, the dataset includes 7,481 images, each paired with detailed annotations for objects such as cars, pedestrians, cyclists, and other road elements. The dataset is divided into two main subsets:
|
||||||
|
|
||||||
|
- **Training set:** Contains 5,985 images with annotated labels used for model training.
|
||||||
|
- **Validation set:** Includes 1,496 images with corresponding annotations used for performance evaluation and benchmarking.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Kitti dataset enables advancements in autonomous driving and robotics, supporting tasks like:
|
||||||
|
|
||||||
|
- **Autonomous vehicle perception**: Training models to detect and track vehicles, pedestrians, and obstacles for safe navigation in self-driving systems.
|
||||||
|
- **3D scene understanding**: Supporting depth estimation, stereo vision, and 3D object localization to help machines understand spatial environments.
|
||||||
|
- **Optical flow and motion prediction**: Enabling motion analysis to predict the movement of objects and improve trajectory planning in dynamic environments.
|
||||||
|
- **Computer vision benchmarking**: Serving as a standard benchmark for evaluating performance across multiple vision tasks, including object detection, and tracking.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
Ultralytics defines the kitti dataset configuration using a YAML file. This file specifies dataset paths, class labels, and metadata required for training. The configuration file is available at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/kitti.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/kitti.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/kitti.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/kitti.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the kitti dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following commands. For more details, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained YOLO26 model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train on kitti dataset
|
||||||
|
results = model.train(data="kitti.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=kitti.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also perform evaluation, [inference](../../modes/predict.md), and [export](../../modes/export.md) tasks directly from the command line or Python API using the same configuration file.
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The kitti dataset provides diverse driving scenarios. Each image includes bounding box annotations for 2D object detection tasks. The examples showcase the dataset's rich variety, enabling robust model generalization across diverse real-world conditions.
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/kitti-dataset-sample.avif" alt="KITTI dataset vehicle detection sample" width="800">
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the kitti dataset in your research, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{Geiger2013IJRR,
|
||||||
|
author = {Andreas Geiger and Philip Lenz and Christoph Stiller and Raquel Urtasun},
|
||||||
|
title = {Vision meets Robotics: The KITTI Dataset},
|
||||||
|
journal = {International Journal of Robotics Research (IJRR)},
|
||||||
|
year = {2013}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We acknowledge the KITTI Vision Benchmark Suite for providing this comprehensive dataset that continues to shape progress in computer vision, robotics, and autonomous systems. Visit the [kitti website](https://www.cvlibs.net/datasets/kitti/) for more information.
|
||||||
|
|
||||||
|
## FAQs
|
||||||
|
|
||||||
|
### What is the kitti dataset used for?
|
||||||
|
|
||||||
|
The kitti dataset is primarily used for computer vision research in autonomous driving, supporting tasks like object detection, depth estimation, optical flow, and 3D localization.
|
||||||
|
|
||||||
|
### How many images are included in the kitti dataset?
|
||||||
|
|
||||||
|
The dataset includes 5,985 labeled training images and 1,496 validation images captured across urban, rural, and highway scenes. The original test set is excluded here since it does not contain ground-truth annotations.
|
||||||
|
|
||||||
|
### Which object classes are annotated in the dataset?
|
||||||
|
|
||||||
|
kitti includes annotations for objects such as cars, pedestrians, cyclists, trucks, trams, and miscellaneous road users.
|
||||||
|
|
||||||
|
### Can I train Ultralytics YOLO26 models using the kitti dataset?
|
||||||
|
|
||||||
|
Yes, kitti is fully compatible with Ultralytics YOLO26. You can [train](../../modes/train.md) and [validate](../../modes/val.md), models directly using the provided YAML configuration file.
|
||||||
|
|
||||||
|
### Where can I find the kitti dataset configuration file?
|
||||||
|
|
||||||
|
You can access the YAML file at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/kitti.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/kitti.yaml).
|
||||||
159
docs/en/datasets/detect/lvis.md
Executable file
159
docs/en/datasets/detect/lvis.md
Executable file
@@ -0,0 +1,159 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the LVIS dataset by Facebook AI Research, a benchmark for object detection and instance segmentation with a large, diverse vocabulary. Learn how to utilize it.
|
||||||
|
keywords: LVIS dataset, object detection, instance segmentation, Facebook AI Research, YOLO, computer vision, model training, LVIS examples
|
||||||
|
---
|
||||||
|
|
||||||
|
# LVIS Dataset
|
||||||
|
|
||||||
|
The [LVIS dataset](https://www.lvisdataset.org/) is a large-scale, fine-grained vocabulary-level annotation dataset developed and released by Facebook AI Research (FAIR). It is primarily used as a research benchmark for object detection and [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) with a large vocabulary of categories, aiming to drive further advancements in the computer vision field.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/cfTKj96TjSE"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> YOLO World training workflow with LVIS dataset
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/lvis-dataset-example-images.avif" alt="LVIS large vocabulary instance segmentation dataset">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- LVIS contains 160k images and 2M instance annotations for object detection, segmentation, and captioning tasks.
|
||||||
|
- The dataset comprises 1203 object categories, including common objects like cars, bicycles, and animals, as well as more specific categories such as umbrellas, handbags, and sports equipment.
|
||||||
|
- Annotations include object bounding boxes, segmentation masks, and captions for each image.
|
||||||
|
- LVIS provides standardized evaluation metrics like [mean Average Precision](https://www.ultralytics.com/glossary/mean-average-precision-map) (mAP) for object detection, and mean Average [Recall](https://www.ultralytics.com/glossary/recall) (mAR) for segmentation tasks, making it suitable for comparing model performance.
|
||||||
|
- LVIS uses exactly the same images as [COCO](./coco.md) dataset, but with different splits and different annotations.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The LVIS dataset is split into four subsets:
|
||||||
|
|
||||||
|
1. **Train**: This subset contains 100k images for training object detection, segmentation, and captioning models.
|
||||||
|
2. **Val**: This subset has 20k images used for validation purposes during model training.
|
||||||
|
3. **Minival**: This subset is exactly the same as COCO val2017 set which has 5k images used for validation purposes during model training.
|
||||||
|
4. **Test**: This subset consists of 20k images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results are submitted to the [LVIS evaluation server](https://eval.ai/web/challenges/challenge-page/675/overview) for performance evaluation.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The LVIS dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection (such as [YOLO](../../models/yolo26.md), [Faster R-CNN](https://arxiv.org/abs/1506.01497), and [SSD](https://arxiv.org/abs/1512.02325)), instance segmentation (such as [Mask R-CNN](https://arxiv.org/abs/1703.06870)). The dataset's diverse set of object categories, large number of annotated images, and standardized evaluation metrics make it an essential resource for computer vision researchers and practitioners.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the LVIS dataset, the `lvis.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/lvis.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/lvis.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/lvis.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/lvis.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the LVIS dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="lvis.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=lvis.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The LVIS dataset contains a diverse set of images with various object categories and complex scenes. Here are some examples of images from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the LVIS dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the LVIS dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{gupta2019lvis,
|
||||||
|
title={LVIS: A Dataset for Large Vocabulary Instance Segmentation},
|
||||||
|
author={Gupta, Agrim and Dollar, Piotr and Girshick, Ross},
|
||||||
|
booktitle={Proceedings of the {IEEE} Conference on Computer Vision and Pattern Recognition},
|
||||||
|
year={2019}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the LVIS Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the LVIS dataset and its creators, visit the [LVIS dataset website](https://www.lvisdataset.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the LVIS dataset, and how is it used in computer vision?
|
||||||
|
|
||||||
|
The [LVIS dataset](https://www.lvisdataset.org/) is a large-scale dataset with fine-grained vocabulary-level annotations developed by Facebook AI Research (FAIR). It is primarily used for object detection and instance segmentation, featuring over 1203 object categories and 2 million instance annotations. Researchers and practitioners use it to train and benchmark models like Ultralytics YOLO for advanced computer vision tasks. The dataset's extensive size and diversity make it an essential resource for pushing the boundaries of model performance in detection and segmentation.
|
||||||
|
|
||||||
|
### How can I train a YOLO26n model using the LVIS dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n model on the LVIS dataset for 100 epochs with an image size of 640, follow the example below. This process utilizes Ultralytics' framework, which offers comprehensive training features.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="lvis.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=lvis.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed training configurations, refer to the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### How does the LVIS dataset differ from the COCO dataset?
|
||||||
|
|
||||||
|
The images in the LVIS dataset are the same as those in the [COCO dataset](./coco.md), but the two differ in terms of splitting and annotations. LVIS provides a larger and more detailed vocabulary with 1203 object categories compared to COCO's 80 categories. Additionally, LVIS focuses on annotation completeness and diversity, aiming to push the limits of [object detection](https://www.ultralytics.com/glossary/object-detection) and instance segmentation models by offering more nuanced and comprehensive data.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO for training on the LVIS dataset?
|
||||||
|
|
||||||
|
Ultralytics YOLO models, including the latest YOLO26, are optimized for real-time object detection with state-of-the-art [accuracy](https://www.ultralytics.com/glossary/accuracy) and speed. They support a wide range of annotations, such as the fine-grained ones provided by the LVIS dataset, making them ideal for advanced computer vision applications. Moreover, Ultralytics offers seamless integration with various [training](../../modes/train.md), [validation](../../modes/val.md), and [prediction](../../modes/predict.md) modes, ensuring efficient model development and deployment.
|
||||||
|
|
||||||
|
### Can I see some sample annotations from the LVIS dataset?
|
||||||
|
|
||||||
|
Yes, the LVIS dataset includes a variety of images with diverse object categories and complex scenes. Here is an example of a sample image along with its annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This mosaiced image demonstrates a training batch composed of multiple dataset images combined into one. Mosaicing increases the variety of objects and scenes within each training batch, enhancing the model's ability to generalize across different contexts. For more details on the LVIS dataset, explore the [LVIS dataset documentation](#key-features).
|
||||||
153
docs/en/datasets/detect/medical-pills.md
Executable file
153
docs/en/datasets/detect/medical-pills.md
Executable file
@@ -0,0 +1,153 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the medical-pills detection dataset with labeled images. Essential for training AI models for pharmaceutical identification and automation.
|
||||||
|
keywords: medical-pills dataset, pill detection, pharmaceutical imaging, AI in healthcare, computer vision, object detection, medical automation, dataset for training
|
||||||
|
---
|
||||||
|
|
||||||
|
# Medical Pills Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-medical-pills-dataset.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Medical Pills Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The medical-pills detection dataset is a proof-of-concept (POC) dataset, carefully curated to demonstrate the potential of AI in pharmaceutical applications. It contains labeled images specifically designed to train [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) [models](https://docs.ultralytics.com/models/) for identifying medical-pills.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/8gePl_Zcs5c"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to train Ultralytics YOLO26 Model on Medical Pills Detection Dataset in <a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-medical-pills-dataset.ipynb">Google Colab</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This dataset serves as a foundational resource for automating essential [tasks](https://docs.ultralytics.com/tasks/) such as quality control, packaging automation, and efficient sorting in pharmaceutical workflows. By integrating this dataset into projects, researchers and developers can explore innovative [solutions](https://docs.ultralytics.com/solutions/) that enhance [accuracy](https://www.ultralytics.com/glossary/accuracy), streamline operations, and ultimately contribute to improved healthcare outcomes.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The medical-pills dataset is divided into two subsets:
|
||||||
|
|
||||||
|
- **Training set**: Consisting of 92 images, each annotated with the class `pill`.
|
||||||
|
- **Validation set**: Comprising 23 images with corresponding annotations.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Using computer vision for medical-pills detection enables automation in the pharmaceutical industry, supporting tasks like:
|
||||||
|
|
||||||
|
- **Pharmaceutical Sorting**: Automating the sorting of pills based on size, shape, or color to enhance production efficiency.
|
||||||
|
- **AI Research and Development**: Serving as a benchmark for developing and testing computer vision algorithms in pharmaceutical use cases.
|
||||||
|
- **Digital Inventory Systems**: Powering smart inventory solutions by integrating automated pill recognition for real-time stock monitoring and replenishment planning.
|
||||||
|
- **Quality Control**: Ensuring consistency in pill production by identifying defects, irregularities, or contamination.
|
||||||
|
- **Counterfeit Detection**: Helping identify potentially counterfeit medications by analyzing visual characteristics against known standards.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML configuration file is provided to define the dataset's structure, including paths and classes. For the medical-pills dataset, the `medical-pills.yaml` file can be accessed at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/medical-pills.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/medical-pills.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/medical-pills.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/medical-pills.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the medical-pills dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following examples. For detailed arguments, refer to the model's [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="medical-pills.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=medical-pills.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a fine-tuned model
|
||||||
|
|
||||||
|
# Inference using the model
|
||||||
|
results = model.predict("https://ultralytics.com/assets/medical-pills-sample.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start prediction with a fine-tuned *.pt model
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/medical-pills-sample.jpg"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The medical-pills dataset features labeled images showcasing the diversity of pills. Below is an example of a labeled image from the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: Displayed is a training batch comprising mosaiced dataset images. Mosaicing enhances training diversity by consolidating multiple images into one, improving model generalization.
|
||||||
|
|
||||||
|
## Integration with Other Datasets
|
||||||
|
|
||||||
|
For more comprehensive pharmaceutical analysis, consider combining the medical-pills dataset with other related datasets like [package-seg](../segment/package-seg.md) for packaging identification or medical imaging datasets like [brain-tumor](brain-tumor.md) to develop end-to-end healthcare AI solutions.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
The dataset is available under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE).
|
||||||
|
|
||||||
|
If you use the Medical-pills dataset in your research or development work, please cite it using the mentioned details:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@dataset{Jocher_Ultralytics_Datasets_2024,
|
||||||
|
author = {Jocher, Glenn and Rizwan, Muhammad},
|
||||||
|
license = {AGPL-3.0},
|
||||||
|
month = {Dec},
|
||||||
|
title = {Ultralytics Datasets: Medical-pills Detection Dataset},
|
||||||
|
url = {https://docs.ultralytics.com/datasets/detect/medical-pills/},
|
||||||
|
version = {1.0.0},
|
||||||
|
year = {2024}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the structure of the medical-pills dataset?
|
||||||
|
|
||||||
|
The dataset includes 92 images for training and 23 images for validation. Each image is annotated with the class `pill`, enabling effective training and evaluation of models for pharmaceutical applications.
|
||||||
|
|
||||||
|
### How can I train a YOLO26 model on the medical-pills dataset?
|
||||||
|
|
||||||
|
You can train a YOLO26 model for 100 epochs with an image size of 640px using the Python or CLI methods provided. Refer to the [Training Example](#usage) section for detailed instructions and check the [YOLO26 documentation](../../models/yolo26.md) for more information on model capabilities.
|
||||||
|
|
||||||
|
### What are the benefits of using the medical-pills dataset in AI projects?
|
||||||
|
|
||||||
|
The dataset enables automation in pill detection, contributing to counterfeit prevention, quality assurance, and pharmaceutical process optimization. It also serves as a valuable resource for developing AI solutions that can improve medication safety and supply chain efficiency.
|
||||||
|
|
||||||
|
### How do I perform inference on the medical-pills dataset?
|
||||||
|
|
||||||
|
Inference can be done using Python or CLI methods with a fine-tuned YOLO26 model. Refer to the [Inference Example](#usage) section for code snippets and the [Predict mode documentation](../../modes/predict.md) for additional options.
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration file for the medical-pills dataset?
|
||||||
|
|
||||||
|
The YAML file is available at [medical-pills.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/medical-pills.yaml), containing dataset paths, classes, and additional configuration details essential for training models on this dataset.
|
||||||
152
docs/en/datasets/detect/objects365.md
Executable file
152
docs/en/datasets/detect/objects365.md
Executable file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Objects365 Dataset with 2M images and 30M bounding boxes across 365 categories. Enhance your object detection models with diverse, high-quality data.
|
||||||
|
keywords: Objects365 dataset, object detection, machine learning, deep learning, computer vision, annotated images, bounding boxes, YOLO26, high-resolution images, dataset configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
# Objects365 Dataset
|
||||||
|
|
||||||
|
The [Objects365](https://www.objects365.org/) dataset is a large-scale, high-quality dataset designed to foster object detection research with a focus on diverse objects in the wild. Created by a team of [Megvii](https://en.megvii.com/) researchers, the dataset offers a wide range of high-resolution images with a comprehensive set of annotated bounding boxes covering 365 object categories.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/J-RH22rwx1A"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the Objects365 Dataset with Ultralytics | 2M Annotations 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- Objects365 contains 365 object categories, with 2 million images and over 30 million bounding boxes.
|
||||||
|
- The dataset includes diverse objects in various scenarios, providing a rich and challenging benchmark for object detection tasks.
|
||||||
|
- Annotations include bounding boxes for objects, making it suitable for training and evaluating object detection models.
|
||||||
|
- Objects365 pretrained models significantly outperform ImageNet pretrained models, leading to better generalization on various tasks.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Objects365 dataset is organized into a single set of images with corresponding annotations:
|
||||||
|
|
||||||
|
- **Images**: The dataset includes 2 million high-resolution images, each containing a variety of objects across 365 categories.
|
||||||
|
- **Annotations**: The images are annotated with over 30 million bounding boxes, providing comprehensive ground truth information for [object detection](https://docs.ultralytics.com/tasks/detect/) tasks.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The Objects365 dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection tasks. The dataset's diverse set of object categories and high-quality annotations make it a valuable resource for researchers and practitioners in the field of [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. For the case of the Objects365 Dataset, the `Objects365.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Objects365.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Objects365.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/Objects365.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/Objects365.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Objects365 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="Objects365.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=Objects365.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Objects365 dataset contains a diverse set of high-resolution images with objects from 365 categories, providing rich context for [object detection](https://www.ultralytics.com/glossary/object-detection) tasks. Here are some examples of the images in the dataset:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Objects365**: This image demonstrates an example of object detection, where objects are annotated with bounding boxes. The dataset provides a wide range of images to facilitate the development of models for this task.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the Objects365 dataset and highlights the importance of accurate object detection for computer vision applications.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Objects365 dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{shao2019objects365,
|
||||||
|
title={Objects365: A Large-scale, High-quality Dataset for Object Detection},
|
||||||
|
author={Shao, Shuai and Li, Zeming and Zhang, Tianyuan and Peng, Chao and Yu, Gang and Li, Jing and Zhang, Xiangyu and Sun, Jian},
|
||||||
|
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
|
||||||
|
pages={8425--8434},
|
||||||
|
year={2019}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the team of researchers who created and maintain the Objects365 dataset as a valuable resource for the computer vision research community. For more information about the Objects365 dataset and its creators, visit the [Objects365 dataset website](https://www.objects365.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Objects365 dataset used for?
|
||||||
|
|
||||||
|
The [Objects365 dataset](https://www.objects365.org/) is designed for object detection tasks in [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) and computer vision. It provides a large-scale, high-quality dataset with 2 million annotated images and 30 million bounding boxes across 365 categories. Leveraging such a diverse dataset helps improve the performance and generalization of object detection models, making it invaluable for research and development in the field.
|
||||||
|
|
||||||
|
### How can I train a YOLO26 model on the Objects365 dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n model using the Objects365 dataset for 100 epochs with an image size of 640, follow these instructions:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="Objects365.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=Objects365.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [Training](../../modes/train.md) page for a comprehensive list of available arguments.
|
||||||
|
|
||||||
|
### Why should I use the Objects365 dataset for my object detection projects?
|
||||||
|
|
||||||
|
The Objects365 dataset offers several advantages for object detection tasks:
|
||||||
|
|
||||||
|
1. **Diversity**: It includes 2 million images with objects in diverse scenarios, covering 365 categories.
|
||||||
|
2. **High-quality Annotations**: Over 30 million bounding boxes provide comprehensive ground truth data.
|
||||||
|
3. **Performance**: Models pretrained on Objects365 significantly outperform those trained on datasets like [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/), leading to better generalization.
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration file for the Objects365 dataset?
|
||||||
|
|
||||||
|
The YAML configuration file for the Objects365 dataset is available at [Objects365.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/Objects365.yaml). This file contains essential information such as dataset paths and class labels, crucial for setting up your training environment.
|
||||||
|
|
||||||
|
### How does the dataset structure of Objects365 enhance object detection modeling?
|
||||||
|
|
||||||
|
The [Objects365 dataset](https://www.objects365.org/) is organized with 2 million high-resolution images and comprehensive annotations of over 30 million bounding boxes. This structure ensures a robust dataset for training [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection, offering a wide variety of objects and scenarios. Such diversity and volume help in developing models that are more accurate and capable of generalizing well to real-world applications. For more details on the dataset structure, refer to the [Dataset YAML](#dataset-yaml) section.
|
||||||
237
docs/en/datasets/detect/open-images-v7.md
Executable file
237
docs/en/datasets/detect/open-images-v7.md
Executable file
@@ -0,0 +1,237 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the comprehensive Open Images V7 dataset by Google. Learn about its annotations, applications, and use YOLO26 pretrained models for computer vision tasks.
|
||||||
|
keywords: Open Images V7, Google dataset, computer vision, YOLO26 models, object detection, image segmentation, visual relationships, AI research, Ultralytics
|
||||||
|
---
|
||||||
|
|
||||||
|
# Open Images V7 Dataset
|
||||||
|
|
||||||
|
[Open Images V7](https://storage.googleapis.com/openimages/web/index.html) is a versatile and expansive dataset championed by Google. Aimed at propelling research in the realm of [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv), it boasts a vast collection of images annotated with a plethora of data, including image-level labels, object bounding boxes, object segmentation masks, visual relationships, and localized narratives.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/u3pLlgzUeV8"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> <a href="https://www.ultralytics.com/glossary/object-detection">Object Detection</a> using OpenImagesV7 Pretrained Model
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Open Images V7 Pretrained Models
|
||||||
|
|
||||||
|
| Model | size<br><sup>(pixels)</sup> | mAP<sup>val<br>50-95</sup> | Speed<br><sup>CPU ONNX<br>(ms)</sup> | Speed<br><sup>A100 TensorRT<br>(ms)</sup> | params<br><sup>(M)</sup> | FLOPs<br><sup>(B)</sup> |
|
||||||
|
| ----------------------------------------------------------------------------------------- | --------------------------- | -------------------------- | ------------------------------------ | ----------------------------------------- | ------------------------ | ----------------------- |
|
||||||
|
| [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8n-oiv7.pt) | 640 | 18.4 | 142.4 | 1.21 | 3.5 | 10.5 |
|
||||||
|
| [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8s-oiv7.pt) | 640 | 27.7 | 183.1 | 1.40 | 11.4 | 29.7 |
|
||||||
|
| [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8m-oiv7.pt) | 640 | 33.6 | 408.5 | 2.26 | 26.2 | 80.6 |
|
||||||
|
| [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8l-oiv7.pt) | 640 | 34.9 | 596.9 | 2.43 | 44.1 | 167.4 |
|
||||||
|
| [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8x-oiv7.pt) | 640 | 36.3 | 860.6 | 3.56 | 68.7 | 260.6 |
|
||||||
|
|
||||||
|
You can use these pretrained models for inference or fine-tuning as follows.
|
||||||
|
|
||||||
|
!!! example "Pretrained Model Usage Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load an Open Images Dataset V7 pretrained YOLOv8n model
|
||||||
|
model = YOLO("yolov8n-oiv7.pt")
|
||||||
|
|
||||||
|
# Run prediction
|
||||||
|
results = model.predict(source="image.jpg")
|
||||||
|
|
||||||
|
# Start training from the pretrained checkpoint
|
||||||
|
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Predict using an Open Images Dataset V7 pretrained model
|
||||||
|
yolo detect predict source=image.jpg model=yolov8n-oiv7.pt
|
||||||
|
|
||||||
|
# Start training from an Open Images Dataset V7 pretrained checkpoint
|
||||||
|
yolo detect train data=coco8.yaml model=yolov8n-oiv7.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- Encompasses ~9M images annotated in various ways to suit multiple computer vision tasks.
|
||||||
|
- Houses a staggering 16M bounding boxes across 600 object classes in 1.9M images. These boxes are primarily hand-drawn by experts ensuring high [precision](https://www.ultralytics.com/glossary/precision).
|
||||||
|
- Visual relationship annotations totaling 3.3M are available, detailing 1,466 unique relationship triplets, object properties, and human activities.
|
||||||
|
- V5 introduced segmentation masks for 2.8M objects across 350 classes.
|
||||||
|
- V6 introduced 675k localized narratives that amalgamate voice, text, and mouse traces highlighting described objects.
|
||||||
|
- V7 introduced 66.4M point-level labels on 1.4M images, spanning 5,827 classes.
|
||||||
|
- Encompasses 61.4M image-level labels across a diverse set of 20,638 classes.
|
||||||
|
- Provides a unified platform for [image classification](https://www.ultralytics.com/glossary/image-classification), object detection, relationship detection, [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), and multimodal image descriptions.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
Open Images V7 is structured in multiple components catering to varied computer vision challenges:
|
||||||
|
|
||||||
|
- **Images**: About 9 million images, often showcasing intricate scenes with an average of 8.3 objects per image.
|
||||||
|
- **Bounding Boxes**: Over 16 million boxes that demarcate objects across 600 categories.
|
||||||
|
- **Segmentation Masks**: These detail the exact boundary of 2.8M objects across 350 classes.
|
||||||
|
- **Visual Relationships**: 3.3M annotations indicating object relationships, properties, and actions.
|
||||||
|
- **Localized Narratives**: 675k descriptions combining voice, text, and mouse traces.
|
||||||
|
- **Point-Level Labels**: 66.4M labels across 1.4M images, suitable for zero/few-shot [semantic segmentation](https://www.ultralytics.com/glossary/semantic-segmentation).
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Open Images V7 is a cornerstone for training and evaluating state-of-the-art models in various computer vision tasks. The dataset's broad scope and high-quality annotations make it indispensable for researchers and developers specializing in [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
Some key applications include:
|
||||||
|
|
||||||
|
- **Advanced Object Detection**: Train models to identify and locate multiple objects in complex scenes with high accuracy.
|
||||||
|
- **Semantic Understanding**: Develop systems that comprehend visual relationships between objects.
|
||||||
|
- **Image Segmentation**: Create precise pixel-level masks for objects, enabling detailed scene analysis.
|
||||||
|
- **Multi-modal Learning**: Combine visual data with text descriptions for richer AI understanding.
|
||||||
|
- **Zero-shot Learning**: Leverage the extensive class coverage to identify objects not seen during training.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
Ultralytics maintains an `open-images-v7.yaml` file that specifies the dataset paths, class names, and other configuration details required for training.
|
||||||
|
|
||||||
|
!!! example "OpenImagesV7.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/open-images-v7.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Open Images V7 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
|
||||||
|
The complete Open Images V7 dataset comprises 1,743,042 training images and 41,620 validation images, requiring approximately **561 GB of storage space** upon download.
|
||||||
|
|
||||||
|
Executing the commands provided below will trigger an automatic download of the full dataset if it's not already present locally. Before running the below example it's crucial to:
|
||||||
|
|
||||||
|
- Verify that your device has enough storage capacity.
|
||||||
|
- Ensure a robust and speedy internet connection.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a COCO-pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on the Open Images V7 dataset
|
||||||
|
results = model.train(data="open-images-v7.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a COCO-pretrained YOLO26n model on the Open Images V7 dataset
|
||||||
|
yolo detect train data=open-images-v7.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
Illustrations of the dataset help provide insights into its richness:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Open Images V7**: This image exemplifies the depth and detail of annotations available, including bounding boxes, relationships, and segmentation masks.
|
||||||
|
|
||||||
|
Researchers can gain invaluable insights into the array of computer vision challenges that the dataset addresses, from basic object detection to intricate relationship identification. The [diversity of annotations](https://docs.ultralytics.com/datasets/explorer/) makes Open Images V7 particularly valuable for developing models that can understand complex visual scenes.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
For those employing Open Images V7 in their work, it's prudent to cite the relevant papers and acknowledge the creators:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{OpenImages,
|
||||||
|
author = {Alina Kuznetsova and Hassan Rom and Neil Alldrin and Jasper Uijlings and Ivan Krasin and Jordi Pont-Tuset and Shahab Kamali and Stefan Popov and Matteo Malloci and Alexander Kolesnikov and Tom Duerig and Vittorio Ferrari},
|
||||||
|
title = {The Open Images Dataset V4: Unified image classification, object detection, and visual relationship detection at scale},
|
||||||
|
year = {2020},
|
||||||
|
journal = {IJCV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A heartfelt acknowledgment goes out to the Google AI team for creating and maintaining the Open Images V7 dataset. For a deep dive into the dataset and its offerings, navigate to the [official Open Images V7 website](https://storage.googleapis.com/openimages/web/index.html).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Open Images V7 dataset?
|
||||||
|
|
||||||
|
Open Images V7 is an extensive and versatile dataset created by Google, designed to advance research in computer vision. It includes image-level labels, object bounding boxes, object segmentation masks, visual relationships, and localized narratives, making it ideal for various computer vision tasks such as object detection, segmentation, and relationship detection.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model on the Open Images V7 dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model on the Open Images V7 dataset, you can use both Python and CLI commands. Here's an example of training the YOLO26n model for 100 epochs with an image size of 640:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a COCO-pretrained YOLO26n model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model on the Open Images V7 dataset
|
||||||
|
results = model.train(data="open-images-v7.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a COCO-pretrained YOLO26n model on the Open Images V7 dataset
|
||||||
|
yolo detect train data=open-images-v7.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on arguments and settings, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are some key features of the Open Images V7 dataset?
|
||||||
|
|
||||||
|
The Open Images V7 dataset includes approximately 9 million images with various annotations:
|
||||||
|
|
||||||
|
- **Bounding Boxes**: 16 million bounding boxes across 600 object classes.
|
||||||
|
- **Segmentation Masks**: Masks for 2.8 million objects across 350 classes.
|
||||||
|
- **Visual Relationships**: 3.3 million annotations indicating relationships, properties, and actions.
|
||||||
|
- **Localized Narratives**: 675,000 descriptions combining voice, text, and mouse traces.
|
||||||
|
- **Point-Level Labels**: 66.4 million labels across 1.4 million images.
|
||||||
|
- **Image-Level Labels**: 61.4 million labels across 20,638 classes.
|
||||||
|
|
||||||
|
### What pretrained models are available for the Open Images V7 dataset?
|
||||||
|
|
||||||
|
Ultralytics provides several YOLOv8 pretrained models for the Open Images V7 dataset, each with different sizes and performance metrics:
|
||||||
|
|
||||||
|
| Model | size<br><sup>(pixels)</sup> | mAP<sup>val<br>50-95</sup> | Speed<br><sup>CPU ONNX<br>(ms)</sup> | Speed<br><sup>A100 TensorRT<br>(ms)</sup> | params<br><sup>(M)</sup> | FLOPs<br><sup>(B)</sup> |
|
||||||
|
| ----------------------------------------------------------------------------------------- | --------------------------- | -------------------------- | ------------------------------------ | ----------------------------------------- | ------------------------ | ----------------------- |
|
||||||
|
| [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8n-oiv7.pt) | 640 | 18.4 | 142.4 | 1.21 | 3.5 | 10.5 |
|
||||||
|
| [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8s-oiv7.pt) | 640 | 27.7 | 183.1 | 1.40 | 11.4 | 29.7 |
|
||||||
|
| [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8m-oiv7.pt) | 640 | 33.6 | 408.5 | 2.26 | 26.2 | 80.6 |
|
||||||
|
| [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8l-oiv7.pt) | 640 | 34.9 | 596.9 | 2.43 | 44.1 | 167.4 |
|
||||||
|
| [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolov8x-oiv7.pt) | 640 | 36.3 | 860.6 | 3.56 | 68.7 | 260.6 |
|
||||||
|
|
||||||
|
### What applications can the Open Images V7 dataset be used for?
|
||||||
|
|
||||||
|
The Open Images V7 dataset supports a variety of computer vision tasks including:
|
||||||
|
|
||||||
|
- **[Image Classification](https://www.ultralytics.com/glossary/image-classification)**
|
||||||
|
- **Object Detection**
|
||||||
|
- **Instance Segmentation**
|
||||||
|
- **Visual Relationship Detection**
|
||||||
|
- **Multimodal Image Descriptions**
|
||||||
|
|
||||||
|
Its comprehensive annotations and broad scope make it suitable for training and evaluating advanced [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models, as highlighted in practical use cases detailed in our [applications](#applications) section.
|
||||||
182
docs/en/datasets/detect/roboflow-100.md
Executable file
182
docs/en/datasets/detect/roboflow-100.md
Executable file
@@ -0,0 +1,182 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Roboflow 100 dataset featuring 100 diverse datasets designed to test object detection models across various domains, from healthcare to video games.
|
||||||
|
keywords: Roboflow 100, Ultralytics, object detection, dataset, benchmarking, machine learning, computer vision, diverse datasets, model evaluation
|
||||||
|
---
|
||||||
|
|
||||||
|
# Roboflow 100 Dataset
|
||||||
|
|
||||||
|
Roboflow 100, sponsored by [Intel](https://www.intel.com/), is a groundbreaking [object detection](../../tasks/detect.md) benchmark dataset. It includes 100 diverse datasets. This benchmark is specifically designed to test the adaptability of [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) models, like [Ultralytics YOLO models](../../models/yolo26.md), to various domains, including healthcare, aerial imagery, and video games.
|
||||||
|
|
||||||
|
!!! question "Licensing"
|
||||||
|
|
||||||
|
Ultralytics offers two licensing options to accommodate different use cases:
|
||||||
|
|
||||||
|
- **AGPL-3.0 License**: This [OSI-approved](https://opensource.org/license) open-source license is ideal for students and enthusiasts, promoting open collaboration and knowledge sharing. See the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for more details and visit our [AGPL-3.0 License page](https://www.ultralytics.com/legal/agpl-3-0-software-license).
|
||||||
|
- **Enterprise License**: Designed for commercial use, this license allows for the seamless integration of Ultralytics software and AI models into commercial products and services. If your scenario involves commercial applications, please reach out via [Ultralytics Licensing](https://www.ultralytics.com/license).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/roboflow-100-overview.avif" alt="Roboflow 100 diverse object detection benchmark">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Diverse Domains**: Includes 100 datasets across seven distinct domains: Aerial, Video games, Microscopic, Underwater, Documents, Electromagnetic, and Real World.
|
||||||
|
- **Scale**: The benchmark comprises 224,714 images across 805 classes, representing over 11,170 hours of [data labeling](https://www.ultralytics.com/glossary/data-labeling) effort.
|
||||||
|
- **Standardization**: All images are [preprocessed](https://www.ultralytics.com/glossary/data-preprocessing) and resized to 640x640 pixels for consistent evaluation.
|
||||||
|
- **Clean Evaluation**: Focuses on eliminating class ambiguity and filters out underrepresented classes to ensure cleaner [model evaluation](../../guides/model-evaluation-insights.md).
|
||||||
|
- **Annotations**: Includes [bounding boxes](https://www.ultralytics.com/glossary/bounding-box) for objects, suitable for [training](../../modes/train.md) and evaluating object detection models using metrics like [mAP](https://www.ultralytics.com/glossary/mean-average-precision-map).
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Roboflow 100 dataset is organized into seven categories, each containing a unique collection of datasets, images, and classes:
|
||||||
|
|
||||||
|
- **Aerial**: 7 datasets, 9,683 images, 24 classes.
|
||||||
|
- **Video Games**: 7 datasets, 11,579 images, 88 classes.
|
||||||
|
- **Microscopic**: 11 datasets, 13,378 images, 28 classes.
|
||||||
|
- **Underwater**: 5 datasets, 18,003 images, 39 classes.
|
||||||
|
- **Documents**: 8 datasets, 24,813 images, 90 classes.
|
||||||
|
- **Electromagnetic**: 12 datasets, 36,381 images, 41 classes.
|
||||||
|
- **Real World**: 50 datasets, 110,615 images, 495 classes.
|
||||||
|
|
||||||
|
This structure provides a diverse and extensive testing ground for [object detection](https://www.ultralytics.com/glossary/object-detection) models, reflecting a wide array of real-world application scenarios found in various [Ultralytics Solutions](https://www.ultralytics.com/solutions).
|
||||||
|
|
||||||
|
## Benchmarking
|
||||||
|
|
||||||
|
Dataset [benchmarking](../../modes/benchmark.md) involves evaluating the performance of [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models on specific datasets using standardized metrics. Common metrics include [accuracy](https://www.ultralytics.com/glossary/accuracy), mean Average Precision (mAP), and [F1-score](https://www.ultralytics.com/glossary/f1-score). You can learn more about these in our [YOLO Performance Metrics guide](../../guides/yolo-performance-metrics.md).
|
||||||
|
|
||||||
|
!!! tip "Benchmarking Results"
|
||||||
|
|
||||||
|
Benchmarking results using the provided script will be stored in the `ultralytics-benchmarks/` directory, specifically in `evaluation.txt`.
|
||||||
|
|
||||||
|
!!! example "Benchmarking Example"
|
||||||
|
|
||||||
|
The following script demonstrates how to programmatically benchmark an Ultralytics YOLO model (e.g., YOLO26n) on all 100 datasets within the Roboflow 100 benchmark using the `RF100Benchmark` class.
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from ultralytics.utils.benchmarks import RF100Benchmark
|
||||||
|
|
||||||
|
# Initialize RF100Benchmark and set API key
|
||||||
|
benchmark = RF100Benchmark()
|
||||||
|
benchmark.set_key(api_key="YOUR_ROBOFLOW_API_KEY")
|
||||||
|
|
||||||
|
# Parse dataset and define file paths
|
||||||
|
names, cfg_yamls = benchmark.parse_dataset()
|
||||||
|
val_log_file = Path("ultralytics-benchmarks") / "validation.txt"
|
||||||
|
eval_log_file = Path("ultralytics-benchmarks") / "evaluation.txt"
|
||||||
|
|
||||||
|
# Run benchmarks on each dataset in RF100
|
||||||
|
for ind, path in enumerate(cfg_yamls):
|
||||||
|
path = Path(path)
|
||||||
|
if path.exists():
|
||||||
|
# Fix YAML file and run training
|
||||||
|
benchmark.fix_yaml(str(path))
|
||||||
|
os.system(f"yolo detect train data={path} model=yolo26s.pt epochs=1 batch=16")
|
||||||
|
|
||||||
|
# Run validation and evaluate
|
||||||
|
os.system(f"yolo detect val data={path} model=runs/detect/train/weights/best.pt > {val_log_file} 2>&1")
|
||||||
|
benchmark.evaluate(str(path), str(val_log_file), str(eval_log_file), ind)
|
||||||
|
|
||||||
|
# Remove the 'runs' directory
|
||||||
|
runs_dir = Path.cwd() / "runs"
|
||||||
|
shutil.rmtree(runs_dir)
|
||||||
|
else:
|
||||||
|
print("YAML file path does not exist")
|
||||||
|
continue
|
||||||
|
|
||||||
|
print("RF100 Benchmarking completed!")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Roboflow 100 is invaluable for various applications related to [computer vision](https://www.ultralytics.com/blog/everything-you-need-to-know-about-computer-vision-in-2025) and [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl). Researchers and engineers can leverage this benchmark to:
|
||||||
|
|
||||||
|
- Evaluate the performance of object detection models in a multi-domain context.
|
||||||
|
- Test the adaptability and [robustness](<https://en.wikipedia.org/wiki/Robustness_(computer_science)>) of models to real-world scenarios beyond common [benchmark datasets](https://www.ultralytics.com/glossary/benchmark-dataset) like [COCO](https://cocodataset.org/#home) or [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/).
|
||||||
|
- Benchmark the capabilities of object detection models across diverse datasets, including specialized areas like healthcare, aerial imagery, and video games.
|
||||||
|
- Compare model performance across different [neural network](https://www.ultralytics.com/glossary/neural-network-nn) architectures and [optimization](https://www.ultralytics.com/glossary/optimization-algorithm) techniques.
|
||||||
|
- Identify domain-specific challenges that may require specialized [model training tips](../../guides/model-training-tips.md) or [fine-tuning](https://www.ultralytics.com/glossary/fine-tuning) approaches like [transfer learning](https://www.ultralytics.com/glossary/transfer-learning).
|
||||||
|
|
||||||
|
For more ideas and inspiration on real-world applications, explore [our guides on practical projects](../../guides/index.md) or check out [Ultralytics Platform](https://platform.ultralytics.com) for streamlined [model training](../../modes/train.md) and [deployment](../../guides/model-deployment-options.md).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The Roboflow 100 dataset, including metadata and download links, is available on the official [Roboflow 100 GitHub repository](https://github.com/roboflow/roboflow-100-benchmark). You can access and utilize the dataset directly from there for your benchmarking needs. The Ultralytics `RF100Benchmark` utility simplifies the process of downloading and preparing these datasets for use with Ultralytics models.
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
Roboflow 100 consists of datasets with diverse images captured from various angles and domains. Below are examples of annotated images included in the RF100 benchmark, showcasing the variety of objects and scenes. Techniques like [data augmentation](https://www.ultralytics.com/glossary/data-augmentation) can further enhance the diversity during training.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/sample-data-annotations.avif" alt="Roboflow 100 sample images with annotations">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
The diversity seen in the Roboflow 100 benchmark represents a significant advancement from traditional benchmarks, which often focus on optimizing a single metric within a limited domain. This comprehensive approach aids in developing more robust and versatile [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) models capable of performing well across a multitude of different scenarios.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Roboflow 100 dataset in your research or development work, please cite the original paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{rf100benchmark,
|
||||||
|
Author = {Floriana Ciaglia and Francesco Saverio Zuppichini and Paul Guerrie and Mark McQuade and Jacob Solawetz},
|
||||||
|
Title = {Roboflow 100: A Rich, Multi-Domain Object Detection Benchmark},
|
||||||
|
Year = {2022},
|
||||||
|
Eprint = {arXiv:2211.13523},
|
||||||
|
url = {https://arxiv.org/abs/2211.13523}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We extend our gratitude to the Roboflow team and all contributors for their significant efforts in creating and maintaining the Roboflow 100 dataset as a valuable resource for the computer vision community.
|
||||||
|
|
||||||
|
If you are interested in exploring more datasets to enhance your object detection and machine learning projects, feel free to visit [our comprehensive dataset collection](../index.md), which includes a variety of other [detection datasets](../detect/index.md).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Roboflow 100 dataset, and why is it significant for object detection?
|
||||||
|
|
||||||
|
The **Roboflow 100** dataset is a benchmark for [object detection](../../tasks/detect.md) models. It comprises 100 diverse datasets covering domains like healthcare, aerial imagery, and video games. Its significance lies in providing a standardized way to test model adaptability and robustness across a wide range of real-world scenarios, moving beyond traditional, often domain-limited, benchmarks.
|
||||||
|
|
||||||
|
### Which domains are covered by the Roboflow 100 dataset?
|
||||||
|
|
||||||
|
The **Roboflow 100** dataset spans seven diverse domains, offering unique challenges for [object detection](https://www.ultralytics.com/glossary/object-detection) models:
|
||||||
|
|
||||||
|
1. **Aerial**: 7 datasets (e.g., satellite imagery, drone views).
|
||||||
|
2. **Video Games**: 7 datasets (e.g., objects from various game environments).
|
||||||
|
3. **Microscopic**: 11 datasets (e.g., cells, particles).
|
||||||
|
4. **Underwater**: 5 datasets (e.g., marine life, submerged objects).
|
||||||
|
5. **Documents**: 8 datasets (e.g., text regions, form elements).
|
||||||
|
6. **Electromagnetic**: 12 datasets (e.g., radar signatures, spectral data visualizations).
|
||||||
|
7. **Real World**: 50 datasets (a broad category including everyday objects, scenes, retail, etc.).
|
||||||
|
|
||||||
|
This variety makes RF100 an excellent resource for assessing the [generalizability](<https://en.wikipedia.org/wiki/Generalization_(learning)>) of computer vision models.
|
||||||
|
|
||||||
|
### What should I include when citing the Roboflow 100 dataset in my research?
|
||||||
|
|
||||||
|
When using the Roboflow 100 dataset, please cite the original paper to give credit to the creators. Here is the recommended BibTeX citation:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{rf100benchmark,
|
||||||
|
Author = {Floriana Ciaglia and Francesco Saverio Zuppichini and Paul Guerrie and Mark McQuade and Jacob Solawetz},
|
||||||
|
Title = {Roboflow 100: A Rich, Multi-Domain Object Detection Benchmark},
|
||||||
|
Year = {2022},
|
||||||
|
Eprint = {arXiv:2211.13523},
|
||||||
|
url = {https://arxiv.org/abs/2211.13523}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For further exploration, consider visiting our [comprehensive dataset collection](../index.md) or browsing other [detection datasets](../detect/index.md) compatible with Ultralytics models.
|
||||||
179
docs/en/datasets/detect/signature.md
Executable file
179
docs/en/datasets/detect/signature.md
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the Signature Detection Dataset for training models to identify and verify human signatures in various documents. Perfect for document verification and fraud prevention.
|
||||||
|
keywords: Signature Detection Dataset, document verification, fraud detection, computer vision, YOLO26, Ultralytics, annotated signatures, training dataset
|
||||||
|
---
|
||||||
|
|
||||||
|
# Signature Detection Dataset
|
||||||
|
|
||||||
|
This dataset focuses on detecting human written signatures within documents. It includes a variety of document types with annotated signatures, providing valuable insights for applications in document verification and fraud detection. Essential for training [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) algorithms, this dataset aids in identifying signatures in various document formats, supporting research and practical applications in document analysis.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The signature detection dataset is split into two subsets:
|
||||||
|
|
||||||
|
- **Training set**: Contains 143 images, each with corresponding annotations.
|
||||||
|
- **Validation set**: Includes 35 images, each with paired annotations.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
This dataset can be applied in various computer vision tasks such as [object detection](https://www.ultralytics.com/glossary/object-detection), [object tracking](https://docs.ultralytics.com/modes/track/), and document analysis. Specifically, it can be used to train and evaluate models for identifying signatures in documents, which has significant applications in:
|
||||||
|
|
||||||
|
- **Document Verification**: Automating the verification process for legal and financial documents
|
||||||
|
- **Fraud Detection**: Identifying potentially forged or unauthorized signatures
|
||||||
|
- **Digital Document Processing**: Streamlining workflows in administrative and legal sectors
|
||||||
|
- **Banking and Finance**: Enhancing security in check processing and loan document verification
|
||||||
|
- **Archival Research**: Supporting historical document analysis and cataloging
|
||||||
|
|
||||||
|
Additionally, it serves as a valuable resource for educational purposes, enabling students and researchers to study signature characteristics across different document types.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file defines the dataset configuration, including paths and classes information. For the signature detection dataset, the `signature.yaml` file is located at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/signature.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/signature.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/signature.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/signature.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the signature detection dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the provided code samples. For a comprehensive list of available parameters, refer to the model's [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="signature.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=signature.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a signature-detection fine-tuned model
|
||||||
|
|
||||||
|
# Inference using the model
|
||||||
|
results = model.predict("https://ultralytics.com/assets/signature-s.mp4", conf=0.75)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start prediction with a finetuned *.pt model
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/signature-s.mp4" conf=0.75
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The signature detection dataset comprises a wide variety of images showcasing different document types and annotated signatures. Below are examples of images from the dataset, each accompanied by its corresponding annotations.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: Here, we present a training batch consisting of mosaiced dataset images. Mosaicing, a training technique, combines multiple images into one, enriching batch diversity. This method helps enhance the model's ability to generalize across different signature sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
This example illustrates the variety and complexity of images in the signature Detection Dataset, emphasizing the benefits of including mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
The dataset has been released under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Signature Detection Dataset, and how can it be used?
|
||||||
|
|
||||||
|
The Signature Detection Dataset is a collection of annotated images aimed at detecting human signatures within various document types. It can be applied in computer vision tasks such as [object detection](https://www.ultralytics.com/glossary/object-detection) and tracking, primarily for document verification, fraud detection, and archival research. This dataset helps train models to recognize signatures in different contexts, making it valuable for both research and practical applications in [smart document analysis](https://www.ultralytics.com/blog/using-ultralytics-yolo11-for-smart-document-analysis).
|
||||||
|
|
||||||
|
### How do I train a YOLO26n model on the Signature Detection Dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n model on the Signature Detection Dataset, follow these steps:
|
||||||
|
|
||||||
|
1. Download the `signature.yaml` dataset configuration file from [signature.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/signature.yaml).
|
||||||
|
2. Use the following Python script or CLI command to start training:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="signature.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect train data=signature.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, refer to the [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the main applications of the Signature Detection Dataset?
|
||||||
|
|
||||||
|
The Signature Detection Dataset can be used for:
|
||||||
|
|
||||||
|
1. **Document Verification**: Automatically verifying the presence and authenticity of human signatures in documents.
|
||||||
|
2. **Fraud Detection**: Identifying forged or fraudulent signatures in legal and financial documents.
|
||||||
|
3. **Archival Research**: Assisting historians and archivists in the digital analysis and cataloging of historical documents.
|
||||||
|
4. **Education**: Supporting academic research and teaching in the fields of computer vision and [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml).
|
||||||
|
5. **Financial Services**: Enhancing security in banking transactions and loan processing by verifying signature authenticity.
|
||||||
|
|
||||||
|
### How can I perform inference using a model trained on the Signature Detection Dataset?
|
||||||
|
|
||||||
|
To perform inference using a model trained on the Signature Detection Dataset, follow these steps:
|
||||||
|
|
||||||
|
1. Load your fine-tuned model.
|
||||||
|
2. Use the below Python script or CLI command to perform inference:
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load the fine-tuned model
|
||||||
|
model = YOLO("path/to/best.pt")
|
||||||
|
|
||||||
|
# Perform inference
|
||||||
|
results = model.predict("https://ultralytics.com/assets/signature-s.mp4", conf=0.75)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo detect predict model='path/to/best.pt' imgsz=640 source="https://ultralytics.com/assets/signature-s.mp4" conf=0.75
|
||||||
|
```
|
||||||
|
|
||||||
|
### What is the structure of the Signature Detection Dataset, and where can I find more information?
|
||||||
|
|
||||||
|
The Signature Detection Dataset is divided into two subsets:
|
||||||
|
|
||||||
|
- **Training Set**: Contains 143 images with annotations.
|
||||||
|
- **Validation Set**: Includes 35 images with annotations.
|
||||||
|
|
||||||
|
For detailed information, you can refer to the [Dataset Structure](#dataset-structure) section. Additionally, view the complete dataset configuration in the `signature.yaml` file located at [signature.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/signature.yaml).
|
||||||
189
docs/en/datasets/detect/sku-110k.md
Executable file
189
docs/en/datasets/detect/sku-110k.md
Executable file
@@ -0,0 +1,189 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the SKU-110k dataset of densely packed retail shelf images, perfect for training and evaluating deep learning models in object detection tasks.
|
||||||
|
keywords: SKU-110k, dataset, object detection, retail shelf images, deep learning, computer vision, model training
|
||||||
|
---
|
||||||
|
|
||||||
|
# SKU-110k Dataset
|
||||||
|
|
||||||
|
The [SKU-110k](https://github.com/eg4000/SKU110K_CVPR19) dataset is a collection of densely packed retail shelf images, designed to support research in [object detection](https://www.ultralytics.com/glossary/object-detection) tasks. Developed by Eran Goldman et al., the dataset contains over 110,000 unique store keeping unit (SKU) categories with densely packed objects, often looking similar or even identical, positioned in proximity.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/_gRqR-miFPE"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train YOLOv10 on SKU-110k Dataset using Ultralytics | Retail Dataset
|
||||||
|
</p>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- SKU-110k contains images of store shelves from around the world, featuring densely packed objects that pose challenges for state-of-the-art object detectors.
|
||||||
|
- The dataset includes over 110,000 unique SKU categories, providing a diverse range of object appearances.
|
||||||
|
- Annotations include bounding boxes for objects and SKU category labels.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The SKU-110k dataset is organized into three main subsets:
|
||||||
|
|
||||||
|
1. **Training set**: This subset contains 8,219 images and annotations used for training object detection models.
|
||||||
|
2. **Validation set**: This subset consists of 588 images and annotations used for model validation during training.
|
||||||
|
3. **Test set**: This subset includes 2,936 images designed for the final evaluation of trained object detection models.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The SKU-110k dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection tasks, especially in densely packed scenes such as retail shelf displays. Its applications include:
|
||||||
|
|
||||||
|
- Retail inventory management and automation
|
||||||
|
- Product recognition in e-commerce platforms
|
||||||
|
- Planogram compliance verification
|
||||||
|
- Self-checkout systems in stores
|
||||||
|
- Robotic picking and sorting in warehouses
|
||||||
|
|
||||||
|
The dataset's diverse set of SKU categories and densely packed object arrangements make it a valuable resource for researchers and practitioners in the field of [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. For the case of the SKU-110K dataset, the `SKU-110K.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/SKU-110K.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/SKU-110K.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/SKU-110K.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/SKU-110K.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the SKU-110K dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="SKU-110K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=SKU-110K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The SKU-110k dataset contains a diverse set of retail shelf images with densely packed objects, providing rich context for object detection tasks. Here are some examples of data from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Densely packed retail shelf image**: This image demonstrates an example of densely packed objects in a retail shelf setting. Objects are annotated with bounding boxes and SKU category labels.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the SKU-110k dataset and highlights the importance of high-quality data for object detection tasks. The dense arrangement of products presents unique challenges for detection algorithms, making this dataset particularly valuable for developing robust retail-focused computer vision solutions.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the SKU-110k dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{goldman2019dense,
|
||||||
|
author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner},
|
||||||
|
title = {Precise Detection in Densely Packed Scenes},
|
||||||
|
booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)},
|
||||||
|
year = {2019}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge Eran Goldman et al. for creating and maintaining the SKU-110k dataset as a valuable resource for the computer vision research community. For more information about the SKU-110k dataset and its creators, visit the [SKU-110k dataset GitHub repository](https://github.com/eg4000/SKU110K_CVPR19).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the SKU-110k dataset and why is it important for object detection?
|
||||||
|
|
||||||
|
The SKU-110k dataset consists of densely packed retail shelf images designed to aid research in object detection tasks. Developed by Eran Goldman et al., it includes over 110,000 unique SKU categories. Its importance lies in its ability to challenge state-of-the-art object detectors with diverse object appearances and proximity, making it an invaluable resource for researchers and practitioners in computer vision. Learn more about the dataset's structure and applications in our [SKU-110k Dataset](#sku-110k-dataset) section.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the SKU-110k dataset?
|
||||||
|
|
||||||
|
Training a YOLO26 model on the SKU-110k dataset is straightforward. Here's an example to train a YOLO26n model for 100 epochs with an image size of 640:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="SKU-110K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=SKU-110K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the main subsets of the SKU-110k dataset?
|
||||||
|
|
||||||
|
The SKU-110k dataset is organized into three main subsets:
|
||||||
|
|
||||||
|
1. **Training set**: Contains 8,219 images and annotations used for training object detection models.
|
||||||
|
2. **Validation set**: Consists of 588 images and annotations used for model validation during training.
|
||||||
|
3. **Test set**: Includes 2,936 images designed for the final evaluation of trained object detection models.
|
||||||
|
|
||||||
|
Refer to the [Dataset Structure](#dataset-structure) section for more details.
|
||||||
|
|
||||||
|
### How do I configure the SKU-110k dataset for training?
|
||||||
|
|
||||||
|
The SKU-110k dataset configuration is defined in a YAML file, which includes details about the dataset's paths, classes, and other relevant information. The `SKU-110K.yaml` file is maintained at [SKU-110K.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/SKU-110K.yaml). For example, you can train a model using this configuration as shown in our [Usage](#usage) section.
|
||||||
|
|
||||||
|
### What are the key features of the SKU-110k dataset in the context of [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl)?
|
||||||
|
|
||||||
|
The SKU-110k dataset features images of store shelves from around the world, showcasing densely packed objects that pose significant challenges for object detectors:
|
||||||
|
|
||||||
|
- Over 110,000 unique SKU categories
|
||||||
|
- Diverse object appearances
|
||||||
|
- Annotations include bounding boxes and SKU category labels
|
||||||
|
|
||||||
|
These features make the SKU-110k dataset particularly valuable for training and evaluating deep learning models in object detection tasks. For more details, see the [Key Features](#key-features) section.
|
||||||
|
|
||||||
|
### How do I cite the SKU-110k dataset in my research?
|
||||||
|
|
||||||
|
If you use the SKU-110k dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{goldman2019dense,
|
||||||
|
author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner},
|
||||||
|
title = {Precise Detection in Densely Packed Scenes},
|
||||||
|
booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)},
|
||||||
|
year = {2019}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More information about the dataset can be found in the [Citations and Acknowledgments](#citations-and-acknowledgments) section.
|
||||||
234
docs/en/datasets/detect/tt100k.md
Executable file
234
docs/en/datasets/detect/tt100k.md
Executable file
@@ -0,0 +1,234 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Tsinghua-Tencent 100K (TT100K) traffic sign dataset with 100,000 street view images and 30,000+ annotated traffic signs for robust detection and classification.
|
||||||
|
keywords: TT100K, Tsinghua-Tencent 100K, traffic sign detection, YOLO26, dataset, object detection, street view, traffic signs, Chinese traffic signs
|
||||||
|
---
|
||||||
|
|
||||||
|
# TT100K Dataset
|
||||||
|
|
||||||
|
The [Tsinghua-Tencent 100K (TT100K)](https://cg.cs.tsinghua.edu.cn/traffic-sign/) is a large-scale traffic sign benchmark dataset created from 100,000 Tencent Street View panoramas. This dataset is specifically designed for traffic sign detection and classification in real-world conditions, providing researchers and developers with a comprehensive resource for building robust traffic sign recognition systems.
|
||||||
|
|
||||||
|
The dataset contains **100,000 images** with over **30,000 traffic sign instances** across **221 different categories**. These images capture large variations in illuminance, weather conditions, viewing angles, and distances, making it ideal for training models that need to perform reliably in diverse real-world scenarios.
|
||||||
|
|
||||||
|
This dataset is particularly valuable for:
|
||||||
|
|
||||||
|
- Autonomous driving systems
|
||||||
|
- Advanced driver assistance systems (ADAS)
|
||||||
|
- Traffic monitoring applications
|
||||||
|
- Urban planning and traffic analysis
|
||||||
|
- Computer vision research in real-world conditions
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
The TT100K dataset provides several key advantages:
|
||||||
|
|
||||||
|
- **Scale**: 100,000 high-resolution images (2048×2048 pixels)
|
||||||
|
- **Diversity**: 221 traffic sign categories covering Chinese traffic signs
|
||||||
|
- **Real-world conditions**: Large variations in weather, illumination, and viewing angles
|
||||||
|
- **Rich annotations**: Each sign includes class label, bounding box, and pixel mask
|
||||||
|
- **Comprehensive coverage**: Includes prohibitory, warning, mandatory, and informative signs
|
||||||
|
- **Train/Test split**: Pre-defined splits for consistent evaluation
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The TT100K dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Training Set**:
|
||||||
|
The primary collection of traffic-scene images used to train models for detecting and classifying different types of traffic signs.
|
||||||
|
2. **Validation Set**:
|
||||||
|
A subset used during model development to monitor performance and tune hyperparameters.
|
||||||
|
3. **Test Set**:
|
||||||
|
A held-out collection of images used to evaluate the final model's ability to detect and classify traffic signs in real-world scenarios.
|
||||||
|
|
||||||
|
The TT100K dataset includes 221 traffic sign categories organized into several major groups:
|
||||||
|
|
||||||
|
**Speed Limit Signs (pl*, pm*)**
|
||||||
|
|
||||||
|
1. **pl\_**: Prohibitory speed limits (pl5, pl10, pl20, pl30, pl40, pl50, pl60, pl70, pl80, pl100, pl120)
|
||||||
|
2. **pm\_**: Minimum speed limits (pm5, pm10, pm20, pm30, pm40, pm50, pm55)
|
||||||
|
|
||||||
|
**Prohibitory Signs (p*, pn*, pr\_)**
|
||||||
|
|
||||||
|
1. **p1-p28**: General prohibitory signs (no entry, no parking, no stopping, etc.)
|
||||||
|
2. **pn/pne**: No entry and no parking signs
|
||||||
|
3. **pr**: Various restriction signs (pr10, pr20, pr30, pr40, pr50, etc.)
|
||||||
|
|
||||||
|
**Warning Signs (w\_)**
|
||||||
|
|
||||||
|
1. **w1-w66**: Warning signs for various road hazards, conditions, and situations
|
||||||
|
2. Includes pedestrian crossings, sharp turns, slippery roads, animals, construction, etc.
|
||||||
|
|
||||||
|
**Height/Width Limit Signs (ph*, pb*)**
|
||||||
|
|
||||||
|
1. **ph\_**: Height limit signs (ph2, ph2.5, ph3, ph3.5, ph4, ph4.5, ph5, etc.)
|
||||||
|
2. **pb\_**: Width limit signs
|
||||||
|
|
||||||
|
**Informative Signs (i*, il*, io, ip)**
|
||||||
|
|
||||||
|
1. **i1-i15**: General informative signs
|
||||||
|
2. **il\_**: Speed limit information (il60, il80, il100, il110)
|
||||||
|
3. **io**: Other informative signs
|
||||||
|
4. **ip**: Information plates
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. For the TT100K dataset, the `TT100K.yaml` file includes automatic download and conversion functionality.
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/TT100K.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/TT100K.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26 model on the TT100K dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. The dataset will be automatically downloaded and converted to YOLO format on first use.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model - dataset will auto-download on first run
|
||||||
|
results = model.train(data="TT100K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
# Dataset will auto-download and convert on first run
|
||||||
|
yolo detect train data=TT100K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are typical examples from the TT100K dataset:
|
||||||
|
|
||||||
|
1. **Urban environments**: Street scenes with multiple traffic signs at various distances
|
||||||
|
2. **Highway scenes**: High-speed road signs including speed limits and direction indicators
|
||||||
|
3. **Complex intersections**: Multiple signs in close proximity with varying orientations
|
||||||
|
4. **Challenging conditions**: Signs under different lighting (day/night), weather (rain/fog), and viewing angles
|
||||||
|
|
||||||
|
The dataset includes:
|
||||||
|
|
||||||
|
1. **Close-up signs**: Large, clearly visible signs occupying significant image area
|
||||||
|
2. **Distant signs**: Small signs requiring fine-grained detection capabilities
|
||||||
|
3. **Partially occluded signs**: Signs partially blocked by vehicles, trees, or other objects
|
||||||
|
4. **Multiple signs per image**: Images containing several different sign types
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the TT100K dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@InProceedings{Zhu_2016_CVPR,
|
||||||
|
author = {Zhu, Zhe and Liang, Dun and Zhang, Songhai and Huang, Xiaolei and Li, Baoli and Hu, Shimin},
|
||||||
|
title = {Traffic-Sign Detection and Classification in the Wild},
|
||||||
|
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
|
||||||
|
month = {June},
|
||||||
|
year = {2016}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the Tsinghua University and Tencent collaboration for creating and maintaining this valuable resource for the computer vision and autonomous driving communities. For more information about the TT100K dataset, visit the [official dataset website](https://cg.cs.tsinghua.edu.cn/traffic-sign/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the TT100K dataset used for?
|
||||||
|
|
||||||
|
The Tsinghua-Tencent 100K (TT100K) dataset is specifically designed for traffic sign detection and classification in real-world conditions. It's primarily used for:
|
||||||
|
|
||||||
|
1. Training autonomous driving perception systems
|
||||||
|
2. Developing Advanced Driver Assistance Systems (ADAS)
|
||||||
|
3. Research in robust object detection under varying conditions
|
||||||
|
4. Benchmarking traffic sign recognition algorithms
|
||||||
|
5. Testing model performance on small objects in large images
|
||||||
|
|
||||||
|
With 100,000 diverse street view images and 221 traffic sign categories, it provides a comprehensive testbed for real-world traffic sign detection.
|
||||||
|
|
||||||
|
### How many traffic sign categories are in TT100K?
|
||||||
|
|
||||||
|
The TT100K dataset contains **221 different traffic sign categories**, including:
|
||||||
|
|
||||||
|
1. **Speed limits**: pl5 through pl120 (prohibitory limits) and pm5 through pm55 (minimum speeds)
|
||||||
|
2. **Prohibitory signs**: 28+ general prohibition types (p1-p28) plus restrictions (pr\*, pn, pne)
|
||||||
|
3. **Warning signs**: 60+ warning categories (w1-w66)
|
||||||
|
4. **Height/width limits**: ph* and pb* series for physical restrictions
|
||||||
|
5. **Informative signs**: i1-i15, il\*, io, ip for guidance and information
|
||||||
|
|
||||||
|
This comprehensive coverage includes most traffic signs found in Chinese road networks.
|
||||||
|
|
||||||
|
### How can I train a YOLO26n model using the TT100K dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n model on the TT100K dataset for 100 epochs with an image size of 640, use the example below.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="TT100K.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=TT100K.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed training configurations, refer to the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### What makes TT100K challenging compared to other datasets?
|
||||||
|
|
||||||
|
TT100K presents several unique challenges:
|
||||||
|
|
||||||
|
1. **Scale variation**: Signs range from very small (distant highway signs) to large (close-up urban signs)
|
||||||
|
2. **Real-world conditions**: Extreme variations in lighting, weather, and viewing angles
|
||||||
|
3. **High resolution**: 2048×2048 pixel images require significant processing power
|
||||||
|
4. **Class imbalance**: Some sign types are much more common than others
|
||||||
|
5. **Dense scenes**: Multiple signs may appear in a single image
|
||||||
|
6. **Partial occlusion**: Signs may be partially blocked by vehicles, vegetation, or structures
|
||||||
|
|
||||||
|
These challenges make TT100K a valuable benchmark for developing robust detection algorithms.
|
||||||
|
|
||||||
|
### How do I handle the large image sizes in TT100K?
|
||||||
|
|
||||||
|
The TT100K dataset uses 2048×2048 pixel images, which can be resource-intensive. Here are recommended strategies:
|
||||||
|
|
||||||
|
**For Training:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Option 1: Resize to standard YOLO size
|
||||||
|
model.train(data="TT100K.yaml", imgsz=640, batch=16)
|
||||||
|
|
||||||
|
# Option 2: Use larger size for better small object detection
|
||||||
|
model.train(data="TT100K.yaml", imgsz=1280, batch=4)
|
||||||
|
|
||||||
|
# Option 3: Multi-scale training
|
||||||
|
model.train(data="TT100K.yaml", imgsz=640, scale=0.5) # trains at varying scales
|
||||||
|
```
|
||||||
|
|
||||||
|
**Recommendations:**
|
||||||
|
|
||||||
|
- Start with `imgsz=640` for initial experiments
|
||||||
|
- Use `imgsz=1280` if you have sufficient GPU memory (24GB+)
|
||||||
|
- Consider tiling strategies for very small signs
|
||||||
|
- Use gradient accumulation to simulate larger batch sizes
|
||||||
179
docs/en/datasets/detect/visdrone.md
Executable file
179
docs/en/datasets/detect/visdrone.md
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the VisDrone Dataset, a large-scale benchmark for drone-based image and video analysis with over 2.6 million annotations for objects like pedestrians and vehicles.
|
||||||
|
keywords: VisDrone, drone dataset, computer vision, object detection, object tracking, crowd counting, machine learning, deep learning
|
||||||
|
---
|
||||||
|
|
||||||
|
# VisDrone Dataset
|
||||||
|
|
||||||
|
The [VisDrone Dataset](https://github.com/VisDrone/VisDrone-Dataset) is a large-scale benchmark created by the AISKYEYE team at the Lab of [Machine Learning](https://www.ultralytics.com/glossary/machine-learning-ml) and Data Mining, Tianjin University, China. It contains carefully annotated ground truth data for various computer vision tasks related to drone-based image and video analysis.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/9ymyH4H1fG4"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the VisDrone Dataset | Aerial Detection | Complete Tutorial 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
VisDrone is composed of 288 video clips with 261,908 frames and 10,209 static images, captured by various drone-mounted cameras. The dataset covers a wide range of aspects, including location (14 different cities across China), environment (urban and rural), objects (pedestrians, vehicles, bicycles, etc.), and density (sparse and crowded scenes). The dataset was collected using various drone platforms under different scenarios and weather and lighting conditions. These frames are manually annotated with over 2.6 million bounding boxes of targets such as pedestrians, cars, bicycles, and tricycles. Attributes like scene visibility, object class, and occlusion are also provided for better data utilization.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The VisDrone dataset is organized into five main subsets, each focusing on a specific task:
|
||||||
|
|
||||||
|
1. **Task 1**: Object detection in images
|
||||||
|
2. **Task 2**: Object detection in videos
|
||||||
|
3. **Task 3**: Single-object tracking
|
||||||
|
4. **Task 4**: [Multi-object tracking](../index.md#multi-object-tracking)
|
||||||
|
5. **Task 5**: Crowd counting
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The VisDrone dataset is widely used for training and evaluating deep learning models in drone-based [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks such as object detection, object tracking, and crowd counting. The dataset's diverse set of sensor data, object annotations, and attributes make it a valuable resource for researchers and practitioners in the field of drone-based computer vision.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the Visdrone dataset, the `VisDrone.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VisDrone.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VisDrone.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/VisDrone.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/VisDrone.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the VisDrone dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="VisDrone.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=VisDrone.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The VisDrone dataset contains a diverse set of images and videos captured by drone-mounted cameras. Here are some examples of data from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Task 1**: [Object detection](https://www.ultralytics.com/glossary/object-detection) in images - This image demonstrates an example of object detection in images, where objects are annotated with [bounding boxes](https://www.ultralytics.com/glossary/bounding-box). The dataset provides a wide variety of images taken from different locations, environments, and densities to facilitate the development of models for this task.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the VisDrone dataset and highlights the importance of high-quality sensor data for drone-based computer vision tasks.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the VisDrone dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@ARTICLE{9573394,
|
||||||
|
author={Zhu, Pengfei and Wen, Longyin and Du, Dawei and Bian, Xiao and Fan, Heng and Hu, Qinghua and Ling, Haibin},
|
||||||
|
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
|
||||||
|
title={Detection and Tracking Meet Drones Challenge},
|
||||||
|
year={2021},
|
||||||
|
volume={},
|
||||||
|
number={},
|
||||||
|
pages={1-1},
|
||||||
|
doi={10.1109/TPAMI.2021.3119563}}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the AISKYEYE team at the Lab of Machine Learning and [Data Mining](https://www.ultralytics.com/glossary/data-mining), Tianjin University, China, for creating and maintaining the VisDrone dataset as a valuable resource for the drone-based computer vision research community. For more information about the VisDrone dataset and its creators, visit the [VisDrone Dataset GitHub repository](https://github.com/VisDrone/VisDrone-Dataset).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the VisDrone Dataset and what are its key features?
|
||||||
|
|
||||||
|
The [VisDrone Dataset](https://github.com/VisDrone/VisDrone-Dataset) is a large-scale benchmark created by the AISKYEYE team at Tianjin University, China. It is designed for various computer vision tasks related to drone-based image and video analysis. Key features include:
|
||||||
|
|
||||||
|
- **Composition**: 288 video clips with 261,908 frames and 10,209 static images.
|
||||||
|
- **Annotations**: Over 2.6 million bounding boxes for objects like pedestrians, cars, bicycles, and tricycles.
|
||||||
|
- **Diversity**: Collected across 14 cities, in urban and rural settings, under different weather and lighting conditions.
|
||||||
|
- **Tasks**: Split into five main tasks—object detection in images and videos, single-object and multi-object tracking, and crowd counting.
|
||||||
|
|
||||||
|
### How can I use the VisDrone Dataset to train a YOLO26 model with Ultralytics?
|
||||||
|
|
||||||
|
To train a YOLO26 model on the VisDrone dataset for 100 epochs with an image size of 640, you can follow these steps:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="VisDrone.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=VisDrone.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For additional configuration options, please refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the main subsets of the VisDrone dataset and their applications?
|
||||||
|
|
||||||
|
The VisDrone dataset is divided into five main subsets, each tailored for a specific computer vision task:
|
||||||
|
|
||||||
|
1. **Task 1**: Object detection in images.
|
||||||
|
2. **Task 2**: Object detection in videos.
|
||||||
|
3. **Task 3**: Single-object tracking.
|
||||||
|
4. **Task 4**: Multi-object tracking.
|
||||||
|
5. **Task 5**: Crowd counting.
|
||||||
|
|
||||||
|
These subsets are widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in drone-based applications such as surveillance, traffic monitoring, and public safety.
|
||||||
|
|
||||||
|
### Where can I find the configuration file for the VisDrone dataset in Ultralytics?
|
||||||
|
|
||||||
|
The configuration file for the VisDrone dataset, `VisDrone.yaml`, can be found in the Ultralytics repository at the following link:
|
||||||
|
[VisDrone.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VisDrone.yaml).
|
||||||
|
|
||||||
|
### How can I cite the VisDrone dataset if I use it in my research?
|
||||||
|
|
||||||
|
If you use the VisDrone dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@ARTICLE{9573394,
|
||||||
|
author={Zhu, Pengfei and Wen, Longyin and Du, Dawei and Bian, Xiao and Fan, Heng and Hu, Qinghua and Ling, Haibin},
|
||||||
|
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
|
||||||
|
title={Detection and Tracking Meet Drones Challenge},
|
||||||
|
year={2021},
|
||||||
|
volume={},
|
||||||
|
number={},
|
||||||
|
pages={1-1},
|
||||||
|
doi={10.1109/TPAMI.2021.3119563}
|
||||||
|
}
|
||||||
|
```
|
||||||
148
docs/en/datasets/detect/voc.md
Executable file
148
docs/en/datasets/detect/voc.md
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the PASCAL VOC dataset, essential for object detection, segmentation, and classification. Learn key features, applications, and usage tips.
|
||||||
|
keywords: PASCAL VOC, VOC dataset, object detection, segmentation, classification, YOLO, Faster R-CNN, Mask R-CNN, image annotations, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# VOC Dataset
|
||||||
|
|
||||||
|
The [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/) (Visual Object Classes) dataset is a well-known object detection, segmentation, and classification dataset. It is designed to encourage research on a wide variety of object categories and is commonly used for benchmarking computer vision models. It is an essential dataset for researchers and developers working on object detection, segmentation, and classification tasks.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/yrHzL8RyY6g"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the Pascal VOC Dataset | Object Detection 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- VOC dataset includes two main challenges: VOC2007 and VOC2012.
|
||||||
|
- The dataset comprises 20 object categories, including common objects like cars, bicycles, and animals, as well as more specific categories such as boats, sofas, and dining tables.
|
||||||
|
- Annotations include object bounding boxes and class labels for object detection and classification tasks, and segmentation masks for the segmentation tasks.
|
||||||
|
- VOC provides standardized evaluation metrics like [mean Average Precision](https://www.ultralytics.com/glossary/mean-average-precision-map) (mAP) for object detection and classification, making it suitable for comparing model performance.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The VOC dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Train**: This subset contains images for training object detection, segmentation, and classification models.
|
||||||
|
2. **Validation**: This subset has images used for validation purposes during model training.
|
||||||
|
3. **Test**: This subset consists of images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results were historically submitted to the PASCAL VOC evaluation server for performance evaluation.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The VOC dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in object detection (such as [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo26/), [Faster R-CNN](https://arxiv.org/abs/1506.01497), and [SSD](https://arxiv.org/abs/1512.02325)), [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) (such as [Mask R-CNN](https://arxiv.org/abs/1703.06870)), and [image classification](https://www.ultralytics.com/glossary/image-classification). The dataset's diverse set of object categories, large number of annotated images, and standardized evaluation metrics make it an essential resource for [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) researchers and practitioners.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the VOC dataset, the `VOC.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VOC.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VOC.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/VOC.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/VOC.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n model on the VOC dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="VOC.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=VOC.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The VOC dataset contains a diverse set of images with various object categories and complex scenes. Here are some examples of images from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the VOC dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the VOC dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{everingham2010pascal,
|
||||||
|
title={The PASCAL Visual Object Classes (VOC) Challenge},
|
||||||
|
author={Mark Everingham and Luc Van Gool and Christopher K. I. Williams and John Winn and Andrew Zisserman},
|
||||||
|
year={2010},
|
||||||
|
eprint={0909.5206},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the PASCAL VOC Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the VOC dataset and its creators, visit the [PASCAL VOC dataset website](http://host.robots.ox.ac.uk/pascal/VOC/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the PASCAL VOC dataset and why is it important for computer vision tasks?
|
||||||
|
|
||||||
|
The [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/) (Visual Object Classes) dataset is a renowned benchmark for [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and classification in computer vision. It includes comprehensive annotations like bounding boxes, class labels, and segmentation masks across 20 different object categories. Researchers use it widely to evaluate the performance of models like Faster R-CNN, YOLO, and Mask R-CNN due to its standardized evaluation metrics such as mean Average Precision (mAP).
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the VOC dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model with the VOC dataset, you need the dataset configuration in a YAML file. Here's an example to start training a YOLO26n model for 100 epochs with an image size of 640:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="VOC.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=VOC.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are the primary challenges included in the VOC dataset?
|
||||||
|
|
||||||
|
The VOC dataset includes two main challenges: VOC2007 and VOC2012. These challenges test object detection, segmentation, and classification across 20 diverse object categories. Each image is meticulously annotated with bounding boxes, class labels, and segmentation masks. The challenges provide standardized metrics like mAP, facilitating the comparison and benchmarking of different computer vision models.
|
||||||
|
|
||||||
|
### How does the PASCAL VOC dataset enhance model benchmarking and evaluation?
|
||||||
|
|
||||||
|
The PASCAL VOC dataset enhances model benchmarking and evaluation through its detailed annotations and standardized metrics like mean Average [Precision](https://www.ultralytics.com/glossary/precision) (mAP). These metrics are crucial for assessing the performance of object detection and classification models. The dataset's diverse and complex images ensure comprehensive model evaluation across various real-world scenarios.
|
||||||
|
|
||||||
|
### How do I use the VOC dataset for [semantic segmentation](https://www.ultralytics.com/glossary/semantic-segmentation) in YOLO models?
|
||||||
|
|
||||||
|
To use the VOC dataset for semantic segmentation tasks with YOLO models, you need to configure the dataset properly in a YAML file. The YAML file defines paths and classes needed for training segmentation models. Check the VOC dataset YAML configuration file at [VOC.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VOC.yaml) for detailed setups. For segmentation tasks, you would use a segmentation-specific model like `yolo26n-seg.pt` instead of the detection model.
|
||||||
188
docs/en/datasets/detect/xview.md
Executable file
188
docs/en/datasets/detect/xview.md
Executable file
@@ -0,0 +1,188 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the xView dataset, a rich resource of 1M+ object instances in high-resolution satellite imagery. Enhance detection, learning efficiency, and more.
|
||||||
|
keywords: xView dataset, overhead imagery, satellite images, object detection, high resolution, bounding boxes, computer vision, TensorFlow, PyTorch, dataset structure
|
||||||
|
---
|
||||||
|
|
||||||
|
# xView Dataset
|
||||||
|
|
||||||
|
The [xView](http://xviewdataset.org/) dataset is one of the largest publicly available datasets of overhead imagery, containing images from complex scenes around the world annotated using bounding boxes. The goal of the xView dataset is to accelerate progress in four [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) frontiers:
|
||||||
|
|
||||||
|
1. Reduce minimum resolution for detection.
|
||||||
|
2. Improve learning efficiency.
|
||||||
|
3. Enable discovery of more object classes.
|
||||||
|
4. Improve detection of fine-grained classes.
|
||||||
|
|
||||||
|
xView builds on the success of challenges like [Common Objects in Context (COCO)](../detect/coco.md) and aims to leverage computer vision to analyze the growing amount of available imagery from space in order to understand the visual world in new ways and address a range of important applications.
|
||||||
|
|
||||||
|
!!! warning "Manual Download Required"
|
||||||
|
|
||||||
|
The xView dataset is **not** automatically downloaded by Ultralytics scripts. You **must** manually download the dataset first from the official source:
|
||||||
|
|
||||||
|
- **Source:** DIUx xView 2018 Challenge by U.S. National Geospatial-Intelligence Agency (NGA)
|
||||||
|
- **URL:** [https://challenge.xviewdataset.org](https://challenge.xviewdataset.org)
|
||||||
|
|
||||||
|
**Important:** After downloading the necessary files (e.g., `train_images.tif`, `val_images.tif`, `xView_train.geojson`), you need to extract them and place them into the correct directory structure, typically expected under a `datasets/xView/` folder, **before** running the training commands provided below. Ensure the dataset is properly set up as per the challenge instructions.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- xView contains over 1 million object instances across 60 classes.
|
||||||
|
- The dataset has a resolution of 0.3 meters, providing higher resolution imagery than most public satellite imagery datasets.
|
||||||
|
- xView features a diverse collection of small, rare, fine-grained, and multi-type objects with [bounding box](https://www.ultralytics.com/glossary/bounding-box) annotation.
|
||||||
|
- Comes with a pretrained baseline model using the [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) object detection API and an example for [PyTorch](https://www.ultralytics.com/glossary/pytorch).
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The xView dataset is composed of satellite images collected from WorldView-3 satellites at a 0.3m ground sample distance. It contains over 1 million objects across 60 classes in over 1,400 km² of imagery. The dataset is particularly valuable for [remote sensing](https://www.ultralytics.com/blog/using-computer-vision-to-analyze-satellite-imagery) applications and environmental monitoring.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The xView dataset is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models for object detection in overhead imagery. The dataset's diverse set of object classes and high-resolution imagery make it a valuable resource for researchers and practitioners in the field of computer vision, especially for satellite imagery analysis. Applications include:
|
||||||
|
|
||||||
|
- Military and defense reconnaissance
|
||||||
|
- Urban planning and development
|
||||||
|
- Environmental monitoring
|
||||||
|
- Disaster response and assessment
|
||||||
|
- Infrastructure mapping and management
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the xView dataset, the `xView.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/xView.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/xView.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/xView.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/xView.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a model on the xView dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="xView.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=xView.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The xView dataset contains high-resolution satellite images with a diverse set of objects annotated using bounding boxes. Here are some examples of data from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Overhead Imagery**: This image demonstrates an example of [object detection](https://www.ultralytics.com/glossary/object-detection) in overhead imagery, where objects are annotated with bounding boxes. The dataset provides high-resolution satellite images to facilitate the development of models for this task.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the data in the xView dataset and highlights the importance of high-quality satellite imagery for object detection tasks.
|
||||||
|
|
||||||
|
## Related Datasets
|
||||||
|
|
||||||
|
If you're working with satellite imagery, you might also be interested in exploring these related datasets:
|
||||||
|
|
||||||
|
- [DOTA-v2](../obb/dota-v2.md): A dataset for oriented object detection in aerial images
|
||||||
|
- [VisDrone](../detect/visdrone.md): A dataset for object detection and tracking in drone-captured imagery
|
||||||
|
- [Argoverse](../detect/argoverse.md): A dataset for autonomous driving with 3D tracking annotations
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the xView dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lam2018xview,
|
||||||
|
title={xView: Objects in Context in Overhead Imagery},
|
||||||
|
author={Darius Lam and Richard Kuzma and Kevin McGee and Samuel Dooley and Michael Laielli and Matthew Klaric and Yaroslav Bulatov and Brendan McCord},
|
||||||
|
year={2018},
|
||||||
|
eprint={1802.07856},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the [Defense Innovation Unit](https://www.diu.mil/) (DIU) and the creators of the xView dataset for their valuable contribution to the computer vision research community. For more information about the xView dataset and its creators, visit the [xView dataset website](http://xviewdataset.org/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the xView dataset and how does it benefit computer vision research?
|
||||||
|
|
||||||
|
The [xView](http://xviewdataset.org/) dataset is one of the largest publicly available collections of high-resolution overhead imagery, containing over 1 million object instances across 60 classes. It is designed to enhance various facets of computer vision research such as reducing the minimum resolution for detection, improving learning efficiency, discovering more object classes, and advancing fine-grained object detection.
|
||||||
|
|
||||||
|
### How can I use Ultralytics YOLO to train a model on the xView dataset?
|
||||||
|
|
||||||
|
To train a model on the xView dataset using [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo26/), follow these steps:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="xView.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo detect train data=xView.yaml model=yolo26n.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed arguments and settings, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the key features of the xView dataset?
|
||||||
|
|
||||||
|
The xView dataset stands out due to its comprehensive set of features:
|
||||||
|
|
||||||
|
- Over 1 million object instances across 60 distinct classes.
|
||||||
|
- High-resolution imagery at 0.3 meters.
|
||||||
|
- Diverse object types including small, rare, and fine-grained objects, all annotated with bounding boxes.
|
||||||
|
- Availability of a pretrained baseline model and examples in [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) and PyTorch.
|
||||||
|
|
||||||
|
### What is the dataset structure of xView, and how is it annotated?
|
||||||
|
|
||||||
|
The xView dataset contains high-resolution satellite imagery captured by WorldView-3 satellites at a 0.3m ground sample distance, covering over 1 million objects across 60 distinct classes within approximately 1,400 km² of annotated imagery. Each object is labeled with bounding boxes, making the dataset highly suitable for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models for object detection in overhead views. For a detailed breakdown, refer to the [Dataset Structure section](#dataset-structure).
|
||||||
|
|
||||||
|
### How do I cite the xView dataset in my research?
|
||||||
|
|
||||||
|
If you utilize the xView dataset in your research, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lam2018xview,
|
||||||
|
title={xView: Objects in Context in Overhead Imagery},
|
||||||
|
author={Darius Lam and Richard Kuzma and Kevin McGee and Samuel Dooley and Michael Laielli and Matthew Klaric and Yaroslav Bulatov and Brendan McCord},
|
||||||
|
year={2018},
|
||||||
|
eprint={1802.07856},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information about the xView dataset, visit the official [xView dataset website](http://xviewdataset.org/).
|
||||||
395
docs/en/datasets/explorer/api.md
Executable file
395
docs/en/datasets/explorer/api.md
Executable file
@@ -0,0 +1,395 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Ultralytics Explorer API for dataset exploration with SQL queries, vector similarity search, and semantic search. Learn installation and usage tips.
|
||||||
|
keywords: Ultralytics, Explorer API, dataset exploration, SQL queries, similarity search, semantic search, Python API, embeddings, data analysis
|
||||||
|
---
|
||||||
|
|
||||||
|
# Ultralytics Explorer API
|
||||||
|
|
||||||
|
!!! warning "Community Note ⚠️"
|
||||||
|
|
||||||
|
As of **`ultralytics>=8.3.10`**, Ultralytics Explorer support is deprecated. Similar (and expanded) dataset exploration features are available in [Ultralytics Platform](https://platform.ultralytics.com/).
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||||
|
The Explorer API is a Python API for exploring your datasets. It supports filtering and searching your dataset using SQL queries, vector similarity search, and semantic search.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/3VryynorQeo?start=279"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics Explorer API Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Explorer depends on external libraries for some of its functionality. These are automatically installed when you use Explorer. To manually install these dependencies, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# Create an Explorer object
|
||||||
|
explorer = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
|
||||||
|
# Create embeddings for your dataset
|
||||||
|
explorer.create_embeddings_table()
|
||||||
|
|
||||||
|
# Search for similar images to a given image/images
|
||||||
|
df = explorer.get_similar(img="path/to/image.jpg")
|
||||||
|
|
||||||
|
# Or search for similar images to a given index/indices
|
||||||
|
df = explorer.get_similar(idx=0)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
[Embeddings](https://www.ultralytics.com/glossary/embeddings) table for a given dataset and model pair is only created once and reused. These use [LanceDB](https://lancedb.github.io/lancedb/) under the hood, which scales on-disk, so you can create and reuse embeddings for large datasets like COCO without running out of memory.
|
||||||
|
|
||||||
|
In case you want to force update the embeddings table, you can pass `force=True` to `create_embeddings_table` method.
|
||||||
|
|
||||||
|
You can directly access the LanceDB table object to perform advanced analysis. Learn more about it in the [Working with Embeddings Table section](#4-working-with-embeddings-table)
|
||||||
|
|
||||||
|
## 1. Similarity Search
|
||||||
|
|
||||||
|
Similarity search is a technique for finding similar images to a given image. It is based on the idea that similar images will have similar embeddings. Once the embeddings table is built, you can get run semantic search in any of the following ways:
|
||||||
|
|
||||||
|
- On a given index or list of indices in the dataset: `exp.get_similar(idx=[1,10], limit=10)`
|
||||||
|
- On any image or list of images not in the dataset: `exp.get_similar(img=["path/to/img1", "path/to/img2"], limit=10)`
|
||||||
|
|
||||||
|
In case of multiple inputs, the aggregate of their embeddings is used.
|
||||||
|
|
||||||
|
You get a pandas DataFrame with the `limit` number of most similar data points to the input, along with their distance in the embedding space. You can use this dataset to perform further filtering.
|
||||||
|
|
||||||
|
!!! example "Semantic Search"
|
||||||
|
|
||||||
|
=== "Using Images"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
similar = exp.get_similar(img="https://ultralytics.com/images/bus.jpg", limit=10)
|
||||||
|
print(similar.head())
|
||||||
|
|
||||||
|
# Search using multiple indices
|
||||||
|
similar = exp.get_similar(
|
||||||
|
img=["https://ultralytics.com/images/bus.jpg", "https://ultralytics.com/images/bus.jpg"],
|
||||||
|
limit=10,
|
||||||
|
)
|
||||||
|
print(similar.head())
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Using Dataset Indices"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
similar = exp.get_similar(idx=1, limit=10)
|
||||||
|
print(similar.head())
|
||||||
|
|
||||||
|
# Search using multiple indices
|
||||||
|
similar = exp.get_similar(idx=[1, 10], limit=10)
|
||||||
|
print(similar.head())
|
||||||
|
```
|
||||||
|
|
||||||
|
### Plotting Similar Images
|
||||||
|
|
||||||
|
You can also plot the similar images using the `plot_similar` method. This method takes the same arguments as `get_similar` and plots the similar images in a grid.
|
||||||
|
|
||||||
|
!!! example "Plotting Similar Images"
|
||||||
|
|
||||||
|
=== "Using Images"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
plt = exp.plot_similar(img="https://ultralytics.com/images/bus.jpg", limit=10)
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Using Dataset Indices"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
plt = exp.plot_similar(idx=1, limit=10)
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Ask AI (Natural Language Querying)
|
||||||
|
|
||||||
|
This feature lets you filter your dataset using natural language, without writing SQL. The AI-powered query generator converts your prompt into a query and returns matching results. For example, you can ask: "show me 100 images with exactly one person and 2 dogs. There can be other objects too" and it will generate the query and show you those results.
|
||||||
|
Note: This feature uses LLMs, so results are probabilistic and may be inaccurate.
|
||||||
|
|
||||||
|
!!! example "Ask AI"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.explorer import plot_query_result
|
||||||
|
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
df = exp.ask_ai("show me 100 images with exactly one person and 2 dogs. There can be other objects too")
|
||||||
|
print(df.head())
|
||||||
|
|
||||||
|
# plot the results
|
||||||
|
plt = plot_query_result(df)
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. SQL Querying
|
||||||
|
|
||||||
|
You can run SQL queries on your dataset using the `sql_query` method. This method takes a SQL query as input and returns a pandas DataFrame with the results.
|
||||||
|
|
||||||
|
!!! example "SQL Query"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
df = exp.sql_query("WHERE labels LIKE '%person%' AND labels LIKE '%dog%'")
|
||||||
|
print(df.head())
|
||||||
|
```
|
||||||
|
|
||||||
|
### Plotting SQL Query Results
|
||||||
|
|
||||||
|
You can also plot the results of a SQL query using the `plot_sql_query` method. This method takes the same arguments as `sql_query` and plots the results in a grid.
|
||||||
|
|
||||||
|
!!! example "Plotting SQL Query Results"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# create an Explorer object
|
||||||
|
exp = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
# plot the SQL Query
|
||||||
|
exp.plot_sql_query("WHERE labels LIKE '%person%' AND labels LIKE '%dog%' LIMIT 10")
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Working with Embeddings Table
|
||||||
|
|
||||||
|
You can also work with the embeddings table directly. Once the embeddings table is created, you can access it using the `Explorer.table`
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Explorer works on [LanceDB](https://lancedb.github.io/lancedb/) tables internally. You can access this table directly, using `Explorer.table` object and run raw queries, push down pre- and post-filters, etc.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
exp = Explorer()
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
table = exp.table
|
||||||
|
```
|
||||||
|
|
||||||
|
Here are some examples of what you can do with the table:
|
||||||
|
|
||||||
|
### Get raw Embeddings
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
exp = Explorer()
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
table = exp.table
|
||||||
|
|
||||||
|
embeddings = table.to_pandas()["vector"]
|
||||||
|
print(embeddings)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced Querying with pre- and post-filters
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
exp = Explorer(model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
table = exp.table
|
||||||
|
|
||||||
|
# Dummy embedding
|
||||||
|
embedding = [i for i in range(256)]
|
||||||
|
rs = table.search(embedding).metric("cosine").where("").limit(10)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Vector Index
|
||||||
|
|
||||||
|
When using large datasets, you can also create a dedicated vector index for faster querying. This is done using the `create_index` method on LanceDB table.
|
||||||
|
|
||||||
|
```python
|
||||||
|
table.create_index(num_partitions=..., num_sub_vectors=...)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Embeddings Applications
|
||||||
|
|
||||||
|
You can use the embeddings table to perform a variety of exploratory analysis. Here are some examples:
|
||||||
|
|
||||||
|
### Similarity Index
|
||||||
|
|
||||||
|
Explorer comes with a `similarity_index` operation:
|
||||||
|
|
||||||
|
- It tries to estimate how similar each data point is with the rest of the dataset.
|
||||||
|
- It does that by counting how many image embeddings lie closer than `max_dist` to the current image in the generated embedding space, considering `top_k` similar images at a time.
|
||||||
|
|
||||||
|
It returns a pandas DataFrame with the following columns:
|
||||||
|
|
||||||
|
- `idx`: Index of the image in the dataset
|
||||||
|
- `im_file`: Path to the image file
|
||||||
|
- `count`: Number of images in the dataset that are closer than `max_dist` to the current image
|
||||||
|
- `sim_im_files`: List of paths to the `count` similar images
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
For a given dataset, model, `max_dist` & `top_k` the similarity index once generated will be reused. In case, your dataset has changed, or you simply need to regenerate the similarity index, you can pass `force=True`.
|
||||||
|
|
||||||
|
!!! example "Similarity Index"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
exp = Explorer()
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
|
||||||
|
sim_idx = exp.similarity_index()
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use similarity index to build custom conditions to filter out the dataset. For example, you can filter out images that are not similar to any other image in the dataset using the following code:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
sim_count = np.array(sim_idx["count"])
|
||||||
|
sim_idx["im_file"][sim_count > 30]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Visualize Embedding Space
|
||||||
|
|
||||||
|
You can also visualize the embedding space using the plotting tool of your choice. For example here is a simple example using matplotlib:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from sklearn.decomposition import PCA
|
||||||
|
|
||||||
|
# Reduce dimensions using PCA to 3 components for visualization in 3D
|
||||||
|
pca = PCA(n_components=3)
|
||||||
|
reduced_data = pca.fit_transform(embeddings)
|
||||||
|
|
||||||
|
# Create a 3D scatter plot using Matplotlib Axes3D
|
||||||
|
fig = plt.figure(figsize=(8, 6))
|
||||||
|
ax = fig.add_subplot(111, projection="3d")
|
||||||
|
|
||||||
|
# Scatter plot
|
||||||
|
ax.scatter(reduced_data[:, 0], reduced_data[:, 1], reduced_data[:, 2], alpha=0.5)
|
||||||
|
ax.set_title("3D Scatter Plot of Reduced 256-Dimensional Data (PCA)")
|
||||||
|
ax.set_xlabel("Component 1")
|
||||||
|
ax.set_ylabel("Component 2")
|
||||||
|
ax.set_zlabel("Component 3")
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
||||||
|
Start creating your own CV dataset exploration reports using the Explorer API. For inspiration, check out the [VOC Exploration Example](explorer.md).
|
||||||
|
|
||||||
|
## Apps Built Using Ultralytics Explorer
|
||||||
|
|
||||||
|
Try our [GUI Demo](dashboard.md) based on Explorer API
|
||||||
|
|
||||||
|
## Coming Soon
|
||||||
|
|
||||||
|
- [ ] Merge specific labels from datasets. Example - Import all `person` labels from COCO and `car` labels from Cityscapes
|
||||||
|
- [ ] Remove images that have a higher similarity index than the given threshold
|
||||||
|
- [ ] Automatically persist new datasets after merging/removing entries
|
||||||
|
- [ ] Advanced Dataset Visualizations
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Ultralytics Explorer API used for?
|
||||||
|
|
||||||
|
The Ultralytics Explorer API is designed for comprehensive dataset exploration. It allows users to filter and search datasets using SQL queries, vector similarity search, and semantic search. This powerful Python API can handle large datasets, making it ideal for various [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks using Ultralytics models.
|
||||||
|
|
||||||
|
### How do I install the Ultralytics Explorer API?
|
||||||
|
|
||||||
|
To install the Ultralytics Explorer API along with its dependencies, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically install all necessary external libraries for the Explorer API functionality. For additional setup details, refer to the [installation section](#installation) of our documentation.
|
||||||
|
|
||||||
|
### How can I use the Ultralytics Explorer API for similarity search?
|
||||||
|
|
||||||
|
You can use the Ultralytics Explorer API to perform similarity searches by creating an embeddings table and querying it for similar images. Here's a basic example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# Create an Explorer object
|
||||||
|
explorer = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
explorer.create_embeddings_table()
|
||||||
|
|
||||||
|
# Search for similar images to a given image
|
||||||
|
similar_images_df = explorer.get_similar(img="path/to/image.jpg")
|
||||||
|
print(similar_images_df.head())
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, please visit the [Similarity Search section](#1-similarity-search).
|
||||||
|
|
||||||
|
### What are the benefits of using LanceDB with Ultralytics Explorer?
|
||||||
|
|
||||||
|
LanceDB, used under the hood by Ultralytics Explorer, provides scalable, on-disk embeddings tables. This ensures that you can create and reuse embeddings for large datasets like COCO without running out of memory. These tables are only created once and can be reused, enhancing efficiency in data handling.
|
||||||
|
|
||||||
|
### How does the Ask AI feature work in the Ultralytics Explorer API?
|
||||||
|
|
||||||
|
The Ask AI feature allows users to filter datasets using natural language queries. This feature leverages LLMs to convert these queries into SQL queries behind the scenes. Here's an example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import Explorer
|
||||||
|
|
||||||
|
# Create an Explorer object
|
||||||
|
explorer = Explorer(data="coco128.yaml", model="yolo26n.pt")
|
||||||
|
explorer.create_embeddings_table()
|
||||||
|
|
||||||
|
# Query with natural language
|
||||||
|
query_result = explorer.ask_ai("show me 100 images with exactly one person and 2 dogs. There can be other objects too")
|
||||||
|
print(query_result.head())
|
||||||
|
```
|
||||||
|
|
||||||
|
For more examples, check out the [Ask AI section](#2-ask-ai-natural-language-querying).
|
||||||
127
docs/en/datasets/explorer/dashboard.md
Executable file
127
docs/en/datasets/explorer/dashboard.md
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Unlock advanced data exploration with Ultralytics Explorer GUI. Utilize semantic search, run SQL queries, and ask AI for natural language data insights.
|
||||||
|
keywords: Ultralytics Explorer GUI, semantic search, vector similarity, SQL queries, AI, natural language search, data exploration, machine learning, OpenAI, LLMs
|
||||||
|
---
|
||||||
|
|
||||||
|
# Explorer GUI
|
||||||
|
|
||||||
|
!!! warning "Community Note ⚠️"
|
||||||
|
|
||||||
|
As of **`ultralytics>=8.3.10`**, Ultralytics Explorer support is deprecated. Similar (and expanded) dataset exploration features are available in [Ultralytics Platform](https://platform.ultralytics.com/).
|
||||||
|
|
||||||
|
Explorer GUI is built on the [Ultralytics Explorer API](api.md). It allows you to run semantic/vector similarity search, SQL queries, and natural language queries using the Ask AI feature powered by LLMs.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1709" alt="Ultralytics Explorer GUI main dashboard interface" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-1.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/3VryynorQeo?start=306"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics Explorer Dashboard Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
The Ask AI feature uses OpenAI, so you will be prompted to set the OpenAI API key when you first run the GUI.
|
||||||
|
Set it with `yolo settings openai_api_key="..."`.
|
||||||
|
|
||||||
|
## Vector Semantic Similarity Search
|
||||||
|
|
||||||
|
[Semantic search](https://www.ultralytics.com/glossary/semantic-search) is a technique for finding similar images to a given image. It is based on the idea that similar images will have similar [embeddings](https://www.ultralytics.com/glossary/embeddings). In the UI, you can select one or more images and search for the images similar to them. This can be useful when you want to find images similar to a given image or a set of images that don't perform as expected.
|
||||||
|
|
||||||
|
For example, in this VOC Exploration dashboard, the user selects a few airplane images:
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1710" alt="Explorer selecting airplane images for similarity search" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-2.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
After running the similarity search, you should see similar results:
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1710" alt="Ultralytics Explorer semantic similarity search" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-3.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Ask AI
|
||||||
|
|
||||||
|
This feature lets you filter your dataset using natural language, without writing SQL. The AI-powered query generator converts your prompt into a query and returns matching results. For example, you can ask: "show me 100 images with exactly one person and 2 dogs. There can be other objects too" and it will generate the query and show you those results. Here is an example output when asked: "Show 10 images with exactly 5 persons":
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1709" alt="Explorer Ask AI results for images with 5 persons" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-4.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Note: This feature uses [Large Language Models](https://www.ultralytics.com/glossary/large-language-model-llm), so results are probabilistic and may be inaccurate.
|
||||||
|
|
||||||
|
## Run SQL queries on your CV datasets
|
||||||
|
|
||||||
|
You can run SQL queries on your dataset to filter it. It also works if you only provide the WHERE clause. For example, the following WHERE clause returns images that contain at least one person and one dog:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
WHERE labels LIKE '%person%' AND labels LIKE '%dog%'
|
||||||
|
```
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1707" alt="Explorer SQL query filtering images with person and dog" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-5.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This demo was built using the Explorer API, which you can use to create your own exploratory notebooks or scripts for gaining insights into your datasets. To get started, check out the [Explorer API documentation](api.md).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is Ultralytics Explorer GUI and how do I install it?
|
||||||
|
|
||||||
|
Ultralytics Explorer GUI is a powerful interface that unlocks advanced data exploration capabilities using the [Ultralytics Explorer API](api.md). It allows you to run semantic/vector similarity search, SQL queries, and natural language queries using the Ask AI feature powered by [Large Language Models](https://www.ultralytics.com/glossary/large-language-model-llm) (LLMs).
|
||||||
|
|
||||||
|
To install the Explorer GUI, you can use pip:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: To use the Ask AI feature, you'll need to set the OpenAI API key: `yolo settings openai_api_key="..."`.
|
||||||
|
|
||||||
|
### How does the semantic search feature in Ultralytics Explorer GUI work?
|
||||||
|
|
||||||
|
The semantic search feature in Ultralytics Explorer GUI allows you to find images similar to a given image based on their embeddings. This technique is useful for identifying and exploring images that share visual similarities. To use this feature, select one or more images in the UI and execute a search for similar images. The result will display images that closely resemble the selected ones, facilitating efficient dataset exploration and [anomaly detection](https://www.ultralytics.com/glossary/anomaly-detection).
|
||||||
|
|
||||||
|
Learn more about semantic search and other features by visiting the [Feature Overview](#vector-semantic-similarity-search) section.
|
||||||
|
|
||||||
|
### Can I use natural language to filter datasets in Ultralytics Explorer GUI?
|
||||||
|
|
||||||
|
Yes, with the Ask AI feature powered by large language models (LLMs), you can filter your datasets using natural language queries. You don't need to be proficient in SQL. For instance, you can ask "Show me 100 images with exactly one person and 2 dogs. There can be other objects too," and the AI will generate the appropriate query under the hood to deliver the desired results.
|
||||||
|
|
||||||
|
### How do I run SQL queries on datasets using Ultralytics Explorer GUI?
|
||||||
|
|
||||||
|
Ultralytics Explorer GUI allows you to run SQL queries directly on your dataset to filter and manage data efficiently. To run a query, navigate to the SQL query section in the GUI and write your query. For example, to show images with at least one person and one dog, you could use:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
WHERE labels LIKE '%person%' AND labels LIKE '%dog%'
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also provide only the WHERE clause, making the querying process more flexible.
|
||||||
|
|
||||||
|
For more details, refer to the [SQL Queries Section](#run-sql-queries-on-your-cv-datasets).
|
||||||
|
|
||||||
|
### What are the benefits of using Ultralytics Explorer GUI for data exploration?
|
||||||
|
|
||||||
|
Ultralytics Explorer GUI enhances data exploration with features like semantic search, SQL querying, and natural language interactions through the Ask AI feature. These capabilities allow users to:
|
||||||
|
|
||||||
|
- Efficiently find visually similar images.
|
||||||
|
- Filter datasets using complex SQL queries.
|
||||||
|
- Utilize AI to perform natural language searches, eliminating the need for advanced SQL expertise.
|
||||||
|
|
||||||
|
These features make it a versatile tool for developers, researchers, and data scientists looking to gain deeper insights into their datasets.
|
||||||
|
|
||||||
|
Explore more about these features in the [Explorer GUI Documentation](#explorer-gui).
|
||||||
277
docs/en/datasets/explorer/explorer.md
Executable file
277
docs/en/datasets/explorer/explorer.md
Executable file
@@ -0,0 +1,277 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Dive into advanced data exploration with Ultralytics Explorer. Perform semantic searches, execute SQL queries, and leverage AI-powered natural language insights for seamless data analysis.
|
||||||
|
keywords: Ultralytics Explorer, data exploration, semantic search, vector similarity, SQL queries, AI, natural language queries, machine learning, OpenAI, LLMs, Ultralytics Platform
|
||||||
|
---
|
||||||
|
|
||||||
|
# VOC Exploration Example
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<a href="https://www.ultralytics.com/events/yolovision" target="_blank"><img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/ultralytics-yolov8-banner.avif" alt="Ultralytics YOLO banner"></a>
|
||||||
|
<a href="https://docs.ultralytics.com/zh/">中文</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/ko/">한국어</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/ja/">日本語</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/ru/">Русский</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/de/">Deutsch</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/fr/">Français</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/es">Español</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/pt/">Português</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/tr/">Türkçe</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/vi/">Tiếng Việt</a> |
|
||||||
|
<a href="https://docs.ultralytics.com/ar/">العربية</a>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml/badge.svg" alt="Ultralytics CI"></a>
|
||||||
|
<a href="https://clickpy.clickhouse.com/dashboard/ultralytics"><img src="https://static.pepy.tech/badge/ultralytics" alt="Ultralytics Downloads"></a>
|
||||||
|
<a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="Ultralytics YOLO Citation"></a>
|
||||||
|
<a href="https://discord.com/invite/ultralytics"><img alt="Ultralytics Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
|
||||||
|
<a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>
|
||||||
|
<a href="https://www.reddit.com/r/ultralytics/"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
|
||||||
|
<br>
|
||||||
|
<a href="https://console.paperspace.com/github/ultralytics/ultralytics"><img src="https://assets.paperspace.io/img/gradient-badge.svg" alt="Run Ultralytics on Gradient"></a>
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Ultralytics In Colab"></a>
|
||||||
|
<a href="https://www.kaggle.com/models/ultralytics/yolo26"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open Ultralytics In Kaggle"></a>
|
||||||
|
<a href="https://mybinder.org/v2/gh/ultralytics/ultralytics/HEAD?labpath=examples%2Ftutorial.ipynb"><img src="https://mybinder.org/badge_logo.svg" alt="Open Ultralytics In Binder"></a>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Welcome to the Ultralytics Explorer API notebook. This notebook introduces the resources available for exploring datasets with semantic search, vector search, and SQL queries.
|
||||||
|
|
||||||
|
Try `yolo explorer` (powered by the Explorer API)
|
||||||
|
|
||||||
|
Install `ultralytics` and run `yolo explorer` in your terminal to run custom queries and semantic search in your browser.
|
||||||
|
|
||||||
|
!!! warning "Community Note ⚠️"
|
||||||
|
|
||||||
|
As of **`ultralytics>=8.3.10`**, Ultralytics Explorer support is deprecated. Similar (and expanded) dataset exploration features are available in [Ultralytics Platform](https://platform.ultralytics.com/).
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Install `ultralytics` and the required [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml), then check software and hardware.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
!uv pip install ultralytics[explorer] openai
|
||||||
|
yolo checks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Similarity Search
|
||||||
|
|
||||||
|
Utilize the power of vector similarity search to find the similar data points in your dataset along with their distance in the embedding space. Simply create an embeddings table for the given dataset-model pair. It is only needed once, and it is reused automatically.
|
||||||
|
|
||||||
|
```python
|
||||||
|
exp = Explorer("VOC.yaml", model="yolo26n.pt")
|
||||||
|
exp.create_embeddings_table()
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the embeddings table is built, you can run semantic search in any of the following ways:
|
||||||
|
|
||||||
|
- On a given index/list of indices in the dataset, e.g., `exp.get_similar(idx=[1, 10], limit=10)`
|
||||||
|
- On any image/ list of images not in the dataset - exp.get_similar(img=["path/to/img1", "path/to/img2"], limit=10) In case of multiple inputs, the aggregate of their embeddings is used.
|
||||||
|
|
||||||
|
You get a pandas DataFrame with the limit number of most similar data points to the input, along with their distance in the embedding space. You can use this dataset to perform further filtering.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
# Search dataset by index
|
||||||
|
similar = exp.get_similar(idx=1, limit=10)
|
||||||
|
similar.head()
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also plot the similar samples directly using the `plot_similar` util
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
exp.plot_similar(idx=6500, limit=20)
|
||||||
|
exp.plot_similar(idx=[100, 101], limit=10) # Can also pass list of idxs or imgs
|
||||||
|
|
||||||
|
exp.plot_similar(img="https://ultralytics.com/images/bus.jpg", limit=10, labels=False) # Can also pass external images
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Ask AI: Search or Filter with Natural Language
|
||||||
|
|
||||||
|
You can prompt the Explorer object with the kind of data points you want to see, and it will try to return a DataFrame with those results. Because it is powered by LLMs, it does not always get it right. In that case, it will return `None`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
df = exp.ask_ai("show me images containing more than 10 objects with at least 2 persons")
|
||||||
|
df.head(5)
|
||||||
|
```
|
||||||
|
|
||||||
|
To plot these results, you can use the `plot_query_result` utility. Example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
plt = plot_query_result(exp.ask_ai("show me 10 images containing exactly 2 persons"))
|
||||||
|
Image.fromarray(plt)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
# plot
|
||||||
|
from PIL import Image
|
||||||
|
from ultralytics.data.explorer import plot_query_result
|
||||||
|
|
||||||
|
plt = plot_query_result(exp.ask_ai("show me 10 images containing exactly 2 persons"))
|
||||||
|
Image.fromarray(plt)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run SQL Queries on Your Dataset
|
||||||
|
|
||||||
|
Sometimes you might want to investigate certain entries in your dataset. For this, Explorer allows you to execute SQL queries. It accepts either of the following formats:
|
||||||
|
|
||||||
|
- Queries beginning with "WHERE" will automatically select all columns. This can be thought of as a shorthand query.
|
||||||
|
- You can also write full queries where you can specify which columns to select.
|
||||||
|
|
||||||
|
This can be used to investigate model performance and specific data points. For example:
|
||||||
|
|
||||||
|
- let's say your model struggles on images that have humans and dogs. You can write a query like this to select the points that have at least 2 humans AND at least one dog.
|
||||||
|
|
||||||
|
You can combine SQL query and semantic search to filter down to specific type of results
|
||||||
|
|
||||||
|
```python
|
||||||
|
table = exp.sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10")
|
||||||
|
exp.plot_sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10", labels=True)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
table = exp.sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10")
|
||||||
|
print(table)
|
||||||
|
```
|
||||||
|
|
||||||
|
Just like similarity search, you also get a util to directly plot the sql queries using `exp.plot_sql_query`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
exp.plot_sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10", labels=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Working with embeddings Table (Advanced)
|
||||||
|
|
||||||
|
Explorer works on [LanceDB](https://lancedb.github.io/lancedb/) tables internally. You can access this table directly, using `Explorer.table` object and run raw queries, push down pre- and post-filters, etc.
|
||||||
|
|
||||||
|
```python
|
||||||
|
table = exp.table
|
||||||
|
print(table.schema)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run raw queries¶
|
||||||
|
|
||||||
|
Vector Search finds the nearest vectors from the database. In a recommendation system or search engine, you can find similar products from the one you searched. In LLM and other AI applications, each data point can be presented by the embeddings generated from some models, it returns the most relevant features.
|
||||||
|
|
||||||
|
A search in high-dimensional vector space, is to find K-Nearest-Neighbors (KNN) of the query vector.
|
||||||
|
|
||||||
|
Metric In LanceDB, a Metric is the way to describe the distance between a pair of vectors. Currently, it supports the following metrics:
|
||||||
|
|
||||||
|
- L2
|
||||||
|
- Cosine
|
||||||
|
- Dot Explorer's similarity search uses L2 by default. You can run queries on tables directly, or use the lance format to build custom utilities to manage datasets. More details on available LanceDB table ops in the [docs](https://lancedb.github.io/lancedb/)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
dummy_img_embedding = [i for i in range(256)]
|
||||||
|
table.search(dummy_img_embedding).limit(5).to_pandas()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Interconversion to popular data formats
|
||||||
|
|
||||||
|
```python
|
||||||
|
df = table.to_pandas()
|
||||||
|
pa_table = table.to_arrow()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Work with Embeddings
|
||||||
|
|
||||||
|
You can access the raw embedding from lancedb Table and analyze it. The image embeddings are stored in column `vector`
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
embeddings = table.to_pandas()["vector"].tolist()
|
||||||
|
embeddings = np.array(embeddings)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Scatterplot
|
||||||
|
|
||||||
|
One of the preliminary steps in analyzing embeddings is by plotting them in 2D space via dimensionality reduction. Let's try an example
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from sklearn.decomposition import PCA # pip install scikit-learn
|
||||||
|
|
||||||
|
# Reduce dimensions using PCA to 3 components for visualization in 3D
|
||||||
|
pca = PCA(n_components=3)
|
||||||
|
reduced_data = pca.fit_transform(embeddings)
|
||||||
|
|
||||||
|
# Create a 3D scatter plot using Matplotlib's Axes3D
|
||||||
|
fig = plt.figure(figsize=(8, 6))
|
||||||
|
ax = fig.add_subplot(111, projection="3d")
|
||||||
|
|
||||||
|
# Scatter plot
|
||||||
|
ax.scatter(reduced_data[:, 0], reduced_data[:, 1], reduced_data[:, 2], alpha=0.5)
|
||||||
|
ax.set_title("3D Scatter Plot of Reduced 256-Dimensional Data (PCA)")
|
||||||
|
ax.set_xlabel("Component 1")
|
||||||
|
ax.set_ylabel("Component 2")
|
||||||
|
ax.set_zlabel("Component 3")
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Similarity Index
|
||||||
|
|
||||||
|
Here's a simple example of an operation powered by the embeddings table. Explorer comes with a `similarity_index` operation-
|
||||||
|
|
||||||
|
- It tries to estimate how similar each data point is with the rest of the dataset.
|
||||||
|
- It does that by counting how many image embeddings lie closer than max_dist to the current image in the generated embedding space, considering top_k similar images at a time.
|
||||||
|
|
||||||
|
For a given dataset, model, `max_dist` & `top_k` the similarity index once generated will be reused. In case, your dataset has changed, or you simply need to regenerate the similarity index, you can pass `force=True`. Similar to vector and SQL search, this also comes with a util to directly plot it.
|
||||||
|
|
||||||
|
```python
|
||||||
|
sim_idx = exp.similarity_index(max_dist=0.2, top_k=0.01)
|
||||||
|
exp.plot_similarity_index(max_dist=0.2, top_k=0.01)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Let's look at the plot first
|
||||||
|
|
||||||
|
```python
|
||||||
|
exp.plot_similarity_index(max_dist=0.2, top_k=0.01)
|
||||||
|
```
|
||||||
|
|
||||||
|
Now let's look at the output of the operation
|
||||||
|
|
||||||
|
```python
|
||||||
|
sim_idx = exp.similarity_index(max_dist=0.2, top_k=0.01, force=False)
|
||||||
|
|
||||||
|
sim_idx
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's create a query to see what data points have similarity count of more than 30 and plot images similar to them.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
sim_count = np.array(sim_idx["count"])
|
||||||
|
sim_idx["im_file"][sim_count > 30]
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see something like this
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```python
|
||||||
|
exp.plot_similar(idx=[7146, 14035]) # Using avg embeddings of 2 images
|
||||||
|
```
|
||||||
113
docs/en/datasets/explorer/index.md
Executable file
113
docs/en/datasets/explorer/index.md
Executable file
@@ -0,0 +1,113 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover Ultralytics Explorer for semantic search, SQL queries, vector similarity, and natural language dataset exploration.
|
||||||
|
keywords: Ultralytics Explorer, CV datasets, semantic search, SQL queries, vector similarity, dataset visualization, python API, machine learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# Ultralytics Explorer
|
||||||
|
|
||||||
|
!!! warning "Community Note ⚠️"
|
||||||
|
|
||||||
|
As of **`ultralytics>=8.3.10`**, Ultralytics Explorer support is deprecated. Similar (and expanded) dataset exploration features are available in [Ultralytics Platform](https://platform.ultralytics.com/).
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1709" alt="Ultralytics Explorer dataset visualization GUI" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/explorer-dashboard-screenshot-1.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||||
|
|
||||||
|
Ultralytics Explorer is a tool for exploring CV datasets using semantic search, SQL queries, vector similarity search, and natural language prompts. It also provides a Python API for accessing the same functionality.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/3VryynorQeo"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics Explorer API | Semantic Search, SQL Queries & Ask AI Features
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Installation of Optional Dependencies
|
||||||
|
|
||||||
|
Explorer depends on external libraries for some of its functionality. These are automatically installed when you use Explorer. To manually install these dependencies, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Explorer works on embedding/semantic search & SQL querying and is powered by [LanceDB](https://lancedb.com/) serverless vector database. Unlike traditional in-memory DBs, it is persisted on disk without sacrificing performance, so you can scale locally to large datasets like COCO without running out of memory.
|
||||||
|
|
||||||
|
## Explorer API
|
||||||
|
|
||||||
|
This is a Python API for exploring your datasets. It also powers the GUI Explorer. You can use this to create your own exploratory notebooks or scripts to get insights into your datasets.
|
||||||
|
|
||||||
|
Explore the full capabilities and usage examples in the [Explorer API documentation](api.md).
|
||||||
|
|
||||||
|
## GUI Explorer Usage
|
||||||
|
|
||||||
|
The GUI demo runs in your browser allowing you to create [embeddings](https://www.ultralytics.com/glossary/embeddings) for your dataset and search for similar images, run SQL queries and perform semantic search. It can be run using the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo explorer
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
The Ask AI feature uses OpenAI, so you'll be prompted to set the API key for OpenAI when you first run the GUI.
|
||||||
|
You can set it like this - `yolo settings openai_api_key="..."`
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img width="1709" alt="Ultralytics Explorer OpenAI Integration" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/ultralytics-explorer-openai-integration.avif">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is Ultralytics Explorer and how can it help with CV datasets?
|
||||||
|
|
||||||
|
Ultralytics Explorer is a powerful tool designed for exploring [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) (CV) datasets through semantic search, SQL queries, vector similarity search, and even natural language. This versatile tool provides both a GUI and a Python API, allowing users to seamlessly interact with their datasets. By leveraging technologies like [LanceDB](https://lancedb.com/), Ultralytics Explorer ensures efficient, scalable access to large datasets without excessive memory usage. Whether you're performing detailed dataset analysis or exploring data patterns, Ultralytics Explorer streamlines the entire process.
|
||||||
|
|
||||||
|
Learn more about the [Explorer API](api.md).
|
||||||
|
|
||||||
|
### How do I install the dependencies for Ultralytics Explorer?
|
||||||
|
|
||||||
|
To manually install the optional dependencies needed for Ultralytics Explorer, you can use the following `pip` command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install ultralytics[explorer]
|
||||||
|
```
|
||||||
|
|
||||||
|
These dependencies are essential for the full functionality of semantic search and SQL querying. By including libraries powered by [LanceDB](https://lancedb.com/), the installation ensures that the database operations remain efficient and scalable, even for large datasets like [COCO](../detect/coco.md).
|
||||||
|
|
||||||
|
### How can I use the GUI version of Ultralytics Explorer?
|
||||||
|
|
||||||
|
Using the GUI version of Ultralytics Explorer is straightforward. After installing the necessary dependencies, you can launch the GUI with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo explorer
|
||||||
|
```
|
||||||
|
|
||||||
|
The GUI provides a user-friendly interface for creating dataset embeddings, searching for similar images, running SQL queries, and conducting semantic searches. Additionally, the integration with OpenAI's Ask AI feature allows you to query datasets using natural language, enhancing the flexibility and ease of use.
|
||||||
|
|
||||||
|
For storage and scalability information, check out our [installation instructions](#installation-of-optional-dependencies).
|
||||||
|
|
||||||
|
### What is the Ask AI feature in Ultralytics Explorer?
|
||||||
|
|
||||||
|
The Ask AI feature in Ultralytics Explorer allows users to interact with their datasets using natural language queries. Powered by [OpenAI](https://www.ultralytics.com/blog/openai-gpt-4o-showcases-ai-potential), this feature enables you to ask complex questions and receive insightful answers without needing to write SQL queries or similar commands. To use this feature, you'll need to set your OpenAI API key the first time you run the GUI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo settings openai_api_key="YOUR_API_KEY"
|
||||||
|
```
|
||||||
|
|
||||||
|
For more on this feature and how to integrate it, see our [GUI Explorer Usage](#gui-explorer-usage) section.
|
||||||
|
|
||||||
|
### Can I run Ultralytics Explorer in Google Colab?
|
||||||
|
|
||||||
|
Yes, Ultralytics Explorer can be run in Google Colab, providing a convenient and powerful environment for dataset exploration. You can start by opening the provided Colab notebook, which is pre-configured with all the necessary settings:
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/docs/en/datasets/explorer/explorer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||||
|
|
||||||
|
This setup allows you to explore your datasets fully, taking advantage of Google's cloud resources. Learn more in our [Google Colab Guide](../../integrations/google-colab.md).
|
||||||
239
docs/en/datasets/index.md
Executable file
239
docs/en/datasets/index.md
Executable file
@@ -0,0 +1,239 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore Ultralytics' diverse datasets for vision tasks like detection, segmentation, classification, and more. Enhance your projects with high-quality annotated data.
|
||||||
|
keywords: Ultralytics, datasets, computer vision, object detection, instance segmentation, pose estimation, image classification, multi-object tracking
|
||||||
|
---
|
||||||
|
|
||||||
|
# Datasets Overview
|
||||||
|
|
||||||
|
Ultralytics provides support for various datasets to facilitate computer vision tasks such as detection, [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), pose estimation, classification, and multi-object tracking. Below is a list of the main Ultralytics datasets, followed by a summary of each computer vision task and the respective datasets.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/YDXKa1EljmU"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics Datasets Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## [Object Detection](detect/index.md)
|
||||||
|
|
||||||
|
[Bounding box](https://www.ultralytics.com/glossary/bounding-box) object detection is a computer vision technique that involves detecting and localizing objects in an image by drawing a bounding box around each object.
|
||||||
|
|
||||||
|
- [African-wildlife](detect/african-wildlife.md): A dataset featuring images of African wildlife, including buffalo, elephants, rhinos, and zebras.
|
||||||
|
- [Argoverse](detect/argoverse.md): A dataset containing 3D tracking and motion forecasting data from urban environments with rich annotations.
|
||||||
|
- [Brain-tumor](detect/brain-tumor.md): A dataset for detecting brain tumors that includes MRI or CT scan images with details on tumor presence, location, and characteristics.
|
||||||
|
- [COCO](detect/coco.md): Common Objects in Context (COCO) is a large-scale object detection, segmentation, and captioning dataset with 80 object categories.
|
||||||
|
- [COCO8](detect/coco8.md): A smaller subset of the first 4 images from COCO train and COCO val, suitable for quick tests.
|
||||||
|
- [COCO8-Grayscale](detect/coco8-grayscale.md): A grayscale version of COCO8 created by converting RGB to grayscale, useful for single-channel model evaluation.
|
||||||
|
- [COCO8-Multispectral](detect/coco8-multispectral.md): A 10-channel multispectral version of COCO8 created by interpolating RGB wavelengths, useful for spectral-aware model evaluation.
|
||||||
|
- [COCO128](detect/coco128.md): A smaller subset of the first 128 images from COCO train and COCO val, suitable for tests.
|
||||||
|
- [Construction-PPE](detect/construction-ppe.md): A dataset of construction site imagery annotated with key safety gear such as helmets, vests, gloves, boots, and goggles, along with labels for missing equipment, supporting the development of AI models for compliance and worker protection.
|
||||||
|
- [Global Wheat 2020](detect/globalwheat2020.md): A dataset containing images of wheat heads for the Global Wheat Challenge 2020.
|
||||||
|
- [HomeObjects-3K](detect/homeobjects-3k.md): A dataset of annotated indoor scenes featuring 12 common household items, ideal for developing and testing computer vision models in smart home systems, robotics, and augmented reality.
|
||||||
|
- [KITTI](detect/kitti.md) New: A well-known autonomous driving dataset featuring stereo, LiDAR, and GPS/IMU inputs, used for 2D object detection in varied road scenes.
|
||||||
|
- [LVIS](detect/lvis.md): A large-scale object detection, segmentation, and captioning dataset with 1203 object categories.
|
||||||
|
- [Medical-pills](detect/medical-pills.md): A dataset containing labeled images of medical pills, designed to aid in tasks like pharmaceutical quality control, sorting, and ensuring compliance with industry standards.
|
||||||
|
- [Objects365](detect/objects365.md): A high-quality, large-scale dataset for object detection with 365 object categories and over 600K annotated images.
|
||||||
|
- [OpenImagesV7](detect/open-images-v7.md): A comprehensive dataset by Google with 1.7M train images and 42k validation images.
|
||||||
|
- [RF100](detect/roboflow-100.md): A diverse object detection benchmark with 100 datasets spanning seven imagery domains for comprehensive model evaluation.
|
||||||
|
- [Signature](detect/signature.md): A dataset featuring images of various documents with annotated signatures, supporting document verification and fraud detection research.
|
||||||
|
- [SKU-110K](detect/sku-110k.md): A dataset featuring dense object detection in retail environments with over 11K images and 1.7 million bounding boxes.
|
||||||
|
- [VisDrone](detect/visdrone.md): A dataset containing object detection and multi-object tracking data from drone-captured imagery with over 10K images and video sequences.
|
||||||
|
- [VOC](detect/voc.md): The Pascal Visual Object Classes (VOC) dataset for object detection and segmentation with 20 object classes and over 11K images.
|
||||||
|
- [xView](detect/xview.md): A dataset for object detection in overhead imagery with 60 object categories and over 1 million annotated objects.
|
||||||
|
|
||||||
|
## [Instance Segmentation](segment/index.md)
|
||||||
|
|
||||||
|
Instance segmentation is a computer vision technique that involves identifying and localizing objects in an image at the pixel level. Unlike semantic segmentation which only classifies each pixel, [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) distinguishes between different instances of the same class.
|
||||||
|
|
||||||
|
- [Carparts-seg](segment/carparts-seg.md): Purpose-built dataset for identifying vehicle parts, catering to design, manufacturing, and research needs. It serves for both object detection and segmentation tasks.
|
||||||
|
- [COCO](segment/coco.md): A large-scale dataset designed for object detection, segmentation, and captioning tasks with over 200K labeled images.
|
||||||
|
- [COCO8-seg](segment/coco8-seg.md): A smaller dataset for instance segmentation tasks, containing a subset of 8 COCO images with segmentation annotations.
|
||||||
|
- [COCO128-seg](segment/coco128-seg.md): A smaller dataset for instance segmentation tasks, containing a subset of 128 COCO images with segmentation annotations.
|
||||||
|
- [Crack-seg](segment/crack-seg.md): Specifically crafted dataset for detecting cracks on roads and walls, applicable for both object detection and segmentation tasks.
|
||||||
|
- [Package-seg](segment/package-seg.md): Tailored dataset for identifying packages in warehouses or industrial settings, suitable for both object detection and segmentation applications.
|
||||||
|
|
||||||
|
## [Pose Estimation](pose/index.md)
|
||||||
|
|
||||||
|
Pose estimation is a technique used to determine the pose of the object relative to the camera or the world coordinate system. This involves identifying key points or joints on objects, particularly humans or animals.
|
||||||
|
|
||||||
|
- [COCO](pose/coco.md): A large-scale dataset with human pose annotations designed for pose estimation tasks.
|
||||||
|
- [COCO8-pose](pose/coco8-pose.md): A smaller dataset for pose estimation tasks, containing a subset of 8 COCO images with human pose annotations.
|
||||||
|
- [Dog-pose](pose/dog-pose.md): A comprehensive dataset featuring approximately 6,000 images focused on dogs, annotated with 24 keypoints per dog, tailored for pose estimation tasks.
|
||||||
|
- [Hand-Keypoints](pose/hand-keypoints.md): A concise dataset featuring over 26,000 images centered on human hands, annotated with 21 keypoints per hand, designed for pose estimation tasks.
|
||||||
|
- [Tiger-pose](pose/tiger-pose.md): A compact dataset consisting of 263 images focused on tigers, annotated with 12 keypoints per tiger for pose estimation tasks.
|
||||||
|
|
||||||
|
## [Classification](classify/index.md)
|
||||||
|
|
||||||
|
[Image classification](https://www.ultralytics.com/glossary/image-classification) is a computer vision task that involves categorizing an image into one or more predefined classes or categories based on its visual content.
|
||||||
|
|
||||||
|
- [Caltech 101](classify/caltech101.md): A dataset containing images of 101 object categories for image classification tasks.
|
||||||
|
- [Caltech 256](classify/caltech256.md): An extended version of Caltech 101 with 256 object categories and more challenging images.
|
||||||
|
- [CIFAR-10](classify/cifar10.md): A dataset of 60K 32x32 color images in 10 classes, with 6K images per class.
|
||||||
|
- [CIFAR-100](classify/cifar100.md): An extended version of CIFAR-10 with 100 object categories and 600 images per class.
|
||||||
|
- [Fashion-MNIST](classify/fashion-mnist.md): A dataset consisting of 70,000 grayscale images of 10 fashion categories for image classification tasks.
|
||||||
|
- [ImageNet](classify/imagenet.md): A large-scale dataset for object detection and image classification with over 14 million images and 20,000 categories.
|
||||||
|
- [ImageNet-10](classify/imagenet10.md): A smaller subset of ImageNet with 10 categories for faster experimentation and testing.
|
||||||
|
- [Imagenette](classify/imagenette.md): A smaller subset of ImageNet that contains 10 easily distinguishable classes for quicker training and testing.
|
||||||
|
- [Imagewoof](classify/imagewoof.md): A more challenging subset of ImageNet containing 10 dog breed categories for image classification tasks.
|
||||||
|
- [MNIST](classify/mnist.md): A dataset of 70,000 grayscale images of handwritten digits for image classification tasks.
|
||||||
|
- [MNIST160](classify/mnist.md): First 8 images of each MNIST category from the MNIST dataset. Dataset contains 160 images total.
|
||||||
|
|
||||||
|
## [Oriented Bounding Boxes (OBB)](obb/index.md)
|
||||||
|
|
||||||
|
Oriented Bounding Boxes (OBB) is a method in computer vision for detecting angled objects in images using rotated bounding boxes, often applied to aerial and satellite imagery. Unlike traditional bounding boxes, OBB can better fit objects at various orientations.
|
||||||
|
|
||||||
|
- [DOTA-v2](obb/dota-v2.md): A popular OBB aerial imagery dataset with 1.7 million instances and 11,268 images.
|
||||||
|
- [DOTA8](obb/dota8.md): A smaller subset of the first 8 images from the DOTAv1 split set, 4 for training and 4 for validation, suitable for quick tests.
|
||||||
|
|
||||||
|
## [Multi-Object Tracking](track/index.md)
|
||||||
|
|
||||||
|
Multi-object tracking is a computer vision technique that involves detecting and tracking multiple objects over time in a video sequence. This task extends object detection by maintaining consistent identities of objects across frames.
|
||||||
|
|
||||||
|
- [Argoverse](detect/argoverse.md): A dataset containing 3D tracking and motion forecasting data from urban environments with rich annotations for multi-object tracking tasks.
|
||||||
|
- [VisDrone](detect/visdrone.md): A dataset containing object detection and multi-object tracking data from drone-captured imagery with over 10K images and video sequences.
|
||||||
|
|
||||||
|
## Contribute New Datasets
|
||||||
|
|
||||||
|
Contributing a new dataset involves several steps to ensure that it aligns well with the existing infrastructure. Below are the necessary steps:
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/yMR7BgwHQ3g?start=427"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Contribute to Ultralytics Datasets
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Steps to Contribute a New Dataset
|
||||||
|
|
||||||
|
1. **Collect Images**: Gather the images that belong to the dataset. These could be collected from various sources, such as public databases or your own collection.
|
||||||
|
2. **Annotate Images**: Annotate these images with bounding boxes, segments, or keypoints, depending on the task.
|
||||||
|
3. **Export Annotations**: Convert these annotations into the YOLO `*.txt` file format which Ultralytics supports.
|
||||||
|
4. **Organize Dataset**: Arrange your dataset into the correct folder structure. You should have `images/` and `labels/` top-level directories, and within each, a `train/` and `val/` subdirectory.
|
||||||
|
|
||||||
|
```
|
||||||
|
dataset/
|
||||||
|
├── images/
|
||||||
|
│ ├── train/
|
||||||
|
│ └── val/
|
||||||
|
└── labels/
|
||||||
|
├── train/
|
||||||
|
└── val/
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Create a `data.yaml` File**: In your dataset's root directory, create a `data.yaml` file that describes the dataset, classes, and other necessary information.
|
||||||
|
6. **Optimize Images (Optional)**: If you want to reduce the size of the dataset for more efficient processing, you can optimize the images using the code below. This is not required, but recommended for smaller dataset sizes and faster download speeds.
|
||||||
|
7. **Zip Dataset**: Compress the entire dataset folder into a zip file.
|
||||||
|
8. **Document and PR**: Create a documentation page describing your dataset and how it fits into the existing framework. After that, submit a Pull Request (PR). Refer to [Ultralytics Contribution Guidelines](https://docs.ultralytics.com/help/contributing/) for more details on how to submit a PR.
|
||||||
|
|
||||||
|
### Example Code to Optimize and Zip a Dataset
|
||||||
|
|
||||||
|
!!! example "Optimize and Zip a Dataset"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from ultralytics.data.utils import compress_one_image
|
||||||
|
from ultralytics.utils.downloads import zip_directory
|
||||||
|
|
||||||
|
# Define dataset directory
|
||||||
|
path = Path("path/to/dataset")
|
||||||
|
|
||||||
|
# Optimize images in dataset (optional)
|
||||||
|
for f in path.rglob("*.jpg"):
|
||||||
|
compress_one_image(f)
|
||||||
|
|
||||||
|
# Zip dataset into 'path/to/dataset.zip'
|
||||||
|
zip_directory(path)
|
||||||
|
```
|
||||||
|
|
||||||
|
By following these steps, you can contribute a new dataset that integrates well with Ultralytics' existing structure.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What datasets does Ultralytics support for object detection?
|
||||||
|
|
||||||
|
Ultralytics supports a wide variety of datasets for [object detection](https://www.ultralytics.com/glossary/object-detection), including:
|
||||||
|
|
||||||
|
- [COCO](detect/coco.md): A large-scale object detection, segmentation, and captioning dataset with 80 object categories.
|
||||||
|
- [LVIS](detect/lvis.md): An extensive dataset with 1203 object categories, designed for more fine-grained object detection and segmentation.
|
||||||
|
- [Argoverse](detect/argoverse.md): A dataset containing 3D tracking and motion forecasting data from urban environments with rich annotations.
|
||||||
|
- [VisDrone](detect/visdrone.md): A dataset with object detection and multi-object tracking data from drone-captured imagery.
|
||||||
|
- [SKU-110K](detect/sku-110k.md): Featuring dense object detection in retail environments with over 11K images.
|
||||||
|
|
||||||
|
These datasets facilitate training robust [Ultralytics YOLO](https://docs.ultralytics.com/models/) models for various object detection applications.
|
||||||
|
|
||||||
|
### How do I contribute a new dataset to Ultralytics?
|
||||||
|
|
||||||
|
Contributing a new dataset involves several steps:
|
||||||
|
|
||||||
|
1. **Collect Images**: Gather images from public databases or personal collections.
|
||||||
|
2. **Annotate Images**: Apply bounding boxes, segments, or keypoints, depending on the task.
|
||||||
|
3. **Export Annotations**: Convert annotations into the YOLO `*.txt` format.
|
||||||
|
4. **Organize Dataset**: Use the folder structure with `train/` and `val/` directories, each containing `images/` and `labels/` subdirectories.
|
||||||
|
5. **Create a `data.yaml` File**: Include dataset descriptions, classes, and other relevant information.
|
||||||
|
6. **Optimize Images (Optional)**: Reduce dataset size for efficiency.
|
||||||
|
7. **Zip Dataset**: Compress the dataset into a zip file.
|
||||||
|
8. **Document and PR**: Describe your dataset and submit a Pull Request following [Ultralytics Contribution Guidelines](https://docs.ultralytics.com/help/contributing/).
|
||||||
|
|
||||||
|
Visit [Contribute New Datasets](#contribute-new-datasets) for a comprehensive guide.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics Platform for my dataset?
|
||||||
|
|
||||||
|
[Ultralytics Platform](https://platform.ultralytics.com/) offers powerful features for dataset management and analysis, including:
|
||||||
|
|
||||||
|
- **Seamless Dataset Management**: Upload, organize, and manage your datasets in one place.
|
||||||
|
- **Immediate Training Integration**: Use uploaded datasets directly for model training without additional setup.
|
||||||
|
- **Visualization Tools**: Explore and visualize your dataset images and annotations.
|
||||||
|
- **Dataset Analysis**: Get insights into your dataset distribution and characteristics.
|
||||||
|
|
||||||
|
The platform streamlines the transition from dataset management to model training, making the entire process more efficient. Learn more about [Ultralytics Platform Datasets](https://docs.ultralytics.com/platform/data/).
|
||||||
|
|
||||||
|
### What are the unique features of Ultralytics YOLO models for computer vision?
|
||||||
|
|
||||||
|
Ultralytics YOLO models provide several unique features for [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks:
|
||||||
|
|
||||||
|
- **Real-time Performance**: High-speed inference and training capabilities for time-sensitive applications.
|
||||||
|
- **Versatility**: Support for detection, segmentation, classification, and pose estimation tasks in a unified framework.
|
||||||
|
- **Pretrained Models**: Access to high-performing, pretrained models for various applications, reducing training time.
|
||||||
|
- **Extensive Community Support**: Active community and comprehensive documentation for troubleshooting and development.
|
||||||
|
- **Easy Integration**: Simple API for integrating with existing projects and workflows.
|
||||||
|
|
||||||
|
Discover more about YOLO models on the [Ultralytics Models](https://docs.ultralytics.com/models/) page.
|
||||||
|
|
||||||
|
### How can I optimize and zip a dataset using Ultralytics tools?
|
||||||
|
|
||||||
|
To optimize and zip a dataset using Ultralytics tools, follow this example code:
|
||||||
|
|
||||||
|
!!! example "Optimize and Zip a Dataset"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from ultralytics.data.utils import compress_one_image
|
||||||
|
from ultralytics.utils.downloads import zip_directory
|
||||||
|
|
||||||
|
# Define dataset directory
|
||||||
|
path = Path("path/to/dataset")
|
||||||
|
|
||||||
|
# Optimize images in dataset (optional)
|
||||||
|
for f in path.rglob("*.jpg"):
|
||||||
|
compress_one_image(f)
|
||||||
|
|
||||||
|
# Zip dataset into 'path/to/dataset.zip'
|
||||||
|
zip_directory(path)
|
||||||
|
```
|
||||||
|
|
||||||
|
This process helps reduce dataset size for more efficient storage and faster download speeds. Learn more on how to [Optimize and Zip a Dataset](#example-code-to-optimize-and-zip-a-dataset).
|
||||||
250
docs/en/datasets/obb/dota-v2.md
Executable file
250
docs/en/datasets/obb/dota-v2.md
Executable file
@@ -0,0 +1,250 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the DOTA dataset for object detection in aerial images, featuring 1.7M Oriented Bounding Boxes across 18 categories. Ideal for aerial image analysis.
|
||||||
|
keywords: DOTA dataset, object detection, aerial images, oriented bounding boxes, OBB, DOTA v1.0, DOTA v1.5, DOTA v2.0, multiscale detection, Ultralytics
|
||||||
|
---
|
||||||
|
|
||||||
|
# DOTA Dataset with OBB
|
||||||
|
|
||||||
|
[DOTA](https://captain-whu.github.io/DOTA/index.html) stands as a specialized dataset, emphasizing [object detection](https://www.ultralytics.com/glossary/object-detection) in aerial images. Originating from the DOTA series of datasets, it offers annotated images capturing a diverse array of aerial scenes with [Oriented Bounding Boxes (OBB)](https://docs.ultralytics.com/datasets/obb/).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/JjQ-URE0LJE"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the DOTA Dataset for Oriented Bounding Boxes in Google Colab
|
||||||
|
</p>
|
||||||
|
|
||||||
|
- Collection from various sensors and platforms, with image sizes ranging from 800 × 800 to 20,000 × 20,000 pixels.
|
||||||
|
- Features more than 1.7M oriented bounding boxes across 18 categories.
|
||||||
|
- Encompasses multiscale object detection thanks to the wide spread of object sizes per image.
|
||||||
|
- Instances are annotated by experts using arbitrary (8 d.o.f.) quadrilaterals, capturing objects of different scales, orientations, and shapes.
|
||||||
|
|
||||||
|
## Dataset Versions
|
||||||
|
|
||||||
|
### DOTA-v1.0
|
||||||
|
|
||||||
|
- Contains 15 common categories.
|
||||||
|
- Comprises 2,806 images with 188,282 instances.
|
||||||
|
- Split ratios: 1/2 for training, 1/6 for validation, and 1/3 for testing.
|
||||||
|
|
||||||
|
### DOTA-v1.5
|
||||||
|
|
||||||
|
- Incorporates the same images as DOTA-v1.0.
|
||||||
|
- Very small instances (less than 10 pixels) are also annotated.
|
||||||
|
- Addition of a new category: "container crane".
|
||||||
|
- A total of 403,318 instances.
|
||||||
|
- Released for the [DOAI Challenge 2019 on Object Detection in Aerial Images](https://captain-whu.github.io/DOAI2019/challenge.html).
|
||||||
|
|
||||||
|
### DOTA-v2.0
|
||||||
|
|
||||||
|
- Collections from Google Earth, GF-2 Satellite, and other aerial images.
|
||||||
|
- Contains 18 common categories.
|
||||||
|
- Comprises 11,268 images with a whopping 1,793,658 instances.
|
||||||
|
- New categories introduced: "airport" and "helipad".
|
||||||
|
- Image splits:
|
||||||
|
- Training: 1,830 images with 268,627 instances.
|
||||||
|
- Validation: 593 images with 81,048 instances.
|
||||||
|
- Test-dev: 2,792 images with 353,346 instances.
|
||||||
|
- Test-challenge: 6,053 images with 1,090,637 instances.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
DOTA exhibits a structured layout tailored for OBB object detection challenges:
|
||||||
|
|
||||||
|
- **Images**: A vast collection of high-resolution aerial images capturing diverse terrains and structures.
|
||||||
|
- **Oriented Bounding Boxes**: Annotations in the form of rotated rectangles encapsulating objects irrespective of their orientation, ideal for capturing objects like airplanes, ships, and buildings.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
DOTA serves as a benchmark for training and evaluating models specifically tailored for aerial image analysis. With the inclusion of OBB annotations, it provides a unique challenge, enabling the development of specialized [object detection](https://docs.ultralytics.com/tasks/detect/) models that cater to aerial imagery's nuances. The dataset is particularly valuable for applications in remote sensing, surveillance, and environmental monitoring.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A dataset YAML (Yet Another Markup Language) file specifies image/label roots, class names, and other important metadata. Ultralytics maintains official YAML files for the two most commonly used releases:
|
||||||
|
|
||||||
|
- [`DOTAv1.yaml`](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/DOTAv1.yaml)
|
||||||
|
- [`DOTAv1.5.yaml`](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/DOTAv1.5.yaml)
|
||||||
|
|
||||||
|
Use the YAML that matches the release you downloaded, or author a custom YAML if you are working with DOTA-v2 or another derivative.
|
||||||
|
|
||||||
|
!!! example "DOTAv1.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/DOTAv1.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Split DOTA images
|
||||||
|
|
||||||
|
The raw imagery routinely exceeds 10,000 pixels on a side, so tiling is required before feeding the data to YOLO. Use the helper below to slice the source imagery into overlapping 1024 × 1024 crops at multiple scales while keeping the annotations in sync.
|
||||||
|
|
||||||
|
!!! example "Split images"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.split_dota import split_test, split_trainval
|
||||||
|
|
||||||
|
# Split train and val set, with labels.
|
||||||
|
split_trainval(
|
||||||
|
data_root="path/to/DOTAv1.0/",
|
||||||
|
save_dir="path/to/DOTAv1.0-split/",
|
||||||
|
rates=[0.5, 1.0, 1.5], # multiscale
|
||||||
|
gap=500,
|
||||||
|
)
|
||||||
|
# Split test set, without labels.
|
||||||
|
split_test(
|
||||||
|
data_root="path/to/DOTAv1.0/",
|
||||||
|
save_dir="path/to/DOTAv1.0-split/",
|
||||||
|
rates=[0.5, 1.0, 1.5], # multiscale
|
||||||
|
gap=500,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Keep the output directory organized in the standard YOLO layout (`images/train`, `labels/train`, etc.) so you can reference it directly from the dataset YAML.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a model on the DOTA v1 dataset, you can utilize the following code snippets. Always refer to your model's documentation for a thorough list of available arguments. For those looking to experiment with a smaller subset first, consider using the [DOTA8 dataset](https://docs.ultralytics.com/datasets/obb/dota8/), which contains just 8 images for quick testing.
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
|
||||||
|
Please note that all images and associated annotations in the DOTAv1 dataset can be used for academic purposes, but commercial use is prohibited. Your understanding and respect for the dataset creators' wishes are greatly appreciated!
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Create a new YOLO26n-OBB model from scratch
|
||||||
|
model = YOLO("yolo26n-obb.yaml")
|
||||||
|
|
||||||
|
# Train the model on the DOTAv1 dataset
|
||||||
|
results = model.train(data="DOTAv1.yaml", epochs=100, imgsz=1024)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a new YOLO26n-OBB model on the DOTAv1 dataset
|
||||||
|
yolo obb train data=DOTAv1.yaml model=yolo26n-obb.pt epochs=100 imgsz=1024
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
Having a glance at the dataset illustrates its depth:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **DOTA examples**: This snapshot underlines the complexity of aerial scenes and the significance of Oriented [Bounding Box](https://www.ultralytics.com/glossary/bounding-box) annotations, capturing objects in their natural orientation.
|
||||||
|
|
||||||
|
The dataset's richness offers invaluable insights into object detection challenges exclusive to aerial imagery. The [DOTA-v2.0 dataset](https://www.ultralytics.com/blog/exploring-the-best-computer-vision-datasets-in-2025) has become particularly popular for remote sensing and aerial surveillance projects due to its comprehensive annotations and diverse object categories.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use DOTA in your work, please cite the relevant research papers:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{9560031,
|
||||||
|
author={Ding, Jian and Xue, Nan and Xia, Gui-Song and Bai, Xiang and Yang, Wen and Yang, Michael and Belongie, Serge and Luo, Jiebo and Datcu, Mihai and Pelillo, Marcello and Zhang, Liangpei},
|
||||||
|
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
|
||||||
|
title={Object Detection in Aerial Images: A Large-Scale Benchmark and Challenges},
|
||||||
|
year={2021},
|
||||||
|
volume={},
|
||||||
|
number={},
|
||||||
|
pages={1-1},
|
||||||
|
doi={10.1109/TPAMI.2021.3117983}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A special note of gratitude to the team behind the DOTA datasets for their commendable effort in curating this dataset. For an exhaustive understanding of the dataset and its nuances, please visit the [official DOTA website](https://captain-whu.github.io/DOTA/index.html).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the DOTA dataset and why is it important for object detection in aerial images?
|
||||||
|
|
||||||
|
The [DOTA dataset](https://captain-whu.github.io/DOTA/index.html) is a specialized dataset focused on object detection in aerial images. It features Oriented Bounding Boxes (OBB), providing annotated images from diverse aerial scenes. DOTA's diversity in object orientation, scale, and shape across its 1.7M annotations and 18 categories makes it ideal for developing and evaluating models tailored for aerial imagery analysis, such as those used in surveillance, environmental monitoring, and disaster management.
|
||||||
|
|
||||||
|
### How does the DOTA dataset handle different scales and orientations in images?
|
||||||
|
|
||||||
|
DOTA utilizes Oriented Bounding Boxes (OBB) for annotation, which are represented by rotated rectangles encapsulating objects regardless of their orientation. This method ensures that objects, whether small or at different angles, are accurately captured. The dataset's multiscale images, ranging from 800 × 800 to 20,000 × 20,000 pixels, further allow for the detection of both small and large objects effectively. This approach is particularly valuable for aerial imagery where objects appear at various angles and scales.
|
||||||
|
|
||||||
|
### How can I train a model using the DOTA dataset?
|
||||||
|
|
||||||
|
To train a model on the DOTA dataset, you can use the following example with [Ultralytics YOLO](https://docs.ultralytics.com/tasks/obb/):
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Create a new YOLO26n-OBB model from scratch
|
||||||
|
model = YOLO("yolo26n-obb.yaml")
|
||||||
|
|
||||||
|
# Train the model on the DOTAv1 dataset
|
||||||
|
results = model.train(data="DOTAv1.yaml", epochs=100, imgsz=1024)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a new YOLO26n-OBB model on the DOTAv1 dataset
|
||||||
|
yolo obb train data=DOTAv1.yaml model=yolo26n-obb.pt epochs=100 imgsz=1024
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on how to split and preprocess the DOTA images, refer to the [split DOTA images section](#split-dota-images).
|
||||||
|
|
||||||
|
### What are the differences between DOTA-v1.0, DOTA-v1.5, and DOTA-v2.0?
|
||||||
|
|
||||||
|
- **DOTA-v1.0**: Includes 15 common categories across 2,806 images with 188,282 instances. The dataset is split into training, validation, and testing sets.
|
||||||
|
- **DOTA-v1.5**: Builds upon DOTA-v1.0 by annotating very small instances (less than 10 pixels) and adding a new category, "container crane," totaling 403,318 instances.
|
||||||
|
- **DOTA-v2.0**: Expands further with annotations from Google Earth and GF-2 Satellite, featuring 11,268 images and 1,793,658 instances. It includes new categories like "airport" and "helipad."
|
||||||
|
|
||||||
|
For a detailed comparison and additional specifics, check the [dataset versions section](#dataset-versions).
|
||||||
|
|
||||||
|
### How can I prepare high-resolution DOTA images for training?
|
||||||
|
|
||||||
|
DOTA images, which can be very large, are split into smaller resolutions for manageable training. Here's a Python snippet to split images:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.split_dota import split_test, split_trainval
|
||||||
|
|
||||||
|
# split train and val set, with labels.
|
||||||
|
split_trainval(
|
||||||
|
data_root="path/to/DOTAv1.0/",
|
||||||
|
save_dir="path/to/DOTAv1.0-split/",
|
||||||
|
rates=[0.5, 1.0, 1.5], # multiscale
|
||||||
|
gap=500,
|
||||||
|
)
|
||||||
|
# split test set, without labels.
|
||||||
|
split_test(
|
||||||
|
data_root="path/to/DOTAv1.0/",
|
||||||
|
save_dir="path/to/DOTAv1.0-split/",
|
||||||
|
rates=[0.5, 1.0, 1.5], # multiscale
|
||||||
|
gap=500,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
This process facilitates better training efficiency and model performance. For detailed instructions, visit the [split DOTA images section](#split-dota-images).
|
||||||
141
docs/en/datasets/obb/dota8.md
Executable file
141
docs/en/datasets/obb/dota8.md
Executable file
@@ -0,0 +1,141 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the DOTA8 dataset - a small, versatile oriented object detection dataset ideal for testing and debugging object detection models using Ultralytics YOLO26.
|
||||||
|
keywords: DOTA8 dataset, Ultralytics, YOLO26, object detection, debugging, training models, oriented object detection, dataset YAML
|
||||||
|
---
|
||||||
|
|
||||||
|
# DOTA8 Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) DOTA8 is a small but versatile oriented [object detection](https://www.ultralytics.com/glossary/object-detection) dataset composed of the first 8 images of the split DOTAv1 set, 4 for training and 4 for validation. This dataset is ideal for testing and debugging object detection models, or for experimenting with new detection approaches. With 8 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Images**: 8 aerial tiles (4 train, 4 val) sourced from DOTAv1.
|
||||||
|
- **Classes**: Inherits the 15 DOTAv1 categories such as plane, ship, and large vehicle.
|
||||||
|
- **Labels**: YOLO-format oriented bounding boxes saved as `.txt` files beside each image.
|
||||||
|
- **Recommended layout**:
|
||||||
|
|
||||||
|
```
|
||||||
|
datasets/dota8/
|
||||||
|
├── images/
|
||||||
|
│ ├── train/
|
||||||
|
│ └── val/
|
||||||
|
└── labels/
|
||||||
|
├── train/
|
||||||
|
└── val/
|
||||||
|
```
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the DOTA8 dataset, the `dota8.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dota8.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dota8.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/dota8.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/dota8.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-obb model on the DOTA8 dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-obb.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="dota8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo obb train data=dota8.yaml model=yolo26n-obb.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the DOTA8 dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch.avif" alt="DOTA8 oriented bounding box dataset training mosaic" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the DOTA8 dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the DOTA dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{9560031,
|
||||||
|
author={Ding, Jian and Xue, Nan and Xia, Gui-Song and Bai, Xiang and Yang, Wen and Yang, Michael and Belongie, Serge and Luo, Jiebo and Datcu, Mihai and Pelillo, Marcello and Zhang, Liangpei},
|
||||||
|
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
|
||||||
|
title={Object Detection in Aerial Images: A Large-Scale Benchmark and Challenges},
|
||||||
|
year={2021},
|
||||||
|
volume={},
|
||||||
|
number={},
|
||||||
|
pages={1-1},
|
||||||
|
doi={10.1109/TPAMI.2021.3117983}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A special note of gratitude to the team behind the DOTA datasets for their commendable effort in curating this dataset. For an exhaustive understanding of the dataset and its nuances, please visit the [official DOTA website](https://captain-whu.github.io/DOTA/index.html).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the DOTA8 dataset and how can it be used?
|
||||||
|
|
||||||
|
The DOTA8 dataset is a small, versatile oriented object detection dataset made up of the first 8 images from the DOTAv1 split set, with 4 images designated for training and 4 for validation. It's ideal for testing and debugging object detection models like Ultralytics YOLO26. Due to its manageable size and diversity, it helps in identifying pipeline errors and running sanity checks before deploying larger datasets. Learn more about object detection with [Ultralytics YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the DOTA8 dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n-obb model on the DOTA8 dataset for 100 epochs with an image size of 640, you can use the following code snippets. For comprehensive argument options, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-obb.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="dota8.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo obb train data=dota8.yaml model=yolo26n-obb.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are the key features of the DOTA dataset and where can I access the YAML file?
|
||||||
|
|
||||||
|
The DOTA dataset is known for its large-scale benchmark and the challenges it presents for object detection in aerial images. The DOTA8 subset is a smaller, manageable dataset ideal for initial tests. You can access the `dota8.yaml` file, which contains paths, classes, and configuration details, at this [GitHub link](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dota8.yaml).
|
||||||
|
|
||||||
|
### How does mosaicing enhance model training with the DOTA8 dataset?
|
||||||
|
|
||||||
|
Mosaicing combines multiple images into one during training, increasing the variety of objects and contexts within each batch. This improves a model's ability to generalize to different object sizes, aspect ratios, and scenes. This technique can be visually demonstrated through a training batch composed of mosaiced DOTA8 dataset images, helping in robust model development. Explore more about mosaicing and training techniques on our [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 for object detection tasks?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 provides state-of-the-art real-time object detection capabilities, including features like oriented bounding boxes (OBB), [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), and a highly versatile training pipeline. It's suitable for various applications and offers pretrained models for efficient fine-tuning. Explore further about the advantages and usage in the [Ultralytics YOLO26 documentation](https://github.com/ultralytics/ultralytics).
|
||||||
157
docs/en/datasets/obb/index.md
Executable file
157
docs/en/datasets/obb/index.md
Executable file
@@ -0,0 +1,157 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover OBB dataset formats for Ultralytics YOLO models. Learn about their structure, application, and format conversions to enhance your object detection training.
|
||||||
|
keywords: Oriented Bounding Box, OBB Datasets, YOLO, Ultralytics, Object Detection, Dataset Formats
|
||||||
|
---
|
||||||
|
|
||||||
|
# Oriented Bounding Box (OBB) Datasets Overview
|
||||||
|
|
||||||
|
Training a precise [object detection](https://www.ultralytics.com/glossary/object-detection) model with oriented bounding boxes (OBB) requires a thorough dataset. This guide explains the various OBB dataset formats compatible with Ultralytics YOLO models, offering insights into their structure, application, and methods for format conversions.
|
||||||
|
|
||||||
|
## Supported OBB Dataset Formats
|
||||||
|
|
||||||
|
### YOLO OBB Format
|
||||||
|
|
||||||
|
The YOLO OBB format designates bounding boxes by their four corner points with coordinates normalized between 0 and 1. It follows this format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
class_index x1 y1 x2 y2 x3 y3 x4 y4
|
||||||
|
```
|
||||||
|
|
||||||
|
Internally, YOLO processes losses and outputs in the `xywhr` format, which represents the [bounding box](https://www.ultralytics.com/glossary/bounding-box)'s center point (xy), width, height, and rotation.
|
||||||
|
|
||||||
|
<p align="center"><img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/obb-format-examples.avif" alt="Oriented bounding box annotation format examples"></p>
|
||||||
|
|
||||||
|
An example of a `*.txt` label file for the above image, which contains an object of class `0` in OBB format, could look like:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
0 0.780811 0.743961 0.782371 0.74686 0.777691 0.752174 0.776131 0.749758
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dataset YAML format
|
||||||
|
|
||||||
|
The Ultralytics framework uses a YAML file format to define the dataset and model configuration for training OBB models. Here is an example of the YAML format used for defining an OBB dataset:
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/dota8.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/dota8.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a model using these OBB formats:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Create a new YOLO26n-OBB model from scratch
|
||||||
|
model = YOLO("yolo26n-obb.yaml")
|
||||||
|
|
||||||
|
# Train the model on the DOTAv1 dataset
|
||||||
|
results = model.train(data="DOTAv1.yaml", epochs=100, imgsz=1024)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a new YOLO26n-OBB model on the DOTAv1 dataset
|
||||||
|
yolo obb train data=DOTAv1.yaml model=yolo26n-obb.pt epochs=100 imgsz=1024
|
||||||
|
```
|
||||||
|
|
||||||
|
## Supported Datasets
|
||||||
|
|
||||||
|
Currently, the following datasets with oriented bounding boxes are supported:
|
||||||
|
|
||||||
|
- [DOTA-v1](dota-v2.md#dota-v10): The first version of the DOTA dataset, providing a comprehensive set of aerial images with oriented bounding boxes for object detection.
|
||||||
|
- [DOTA-v1.5](dota-v2.md#dota-v15): An intermediate version of the DOTA dataset, offering additional annotations and improvements over DOTA-v1 for enhanced object detection tasks.
|
||||||
|
- [DOTA-v2](dota-v2.md#dota-v20): DOTA (A Large-scale Dataset for Object Detection in Aerial Images) version 2, emphasizes detection from aerial perspectives and contains oriented bounding boxes with 1.7 million instances and 11,268 images.
|
||||||
|
- [DOTA8](dota8.md): A small, 8-image subset of the full DOTA dataset suitable for testing workflows and Continuous Integration (CI) checks of OBB training in the `ultralytics` repository.
|
||||||
|
|
||||||
|
### Incorporating your own OBB dataset
|
||||||
|
|
||||||
|
For those looking to introduce their own datasets with oriented bounding boxes, ensure compatibility with the "YOLO OBB format" mentioned above. Convert your annotations to this required format and detail the paths, classes, and class names in a corresponding YAML configuration file.
|
||||||
|
|
||||||
|
## Convert Label Formats
|
||||||
|
|
||||||
|
### DOTA Dataset Format to YOLO OBB Format
|
||||||
|
|
||||||
|
Transitioning labels from the DOTA dataset format to the YOLO OBB format can be achieved with this script:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_dota_to_yolo_obb
|
||||||
|
|
||||||
|
convert_dota_to_yolo_obb("path/to/DOTA")
|
||||||
|
```
|
||||||
|
|
||||||
|
This conversion mechanism is instrumental for datasets in the DOTA format, ensuring alignment with the [Ultralytics YOLO](../../models/yolo26.md) OBB format.
|
||||||
|
|
||||||
|
It's imperative to validate the compatibility of the dataset with your model and adhere to the necessary format conventions. Properly structured datasets are pivotal for training efficient object detection models with oriented bounding boxes.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What are Oriented Bounding Boxes (OBB) and how are they used in Ultralytics YOLO models?
|
||||||
|
|
||||||
|
Oriented Bounding Boxes (OBB) are a type of bounding box annotation where the box can be rotated to align more closely with the object being detected, rather than just being axis-aligned. This is particularly useful in aerial or satellite imagery where objects might not be aligned with the image axes. In [Ultralytics YOLO](../../tasks/obb.md) models, OBBs are represented by their four corner points in the YOLO OBB format. This allows for more accurate object detection since the bounding boxes can rotate to fit the objects better.
|
||||||
|
|
||||||
|
### How do I convert my existing DOTA dataset labels to YOLO OBB format for use with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
You can convert DOTA dataset labels to YOLO OBB format using the [`convert_dota_to_yolo_obb`](../../reference/data/converter.md) function from Ultralytics. This conversion ensures compatibility with the Ultralytics YOLO models, enabling you to leverage the OBB capabilities for enhanced object detection. Here's a quick example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_dota_to_yolo_obb
|
||||||
|
|
||||||
|
convert_dota_to_yolo_obb("path/to/DOTA")
|
||||||
|
```
|
||||||
|
|
||||||
|
This script will reformat your DOTA annotations into a YOLO-compatible format.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model with oriented bounding boxes (OBB) on my dataset?
|
||||||
|
|
||||||
|
Training a YOLO26 model with OBBs involves ensuring your dataset is in the YOLO OBB format and then using the [Ultralytics API](../../usage/python.md) to train the model. Here's an example in both Python and CLI:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Create a new YOLO26n-OBB model from scratch
|
||||||
|
model = YOLO("yolo26n-obb.yaml")
|
||||||
|
|
||||||
|
# Train the model on the custom dataset
|
||||||
|
results = model.train(data="your_dataset.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Train a new YOLO26n-OBB model on the custom dataset
|
||||||
|
yolo obb train data=your_dataset.yaml model=yolo26n-obb.yaml epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
This ensures your model leverages the detailed OBB annotations for improved detection [accuracy](https://www.ultralytics.com/glossary/accuracy).
|
||||||
|
|
||||||
|
### What datasets are currently supported for OBB training in Ultralytics YOLO models?
|
||||||
|
|
||||||
|
Currently, Ultralytics supports the following datasets for OBB training:
|
||||||
|
|
||||||
|
- [DOTA-v1](dota-v2.md): The first version of the DOTA dataset, providing a comprehensive set of aerial images with oriented bounding boxes for object detection.
|
||||||
|
- [DOTA-v1.5](dota-v2.md): An intermediate version of the DOTA dataset, offering additional annotations and improvements over DOTA-v1 for enhanced object detection tasks.
|
||||||
|
- [DOTA-v2](dota-v2.md): This dataset includes 1.7 million instances with oriented bounding boxes and 11,268 images, primarily focusing on aerial object detection.
|
||||||
|
- [DOTA8](dota8.md): A smaller, 8-image subset of the DOTA dataset used for testing and [continuous integration](../../help/CI.md) (CI) checks.
|
||||||
|
|
||||||
|
These datasets are tailored for scenarios where OBBs offer a significant advantage, such as aerial and satellite image analysis.
|
||||||
|
|
||||||
|
### Can I use my own dataset with oriented bounding boxes for YOLO26 training, and if so, how?
|
||||||
|
|
||||||
|
Yes, you can use your own dataset with oriented bounding boxes for YOLO26 training. Ensure your dataset annotations are converted to the YOLO OBB format, which involves defining bounding boxes by their four corner points. You can then create a [YAML configuration file](../../usage/cfg.md) specifying the dataset paths, classes, and other necessary details. For more information on creating and configuring your datasets, refer to the [Supported Datasets](#supported-datasets) section.
|
||||||
152
docs/en/datasets/pose/coco.md
Executable file
152
docs/en/datasets/pose/coco.md
Executable file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the COCO-Pose dataset for advanced pose estimation. Learn about datasets, pretrained models, metrics, and applications for training with YOLO.
|
||||||
|
keywords: COCO-Pose, pose estimation, dataset, keypoints, COCO Keypoints 2017, YOLO, deep learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO-Pose Dataset
|
||||||
|
|
||||||
|
The [COCO-Pose](https://cocodataset.org/#keypoints-2017) dataset is a specialized version of the COCO (Common Objects in Context) dataset, designed for pose estimation tasks. It leverages the COCO Keypoints 2017 images and labels to enable the training of models like YOLO for pose estimation tasks.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## COCO-Pose Pretrained Models
|
||||||
|
|
||||||
|
{% include "macros/yolo-pose-perf.md" %}
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- COCO-Pose builds upon the COCO Keypoints 2017 dataset which contains 200K images labeled with keypoints for pose estimation tasks.
|
||||||
|
- The dataset supports 17 keypoints for human figures, facilitating detailed pose estimation.
|
||||||
|
- Like COCO, it provides standardized evaluation metrics, including Object Keypoint Similarity (OKS) for pose estimation tasks, making it suitable for comparing model performance.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The COCO-Pose dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Train2017**: This subset contains 56599 images from the COCO dataset, annotated for training pose estimation models.
|
||||||
|
2. **Val2017**: This subset has 2346 images used for validation purposes during model training.
|
||||||
|
3. **Test2017**: This subset consists of images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results are submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7384) for performance evaluation.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
The COCO-Pose dataset is specifically used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in keypoint detection and pose estimation tasks, such as OpenPose. The dataset's large number of annotated images and standardized evaluation metrics make it an essential resource for [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) researchers and practitioners focused on pose estimation.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO-Pose dataset, the `coco-pose.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco-pose.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco-pose.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco-pose.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the COCO-Pose dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=coco-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The COCO-Pose dataset contains a diverse set of images with human figures annotated with keypoints. Here are some examples of images from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO-Pose dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO-Pose dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the COCO-Pose dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO-Pose dataset and how is it used with Ultralytics YOLO for pose estimation?
|
||||||
|
|
||||||
|
The [COCO-Pose](https://cocodataset.org/#keypoints-2017) dataset is a specialized version of the COCO (Common Objects in Context) dataset designed for pose estimation tasks. It builds upon the COCO Keypoints 2017 images and annotations, allowing for the training of models like Ultralytics YOLO for detailed pose estimation. For instance, you can use the COCO-Pose dataset to train a YOLO26n-pose model by loading a pretrained model and training it with a YAML configuration. For training examples, refer to the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### How can I train a YOLO26 model on the COCO-Pose dataset?
|
||||||
|
|
||||||
|
Training a YOLO26 model on the COCO-Pose dataset can be accomplished using either Python or CLI commands. For example, to train a YOLO26n-pose model for 100 epochs with an image size of 640, you can follow the steps below:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=coco-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on the training process and available arguments, check the [training page](../../modes/train.md).
|
||||||
|
|
||||||
|
### What are the different metrics provided by the COCO-Pose dataset for evaluating model performance?
|
||||||
|
|
||||||
|
The COCO-Pose dataset provides several standardized evaluation metrics for pose estimation tasks, similar to the original COCO dataset. Key metrics include the Object Keypoint Similarity (OKS), which evaluates the [accuracy](https://www.ultralytics.com/glossary/accuracy) of predicted keypoints against ground truth annotations. These metrics allow for thorough performance comparisons between different models. For instance, the COCO-Pose pretrained models such as YOLO26n-pose, YOLO26s-pose, and others have specific performance metrics listed in the documentation, like mAP<sup>pose</sup>50-95 and mAP<sup>pose</sup>50.
|
||||||
|
|
||||||
|
### How is the dataset structured and split for the COCO-Pose dataset?
|
||||||
|
|
||||||
|
The COCO-Pose dataset is split into three subsets:
|
||||||
|
|
||||||
|
1. **Train2017**: Contains 56599 COCO images, annotated for training pose estimation models.
|
||||||
|
2. **Val2017**: 2346 images for validation purposes during model training.
|
||||||
|
3. **Test2017**: Images used for testing and benchmarking trained models. Ground truth annotations for this subset are not publicly available; results are submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7403) for performance evaluation.
|
||||||
|
|
||||||
|
These subsets help organize the training, validation, and testing phases effectively. For configuration details, explore the `coco-pose.yaml` file available on [GitHub](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco-pose.yaml).
|
||||||
|
|
||||||
|
### What are the key features and applications of the COCO-Pose dataset?
|
||||||
|
|
||||||
|
The COCO-Pose dataset extends the COCO Keypoints 2017 annotations to include 17 keypoints for human figures, enabling detailed pose estimation. Standardized evaluation metrics (e.g., OKS) facilitate comparisons across different models. Applications of the COCO-Pose dataset span various domains, such as sports analytics, healthcare, and human-computer interaction, wherever detailed pose estimation of human figures is required. For practical use, leveraging pretrained models like those provided in the documentation (e.g., YOLO26n-pose) can significantly streamline the process ([Key Features](#key-features)).
|
||||||
|
|
||||||
|
If you use the COCO-Pose dataset in your research or development work, please cite the paper with the following [BibTeX entry](#citations-and-acknowledgments).
|
||||||
137
docs/en/datasets/pose/coco8-pose.md
Executable file
137
docs/en/datasets/pose/coco8-pose.md
Executable file
@@ -0,0 +1,137 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the compact, versatile COCO8-Pose dataset for testing and debugging object detection models. Ideal for quick experiments with YOLO26.
|
||||||
|
keywords: COCO8-Pose, Ultralytics, pose detection dataset, object detection, YOLO26, machine learning, computer vision, training data
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO8-Pose Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) COCO8-Pose is a small but versatile pose detection dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation. This dataset is ideal for testing and debugging [object detection](https://www.ultralytics.com/glossary/object-detection) models, or for experimenting with new detection approaches. With 8 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Total images**: 8 (4 train / 4 val).
|
||||||
|
- **Classes**: 1 (person) with 17 keypoints per annotation.
|
||||||
|
- **Recommended directory layout**: `datasets/coco8-pose/images/{train,val}` and `datasets/coco8-pose/labels/{train,val}` with YOLO-format keypoints stored as `.txt` files.
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO8-Pose dataset, the `coco8-pose.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-pose.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-pose.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-pose.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the COCO8-Pose dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=coco8-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the COCO8-Pose dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-5.avif" alt="COCO8-pose keypoint estimation dataset mosaic" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO8-Pose dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO8-Pose dataset, and how is it used with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The COCO8-Pose dataset is a small, versatile pose detection dataset that includes the first 8 images from the COCO train 2017 set, with 4 images for training and 4 for validation. It's designed for testing and debugging object detection models and experimenting with new detection approaches. This dataset is ideal for quick experiments with [Ultralytics YOLO26](../../models/yolo26.md). For more details on dataset configuration, check out the [dataset YAML file](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-pose.yaml).
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the COCO8-Pose dataset in Ultralytics?
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the COCO8-Pose dataset for 100 epochs with an image size of 640, follow these examples:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo pose train data=coco8-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of training arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the benefits of using the COCO8-Pose dataset?
|
||||||
|
|
||||||
|
The COCO8-Pose dataset offers several benefits:
|
||||||
|
|
||||||
|
- **Compact Size**: With only 8 images, it is easy to manage and perfect for quick experiments.
|
||||||
|
- **Diverse Data**: Despite its small size, it includes a variety of scenes, useful for thorough pipeline testing.
|
||||||
|
- **Error Debugging**: Ideal for identifying training errors and performing sanity checks before scaling up to larger datasets.
|
||||||
|
|
||||||
|
For more about its features and usage, see the [Dataset Introduction](#introduction) section.
|
||||||
|
|
||||||
|
### How does mosaicing benefit the YOLO26 training process using the COCO8-Pose dataset?
|
||||||
|
|
||||||
|
Mosaicing, demonstrated in the sample images of the COCO8-Pose dataset, combines multiple images into one, increasing the variety of objects and scenes within each training batch. This technique helps improve the model's ability to generalize across various object sizes, aspect ratios, and contexts, ultimately enhancing model performance. See the [Sample Images and Annotations](#sample-images-and-annotations) section for example images.
|
||||||
|
|
||||||
|
### Where can I find the COCO8-Pose dataset YAML file and how do I use it?
|
||||||
|
|
||||||
|
The COCO8-Pose dataset YAML file can be found at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-pose.yaml>. This file defines the dataset configuration, including paths, classes, and other relevant information. Use this file with the YOLO26 training scripts as mentioned in the [Train Example](#how-do-i-train-a-yolo26-model-using-the-coco8-pose-dataset-in-ultralytics) section.
|
||||||
|
|
||||||
|
For more FAQs and detailed documentation, visit the [Ultralytics Documentation](https://docs.ultralytics.com/).
|
||||||
175
docs/en/datasets/pose/dog-pose.md
Executable file
175
docs/en/datasets/pose/dog-pose.md
Executable file
@@ -0,0 +1,175 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the Dog-Pose dataset for pose detection. Featuring 6,773 training and 1,703 test images, it is a robust dataset for training YOLO26 models.
|
||||||
|
keywords: Dog-Pose, Ultralytics, pose detection dataset, YOLO26, machine learning, computer vision, training data
|
||||||
|
---
|
||||||
|
|
||||||
|
# Dog-Pose Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The [Ultralytics](https://www.ultralytics.com/) Dog-Pose dataset is a high-quality and extensive dataset specifically curated for dog keypoint estimation. With 6,773 training images and 1,703 test images, this dataset provides a solid foundation for training robust pose estimation models.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/ZhjO32tZUek"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train Ultralytics YOLO26 on the Stanford Dog Pose Estimation Dataset | Step-by-Step Tutorial
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Each annotated image includes 24 keypoints with 3 dimensions per keypoint (x, y, visibility), making it a valuable resource for advanced research and development in computer vision.
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/ultralytics-dogs.avif" alt="Ultralytics Dog-pose display image" width="800">
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Split**: 6,773 train / 1,703 test images with matching YOLO-format label files.
|
||||||
|
- **Keypoints**: 24 per dog with `(x, y, visibility)` triplets.
|
||||||
|
- **Layout**:
|
||||||
|
|
||||||
|
```
|
||||||
|
datasets/dog-pose/
|
||||||
|
├── images/{train,test}
|
||||||
|
└── labels/{train,test}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It includes paths, keypoint details, and other relevant information. In the case of the Dog-pose dataset, The `dog-pose.yaml` is available at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dog-pose.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dog-pose.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/dog-pose.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/dog-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the Dog-pose dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="dog-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=dog-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the Dog-pose dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-2-dog-pose.avif" alt="Dog pose estimation dataset mosaic training batch" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the Dog-pose dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Dog-pose dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@inproceedings{khosla2011fgvc,
|
||||||
|
title={Novel dataset for Fine-Grained Image Categorization},
|
||||||
|
author={Aditya Khosla and Nityananda Jayadevaprakash and Bangpeng Yao and Li Fei-Fei},
|
||||||
|
booktitle={First Workshop on Fine-Grained Visual Categorization (FGVC), IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
|
||||||
|
year={2011}
|
||||||
|
}
|
||||||
|
@inproceedings{deng2009imagenet,
|
||||||
|
title={ImageNet: A Large-Scale Hierarchical Image Database},
|
||||||
|
author={Jia Deng and Wei Dong and Richard Socher and Li-Jia Li and Kai Li and Li Fei-Fei},
|
||||||
|
booktitle={IEEE Computer Vision and Pattern Recognition (CVPR)},
|
||||||
|
year={2009}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the Stanford team for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the Dog-pose dataset and its creators, visit the [Stanford Dogs Dataset website](http://vision.stanford.edu/aditya86/ImageNetDogs/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Dog-pose dataset, and how is it used with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The Dog-Pose dataset features 6,773 training and 1,703 test images annotated with 24 keypoints for dog pose estimation. It's designed for training and validating models with [Ultralytics YOLO26](../../models/yolo26.md), supporting applications like animal behavior analysis, pet monitoring, and veterinary studies. The dataset's comprehensive annotations make it ideal for developing accurate pose estimation models for canines.
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model using the Dog-pose dataset in Ultralytics?
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the Dog-pose dataset for 100 epochs with an image size of 640, follow these examples:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="dog-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo pose train data=dog-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of training arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the benefits of using the Dog-pose dataset?
|
||||||
|
|
||||||
|
The Dog-pose dataset offers several benefits:
|
||||||
|
|
||||||
|
**Large and Diverse Dataset**: With over 8,400 images, it provides substantial data covering a wide range of dog poses, breeds, and contexts, enabling robust model training and evaluation.
|
||||||
|
|
||||||
|
**Detailed Keypoint Annotations**: Each image includes 24 keypoints with 3 dimensions per keypoint (x, y, visibility), offering precise annotations for training accurate pose detection models.
|
||||||
|
|
||||||
|
**Real-World Scenarios**: Includes images from varied environments, enhancing the model's ability to generalize to real-world applications like [pet monitoring](https://www.ultralytics.com/blog/custom-training-ultralytics-yolo11-for-dog-pose-estimation) and behavior analysis.
|
||||||
|
|
||||||
|
**Transfer Learning Advantage**: The dataset works well with [transfer learning](https://www.ultralytics.com/blog/understanding-few-shot-zero-shot-and-transfer-learning) techniques, allowing models pretrained on human pose datasets to adapt to dog-specific features.
|
||||||
|
|
||||||
|
For more about its features and usage, see the [Dataset Introduction](#introduction) section.
|
||||||
|
|
||||||
|
### How does mosaicing benefit the YOLO26 training process using the Dog-pose dataset?
|
||||||
|
|
||||||
|
Mosaicing, as illustrated in the sample images from the Dog-pose dataset, merges multiple images into a single composite, enriching the diversity of objects and scenes in each training batch. This technique offers several benefits:
|
||||||
|
|
||||||
|
- Increases the variety of dog poses, sizes, and backgrounds in each batch
|
||||||
|
- Improves the model's ability to detect dogs in different contexts and scales
|
||||||
|
- Enhances generalization by exposing the model to more diverse visual patterns
|
||||||
|
- Reduces overfitting by creating novel combinations of training examples
|
||||||
|
|
||||||
|
This approach leads to more robust models that perform better in real-world scenarios. For example images, refer to the [Sample Images and Annotations](#sample-images-and-annotations) section.
|
||||||
|
|
||||||
|
### Where can I find the Dog-pose dataset YAML file and how do I use it?
|
||||||
|
|
||||||
|
The Dog-pose dataset YAML file can be found at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/dog-pose.yaml>. This file defines the dataset configuration, including paths, classes, keypoint details, and other relevant information. The YAML specifies 24 keypoints with 3 dimensions per keypoint, making it suitable for detailed pose estimation tasks.
|
||||||
|
|
||||||
|
To use this file with YOLO26 training scripts, simply reference it in your training command as shown in the [Usage](#usage) section. The dataset will be automatically downloaded when first used, making setup straightforward.
|
||||||
|
|
||||||
|
For more FAQs and detailed documentation, visit the [Ultralytics Documentation](https://docs.ultralytics.com/).
|
||||||
186
docs/en/datasets/pose/hand-keypoints.md
Executable file
186
docs/en/datasets/pose/hand-keypoints.md
Executable file
@@ -0,0 +1,186 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the hand keypoints estimation dataset for advanced pose estimation. Learn about datasets, pretrained models, metrics, and applications for training with YOLO.
|
||||||
|
keywords: Hand KeyPoints, pose estimation, dataset, keypoints, MediaPipe, YOLO, deep learning, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# Hand Keypoints Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The hand-keypoints dataset contains 26,768 images of hands annotated with keypoints, making it suitable for training models like Ultralytics YOLO for pose estimation tasks. The annotations were generated using the Google MediaPipe library, ensuring high [accuracy](https://www.ultralytics.com/glossary/accuracy) and consistency, and the dataset is compatible with [Ultralytics YOLO26](https://github.com/ultralytics/ultralytics) formats.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/fd6u1TW_AGY"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Hand Keypoints Estimation with Ultralytics YOLO26 | Human Hand Pose Estimation Tutorial
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Hand Landmarks
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Keypoints
|
||||||
|
|
||||||
|
The dataset includes keypoints for hand detection. The keypoints are annotated as follows:
|
||||||
|
|
||||||
|
1. Wrist
|
||||||
|
2. Thumb (4 points)
|
||||||
|
3. Index finger (4 points)
|
||||||
|
4. Middle finger (4 points)
|
||||||
|
5. Ring finger (4 points)
|
||||||
|
6. Little finger (4 points)
|
||||||
|
|
||||||
|
Each hand has a total of 21 keypoints.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Large Dataset**: 26,768 images with hand keypoint annotations.
|
||||||
|
- **YOLO26 Compatibility**: Labels ship in YOLO keypoint format and are ready for use with YOLO26 models.
|
||||||
|
- **21 Keypoints**: Detailed hand pose representation spanning the wrist and four points per finger.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The hand keypoint dataset is split into two subsets:
|
||||||
|
|
||||||
|
1. **Train**: This subset contains 18,776 images from the hand keypoints dataset, annotated for training pose estimation models.
|
||||||
|
2. **Val**: This subset contains 7,992 images that can be used for validation purposes during model training.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Hand keypoints can be used for [gesture recognition](https://www.ultralytics.com/blog/enhancing-hand-keypoints-estimation-with-ultralytics-yolo11), [AR/VR controls](https://docs.ultralytics.com/tasks/pose/), robotic manipulation, and hand movement analysis in healthcare. They can also be applied in animation for motion capture and biometric authentication systems for security. The detailed tracking of finger positions enables precise interaction with virtual objects and touchless control interfaces.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the Hand Keypoints dataset, the `hand-keypoints.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/hand-keypoints.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/hand-keypoints.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/hand-keypoints.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/hand-keypoints.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the Hand Keypoints dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="hand-keypoints.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=hand-keypoints.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
The Hand keypoints dataset contains a diverse set of images with human hands annotated with keypoints. Here are some examples of images from the dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the Hand Keypoints dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the hand-keypoints dataset in your research or development work, please acknowledge the following sources:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "Credits"
|
||||||
|
|
||||||
|
We would like to thank the following sources for providing the images used in this dataset:
|
||||||
|
|
||||||
|
- [11k Hands](https://sites.google.com/view/11khands)
|
||||||
|
- [2000 Hand Gestures](https://www.kaggle.com/datasets/ritikagiridhar/2000-hand-gestures)
|
||||||
|
- [Gesture Recognition](https://www.kaggle.com/datasets/imsparsh/gesture-recognition)
|
||||||
|
|
||||||
|
The images were collected and used under the respective licenses provided by each platform and are distributed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
||||||
|
|
||||||
|
We would also like to acknowledge the creator of this dataset, [Rion Dsilva](https://www.linkedin.com/in/rion-dsilva-043464229/), for his great contribution to Vision AI research.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model on the Hand Keypoints dataset?
|
||||||
|
|
||||||
|
To train a YOLO26 model on the Hand Keypoints dataset, you can use either Python or the command line interface (CLI). Here's an example for training a YOLO26n-pose model for 100 epochs with an image size of 640:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="hand-keypoints.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=hand-keypoints.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### What are the key features of the Hand Keypoints dataset?
|
||||||
|
|
||||||
|
The Hand Keypoints dataset is designed for advanced [pose estimation](https://docs.ultralytics.com/datasets/pose/) tasks and includes several key features:
|
||||||
|
|
||||||
|
- **Large Dataset**: Contains 26,768 images with hand keypoint annotations.
|
||||||
|
- **YOLO26 Compatibility**: Ready for use with YOLO26 models.
|
||||||
|
- **21 Keypoints**: Detailed hand pose representation, including wrist and finger joints.
|
||||||
|
|
||||||
|
For more details, you can explore the [Hand Keypoints Dataset](#introduction) section.
|
||||||
|
|
||||||
|
### What applications can benefit from using the Hand Keypoints dataset?
|
||||||
|
|
||||||
|
The Hand Keypoints dataset can be applied in various fields, including:
|
||||||
|
|
||||||
|
- **Gesture Recognition**: Enhancing human-computer interaction.
|
||||||
|
- **AR/VR Controls**: Improving user experience in augmented and virtual reality.
|
||||||
|
- **Robotic Manipulation**: Enabling precise control of robotic hands.
|
||||||
|
- **Healthcare**: Analyzing hand movements for medical diagnostics.
|
||||||
|
- **Animation**: Capturing motion for realistic animations.
|
||||||
|
- **Biometric Authentication**: Enhancing security systems.
|
||||||
|
|
||||||
|
For more information, refer to the [Applications](#applications) section.
|
||||||
|
|
||||||
|
### How is the Hand Keypoints dataset structured?
|
||||||
|
|
||||||
|
The Hand Keypoints dataset is divided into two subsets:
|
||||||
|
|
||||||
|
1. **Train**: Contains 18,776 images for training pose estimation models.
|
||||||
|
2. **Val**: Contains 7,992 images for validation purposes during model training.
|
||||||
|
|
||||||
|
This structure ensures a comprehensive training and validation process. For more details, see the [Dataset Structure](#dataset-structure) section.
|
||||||
|
|
||||||
|
### How do I use the dataset YAML file for training?
|
||||||
|
|
||||||
|
The dataset configuration is defined in a YAML file, which includes paths, classes, and other relevant information. The `hand-keypoints.yaml` file can be found at [hand-keypoints.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/hand-keypoints.yaml).
|
||||||
|
|
||||||
|
To use this YAML file for training, specify it in your training script or CLI command as shown in the training example above. For more details, refer to the [Dataset YAML](#dataset-yaml) section.
|
||||||
216
docs/en/datasets/pose/index.md
Executable file
216
docs/en/datasets/pose/index.md
Executable file
@@ -0,0 +1,216 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn about Ultralytics YOLO format for pose estimation datasets, supported formats, COCO-Pose, COCO8-Pose, Tiger-Pose, and how to add your own dataset.
|
||||||
|
keywords: pose estimation, Ultralytics, YOLO format, COCO-Pose, COCO8-Pose, Tiger-Pose, dataset conversion, keypoints
|
||||||
|
---
|
||||||
|
|
||||||
|
# Pose Estimation Datasets Overview
|
||||||
|
|
||||||
|
## Supported Dataset Formats
|
||||||
|
|
||||||
|
### Ultralytics YOLO format
|
||||||
|
|
||||||
|
The dataset label format used for training YOLO pose models is as follows:
|
||||||
|
|
||||||
|
1. One text file per image: Each image in the dataset has a corresponding text file with the same name as the image file and the ".txt" extension.
|
||||||
|
2. One row per object: Each row in the text file corresponds to one object instance in the image.
|
||||||
|
3. Object information per row: Each row contains the following information about the object instance:
|
||||||
|
- Object class index: An integer representing the class of the object (e.g., 0 for person, 1 for car, etc.).
|
||||||
|
- Object center coordinates: The x and y coordinates of the center of the object, normalized to be between 0 and 1.
|
||||||
|
- Object width and height: The width and height of the object, normalized to be between 0 and 1.
|
||||||
|
- Object keypoint coordinates: The keypoints of the object, normalized to be between 0 and 1.
|
||||||
|
|
||||||
|
Here is an example of the label format for a pose estimation task:
|
||||||
|
|
||||||
|
Format with 2D keypoints
|
||||||
|
|
||||||
|
```
|
||||||
|
<class-index> <x> <y> <width> <height> <px1> <py1> <px2> <py2> ... <pxn> <pyn>
|
||||||
|
```
|
||||||
|
|
||||||
|
Format with 3D keypoints (includes visibility per point)
|
||||||
|
|
||||||
|
```
|
||||||
|
<class-index> <x> <y> <width> <height> <px1> <py1> <p1-visibility> <px2> <py2> <p2-visibility> <pxn> <pyn> <pn-visibility>
|
||||||
|
```
|
||||||
|
|
||||||
|
In this format, `<class-index>` is the index of the class for the object, `<x> <y> <width> <height>` are the normalized coordinates of the [bounding box](https://www.ultralytics.com/glossary/bounding-box), and `<px1> <py1> <px2> <py2> ... <pxn> <pyn>` are the normalized keypoint coordinates. The visibility channel is optional but useful for datasets that annotate occlusion.
|
||||||
|
|
||||||
|
### Dataset YAML format
|
||||||
|
|
||||||
|
The Ultralytics framework uses a YAML file format to define the dataset and model configuration for training pose estimation models. Here is an example of the YAML format used for defining a pose dataset:
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-pose.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
The `train` and `val` fields specify the paths to the directories containing the training and validation images, respectively.
|
||||||
|
|
||||||
|
`names` is a dictionary of class names. The order of the names should match the order of the object class indices in the YOLO dataset files.
|
||||||
|
|
||||||
|
(Optional) if the points are symmetric then need flip_idx, like left-right side of human or face. For example if we assume five keypoints of facial landmark: [left eye, right eye, nose, left mouth, right mouth], and the original index is [0, 1, 2, 3, 4], then flip_idx is [1, 0, 2, 4, 3] (just exchange the left-right index, i.e. 0-1 and 3-4, and do not modify others like nose in this example).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=coco8-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Supported Datasets
|
||||||
|
|
||||||
|
This section outlines the datasets that are compatible with Ultralytics YOLO format and can be used for training [pose estimation](https://docs.ultralytics.com/tasks/pose/) models:
|
||||||
|
|
||||||
|
### COCO-Pose
|
||||||
|
|
||||||
|
- **Description**: COCO-Pose is a large-scale [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and pose estimation dataset. It is a subset of the popular COCO dataset and focuses on human pose estimation. COCO-Pose includes multiple keypoints for each human instance.
|
||||||
|
- **Label Format**: Same as Ultralytics YOLO format as described above, with keypoints for human poses.
|
||||||
|
- **Number of Classes**: 1 (Human).
|
||||||
|
- **Keypoints**: 17 keypoints including nose, eyes, ears, shoulders, elbows, wrists, hips, knees, and ankles.
|
||||||
|
- **Usage**: Suitable for training human pose estimation models.
|
||||||
|
- **Additional Notes**: The dataset is rich and diverse, containing over 200k labeled images.
|
||||||
|
- [Read more about COCO-Pose](coco.md)
|
||||||
|
|
||||||
|
### COCO8-Pose
|
||||||
|
|
||||||
|
- **Description**: [Ultralytics](https://www.ultralytics.com/) COCO8-Pose is a small, but versatile pose detection dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation.
|
||||||
|
- **Label Format**: Same as Ultralytics YOLO format as described above, with keypoints for human poses.
|
||||||
|
- **Number of Classes**: 1 (Human).
|
||||||
|
- **Keypoints**: 17 keypoints including nose, eyes, ears, shoulders, elbows, wrists, hips, knees, and ankles.
|
||||||
|
- **Usage**: Suitable for testing and debugging object detection models, or for experimenting with new detection approaches.
|
||||||
|
- **Additional Notes**: COCO8-Pose is ideal for sanity checks and [CI checks](https://docs.ultralytics.com/help/CI/).
|
||||||
|
- [Read more about COCO8-Pose](coco8-pose.md)
|
||||||
|
|
||||||
|
### Dog-Pose
|
||||||
|
|
||||||
|
- **Description**: The Dog Pose dataset contains 6,773 training and 1,703 test images, providing a diverse and extensive resource for canine keypoint estimation.
|
||||||
|
- **Label Format**: Follows the Ultralytics YOLO format, with annotations for multiple keypoints specific to dog anatomy.
|
||||||
|
- **Number of Classes**: 1 (Dog).
|
||||||
|
- **Keypoints**: Includes 24 keypoints tailored to dog poses, such as limbs, joints, and head positions.
|
||||||
|
- **Usage**: Ideal for training models to estimate dog poses in various scenarios, from research to [real-world applications](https://www.ultralytics.com/blog/custom-training-ultralytics-yolo11-for-dog-pose-estimation).
|
||||||
|
- [Read more about Dog-Pose](dog-pose.md)
|
||||||
|
|
||||||
|
### Hand Keypoints
|
||||||
|
|
||||||
|
- **Description**: The hand keypoints pose dataset comprises nearly 26K images, with 18,776 images allocated for training and 7,992 for validation.
|
||||||
|
- **Label Format**: Same as the Ultralytics YOLO format described above, but with 21 keypoints for a human hand and a visibility dimension.
|
||||||
|
- **Number of Classes**: 1 (Hand).
|
||||||
|
- **Keypoints**: 21 keypoints.
|
||||||
|
- **Usage**: Great for human hand pose estimation and [gesture recognition](https://www.ultralytics.com/blog/enhancing-hand-keypoints-estimation-with-ultralytics-yolo11).
|
||||||
|
- [Read more about Hand Keypoints](hand-keypoints.md)
|
||||||
|
|
||||||
|
### Tiger-Pose
|
||||||
|
|
||||||
|
- **Description**: The [Ultralytics](https://www.ultralytics.com/) Tiger Pose dataset comprises 263 images sourced from a [YouTube video](https://www.youtube.com/watch?v=MIBAT6BGE6U&pp=ygUbVGlnZXIgd2Fsa2luZyByZWZlcmVuY2UubXA0), with 210 images allocated for training and 53 for validation.
|
||||||
|
- **Label Format**: Same as Ultralytics YOLO format as described above, with 12 keypoints for animal pose and no visible dimension.
|
||||||
|
- **Number of Classes**: 1 (Tiger).
|
||||||
|
- **Keypoints**: 12 keypoints.
|
||||||
|
- **Usage**: Great for animal pose or any other pose that is not human-based.
|
||||||
|
- [Read more about Tiger-Pose](tiger-pose.md)
|
||||||
|
|
||||||
|
### Adding your own dataset
|
||||||
|
|
||||||
|
If you have your own dataset and would like to use it for training pose estimation models with Ultralytics YOLO format, ensure that it follows the format specified above under "Ultralytics YOLO format". Convert your annotations to the required format and specify the paths, number of classes, and class names in the YAML configuration file.
|
||||||
|
|
||||||
|
### Conversion Tool
|
||||||
|
|
||||||
|
Ultralytics provides a convenient conversion tool to convert labels from the popular [COCO dataset](https://docs.ultralytics.com/datasets/detect/coco/) format to YOLO format:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/", use_keypoints=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
This conversion tool can be used to convert the COCO dataset or any dataset in the COCO format to the Ultralytics YOLO format. The `use_keypoints` parameter specifies whether to include keypoints (for pose estimation) in the converted labels.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Ultralytics YOLO format for pose estimation?
|
||||||
|
|
||||||
|
The Ultralytics YOLO format for pose estimation datasets involves labeling each image with a corresponding text file. Each row of the text file stores information about an object instance:
|
||||||
|
|
||||||
|
- Object class index
|
||||||
|
- Object center coordinates (normalized x and y)
|
||||||
|
- Object width and height (normalized)
|
||||||
|
- Object keypoint coordinates (normalized pxn and pyn)
|
||||||
|
|
||||||
|
For 2D poses, keypoints include pixel coordinates. For 3D, each keypoint also has a visibility flag. For more details, see [Ultralytics YOLO format](#ultralytics-yolo-format).
|
||||||
|
|
||||||
|
### How do I use the COCO-Pose dataset with Ultralytics YOLO?
|
||||||
|
|
||||||
|
To use the [COCO-Pose dataset](https://docs.ultralytics.com/datasets/pose/coco/) with Ultralytics YOLO:
|
||||||
|
|
||||||
|
1. Download the dataset and prepare your label files in the YOLO format.
|
||||||
|
2. Create a YAML configuration file specifying paths to training and validation images, keypoint shape, and class names.
|
||||||
|
3. Use the configuration file for training:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load pretrained model
|
||||||
|
results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, visit [COCO-Pose](coco.md) and [train](../../modes/train.md) sections.
|
||||||
|
|
||||||
|
### How can I add my own dataset for pose estimation in Ultralytics YOLO?
|
||||||
|
|
||||||
|
To add your dataset:
|
||||||
|
|
||||||
|
1. Convert your annotations to the Ultralytics YOLO format.
|
||||||
|
2. Create a YAML configuration file specifying the dataset paths, number of classes, and class names.
|
||||||
|
3. Use the configuration file to train your model:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n-pose.pt")
|
||||||
|
results = model.train(data="your-dataset.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
For complete steps, check the [Adding your own dataset](#adding-your-own-dataset) section.
|
||||||
|
|
||||||
|
### What is the purpose of the dataset YAML file in Ultralytics YOLO?
|
||||||
|
|
||||||
|
The dataset YAML file in Ultralytics YOLO defines the dataset and model configuration for training. It specifies paths to training, validation, and test images, keypoint shapes, class names, and other configuration options. This structured format helps streamline [dataset management](https://docs.ultralytics.com/datasets/explorer/) and model training. Here is an example YAML format:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
Read more about creating YAML configuration files in [Dataset YAML format](#dataset-yaml-format).
|
||||||
|
|
||||||
|
### How can I convert COCO dataset labels to Ultralytics YOLO format for pose estimation?
|
||||||
|
|
||||||
|
Ultralytics provides a conversion tool to convert COCO dataset labels to the YOLO format, including keypoint information:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/", use_keypoints=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
This tool helps seamlessly integrate COCO datasets into YOLO projects. For details, refer to the [Conversion Tool](#conversion-tool) section and the [data preprocessing guide](https://docs.ultralytics.com/guides/preprocessing_annotated_data/).
|
||||||
170
docs/en/datasets/pose/tiger-pose.md
Executable file
170
docs/en/datasets/pose/tiger-pose.md
Executable file
@@ -0,0 +1,170 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore Ultralytics Tiger-Pose dataset with 263 diverse images. Ideal for testing, training, and refining pose estimation algorithms.
|
||||||
|
keywords: Ultralytics, Tiger-Pose, dataset, pose estimation, YOLO26, training data, machine learning, neural networks
|
||||||
|
---
|
||||||
|
|
||||||
|
# Tiger-Pose Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) introduces the Tiger-Pose dataset, a versatile collection designed for pose estimation tasks. This dataset comprises 263 images sourced from a [YouTube video](https://www.youtube.com/watch?v=MIBAT6BGE6U&pp=ygUbVGlnZXIgd2Fsa2luZyByZWZlcmVuY2UubXA0), with 210 images allocated for training and 53 for validation. It serves as an excellent resource for testing and troubleshooting pose estimation algorithms.
|
||||||
|
|
||||||
|
Despite its manageable training split of 210 images, the Tiger-Pose dataset offers diversity, making it suitable for assessing training pipelines, identifying potential errors, and serving as a valuable preliminary step before working with larger datasets for [pose estimation](https://docs.ultralytics.com/tasks/pose/).
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Total images**: 263 (210 train / 53 val).
|
||||||
|
- **Keypoints**: 12 per tiger (no visibility flag).
|
||||||
|
- **Directory layout**: YOLO-format keypoints stored under `labels/{train,val}` alongside `images/{train,val}` directories.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Gc6K5eKrTNQ"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Train YOLO26 Pose Model on Tiger-Pose Dataset Using Ultralytics Platform
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file serves as the means to specify the configuration details of a dataset. It encompasses crucial data such as file paths, class definitions, and other pertinent information. Specifically, for the `tiger-pose.yaml` file, you can check [Ultralytics Tiger-Pose Dataset Configuration File](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/tiger-pose.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/tiger-pose.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/tiger-pose.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the Tiger-Pose dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="tiger-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=tiger-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the Tiger-Pose dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-4.avif" alt="Tiger pose estimation dataset mosaic training batch" width="100%">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the Tiger-Pose dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Inference Example
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a tiger-pose trained model
|
||||||
|
|
||||||
|
# Run inference
|
||||||
|
results = model.predict(source="https://youtu.be/MIBAT6BGE6U", show=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run inference using a tiger-pose trained model
|
||||||
|
yolo pose predict source="https://youtu.be/MIBAT6BGE6U" show=True model="path/to/best.pt"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
The dataset has been released under the [AGPL-3.0 License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Ultralytics Tiger-Pose dataset used for?
|
||||||
|
|
||||||
|
The Ultralytics Tiger-Pose dataset is designed for pose estimation tasks, consisting of 263 images sourced from a [YouTube video](https://www.youtube.com/watch?v=MIBAT6BGE6U&pp=ygUbVGlnZXIgd2Fsa2luZyByZWZlcmVuY2UubXA0). The dataset is divided into 210 training images and 53 validation images. It is particularly useful for testing, training, and refining pose estimation algorithms using [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
### How do I train a YOLO26 model on the Tiger-Pose dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n-pose model on the Tiger-Pose dataset for 100 epochs with an image size of 640, use the following code snippets. For more details, visit the [Training](../../modes/train.md) page:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-pose.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="tiger-pose.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo pose train data=tiger-pose.yaml model=yolo26n-pose.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### What configurations does the `tiger-pose.yaml` file include?
|
||||||
|
|
||||||
|
The `tiger-pose.yaml` file is used to specify the configuration details of the Tiger-Pose dataset. It includes crucial data such as file paths and class definitions. To see the exact configuration, you can check out the [Ultralytics Tiger-Pose Dataset Configuration File](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/tiger-pose.yaml).
|
||||||
|
|
||||||
|
### How can I run inference using a YOLO26 model trained on the Tiger-Pose dataset?
|
||||||
|
|
||||||
|
To perform inference using a YOLO26 model trained on the Tiger-Pose dataset, you can use the following code snippets. For a detailed guide, visit the [Prediction](../../modes/predict.md) page:
|
||||||
|
|
||||||
|
!!! example "Inference Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/best.pt") # load a tiger-pose trained model
|
||||||
|
|
||||||
|
# Run inference
|
||||||
|
results = model.predict(source="https://youtu.be/MIBAT6BGE6U", show=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run inference using a tiger-pose trained model
|
||||||
|
yolo pose predict source="https://youtu.be/MIBAT6BGE6U" show=True model="path/to/best.pt"
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are the benefits of using the Tiger-Pose dataset for pose estimation?
|
||||||
|
|
||||||
|
The Tiger-Pose dataset, despite its manageable size of 210 images for training, provides a diverse collection of images that are ideal for testing pose estimation pipelines. The dataset helps identify potential errors and acts as a preliminary step before working with larger datasets. Additionally, the dataset supports the training and refinement of pose estimation algorithms using advanced tools like [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics), enhancing model performance and [accuracy](https://www.ultralytics.com/glossary/accuracy).
|
||||||
176
docs/en/datasets/segment/carparts-seg.md
Executable file
176
docs/en/datasets/segment/carparts-seg.md
Executable file
@@ -0,0 +1,176 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Carparts Segmentation Dataset for automotive AI applications. Enhance your segmentation models with rich, annotated data using Ultralytics YOLO.
|
||||||
|
keywords: Carparts Segmentation Dataset, computer vision, automotive AI, vehicle maintenance, Ultralytics, YOLO, segmentation models, deep learning, object segmentation
|
||||||
|
---
|
||||||
|
|
||||||
|
# Carparts Segmentation Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-carparts-segmentation-dataset.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Carparts Segmentation Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The Carparts Segmentation Dataset is a curated collection of images and videos designed for [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) applications, specifically focusing on [segmentation tasks](https://docs.ultralytics.com/tasks/segment/). This dataset provides a diverse set of visuals captured from multiple perspectives, offering valuable [annotated](https://www.ultralytics.com/glossary/data-labeling) examples for training and testing segmentation models.
|
||||||
|
|
||||||
|
Whether you're working on [automotive research](https://www.ultralytics.com/solutions/ai-in-automotive), developing AI solutions for vehicle maintenance, or exploring computer vision applications, the Carparts Segmentation Dataset serves as a valuable resource for enhancing the [accuracy](https://www.ultralytics.com/glossary/accuracy) and efficiency of your projects using models like [Ultralytics YOLO](../../models/yolo26.md).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/7lZa3Yi2kbo"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Carparts <a href="https://www.ultralytics.com/glossary/instance-segmentation">Instance Segmentation</a> with Ultralytics YOLO26.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The data distribution within the Carparts Segmentation Dataset is organized as follows:
|
||||||
|
|
||||||
|
- **Training set**: Includes 3156 images, each accompanied by its corresponding annotations. This set is used for [training](https://www.ultralytics.com/glossary/training-data) the [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) [model](https://www.ultralytics.com/glossary/foundation-model).
|
||||||
|
- **Testing set**: Comprises 276 images, with each one paired with its respective annotations. This set is used to evaluate the model's performance after training using [test data](https://www.ultralytics.com/glossary/test-data).
|
||||||
|
- **Validation set**: Consists of 401 images, each having corresponding annotations. This set is used during training to tune [hyperparameters](https://docs.ultralytics.com/guides/hyperparameter-tuning/) and prevent [overfitting](https://www.ultralytics.com/glossary/overfitting) using [validation data](https://www.ultralytics.com/glossary/validation-data).
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Carparts Segmentation finds applications in various domains including:
|
||||||
|
|
||||||
|
- **Automotive Quality Control**: Identifying defects or inconsistencies in car parts during manufacturing ([AI in Manufacturing](https://www.ultralytics.com/solutions/ai-in-manufacturing)).
|
||||||
|
- **Auto Repair**: Assisting mechanics in identifying parts for repair or replacement.
|
||||||
|
- **E-commerce Cataloging**: Automatically tagging and categorizing car parts in online stores for [e-commerce](https://en.wikipedia.org/wiki/E-commerce) platforms.
|
||||||
|
- **Traffic Monitoring**: Analyzing vehicle components in traffic surveillance footage.
|
||||||
|
- **Autonomous Vehicles**: Enhancing the perception systems of [self-driving cars](https://www.ultralytics.com/blog/ai-in-self-driving-cars) to better understand surrounding vehicles.
|
||||||
|
- **Insurance Processing**: Automating damage assessment by identifying affected car parts during insurance claims.
|
||||||
|
- **Recycling**: Sorting vehicle components for efficient recycling processes.
|
||||||
|
- **Smart City Initiatives**: Contributing data for urban planning and traffic management systems within [Smart Cities](https://en.wikipedia.org/wiki/Smart_city).
|
||||||
|
|
||||||
|
By accurately identifying and categorizing different vehicle components, carparts segmentation streamlines processes and contributes to increased efficiency and automation across these industries.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A [YAML](https://www.ultralytics.com/glossary/yaml) (Yet Another Markup Language) file defines the dataset configuration, including paths, class names, and other essential details. For the Carparts Segmentation dataset, the `carparts-seg.yaml` file is available at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/carparts-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/carparts-seg.yaml). You can learn more about the YAML format at [yaml.org](https://yaml.org/).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/carparts-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/carparts-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train an [Ultralytics YOLO26](../../models/yolo26.md) model on the Carparts Segmentation dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following code snippets. Refer to the model [Training guide](../../modes/train.md) for a comprehensive list of available arguments and explore [model training tips](https://docs.ultralytics.com/guides/model-training-tips/) for best practices.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained segmentation model like YOLO26n-seg
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model on the Carparts Segmentation dataset
|
||||||
|
results = model.train(data="carparts-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
|
||||||
|
# After training, you can validate the model's performance on the validation set
|
||||||
|
results = model.val()
|
||||||
|
|
||||||
|
# Or perform prediction on new images or videos
|
||||||
|
results = model.predict("path/to/your/image.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model using the Command Line Interface
|
||||||
|
# Specify the dataset config file, model, number of epochs, and image size
|
||||||
|
yolo segment train data=carparts-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
|
||||||
|
# Validate the trained model using the validation set
|
||||||
|
yolo segment val data=carparts-seg.yaml model=path/to/best.pt
|
||||||
|
|
||||||
|
# Predict using the trained model on a specific image source
|
||||||
|
yolo segment predict model=path/to/best.pt source=path/to/your/image.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Carparts Segmentation dataset includes a diverse array of images and videos captured from various perspectives. Below are examples showcasing the data and its corresponding annotations:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- The image demonstrates [object segmentation](https://docs.ultralytics.com/tasks/segment/) within a car image sample. Annotated [bounding boxes](https://www.ultralytics.com/glossary/bounding-box) with masks highlight the identified car parts (e.g., headlights, grille).
|
||||||
|
- The dataset features a variety of images captured under different conditions (locations, lighting, object densities), providing a comprehensive resource for training robust car part segmentation models.
|
||||||
|
- This example underscores the dataset's complexity and the importance of [high-quality data](https://www.ultralytics.com/blog/the-importance-of-high-quality-computer-vision-datasets) for computer vision tasks, especially in specialized domains like automotive component analysis. Techniques like [data augmentation](https://www.ultralytics.com/glossary/data-augmentation) can further enhance model generalization.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you utilize the Carparts Segmentation dataset in your research or development efforts, please cite the original source:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{ car-seg-un1pm_dataset,
|
||||||
|
title = { car-seg Dataset },
|
||||||
|
type = { Open Source Dataset },
|
||||||
|
author = { Gianmarco Russo },
|
||||||
|
url = { https://universe.roboflow.com/gianmarco-russo-vt9xr/car-seg-un1pm },
|
||||||
|
year = { 2023 },
|
||||||
|
month = { nov },
|
||||||
|
note = { visited on 2024-01-24 },
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We acknowledge the contribution of Gianmarco Russo and the Roboflow team in creating and maintaining this valuable dataset for the computer vision community. For more datasets, visit the [Ultralytics Datasets collection](https://docs.ultralytics.com/datasets/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Carparts Segmentation Dataset?
|
||||||
|
|
||||||
|
The Carparts Segmentation Dataset is a specialized collection of images and videos for training computer vision models to perform [segmentation](https://docs.ultralytics.com/tasks/segment/) on car parts. It includes diverse visuals with detailed annotations, suitable for automotive AI applications.
|
||||||
|
|
||||||
|
### How can I use the Carparts Segmentation Dataset with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
You can train an [Ultralytics YOLO26](../../models/yolo26.md) segmentation model using this dataset. Load a pretrained model (e.g., `yolo26n-seg.pt`) and initiate training using the provided Python or CLI examples, referencing the `carparts-seg.yaml` configuration file. Check the [Training Guide](../../modes/train.md) for detailed instructions.
|
||||||
|
|
||||||
|
!!! example "Train Example Snippet"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="carparts-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo segment train data=carparts-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are some applications of Carparts Segmentation?
|
||||||
|
|
||||||
|
Carparts Segmentation is useful in:
|
||||||
|
|
||||||
|
- **Automotive Quality Control**: Ensuring parts meet standards ([AI in Manufacturing](https://www.ultralytics.com/solutions/ai-in-manufacturing)).
|
||||||
|
- **Auto Repair**: Identifying parts needing service.
|
||||||
|
- **E-commerce**: Cataloging parts online.
|
||||||
|
- **Autonomous Vehicles**: Improving vehicle perception ([AI in Automotive](https://www.ultralytics.com/solutions/ai-in-automotive)).
|
||||||
|
- **Insurance**: Assessing vehicle damage automatically.
|
||||||
|
- **Recycling**: Sorting parts efficiently.
|
||||||
|
|
||||||
|
### Where can I find the dataset configuration file for Carparts Segmentation?
|
||||||
|
|
||||||
|
The dataset configuration file, `carparts-seg.yaml`, which contains details about the dataset paths and classes, is located in the Ultralytics GitHub repository: [carparts-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/carparts-seg.yaml).
|
||||||
|
|
||||||
|
### Why should I use the Carparts Segmentation Dataset?
|
||||||
|
|
||||||
|
This dataset offers rich, annotated data crucial for developing accurate [segmentation models](https://docs.ultralytics.com/tasks/segment/) for automotive applications. Its diversity helps improve model robustness and performance in real-world scenarios like automated vehicle inspection, enhancing safety systems, and supporting autonomous driving technology. Using high-quality, domain-specific datasets like this accelerates AI development.
|
||||||
156
docs/en/datasets/segment/coco.md
Executable file
156
docs/en/datasets/segment/coco.md
Executable file
@@ -0,0 +1,156 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the COCO-Seg dataset, an extension of COCO, with detailed segmentation annotations. Learn how to train YOLO models with COCO-Seg.
|
||||||
|
keywords: COCO-Seg, dataset, YOLO models, instance segmentation, object detection, COCO dataset, YOLO26, computer vision, Ultralytics, machine learning
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO-Seg Dataset
|
||||||
|
|
||||||
|
The [COCO-Seg](https://cocodataset.org/#home) dataset, an extension of the COCO (Common Objects in Context) dataset, is specially designed to aid research in object [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation). It uses the same images as COCO but introduces more detailed segmentation annotations. This dataset is a crucial resource for researchers and developers working on instance segmentation tasks, especially for training [Ultralytics YOLO](https://docs.ultralytics.com/models/) models.
|
||||||
|
|
||||||
|
## COCO-Seg Pretrained Models
|
||||||
|
|
||||||
|
{% include "macros/yolo-seg-perf.md" %}
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- COCO-Seg retains the original 330K images from COCO.
|
||||||
|
- The dataset consists of the same 80 object categories found in the original COCO dataset.
|
||||||
|
- Annotations now include more detailed instance segmentation masks for each object in the images.
|
||||||
|
- COCO-Seg provides standardized evaluation metrics like [mean Average Precision](https://www.ultralytics.com/glossary/mean-average-precision-map) (mAP) for object detection, and mean Average [Recall](https://www.ultralytics.com/glossary/recall) (mAR) for instance segmentation tasks, enabling effective comparison of model performance.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The COCO-Seg dataset is partitioned into three subsets:
|
||||||
|
|
||||||
|
1. **Train2017**: 118K images for training instance segmentation models.
|
||||||
|
2. **Val2017**: 5K images used for validation during model development.
|
||||||
|
3. **Test2017**: 20K images used for benchmarking. Ground-truth annotations for this subset are not publicly available, so predictions must be submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7383) for scoring.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
COCO-Seg is widely used for training and evaluating [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models in instance segmentation, such as the YOLO models. The large number of annotated images, the diversity of object categories, and the standardized evaluation metrics make it an indispensable resource for [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) researchers and practitioners.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO-Seg dataset, the `coco.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-seg model on the COCO-Seg dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
COCO-Seg, like its predecessor COCO, contains a diverse set of images with various object categories and complex scenes. However, COCO-Seg introduces more detailed instance segmentation masks for each object in the images. Here are some examples of images from the dataset, along with their corresponding instance segmentation masks:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. [Mosaicing](https://docs.ultralytics.com/guides/hyperparameter-tuning/) is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This aids the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO-Seg dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO-Seg dataset in your research or development work, please cite the original COCO paper and acknowledge the extension to COCO-Seg:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We extend our thanks to the COCO Consortium for creating and maintaining this invaluable resource for the computer vision community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO-Seg dataset and how does it differ from the original COCO dataset?
|
||||||
|
|
||||||
|
The [COCO-Seg](https://cocodataset.org/#home) dataset is an extension of the original COCO (Common Objects in Context) dataset, specifically designed for instance segmentation tasks. While it uses the same images as the COCO dataset, COCO-Seg includes more detailed segmentation annotations, making it a powerful resource for researchers and developers focusing on [object instance segmentation](https://docs.ultralytics.com/tasks/segment/).
|
||||||
|
|
||||||
|
### How can I train a YOLO26 model using the COCO-Seg dataset?
|
||||||
|
|
||||||
|
To train a YOLO26n-seg model on the COCO-Seg dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a detailed list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### What are the key features of the COCO-Seg dataset?
|
||||||
|
|
||||||
|
The COCO-Seg dataset includes several key features:
|
||||||
|
|
||||||
|
- Retains the original 330K images from the COCO dataset.
|
||||||
|
- Annotates the same 80 object categories found in the original COCO.
|
||||||
|
- Provides more detailed instance segmentation masks for each object.
|
||||||
|
- Uses standardized evaluation metrics such as mean Average [Precision](https://www.ultralytics.com/glossary/precision) (mAP) for [object detection](https://www.ultralytics.com/glossary/object-detection) and mean Average Recall (mAR) for instance segmentation tasks.
|
||||||
|
|
||||||
|
### What pretrained models are available for COCO-Seg, and what are their performance metrics?
|
||||||
|
|
||||||
|
The COCO-Seg dataset supports multiple pretrained YOLO26 segmentation models with varying performance metrics. Here's a summary of the available models and their key metrics:
|
||||||
|
|
||||||
|
{% include "macros/yolo-seg-perf.md" %}
|
||||||
|
|
||||||
|
These models range from the lightweight YOLO26n-seg to the more powerful YOLO26x-seg, offering different trade-offs between speed and accuracy to suit various application requirements. For more information on model selection, visit the [Ultralytics models page](https://docs.ultralytics.com/models/).
|
||||||
|
|
||||||
|
### How is the COCO-Seg dataset structured and what subsets does it contain?
|
||||||
|
|
||||||
|
The COCO-Seg dataset is partitioned into three subsets for specific training and evaluation needs:
|
||||||
|
|
||||||
|
1. **Train2017**: Contains 118K images used primarily for training instance segmentation models.
|
||||||
|
2. **Val2017**: Comprises 5K images utilized for validation during the training process.
|
||||||
|
3. **Test2017**: Encompasses 20K images reserved for testing and benchmarking trained models. Note that ground truth annotations for this subset are not publicly available, and performance results are submitted to the [COCO evaluation server](https://codalab.lisn.upsaclay.fr/competitions/7383) for assessment.
|
||||||
|
|
||||||
|
For smaller experimentation needs, you might also consider using the [COCO8-seg dataset](https://docs.ultralytics.com/datasets/segment/coco8-seg/), which is a compact version containing just 8 images from the COCO train 2017 set.
|
||||||
130
docs/en/datasets/segment/coco128-seg.md
Executable file
130
docs/en/datasets/segment/coco128-seg.md
Executable file
@@ -0,0 +1,130 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the COCO128-Seg dataset by Ultralytics, a compact yet diverse segmentation dataset ideal for testing and training YOLO26 models.
|
||||||
|
keywords: COCO128-Seg, Ultralytics, segmentation dataset, YOLO26, COCO 2017, model training, computer vision, dataset configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO128-Seg Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) COCO128-Seg is a small but versatile [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) dataset composed of the first 128 images of the COCO train 2017 set. This dataset is ideal for testing and debugging segmentation models, or for experimenting with new detection approaches. With 128 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Images**: 128 total. The default YAML reuses the same directory for train and val so you can quickly iterate, but you can duplicate or customize the split if desired.
|
||||||
|
- **Classes**: Same 80 object categories as COCO.
|
||||||
|
- **Labels**: YOLO-format polygons saved beside each image inside `labels/{train,val}`.
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO128-Seg dataset, the `coco128-seg.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128-seg.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco128-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco128-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-seg model on the COCO128-Seg dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco128-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco128-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the COCO128-Seg dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-2.avif" alt="COCO128-seg instance segmentation dataset mosaic" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO128-Seg dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO128-Seg dataset, and how is it used in Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The **COCO128-Seg dataset** is a compact instance segmentation dataset by Ultralytics, consisting of the first 128 images from the COCO train 2017 set. This dataset is tailored for testing and debugging segmentation models or experimenting with new detection methods. It is particularly useful with Ultralytics [YOLO26](https://github.com/ultralytics/ultralytics) and [Platform](https://platform.ultralytics.com/) for rapid iteration and pipeline error-checking before scaling to larger datasets. For detailed usage, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### How can I train a YOLO26n-seg model using the COCO128-Seg dataset?
|
||||||
|
|
||||||
|
To train a **YOLO26n-seg** model on the COCO128-Seg dataset for 100 epochs with an image size of 640, you can use Python or CLI commands. Here's a quick example:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # Load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco128-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco128-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a thorough explanation of available arguments and configuration options, you can check the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### Why is the COCO128-Seg dataset important for model development and debugging?
|
||||||
|
|
||||||
|
The **COCO128-Seg dataset** offers a balanced combination of manageability and diversity with 128 images, making it perfect for quickly testing and debugging segmentation models or experimenting with new detection techniques. Its moderate size allows for fast training iterations while providing enough diversity to validate training pipelines before scaling to larger datasets. Learn more about supported dataset formats in the [Ultralytics segmentation dataset guide](https://docs.ultralytics.com/datasets/segment/).
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration file for the COCO128-Seg dataset?
|
||||||
|
|
||||||
|
The YAML configuration file for the **COCO128-Seg dataset** is available in the Ultralytics repository. You can access the file directly at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128-seg.yaml>. The YAML file includes essential information about dataset paths, classes, and configuration settings required for model training and validation.
|
||||||
|
|
||||||
|
### What are some benefits of using mosaicing during training with the COCO128-Seg dataset?
|
||||||
|
|
||||||
|
Using **mosaicing** during training helps increase the diversity and variety of objects and scenes in each training batch. This technique combines multiple images into a single composite image, enhancing the model's ability to generalize to different object sizes, aspect ratios, and contexts within the scene. Mosaicing is beneficial for improving a model's robustness and [accuracy](https://www.ultralytics.com/glossary/accuracy), especially when working with moderately-sized datasets like COCO128-Seg. For an example of mosaiced images, see the [Sample Images and Annotations](#sample-images-and-annotations) section.
|
||||||
130
docs/en/datasets/segment/coco8-seg.md
Executable file
130
docs/en/datasets/segment/coco8-seg.md
Executable file
@@ -0,0 +1,130 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Discover the versatile and manageable COCO8-Seg dataset by Ultralytics, ideal for testing and debugging segmentation models or new detection approaches.
|
||||||
|
keywords: COCO8-Seg, Ultralytics, segmentation dataset, YOLO26, COCO 2017, model training, computer vision, dataset configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
# COCO8-Seg Dataset
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[Ultralytics](https://www.ultralytics.com/) COCO8-Seg is a small but versatile [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation. This dataset is ideal for testing and debugging segmentation models, or for experimenting with new detection approaches. With 8 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
- **Images**: 8 total (4 train / 4 val).
|
||||||
|
- **Classes**: 80 COCO categories.
|
||||||
|
- **Labels**: YOLO-format polygons stored under `labels/{train,val}` matching each image file.
|
||||||
|
|
||||||
|
This dataset is intended for use with [Ultralytics Platform](https://platform.ultralytics.com/) and [YOLO26](https://github.com/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO8-Seg dataset, the `coco8-seg.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-seg.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train a YOLO26n-seg model on the COCO8-Seg dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco8-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Images and Annotations
|
||||||
|
|
||||||
|
Here are some examples of images from the COCO8-Seg dataset, along with their corresponding annotations:
|
||||||
|
|
||||||
|
<img src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/mosaiced-training-batch-2.avif" alt="COCO8-seg instance segmentation dataset mosaic" width="800">
|
||||||
|
|
||||||
|
- **Mosaiced Image**: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
|
||||||
|
|
||||||
|
The example showcases the variety and complexity of the images in the COCO8-Seg dataset and the benefits of using mosaicing during the training process.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the COCO dataset in your research or development work, please cite the following paper:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{lin2015microsoft,
|
||||||
|
title={Microsoft COCO: Common Objects in Context},
|
||||||
|
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
|
||||||
|
year={2015},
|
||||||
|
eprint={1405.0312},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CV}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) community. For more information about the COCO dataset and its creators, visit the [COCO dataset website](https://cocodataset.org/#home).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the COCO8-Seg dataset, and how is it used in Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The **COCO8-Seg dataset** is a compact instance segmentation dataset by Ultralytics, consisting of the first 8 images from the COCO train 2017 set—4 images for training and 4 for validation. This dataset is tailored for testing and debugging segmentation models or experimenting with new detection methods. It is particularly useful with Ultralytics [YOLO26](https://github.com/ultralytics/ultralytics) and [Platform](https://platform.ultralytics.com/) for rapid iteration and pipeline error-checking before scaling to larger datasets. For detailed usage, refer to the model [Training](../../modes/train.md) page.
|
||||||
|
|
||||||
|
### How can I train a YOLO26n-seg model using the COCO8-Seg dataset?
|
||||||
|
|
||||||
|
To train a **YOLO26n-seg** model on the COCO8-Seg dataset for 100 epochs with an image size of 640, you can use Python or CLI commands. Here's a quick example:
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # Load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco8-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
For a thorough explanation of available arguments and configuration options, you can check the [Training](../../modes/train.md) documentation.
|
||||||
|
|
||||||
|
### Why is the COCO8-Seg dataset important for model development and debugging?
|
||||||
|
|
||||||
|
The **COCO8-Seg dataset** offers a compact yet diverse set of 8 images, making it perfect for quickly testing and debugging segmentation models or experimenting with new detection techniques. Its small size allows for fast sanity checks and early pipeline validation, helping identify issues before scaling to larger datasets. Learn more about supported dataset formats in the [Ultralytics segmentation dataset guide](https://docs.ultralytics.com/datasets/segment/).
|
||||||
|
|
||||||
|
### Where can I find the YAML configuration file for the COCO8-Seg dataset?
|
||||||
|
|
||||||
|
The YAML configuration file for the **COCO8-Seg dataset** is available in the Ultralytics repository. You can access the file directly at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-seg.yaml>. The YAML file includes essential information about dataset paths, classes, and configuration settings required for model training and validation.
|
||||||
|
|
||||||
|
### What are some benefits of using mosaicing during training with the COCO8-Seg dataset?
|
||||||
|
|
||||||
|
Using **mosaicing** during training helps increase the diversity and variety of objects and scenes in each training batch. This technique combines multiple images into a single composite image, enhancing the model's ability to generalize to different object sizes, aspect ratios, and contexts within the scene. Mosaicing is beneficial for improving a model's robustness and [accuracy](https://www.ultralytics.com/glossary/accuracy), especially when working with small datasets like COCO8-Seg. For an example of mosaiced images, see the [Sample Images and Annotations](#sample-images-and-annotations) section.
|
||||||
154
docs/en/datasets/segment/crack-seg.md
Executable file
154
docs/en/datasets/segment/crack-seg.md
Executable file
@@ -0,0 +1,154 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the extensive Crack Segmentation Dataset, ideal for transportation safety, infrastructure maintenance, and self-driving car model development using Ultralytics YOLO.
|
||||||
|
keywords: Crack Segmentation Dataset, Ultralytics, transportation safety, public safety, self-driving cars, computer vision, road safety, infrastructure maintenance, dataset, YOLO, segmentation, deep learning
|
||||||
|
---
|
||||||
|
|
||||||
|
# Crack Segmentation Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-crack-segmentation-dataset.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Crack Segmentation Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The Crack Segmentation Dataset is an extensive resource designed for individuals involved in transportation and public safety studies. It is also beneficial for developing [self-driving car](https://www.ultralytics.com/blog/ai-in-self-driving-cars) models or exploring various [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) applications. This dataset is part of the broader collection available on the Ultralytics [Datasets Hub](../../datasets/index.md).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/GAFlmuk0fZI"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Train a Crack Segmentation Model using Ultralytics YOLO26 | AI in Construction 🎉
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Comprising 4029 static images captured from diverse road and wall scenarios, this dataset is a valuable asset for crack segmentation tasks. Whether you are researching transportation infrastructure or aiming to enhance the [accuracy](https://www.ultralytics.com/glossary/accuracy) of autonomous driving systems, this dataset provides a rich collection of images for training [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) models.
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The Crack Segmentation Dataset is organized into three subsets:
|
||||||
|
|
||||||
|
- **Training set**: 3717 images with corresponding annotations.
|
||||||
|
- **Testing set**: 112 images with corresponding annotations.
|
||||||
|
- **Validation set**: 200 images with corresponding annotations.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Crack segmentation finds practical applications in [infrastructure maintenance](https://www.ultralytics.com/blog/using-ai-for-crack-detection-and-segmentation), aiding in the identification and assessment of structural damage in buildings, bridges, and roads. It also plays a crucial role in enhancing [road safety](https://www.who.int/news-room/fact-sheets/detail/road-traffic-injuries) by enabling automated systems to detect pavement cracks for timely repairs.
|
||||||
|
|
||||||
|
In industrial settings, crack detection using deep learning models like [Ultralytics YOLO26](../../models/yolo26.md) helps ensure building integrity in construction, prevents costly downtimes in [manufacturing](https://www.ultralytics.com/solutions/ai-in-manufacturing), and makes road inspections safer and more effective. Automatically identifying and classifying cracks allows maintenance teams to prioritize repairs efficiently, contributing to better [model evaluation insights](../../guides/model-evaluation-insights.md).
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A [YAML](https://www.ultralytics.com/glossary/yaml) (Yet Another Markup Language) file defines the dataset configuration. It includes details about the dataset's paths, classes, and other relevant information. For the Crack Segmentation dataset, the `crack-seg.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/crack-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/crack-seg.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/crack-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/crack-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train the Ultralytics YOLO26n-seg model on the Crack Segmentation dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, use the following [Python](https://www.python.org/) or CLI snippets. Refer to the model [Training](../../modes/train.md) documentation page for a comprehensive list of available arguments and configurations like [hyperparameter tuning](../../guides/hyperparameter-tuning.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
# Using a pretrained model like yolo26n-seg.pt is recommended for faster convergence
|
||||||
|
model = YOLO("yolo26n-seg.pt")
|
||||||
|
|
||||||
|
# Train the model on the Crack Segmentation dataset
|
||||||
|
# Ensure 'crack-seg.yaml' is accessible or provide the full path
|
||||||
|
results = model.train(data="crack-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
|
||||||
|
# After training, the model can be used for prediction or exported
|
||||||
|
# results = model.predict(source='path/to/your/images')
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model using the Command Line Interface
|
||||||
|
# Ensure the dataset YAML file 'crack-seg.yaml' is correctly configured and accessible
|
||||||
|
yolo segment train data=crack-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Crack Segmentation dataset contains a diverse collection of images captured from various perspectives, showcasing different types of cracks on roads and walls. Here are some examples:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- This image demonstrates [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), featuring annotated [bounding boxes](https://www.ultralytics.com/glossary/bounding-box) with masks outlining identified cracks. The dataset includes images from different locations and environments, making it a comprehensive resource for developing robust models for this task. Techniques like [data augmentation](https://www.ultralytics.com/glossary/data-augmentation) can further enhance dataset diversity. Learn more about instance segmentation and tracking in our [guide](../../guides/instance-segmentation-and-tracking.md).
|
||||||
|
|
||||||
|
- The example highlights the diversity within the Crack Segmentation dataset, emphasizing the importance of high-quality data for training effective computer vision models.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you use the Crack Segmentation dataset in your research or development work, please cite the source appropriately:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{ crack-bphdr_dataset,
|
||||||
|
title = { crack Dataset },
|
||||||
|
type = { Open Source Dataset },
|
||||||
|
author = { University },
|
||||||
|
url = { https://universe.roboflow.com/university-bswxt/crack-bphdr },
|
||||||
|
year = { 2022 },
|
||||||
|
month = { dec },
|
||||||
|
note = { visited on 2024-01-23 },
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We acknowledge the team at Roboflow for making the Crack Segmentation dataset available, providing a valuable resource for the computer vision community, particularly for projects related to road safety and infrastructure assessment.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Crack Segmentation Dataset?
|
||||||
|
|
||||||
|
The Crack Segmentation Dataset is a collection of 4029 static images designed for transportation and public safety studies. It's suitable for tasks like [self-driving car](https://www.ultralytics.com/blog/ai-in-self-driving-cars) model development and [infrastructure maintenance](https://www.ultralytics.com/blog/using-ai-for-crack-detection-and-segmentation). It includes training, testing, and validation sets for crack detection and [segmentation](../../tasks/segment.md) tasks.
|
||||||
|
|
||||||
|
### How do I train a model using the Crack Segmentation Dataset with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
To train an [Ultralytics YOLO26](../../models/yolo26.md) model on this dataset, use the provided Python or CLI examples. Detailed instructions and parameters are available on the model [Training](../../modes/train.md) page. You can manage your training process using tools like [Ultralytics Platform](https://platform.ultralytics.com).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a pretrained model (recommended)
|
||||||
|
model = YOLO("yolo26n-seg.pt")
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="crack-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained model via CLI
|
||||||
|
yolo segment train data=crack-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
### Why use the Crack Segmentation Dataset for self-driving car projects?
|
||||||
|
|
||||||
|
This dataset is valuable for self-driving car projects due to its diverse images of roads and walls, covering various real-world scenarios. This diversity improves the robustness of models trained for crack detection, which is crucial for road safety and infrastructure assessment. The detailed annotations aid in [developing models](../../guides/model-training-tips.md) that can accurately identify potential road hazards.
|
||||||
|
|
||||||
|
### What features does Ultralytics YOLO offer for crack segmentation?
|
||||||
|
|
||||||
|
Ultralytics YOLO provides real-time [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and classification capabilities, making it highly suitable for crack segmentation tasks. It efficiently handles large datasets and complex scenarios. The framework includes comprehensive modes for [Training](../../modes/train.md), [Prediction](../../modes/predict.md), and [Exporting](../../modes/export.md) models. YOLO's [anchor-free detection](https://www.ultralytics.com/blog/benefits-ultralytics-yolo11-being-anchor-free-detector) approach can improve performance on irregular shapes like cracks, and performance can be measured using standard [metrics](../../guides/yolo-performance-metrics.md).
|
||||||
|
|
||||||
|
### How do I cite the Crack Segmentation Dataset?
|
||||||
|
|
||||||
|
If using this dataset in your work, please cite it using the provided BibTeX entry above to give appropriate credit to the creators.
|
||||||
212
docs/en/datasets/segment/index.md
Executable file
212
docs/en/datasets/segment/index.md
Executable file
@@ -0,0 +1,212 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the supported dataset formats for Ultralytics YOLO and learn how to prepare and use datasets for training object segmentation models.
|
||||||
|
keywords: Ultralytics, YOLO, instance segmentation, dataset formats, auto-annotation, COCO, segmentation models, training data
|
||||||
|
---
|
||||||
|
|
||||||
|
# Instance Segmentation Datasets Overview
|
||||||
|
|
||||||
|
Instance segmentation is a computer vision task that involves identifying and delineating individual objects within an image. This guide provides an overview of dataset formats supported by Ultralytics YOLO for instance segmentation tasks, along with instructions on how to prepare, convert, and use these datasets for training your models.
|
||||||
|
|
||||||
|
## Supported Dataset Formats
|
||||||
|
|
||||||
|
### Ultralytics YOLO format
|
||||||
|
|
||||||
|
The dataset label format used for training YOLO segmentation models is as follows:
|
||||||
|
|
||||||
|
1. One text file per image: Each image in the dataset has a corresponding text file with the same name as the image file and the ".txt" extension.
|
||||||
|
2. One row per object: Each row in the text file corresponds to one object instance in the image.
|
||||||
|
3. Object information per row: Each row contains the following information about the object instance:
|
||||||
|
- Object class index: An integer representing the class of the object (e.g., 0 for person, 1 for car, etc.).
|
||||||
|
- Object bounding coordinates: The bounding coordinates around the mask area, normalized to be between 0 and 1.
|
||||||
|
|
||||||
|
The format for a single row in the segmentation dataset file is as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
<class-index> <x1> <y1> <x2> <y2> ... <xn> <yn>
|
||||||
|
```
|
||||||
|
|
||||||
|
In this format, `<class-index>` is the index of the class for the object, and `<x1> <y1> <x2> <y2> ... <xn> <yn>` are the normalized polygon coordinates of the object's segmentation mask (values are in `[0, 1]` relative to image width and height). The coordinates are separated by spaces.
|
||||||
|
|
||||||
|
Here is an example of the YOLO dataset format for a single image with two objects made up of a 3-point segment and a 5-point segment.
|
||||||
|
|
||||||
|
```
|
||||||
|
0 0.681 0.485 0.670 0.487 0.676 0.487
|
||||||
|
1 0.504 0.000 0.501 0.004 0.498 0.004 0.493 0.010 0.492 0.0104
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
- The length of each row does **not** have to be equal.
|
||||||
|
- Each segmentation label must have a **minimum of 3 `(x, y)` points**: `<class-index> <x1> <y1> <x2> <y2> <x3> <y3>`
|
||||||
|
|
||||||
|
### Dataset YAML format
|
||||||
|
|
||||||
|
The Ultralytics framework uses a YAML file format to define the dataset and model configuration for training Segmentation Models. Here is an example of the YAML format used for defining a segmentation dataset:
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/coco8-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
The `train` and `val` fields specify the paths to the directories containing the training and validation images, respectively.
|
||||||
|
|
||||||
|
`names` is a dictionary of class names. The order of the names should match the order of the object class indices in the YOLO dataset files.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model
|
||||||
|
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start training from a pretrained *.pt model
|
||||||
|
yolo segment train data=coco8-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
```
|
||||||
|
|
||||||
|
## Supported Datasets
|
||||||
|
|
||||||
|
Ultralytics YOLO supports various datasets for instance segmentation tasks. Here's a list of the most commonly used ones:
|
||||||
|
|
||||||
|
- [Carparts-seg](carparts-seg.md): A specialized dataset focused on the segmentation of car parts, ideal for automotive applications. It includes a variety of vehicles with detailed annotations of individual car components.
|
||||||
|
- [COCO](coco.md): A comprehensive dataset for [object detection](https://www.ultralytics.com/glossary/object-detection), segmentation, and captioning, featuring over 200K labeled images across a wide range of categories.
|
||||||
|
- [COCO8-seg](coco8-seg.md): A compact, 8-image subset of COCO designed for quick testing of segmentation model training, ideal for CI checks and workflow validation in the `ultralytics` repository.
|
||||||
|
- [COCO128-seg](coco128-seg.md): A smaller dataset for [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) tasks, containing a subset of 128 COCO images with segmentation annotations.
|
||||||
|
- [Crack-seg](crack-seg.md): A dataset tailored for the segmentation of cracks in various surfaces. Essential for infrastructure maintenance and quality control, it provides detailed imagery for training models to identify structural weaknesses.
|
||||||
|
- [Package-seg](package-seg.md): A dataset dedicated to the segmentation of different types of packaging materials and shapes. It's particularly useful for logistics and warehouse automation, aiding in the development of systems for package handling and sorting.
|
||||||
|
|
||||||
|
### Adding your own dataset
|
||||||
|
|
||||||
|
If you have your own dataset and would like to use it for training segmentation models with Ultralytics YOLO format, ensure that it follows the format specified above under "Ultralytics YOLO format". Convert your annotations to the required format and specify the paths, number of classes, and class names in the YAML configuration file. Keep `images/` and `labels/` as separate folders at the same level, with matching subfolder structure; placing label `.txt` files in the image folder can cause the model to miss labels.
|
||||||
|
|
||||||
|
## Port or Convert Label Formats
|
||||||
|
|
||||||
|
### COCO Dataset Format to YOLO Format
|
||||||
|
|
||||||
|
You can easily convert labels from the popular COCO dataset format to the YOLO format using the following code snippet:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/", use_segments=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
This conversion tool can be used to convert the COCO dataset or any dataset in the COCO format to the Ultralytics YOLO format.
|
||||||
|
|
||||||
|
Remember to double-check if the dataset you want to use is compatible with your model and follows the necessary format conventions. Properly formatted datasets are crucial for training successful segmentation models.
|
||||||
|
|
||||||
|
## Auto-Annotation
|
||||||
|
|
||||||
|
Auto-annotation is an essential feature that allows you to generate a segmentation dataset using a pretrained detection model. It enables you to quickly and accurately annotate a large number of images without the need for manual labeling, saving time and effort.
|
||||||
|
|
||||||
|
### Generate Segmentation Dataset Using a Detection Model
|
||||||
|
|
||||||
|
To auto-annotate your dataset using the Ultralytics framework, you can use the `auto_annotate` function as shown below:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.annotator import auto_annotate
|
||||||
|
|
||||||
|
auto_annotate(data="path/to/images", det_model="yolo26x.pt", sam_model="sam_b.pt")
|
||||||
|
```
|
||||||
|
|
||||||
|
{% include "macros/sam-auto-annotate.md" %}
|
||||||
|
|
||||||
|
The `auto_annotate` function takes the path to your images, along with optional arguments for specifying the pretrained detection models i.e. [YOLO26](../../models/yolo26.md), [YOLO11](../../models/yolo11.md) or other [models](../../models/index.md) and segmentation models i.e, [SAM](../../models/sam.md), [SAM2](../../models/sam-2.md) or [MobileSAM](../../models/mobile-sam.md), the device to run the models on, and the output directory for saving the annotated results.
|
||||||
|
|
||||||
|
By leveraging the power of pretrained models, auto-annotation can significantly reduce the time and effort required for creating high-quality segmentation datasets. This feature is particularly useful for researchers and developers working with large image collections, as it allows them to focus on model development and evaluation rather than manual annotation.
|
||||||
|
|
||||||
|
### Visualize Dataset Annotations
|
||||||
|
|
||||||
|
Before training your model, it's often helpful to visualize your dataset annotations to ensure they're correct. Ultralytics provides a utility function for this purpose:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.utils import visualize_image_annotations
|
||||||
|
|
||||||
|
label_map = { # Define the label map with all annotated class labels.
|
||||||
|
0: "person",
|
||||||
|
1: "car",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Visualize
|
||||||
|
visualize_image_annotations(
|
||||||
|
"path/to/image.jpg", # Input image path.
|
||||||
|
"path/to/annotations.txt", # Annotation file path for the image.
|
||||||
|
label_map,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
This function draws bounding boxes, labels objects with class names, and adjusts text color for better readability, helping you identify and correct any annotation errors before training.
|
||||||
|
|
||||||
|
### Converting Segmentation Masks to YOLO Format
|
||||||
|
|
||||||
|
If you have segmentation masks in binary format, you can convert them to the YOLO segmentation format using:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_segment_masks_to_yolo_seg
|
||||||
|
|
||||||
|
# For datasets like COCO with 80 classes
|
||||||
|
convert_segment_masks_to_yolo_seg(masks_dir="path/to/masks_dir", output_dir="path/to/output_dir", classes=80)
|
||||||
|
```
|
||||||
|
|
||||||
|
This utility converts binary mask images into the YOLO segmentation format and saves them in the specified output directory.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What dataset formats does Ultralytics YOLO support for instance segmentation?
|
||||||
|
|
||||||
|
Ultralytics YOLO supports several dataset formats for instance segmentation, with the primary format being its own Ultralytics YOLO format. Each image in your dataset needs a corresponding text file with object information segmented into multiple rows (one row per object), listing the class index and normalized bounding coordinates. For more detailed instructions on the YOLO dataset format, visit the [Instance Segmentation Datasets Overview](#instance-segmentation-datasets-overview).
|
||||||
|
|
||||||
|
### How can I convert COCO dataset annotations to the YOLO format?
|
||||||
|
|
||||||
|
Converting COCO format annotations to YOLO format is straightforward using Ultralytics tools. You can use the `convert_coco` function from the `ultralytics.data.converter` module:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.converter import convert_coco
|
||||||
|
|
||||||
|
convert_coco(labels_dir="path/to/coco/annotations/", use_segments=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
This script converts your COCO dataset annotations to the required YOLO format, making it suitable for training your YOLO models. For more details, refer to [Port or Convert Label Formats](#coco-dataset-format-to-yolo-format).
|
||||||
|
|
||||||
|
### How do I prepare a YAML file for training Ultralytics YOLO models?
|
||||||
|
|
||||||
|
To prepare a YAML file for training YOLO models with Ultralytics, you need to define the dataset paths and class names. Here's an example YAML configuration:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/coco8-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ensure you update the paths and class names according to your dataset. For more information, check the [Dataset YAML Format](#dataset-yaml-format) section.
|
||||||
|
|
||||||
|
### What is the auto-annotation feature in Ultralytics YOLO?
|
||||||
|
|
||||||
|
Auto-annotation in Ultralytics YOLO allows you to generate segmentation annotations for your dataset using a pretrained detection model. This significantly reduces the need for manual labeling. You can use the `auto_annotate` function as follows:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.annotator import auto_annotate
|
||||||
|
|
||||||
|
auto_annotate(data="path/to/images", det_model="yolo26x.pt", sam_model="sam_b.pt") # or sam_model="mobile_sam.pt"
|
||||||
|
```
|
||||||
|
|
||||||
|
This function automates the annotation process, making it faster and more efficient. For more details, explore the [Auto-Annotate Reference](https://docs.ultralytics.com/reference/data/annotator/#ultralytics.data.annotator.auto_annotate).
|
||||||
163
docs/en/datasets/segment/package-seg.md
Executable file
163
docs/en/datasets/segment/package-seg.md
Executable file
@@ -0,0 +1,163 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Explore the Package Segmentation Dataset. Optimize logistics and enhance vision models with curated images for package identification and sorting.
|
||||||
|
keywords: Package Segmentation Dataset, computer vision, package identification, logistics, warehouse automation, segmentation models, training data, Ultralytics YOLO
|
||||||
|
---
|
||||||
|
|
||||||
|
# Package Segmentation Dataset
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-train-ultralytics-yolo-on-package-segmentation-dataset.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Package Segmentation Dataset In Colab"></a>
|
||||||
|
|
||||||
|
The Package Segmentation Dataset is a curated collection of images specifically tailored for tasks related to package segmentation within the field of [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv). This dataset is designed to assist researchers, developers, and enthusiasts working on projects involving package identification, sorting, and handling, primarily focusing on [image segmentation](https://www.ultralytics.com/glossary/image-segmentation) tasks.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/im7xBCnPURg"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Train Package Segmentation Model using Ultralytics YOLO26 | Industrial Packages 🎉
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Containing a diverse set of images showcasing various packages in different contexts and environments, the dataset serves as a valuable resource for training and evaluating segmentation models. Whether you are engaged in logistics, warehouse automation, or any application requiring precise package analysis, the Package Segmentation Dataset provides a targeted and comprehensive set of images to enhance the performance of your computer vision algorithms. Explore more datasets for segmentation tasks on our [datasets overview page](https://docs.ultralytics.com/datasets/segment/).
|
||||||
|
|
||||||
|
## Dataset Structure
|
||||||
|
|
||||||
|
The distribution of data in the Package Segmentation Dataset is structured as follows:
|
||||||
|
|
||||||
|
- **Training set**: Encompasses 1920 images accompanied by their corresponding annotations.
|
||||||
|
- **Testing set**: Consists of 89 images, each paired with its respective annotations.
|
||||||
|
- **Validation set**: Comprises 188 images, each with corresponding annotations.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Package segmentation, facilitated by the Package Segmentation Dataset, is crucial for optimizing logistics, enhancing last-mile delivery, improving manufacturing quality control, and contributing to smart city solutions. From e-commerce to security applications, this dataset is a key resource, fostering innovation in computer vision for diverse and efficient package analysis applications.
|
||||||
|
|
||||||
|
### Smart Warehouses and Logistics
|
||||||
|
|
||||||
|
In modern warehouses, [vision AI solutions](https://www.ultralytics.com/solutions) can streamline operations by automating package identification and sorting. Computer vision models trained on this dataset can quickly detect and segment packages in real-time, even in challenging environments with dim lighting or cluttered spaces. This leads to faster processing times, reduced errors, and improved overall efficiency in [logistics operations](https://www.ultralytics.com/blog/ultralytics-yolo11-the-key-to-computer-vision-in-logistics).
|
||||||
|
|
||||||
|
### Quality Control and Damage Detection
|
||||||
|
|
||||||
|
Package segmentation models can be used to identify damaged packages by analyzing their shape and appearance. By detecting irregularities or deformations in package outlines, these models help ensure that only intact packages proceed through the supply chain, reducing customer complaints and return rates. This is a key aspect of [quality control in manufacturing](https://www.ultralytics.com/blog/improving-manufacturing-with-computer-vision) and is vital for maintaining product integrity.
|
||||||
|
|
||||||
|
## Dataset YAML
|
||||||
|
|
||||||
|
A YAML (Yet Another Markup Language) file defines the dataset configuration, including paths, classes, and other essential details. For the Package Segmentation dataset, the `package-seg.yaml` file is maintained at [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/package-seg.yaml](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/package-seg.yaml).
|
||||||
|
|
||||||
|
!!! example "ultralytics/cfg/datasets/package-seg.yaml"
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--8<-- "ultralytics/cfg/datasets/package-seg.yaml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To train an [Ultralytics YOLO26n](https://docs.ultralytics.com/models/yolo26/) model on the Package Segmentation dataset for 100 [epochs](https://www.ultralytics.com/glossary/epoch) with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model [Training page](../../modes/train.md).
|
||||||
|
|
||||||
|
!!! example "Train Example"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt") # load a pretrained segmentation model (recommended for training)
|
||||||
|
|
||||||
|
# Train the model on the Package Segmentation dataset
|
||||||
|
results = model.train(data="package-seg.yaml", epochs=100, imgsz=640)
|
||||||
|
|
||||||
|
# Validate the model
|
||||||
|
results = model.val()
|
||||||
|
|
||||||
|
# Perform inference on an image
|
||||||
|
results = model("path/to/image.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Load a pretrained segmentation model and start training
|
||||||
|
yolo segment train data=package-seg.yaml model=yolo26n-seg.pt epochs=100 imgsz=640
|
||||||
|
|
||||||
|
# Resume training from the last checkpoint
|
||||||
|
yolo segment train data=package-seg.yaml model=path/to/last.pt resume=True
|
||||||
|
|
||||||
|
# Validate the trained model
|
||||||
|
yolo segment val data=package-seg.yaml model=path/to/best.pt
|
||||||
|
|
||||||
|
# Perform inference using the trained model
|
||||||
|
yolo segment predict model=path/to/best.pt source=path/to/image.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sample Data and Annotations
|
||||||
|
|
||||||
|
The Package Segmentation dataset comprises a varied collection of images captured from multiple perspectives. Below are instances of data from the dataset, accompanied by their respective segmentation masks:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- This image displays an instance of package segmentation, featuring annotated masks outlining recognized package objects. The dataset incorporates a diverse collection of images taken in different locations, environments, and densities. It serves as a comprehensive resource for developing models specific to this [segmentation task](https://docs.ultralytics.com/tasks/segment/).
|
||||||
|
- The example emphasizes the diversity and complexity present in the dataset, underscoring the significance of high-quality data for computer vision tasks involving package segmentation.
|
||||||
|
|
||||||
|
## Benefits of Using YOLO26 for Package Segmentation
|
||||||
|
|
||||||
|
[Ultralytics YOLO26](https://docs.ultralytics.com/models/yolo26/) offers several advantages for package segmentation tasks:
|
||||||
|
|
||||||
|
1. **Speed and Accuracy Balance**: YOLO26 achieves high precision and efficiency, making it ideal for [real-time inference](https://www.ultralytics.com/glossary/real-time-inference) in fast-paced logistics environments. It provides a strong balance compared to models like [YOLOv8](https://docs.ultralytics.com/models/yolov8/).
|
||||||
|
|
||||||
|
2. **Adaptability**: Models trained with YOLO26 can adapt to various warehouse conditions, from dim lighting to cluttered spaces, ensuring robust performance.
|
||||||
|
|
||||||
|
3. **Scalability**: During peak periods like holiday seasons, YOLO26 models can efficiently scale to handle increased package volumes without compromising performance or [accuracy](https://www.ultralytics.com/glossary/accuracy).
|
||||||
|
|
||||||
|
4. **Integration Capabilities**: YOLO26 can be easily integrated with existing warehouse management systems and deployed across various platforms using formats like [ONNX](https://docs.ultralytics.com/integrations/onnx/) or [TensorRT](https://docs.ultralytics.com/integrations/tensorrt/), facilitating end-to-end automated solutions.
|
||||||
|
|
||||||
|
## Citations and Acknowledgments
|
||||||
|
|
||||||
|
If you integrate the Package Segmentation dataset into your research or development initiatives, please cite the source appropriately:
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
=== "BibTeX"
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{ factory_package_dataset,
|
||||||
|
title = { factory_package Dataset },
|
||||||
|
type = { Open Source Dataset },
|
||||||
|
author = { factorypackage },
|
||||||
|
url = { https://universe.roboflow.com/factorypackage/factory_package },
|
||||||
|
year = { 2024 },
|
||||||
|
month = { jan },
|
||||||
|
note = { visited on 2024-01-24 },
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We express our gratitude to the creators of the Package Segmentation dataset for their contribution to the computer vision community. For further exploration of datasets and model training, consider visiting our [Ultralytics Datasets](https://docs.ultralytics.com/datasets/) page and our guide on [model training tips](https://docs.ultralytics.com/guides/model-training-tips/).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the Package Segmentation Dataset and how can it help in computer vision projects?
|
||||||
|
|
||||||
|
- The Package Segmentation Dataset is a curated collection of images tailored for tasks involving package [image segmentation](https://www.ultralytics.com/glossary/image-segmentation). It includes diverse images of packages in various contexts, making it invaluable for training and evaluating segmentation models. This dataset is particularly useful for applications in logistics, warehouse automation, and any project requiring precise package analysis.
|
||||||
|
|
||||||
|
### How do I train an Ultralytics YOLO26 model on the Package Segmentation Dataset?
|
||||||
|
|
||||||
|
- You can train an [Ultralytics YOLO26](https://docs.ultralytics.com/models/yolo26/) model using both Python and CLI methods. Use the code snippets provided in the [Usage](#usage) section. Refer to the model [Training page](../../modes/train.md) for more details on arguments and configurations.
|
||||||
|
|
||||||
|
### What are the components of the Package Segmentation Dataset, and how is it structured?
|
||||||
|
|
||||||
|
- The dataset is structured into three main components:
|
||||||
|
- **Training set**: Contains 1920 images with annotations.
|
||||||
|
- **Testing set**: Comprises 89 images with corresponding annotations.
|
||||||
|
- **Validation set**: Includes 188 images with annotations.
|
||||||
|
- This structure ensures a balanced dataset for thorough model training, validation, and testing, following best practices outlined in [model evaluation guides](https://docs.ultralytics.com/guides/model-evaluation-insights/).
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 with the Package Segmentation Dataset?
|
||||||
|
|
||||||
|
- Ultralytics YOLO26 provides state-of-the-art [accuracy](https://www.ultralytics.com/glossary/accuracy) and speed for real-time [object detection](https://www.ultralytics.com/glossary/object-detection) and segmentation tasks. Using it with the Package Segmentation Dataset allows you to leverage YOLO26's capabilities for precise package segmentation, which is especially beneficial for industries like [logistics](https://www.ultralytics.com/blog/ultralytics-yolo11-the-key-to-computer-vision-in-logistics) and warehouse automation.
|
||||||
|
|
||||||
|
### How can I access and use the package-seg.yaml file for the Package Segmentation Dataset?
|
||||||
|
|
||||||
|
- The `package-seg.yaml` file is hosted on Ultralytics' GitHub repository and contains essential information about the dataset's paths, classes, and configuration. You can view or download it at <https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/package-seg.yaml>. This file is crucial for configuring your models to utilize the dataset efficiently. For more insights and practical examples, explore our [Python Usage](https://docs.ultralytics.com/usage/python/) section.
|
||||||
142
docs/en/datasets/track/index.md
Executable file
142
docs/en/datasets/track/index.md
Executable file
@@ -0,0 +1,142 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to use Multi-Object Tracking with YOLO. Explore dataset formats, tracking algorithms, and implementation examples using Python or CLI for real-time object tracking.
|
||||||
|
keywords: YOLO, Multi-Object Tracking, Tracking Datasets, Python Tracking Example, CLI Tracking Example, Object Detection, Ultralytics, AI, Machine Learning, BoT-SORT, ByteTrack
|
||||||
|
---
|
||||||
|
|
||||||
|
# Multi-object Tracking Datasets Overview
|
||||||
|
|
||||||
|
Multi-object tracking is a critical component in video analytics that identifies objects and maintains unique IDs for each detected object across video frames. Ultralytics YOLO provides powerful tracking capabilities that can be applied to various domains including surveillance, sports analytics, and traffic monitoring.
|
||||||
|
|
||||||
|
## Dataset Format (Coming Soon)
|
||||||
|
|
||||||
|
Ultralytics tracking currently reuses detection, segmentation, or pose models without requiring tracker-specific training. Native tracker-training support is under active development.
|
||||||
|
|
||||||
|
## Available Trackers
|
||||||
|
|
||||||
|
Ultralytics YOLO supports the following tracking algorithms:
|
||||||
|
|
||||||
|
- [BoT-SORT](https://github.com/NirAharon/BoT-SORT) - Use `botsort.yaml` to enable this tracker (default)
|
||||||
|
- [ByteTrack](https://github.com/FoundationVision/ByteTrack) - Use `bytetrack.yaml` to enable this tracker
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo track model=yolo26n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
|
||||||
|
```
|
||||||
|
|
||||||
|
## Persisting Tracks Between Frames
|
||||||
|
|
||||||
|
For continuous tracking across video frames, you can use the `persist=True` parameter:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load the YOLO model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Open the video file
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
|
||||||
|
while cap.isOpened():
|
||||||
|
success, frame = cap.read()
|
||||||
|
if success:
|
||||||
|
# Run tracking with persistence between frames
|
||||||
|
results = model.track(frame, persist=True)
|
||||||
|
|
||||||
|
# Visualize the results
|
||||||
|
annotated_frame = results[0].plot()
|
||||||
|
cv2.imshow("Tracking", annotated_frame)
|
||||||
|
|
||||||
|
if cv2.waitKey(1) & 0xFF == ord("q"):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I use Multi-Object Tracking with Ultralytics YOLO?
|
||||||
|
|
||||||
|
To use Multi-Object Tracking with Ultralytics YOLO, you can start by using the Python or CLI examples provided. Here is how you can get started:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt") # Load the YOLO26 model
|
||||||
|
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo track model=yolo26n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
|
||||||
|
```
|
||||||
|
|
||||||
|
These commands load the YOLO26 model and use it for tracking objects in the given video source with specific confidence (`conf`) and [Intersection over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) (`iou`) thresholds. For more details, refer to the [track mode documentation](../../modes/track.md).
|
||||||
|
|
||||||
|
### What are the upcoming features for training trackers in Ultralytics?
|
||||||
|
|
||||||
|
Ultralytics is continuously enhancing its AI models. An upcoming feature will enable the training of standalone trackers. Until then, Multi-Object Detector leverages pretrained detection, segmentation, or Pose models for tracking without requiring standalone training. Stay updated by following our [blog](https://www.ultralytics.com/blog) or checking the [upcoming features](../../reference/trackers/track.md).
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO for multi-object tracking?
|
||||||
|
|
||||||
|
Ultralytics YOLO is a state-of-the-art [object detection](https://www.ultralytics.com/glossary/object-detection) model known for its real-time performance and high [accuracy](https://www.ultralytics.com/glossary/accuracy). Using YOLO for multi-object tracking provides several advantages:
|
||||||
|
|
||||||
|
- **Real-time tracking:** Achieve efficient and high-speed tracking ideal for dynamic environments.
|
||||||
|
- **Flexibility with pretrained models:** No need to train from scratch; simply use pretrained detection, segmentation, or Pose models.
|
||||||
|
- **Ease of use:** Simple API integration with both Python and CLI makes setting up tracking pipelines straightforward.
|
||||||
|
- **Extensive documentation and community support:** Ultralytics provides comprehensive documentation and an active community forum to troubleshoot issues and enhance your tracking models.
|
||||||
|
|
||||||
|
For more details on setting up and using YOLO for tracking, visit our [track usage guide](../../modes/track.md).
|
||||||
|
|
||||||
|
### Can I use custom datasets for multi-object tracking with Ultralytics YOLO?
|
||||||
|
|
||||||
|
Yes, you can use custom datasets for multi-object tracking with Ultralytics YOLO. While support for standalone tracker training is an upcoming feature, you can already use pretrained models on your custom datasets. Prepare your datasets in the appropriate format compatible with YOLO and follow the documentation to integrate them.
|
||||||
|
|
||||||
|
### How do I interpret the results from the Ultralytics YOLO tracking model?
|
||||||
|
|
||||||
|
After running a tracking job with Ultralytics YOLO, the results include various data points such as tracked object IDs, their bounding boxes, and the confidence scores. Here's a brief overview of how to interpret these results:
|
||||||
|
|
||||||
|
- **Tracked IDs:** Each object is assigned a unique ID, which helps in tracking it across frames.
|
||||||
|
- **Bounding boxes:** These indicate the location of tracked objects within the frame.
|
||||||
|
- **Confidence scores:** These reflect the model's confidence in detecting the tracked object.
|
||||||
|
|
||||||
|
For detailed guidance on interpreting and visualizing these results, refer to the [results handling guide](../../reference/engine/results.md).
|
||||||
|
|
||||||
|
### How can I customize the tracker configuration?
|
||||||
|
|
||||||
|
You can customize the tracker by creating a modified version of the tracker configuration file. Copy an existing tracker config file from [ultralytics/cfg/trackers](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/trackers), modify the parameters as needed, and specify this file when running the tracker:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
results = model.track(source="video.mp4", tracker="custom_tracker.yaml")
|
||||||
|
```
|
||||||
330
docs/en/guides/analytics.md
Executable file
330
docs/en/guides/analytics.md
Executable file
@@ -0,0 +1,330 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn to create line graphs, bar plots, and pie charts using Python with guided instructions and code snippets. Maximize your data visualization skills!
|
||||||
|
keywords: Ultralytics, YOLO26, data visualization, line graphs, bar plots, pie charts, Python, analytics, tutorial, guide
|
||||||
|
---
|
||||||
|
|
||||||
|
# Analytics using Ultralytics YOLO26
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This guide provides a comprehensive overview of three fundamental types of [data visualizations](https://www.ultralytics.com/glossary/data-visualization): line graphs, bar plots, and pie charts. Each section includes step-by-step instructions and code snippets on how to create these visualizations using Python.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/tVuLIMt4DMY"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to generate Analytical Graphs using Ultralytics | Line Graphs, Bar Plots, Area and Pie Charts
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Visual Samples
|
||||||
|
|
||||||
|
| Line Graph | Bar Plot | Pie Chart |
|
||||||
|
| :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
### Why Graphs are Important
|
||||||
|
|
||||||
|
- Line graphs are ideal for tracking changes over short and long periods and for comparing changes for multiple groups over the same period.
|
||||||
|
- Bar plots, on the other hand, are suitable for comparing quantities across different categories and showing relationships between a category and its numerical value.
|
||||||
|
- Lastly, pie charts are effective for illustrating proportions among categories and showing parts of a whole.
|
||||||
|
|
||||||
|
!!! example "Analytics using Ultralytics YOLO"
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo solutions analytics show=True
|
||||||
|
|
||||||
|
# Pass the source
|
||||||
|
yolo solutions analytics source="path/to/video.mp4"
|
||||||
|
|
||||||
|
# Generate the pie chart
|
||||||
|
yolo solutions analytics analytics_type="pie" show=True
|
||||||
|
|
||||||
|
# Generate the bar plots
|
||||||
|
yolo solutions analytics analytics_type="bar" show=True
|
||||||
|
|
||||||
|
# Generate the area plots
|
||||||
|
yolo solutions analytics analytics_type="area" show=True
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
# Video writer
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
out = cv2.VideoWriter(
|
||||||
|
"analytics_output.avi",
|
||||||
|
cv2.VideoWriter_fourcc(*"MJPG"),
|
||||||
|
fps,
|
||||||
|
(1280, 720), # this is fixed
|
||||||
|
)
|
||||||
|
|
||||||
|
# Initialize analytics object
|
||||||
|
analytics = solutions.Analytics(
|
||||||
|
show=True, # display the output
|
||||||
|
analytics_type="line", # pass the analytics type, could be "pie", "bar" or "area".
|
||||||
|
model="yolo26n.pt", # path to the YOLO26 model file
|
||||||
|
# classes=[0, 2], # display analytics for specific detection classes
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process video
|
||||||
|
frame_count = 0
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if success:
|
||||||
|
frame_count += 1
|
||||||
|
results = analytics(im0, frame_count) # update analytics graph every frame
|
||||||
|
|
||||||
|
# print(results) # access the output
|
||||||
|
|
||||||
|
out.write(results.plot_im) # write the video file
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
out.release()
|
||||||
|
cv2.destroyAllWindows() # destroy all opened windows
|
||||||
|
```
|
||||||
|
|
||||||
|
### `Analytics` Arguments
|
||||||
|
|
||||||
|
Here's a table outlining the Analytics arguments:
|
||||||
|
|
||||||
|
{% from "macros/solutions-args.md" import param_table %}
|
||||||
|
{{ param_table(["model", "analytics_type"]) }}
|
||||||
|
|
||||||
|
You can also leverage different [`track`](../modes/track.md) arguments in the `Analytics` solution.
|
||||||
|
|
||||||
|
{% from "macros/track-args.md" import param_table %}
|
||||||
|
{{ param_table(["tracker", "conf", "iou", "classes", "verbose", "device"]) }}
|
||||||
|
|
||||||
|
Additionally, the following visualization arguments are supported:
|
||||||
|
|
||||||
|
{% from "macros/visualization-args.md" import param_table %}
|
||||||
|
{{ param_table(["show", "line_width"]) }}
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
Understanding when and how to use different types of visualizations is crucial for effective data analysis. Line graphs, bar plots, and pie charts are fundamental tools that can help you convey your data's story more clearly and effectively. The Ultralytics YOLO26 Analytics solution provides a streamlined way to generate these visualizations from your [object detection](https://www.ultralytics.com/glossary/object-detection) and tracking results, making it easier to extract meaningful insights from your visual data.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I create a line graph using Ultralytics YOLO26 Analytics?
|
||||||
|
|
||||||
|
To create a line graph using Ultralytics YOLO26 Analytics, follow these steps:
|
||||||
|
|
||||||
|
1. Load a YOLO26 model and open your video file.
|
||||||
|
2. Initialize the `Analytics` class with the type set to "line."
|
||||||
|
3. Iterate through video frames, updating the line graph with relevant data, such as object counts per frame.
|
||||||
|
4. Save the output video displaying the line graph.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
|
||||||
|
out = cv2.VideoWriter(
|
||||||
|
"ultralytics_analytics.avi",
|
||||||
|
cv2.VideoWriter_fourcc(*"MJPG"),
|
||||||
|
fps,
|
||||||
|
(1280, 720), # this is fixed
|
||||||
|
)
|
||||||
|
|
||||||
|
analytics = solutions.Analytics(
|
||||||
|
analytics_type="line",
|
||||||
|
show=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
frame_count = 0
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if success:
|
||||||
|
frame_count += 1
|
||||||
|
results = analytics(im0, frame_count) # update analytics graph every frame
|
||||||
|
out.write(results.plot_im) # write the video file
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
out.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
For further details on configuring the `Analytics` class, visit the [Analytics using Ultralytics YOLO26](#analytics-using-ultralytics-yolo26) section.
|
||||||
|
|
||||||
|
### What are the benefits of using Ultralytics YOLO26 for creating bar plots?
|
||||||
|
|
||||||
|
Using Ultralytics YOLO26 for creating bar plots offers several benefits:
|
||||||
|
|
||||||
|
1. **Real-time Data Visualization**: Seamlessly integrate [object detection](https://www.ultralytics.com/glossary/object-detection) results into bar plots for dynamic updates.
|
||||||
|
2. **Ease of Use**: Simple API and functions make it straightforward to implement and visualize data.
|
||||||
|
3. **Customization**: Customize titles, labels, colors, and more to fit your specific requirements.
|
||||||
|
4. **Efficiency**: Efficiently handle large amounts of data and update plots in real-time during video processing.
|
||||||
|
|
||||||
|
Use the following example to generate a bar plot:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
|
||||||
|
out = cv2.VideoWriter(
|
||||||
|
"ultralytics_analytics.avi",
|
||||||
|
cv2.VideoWriter_fourcc(*"MJPG"),
|
||||||
|
fps,
|
||||||
|
(1280, 720), # this is fixed
|
||||||
|
)
|
||||||
|
|
||||||
|
analytics = solutions.Analytics(
|
||||||
|
analytics_type="bar",
|
||||||
|
show=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
frame_count = 0
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if success:
|
||||||
|
frame_count += 1
|
||||||
|
results = analytics(im0, frame_count) # update analytics graph every frame
|
||||||
|
out.write(results.plot_im) # write the video file
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
out.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
To learn more, visit the [Bar Plot](#visual-samples) section in the guide.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 for creating pie charts in my data visualization projects?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 is an excellent choice for creating pie charts because:
|
||||||
|
|
||||||
|
1. **Integration with Object Detection**: Directly integrate object detection results into pie charts for immediate insights.
|
||||||
|
2. **User-Friendly API**: Simple to set up and use with minimal code.
|
||||||
|
3. **Customizable**: Various customization options for colors, labels, and more.
|
||||||
|
4. **Real-time Updates**: Handle and visualize data in real-time, which is ideal for video analytics projects.
|
||||||
|
|
||||||
|
Here's a quick example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
|
||||||
|
out = cv2.VideoWriter(
|
||||||
|
"ultralytics_analytics.avi",
|
||||||
|
cv2.VideoWriter_fourcc(*"MJPG"),
|
||||||
|
fps,
|
||||||
|
(1280, 720), # this is fixed
|
||||||
|
)
|
||||||
|
|
||||||
|
analytics = solutions.Analytics(
|
||||||
|
analytics_type="pie",
|
||||||
|
show=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
frame_count = 0
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if success:
|
||||||
|
frame_count += 1
|
||||||
|
results = analytics(im0, frame_count) # update analytics graph every frame
|
||||||
|
out.write(results.plot_im) # write the video file
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
out.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, refer to the [Pie Chart](#visual-samples) section in the guide.
|
||||||
|
|
||||||
|
### Can Ultralytics YOLO26 be used to track objects and dynamically update visualizations?
|
||||||
|
|
||||||
|
Yes, Ultralytics YOLO26 can be used to track objects and dynamically update visualizations. It supports tracking multiple objects in real-time and can update various visualizations like line graphs, bar plots, and pie charts based on the tracked objects' data.
|
||||||
|
|
||||||
|
Example for tracking and updating a line graph:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
|
||||||
|
out = cv2.VideoWriter(
|
||||||
|
"ultralytics_analytics.avi",
|
||||||
|
cv2.VideoWriter_fourcc(*"MJPG"),
|
||||||
|
fps,
|
||||||
|
(1280, 720), # this is fixed
|
||||||
|
)
|
||||||
|
|
||||||
|
analytics = solutions.Analytics(
|
||||||
|
analytics_type="line",
|
||||||
|
show=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
frame_count = 0
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if success:
|
||||||
|
frame_count += 1
|
||||||
|
results = analytics(im0, frame_count) # update analytics graph every frame
|
||||||
|
out.write(results.plot_im) # write the video file
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
out.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
To learn about the complete functionality, see the [Tracking](../modes/track.md) section.
|
||||||
|
|
||||||
|
### What makes Ultralytics YOLO26 different from other object detection solutions like [OpenCV](https://www.ultralytics.com/glossary/opencv) and [TensorFlow](https://www.ultralytics.com/glossary/tensorflow)?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 stands out from other object detection solutions like OpenCV and TensorFlow for multiple reasons:
|
||||||
|
|
||||||
|
1. **State-of-the-art [Accuracy](https://www.ultralytics.com/glossary/accuracy)**: YOLO26 provides superior accuracy in object detection, segmentation, and classification tasks.
|
||||||
|
2. **Ease of Use**: User-friendly API allows for quick implementation and integration without extensive coding.
|
||||||
|
3. **Real-time Performance**: Optimized for high-speed inference, suitable for real-time applications.
|
||||||
|
4. **Diverse Applications**: Supports various tasks including multi-object tracking, custom model training, and exporting to different formats like ONNX, TensorRT, and CoreML.
|
||||||
|
5. **Comprehensive Documentation**: Extensive [documentation](https://docs.ultralytics.com/) and [blog resources](https://www.ultralytics.com/blog) to guide users through every step.
|
||||||
|
|
||||||
|
For more detailed comparisons and use cases, explore our [Ultralytics Blog](https://www.ultralytics.com/blog/ai-use-cases-transforming-your-future).
|
||||||
227
docs/en/guides/azureml-quickstart.md
Executable file
227
docs/en/guides/azureml-quickstart.md
Executable file
@@ -0,0 +1,227 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to run YOLO26 on AzureML. Quickstart instructions for terminal and notebooks to harness Azure's cloud computing for efficient model training.
|
||||||
|
keywords: YOLO26, AzureML, machine learning, cloud computing, quickstart, terminal, notebooks, model training, Python SDK, AI, Ultralytics
|
||||||
|
---
|
||||||
|
|
||||||
|
# YOLO26 🚀 on AzureML
|
||||||
|
|
||||||
|
## What is Azure?
|
||||||
|
|
||||||
|
[Azure](https://azure.microsoft.com/) is Microsoft's [cloud computing](https://www.ultralytics.com/glossary/cloud-computing) platform, designed to help organizations move their workloads to the cloud from on-premises data centers. With the full spectrum of cloud services including those for computing, databases, analytics, [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml), and networking, users can pick and choose from these services to develop and scale new applications, or run existing applications, in the public cloud.
|
||||||
|
|
||||||
|
## What is Azure Machine Learning (AzureML)?
|
||||||
|
|
||||||
|
Azure Machine Learning, commonly referred to as AzureML, is a fully managed cloud service that enables data scientists and developers to efficiently embed predictive analytics into their applications, helping organizations use massive data sets and bring all the benefits of the cloud to machine learning. AzureML offers a variety of services and capabilities aimed at making machine learning accessible, easy to use, and scalable. It provides capabilities like automated machine learning, drag-and-drop model training, as well as a robust Python SDK so that developers can make the most out of their machine learning models.
|
||||||
|
|
||||||
|
## How Does AzureML Benefit YOLO Users?
|
||||||
|
|
||||||
|
For users of YOLO (You Only Look Once), AzureML provides a robust, scalable, and efficient platform to both train and deploy machine learning models. Whether you are looking to run quick prototypes or scale up to handle more extensive data, AzureML's flexible and user-friendly environment offers various tools and services to fit your needs. You can leverage AzureML to:
|
||||||
|
|
||||||
|
- Easily manage large datasets and computational resources for training.
|
||||||
|
- Utilize built-in tools for data preprocessing, feature selection, and model training.
|
||||||
|
- Collaborate more efficiently with capabilities for MLOps (Machine Learning Operations), including but not limited to monitoring, auditing, and versioning of models and data.
|
||||||
|
|
||||||
|
In the subsequent sections, you will find a quickstart guide detailing how to run YOLO26 object detection models using AzureML, either from a compute terminal or a notebook.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before you can get started, make sure you have access to an AzureML workspace. If you don't have one, you can create a new [AzureML workspace](https://learn.microsoft.com/azure/machine-learning/concept-workspace?view=azureml-api-2) by following Azure's official documentation. This workspace acts as a centralized place to manage all AzureML resources.
|
||||||
|
|
||||||
|
## Create a compute instance
|
||||||
|
|
||||||
|
From your AzureML workspace, select Compute > Compute instances > New, select the instance with the resources you need.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="1280" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/create-compute-arrow.avif" alt="Create Azure Compute Instance">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Quickstart from Terminal
|
||||||
|
|
||||||
|
Start your compute and open a Terminal:
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="480" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/open-terminal.avif" alt="Open Terminal">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Create virtualenv
|
||||||
|
|
||||||
|
Create a conda virtual environment with your preferred Python version and install pip in it. Python 3.13.1 currently has dependency issues in AzureML, so use Python 3.12 instead.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda create --name yolo26env -y python=3.12
|
||||||
|
conda activate yolo26env
|
||||||
|
conda install pip -y
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the required dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ultralytics
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install ultralytics
|
||||||
|
pip install onnx
|
||||||
|
```
|
||||||
|
|
||||||
|
### Perform YOLO26 tasks
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
|
||||||
|
```
|
||||||
|
|
||||||
|
Train a detection model for 10 [epochs](https://www.ultralytics.com/glossary/epoch) with an initial learning_rate of 0.01:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo train data=coco8.yaml model=yolo26n.pt epochs=10 lr0=0.01
|
||||||
|
```
|
||||||
|
|
||||||
|
You can find more [instructions to use the Ultralytics CLI here](../quickstart.md#use-ultralytics-with-cli).
|
||||||
|
|
||||||
|
## Quickstart from a Notebook
|
||||||
|
|
||||||
|
### Create a new IPython kernel
|
||||||
|
|
||||||
|
Open the compute Terminal.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="480" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/open-terminal.avif" alt="Open Terminal">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
From your compute terminal, create a new ipykernel using Python 3.12 that will be used by your notebook to manage dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda create --name yolo26env -y python=3.12
|
||||||
|
conda activate yolo26env
|
||||||
|
conda install pip -y
|
||||||
|
conda install ipykernel -y
|
||||||
|
python -m ipykernel install --user --name yolo26env --display-name "yolo26env"
|
||||||
|
```
|
||||||
|
|
||||||
|
Close your terminal and create a new notebook. From your notebook, select the newly created kernel.
|
||||||
|
|
||||||
|
Then open a notebook cell and install the required dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
%%bash
|
||||||
|
source activate yolo26env
|
||||||
|
cd ultralytics
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install ultralytics
|
||||||
|
pip install onnx
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that you need to run `source activate yolo26env` in every `%%bash` cell to ensure the cell uses the intended environment.
|
||||||
|
|
||||||
|
Run some predictions using the [Ultralytics CLI](../quickstart.md#use-ultralytics-with-cli):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
%%bash
|
||||||
|
source activate yolo26env
|
||||||
|
yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
|
||||||
|
```
|
||||||
|
|
||||||
|
Or with the [Ultralytics Python interface](../quickstart.md#use-ultralytics-with-python), for example to train the model:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n.pt") # load an official YOLO26n model
|
||||||
|
|
||||||
|
# Use the model
|
||||||
|
model.train(data="coco8.yaml", epochs=3) # train the model
|
||||||
|
metrics = model.val() # evaluate model performance on the validation set
|
||||||
|
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
||||||
|
path = model.export(format="onnx") # export the model to ONNX format
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use either the Ultralytics CLI or Python interface for running YOLO26 tasks, as described in the terminal section above.
|
||||||
|
|
||||||
|
By following these steps, you should be able to get YOLO26 running quickly on AzureML for quick trials. For more advanced uses, you may refer to the full AzureML documentation linked at the beginning of this guide.
|
||||||
|
|
||||||
|
## Explore More with AzureML
|
||||||
|
|
||||||
|
This guide serves as an introduction to get you up and running with YOLO26 on AzureML. However, it only scratches the surface of what AzureML can offer. To delve deeper and unlock the full potential of AzureML for your machine learning projects, consider exploring the following resources:
|
||||||
|
|
||||||
|
- [Create a Data Asset](https://learn.microsoft.com/azure/machine-learning/how-to-create-data-assets): Learn how to set up and manage your data assets effectively within the AzureML environment.
|
||||||
|
- [Initiate an AzureML Job](https://learn.microsoft.com/azure/machine-learning/how-to-train-model): Get a comprehensive understanding of how to kickstart your machine learning training jobs on AzureML.
|
||||||
|
- [Register a Model](https://learn.microsoft.com/azure/machine-learning/how-to-manage-models): Familiarize yourself with model management practices including registration, versioning, and deployment.
|
||||||
|
- [Train YOLO26 with AzureML Python SDK](https://medium.com/@ouphi/how-to-train-the-yolov8-model-with-azure-machine-learning-python-sdk-8268696be8ba): Explore a step-by-step guide on using the AzureML Python SDK to train your YOLO26 models.
|
||||||
|
- [Train YOLO26 with AzureML CLI](https://medium.com/@ouphi/how-to-train-the-yolov8-model-with-azureml-and-the-az-cli-73d3c870ba8e): Discover how to utilize the command-line interface for streamlined training and management of YOLO26 models on AzureML.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I run YOLO26 on AzureML for model training?
|
||||||
|
|
||||||
|
Running YOLO26 on AzureML for model training involves several steps:
|
||||||
|
|
||||||
|
1. **Create a Compute Instance**: From your AzureML workspace, navigate to Compute > Compute instances > New, and select the required instance.
|
||||||
|
|
||||||
|
2. **Set Up the Environment**: Start your compute instance, open a terminal, and create a Conda environment. Set your Python version (Python 3.13.1 is not supported yet):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda create --name yolo26env -y python=3.12
|
||||||
|
conda activate yolo26env
|
||||||
|
conda install pip -y
|
||||||
|
pip install ultralytics onnx
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Run YOLO26 Tasks**: Use the Ultralytics CLI to train your model:
|
||||||
|
```bash
|
||||||
|
yolo train data=coco8.yaml model=yolo26n.pt epochs=10 lr0=0.01
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, you can refer to the [instructions to use the Ultralytics CLI](../quickstart.md#use-ultralytics-with-cli).
|
||||||
|
|
||||||
|
### What are the benefits of using AzureML for YOLO26 training?
|
||||||
|
|
||||||
|
AzureML provides a robust and efficient ecosystem for training YOLO26 models:
|
||||||
|
|
||||||
|
- **Scalability**: Easily scale your compute resources as your data and model complexity grows.
|
||||||
|
- **MLOps Integration**: Utilize features like versioning, monitoring, and auditing to streamline ML operations.
|
||||||
|
- **Collaboration**: Share and manage resources within teams, enhancing collaborative workflows.
|
||||||
|
|
||||||
|
These advantages make AzureML an ideal platform for projects ranging from quick prototypes to large-scale deployments. For more tips, check out [AzureML Jobs](https://learn.microsoft.com/azure/machine-learning/how-to-train-model).
|
||||||
|
|
||||||
|
### How do I troubleshoot common issues when running YOLO26 on AzureML?
|
||||||
|
|
||||||
|
Troubleshooting common issues with YOLO26 on AzureML can involve the following steps:
|
||||||
|
|
||||||
|
- **Dependency Issues**: Ensure all required packages are installed. Refer to the `requirements.txt` file for dependencies.
|
||||||
|
- **Environment Setup**: Verify that your conda environment is correctly activated before running commands.
|
||||||
|
- **Resource Allocation**: Make sure your compute instances have sufficient resources to handle the training workload.
|
||||||
|
|
||||||
|
For additional guidance, review our [YOLO Common Issues](https://docs.ultralytics.com/guides/yolo-common-issues/) documentation.
|
||||||
|
|
||||||
|
### Can I use both the Ultralytics CLI and Python interface on AzureML?
|
||||||
|
|
||||||
|
Yes, AzureML allows you to use both the Ultralytics CLI and the Python interface seamlessly:
|
||||||
|
|
||||||
|
- **CLI**: Ideal for quick tasks and running standard scripts directly from the terminal.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Python Interface**: Useful for more complex tasks requiring custom coding and integration within notebooks.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=3)
|
||||||
|
```
|
||||||
|
|
||||||
|
For step-by-step instructions, refer to the [CLI quickstart guide](../quickstart.md#use-ultralytics-with-cli) and the [Python quickstart guide](../quickstart.md#use-ultralytics-with-python).
|
||||||
|
|
||||||
|
### What is the advantage of using Ultralytics YOLO26 over other [object detection](https://www.ultralytics.com/glossary/object-detection) models?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 offers several unique advantages over competing object detection models:
|
||||||
|
|
||||||
|
- **Speed**: Faster inference and training times compared to models like Faster R-CNN and SSD.
|
||||||
|
- **[Accuracy](https://www.ultralytics.com/glossary/accuracy)**: High accuracy in detection tasks with features like anchor-free design and enhanced augmentation strategies.
|
||||||
|
- **Ease of Use**: Intuitive API and CLI for quick setup, making it accessible both to beginners and experts.
|
||||||
|
|
||||||
|
To explore more about YOLO26's features, visit the [Ultralytics YOLO](https://www.ultralytics.com/yolo) page for detailed insights.
|
||||||
193
docs/en/guides/conda-quickstart.md
Executable file
193
docs/en/guides/conda-quickstart.md
Executable file
@@ -0,0 +1,193 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn to set up a Conda environment for Ultralytics projects. Follow our comprehensive guide for easy installation and initialization.
|
||||||
|
keywords: Ultralytics, Conda, setup, installation, environment, guide, machine learning, data science
|
||||||
|
---
|
||||||
|
|
||||||
|
# Conda Quickstart Guide for Ultralytics
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/ultralytics-conda-package-visual.avif" alt="Ultralytics Conda Package Visual">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This guide provides a comprehensive introduction to setting up a Conda environment for your Ultralytics projects. Conda is an open-source package and environment management system that offers an excellent alternative to pip for installing packages and dependencies. Its isolated environments make it particularly well-suited for data science and [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) endeavors. For more details, visit the Ultralytics Conda package on [Anaconda](https://anaconda.org/conda-forge/ultralytics) and check out the Ultralytics feedstock repository for package updates on [GitHub](https://github.com/conda-forge/ultralytics-feedstock/).
|
||||||
|
|
||||||
|
[](https://anaconda.org/conda-forge/ultralytics)
|
||||||
|
[](https://anaconda.org/conda-forge/ultralytics)
|
||||||
|
[](https://anaconda.org/conda-forge/ultralytics)
|
||||||
|
[](https://anaconda.org/conda-forge/ultralytics)
|
||||||
|
|
||||||
|
## What You Will Learn
|
||||||
|
|
||||||
|
- Setting up a Conda environment
|
||||||
|
- Installing Ultralytics via Conda
|
||||||
|
- Initializing Ultralytics in your environment
|
||||||
|
- Using Ultralytics Docker images with Conda
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- You should have Anaconda or Miniconda installed on your system. If not, download and install it from [Anaconda](https://www.anaconda.com/) or [Miniconda](https://www.anaconda.com/docs/main).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setting up a Conda Environment
|
||||||
|
|
||||||
|
First, let's create a new Conda environment. Open your terminal and run the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda create --name ultralytics-env python=3.11 -y
|
||||||
|
```
|
||||||
|
|
||||||
|
Activate the new environment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda activate ultralytics-env
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installing Ultralytics
|
||||||
|
|
||||||
|
You can install the Ultralytics package from the conda-forge channel. Execute the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install -c conda-forge ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
### Note on CUDA Environment
|
||||||
|
|
||||||
|
If you're working in a CUDA-enabled environment, it's a good practice to install `ultralytics`, `pytorch`, and `pytorch-cuda` together to resolve any conflicts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Using Ultralytics
|
||||||
|
|
||||||
|
With Ultralytics installed, you can now start using its robust features for [object detection](https://www.ultralytics.com/glossary/object-detection), [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), and more. For example, to predict an image, you can run:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt") # initialize model
|
||||||
|
results = model("path/to/image.jpg") # perform inference
|
||||||
|
results[0].show() # display results for the first image
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ultralytics Conda Docker Image
|
||||||
|
|
||||||
|
If you prefer using Docker, Ultralytics offers Docker images with a Conda environment included. You can pull these images from [DockerHub](https://hub.docker.com/r/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
Pull the latest Ultralytics image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set image name as a variable
|
||||||
|
t=ultralytics/ultralytics:latest-conda
|
||||||
|
|
||||||
|
# Pull the latest Ultralytics image from Docker Hub
|
||||||
|
sudo docker pull $t
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run the Ultralytics image in a container with GPU support
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all $t # all GPUs
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus '"device=2,3"' $t # specify GPUs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Speeding Up Installation with Libmamba
|
||||||
|
|
||||||
|
If you're looking to [speed up the package installation](https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community) process in Conda, you can opt to use `libmamba`, a fast, cross-platform, and dependency-aware package manager that serves as an alternative solver to Conda's default.
|
||||||
|
|
||||||
|
### How to Enable Libmamba
|
||||||
|
|
||||||
|
To enable `libmamba` as the solver for Conda, you can perform the following steps:
|
||||||
|
|
||||||
|
1. First, install the `conda-libmamba-solver` package. This can be skipped if your Conda version is 4.11 or above, as `libmamba` is included by default.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install conda-libmamba-solver
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Next, configure Conda to use `libmamba` as the solver:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda config --set solver libmamba
|
||||||
|
```
|
||||||
|
|
||||||
|
And that's it! Your Conda installation will now use `libmamba` as the solver, which should result in a faster package installation process.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You have successfully set up a Conda environment, installed the Ultralytics package, and are now ready to explore its features. For more advanced tutorials and examples, see the [Ultralytics documentation](../index.md).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the process for setting up a Conda environment for Ultralytics projects?
|
||||||
|
|
||||||
|
Setting up a Conda environment for Ultralytics projects is straightforward and ensures smooth package management. First, create a new Conda environment using the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda create --name ultralytics-env python=3.11 -y
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, activate the new environment with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda activate ultralytics-env
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, install Ultralytics from the conda-forge channel:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install -c conda-forge ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
### Why should I use Conda over pip for managing dependencies in Ultralytics projects?
|
||||||
|
|
||||||
|
Conda is a robust package and environment management system that offers several advantages over pip. It manages dependencies efficiently and ensures that all necessary libraries are compatible. Conda's isolated environments prevent conflicts between packages, which is crucial in data science and machine learning projects. Additionally, Conda supports binary package distribution, speeding up the installation process.
|
||||||
|
|
||||||
|
### Can I use Ultralytics YOLO in a CUDA-enabled environment for faster performance?
|
||||||
|
|
||||||
|
Yes, you can enhance performance by utilizing a CUDA-enabled environment. Ensure that you install `ultralytics`, `pytorch`, and `pytorch-cuda` together to avoid conflicts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
This setup enables GPU acceleration, crucial for intensive tasks like [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) model training and inference. For more information, visit the [Ultralytics installation guide](../quickstart.md).
|
||||||
|
|
||||||
|
### What are the benefits of using Ultralytics Docker images with a Conda environment?
|
||||||
|
|
||||||
|
Using Ultralytics Docker images ensures a consistent and reproducible environment, eliminating "it works on my machine" issues. These images include a pre-configured Conda environment, simplifying the setup process. You can pull and run the latest Ultralytics Docker image with the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker pull ultralytics/ultralytics:latest-conda
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all ultralytics/ultralytics:latest-conda # all GPUs
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus '"device=2,3"' ultralytics/ultralytics:latest-conda # specify GPUs
|
||||||
|
```
|
||||||
|
|
||||||
|
This approach is ideal for deploying applications in production or running complex workflows without manual configuration. Learn more about [Ultralytics Conda Docker Image](../quickstart.md).
|
||||||
|
|
||||||
|
### How can I speed up Conda package installation in my Ultralytics environment?
|
||||||
|
|
||||||
|
You can speed up the package installation process by using `libmamba`, a fast dependency solver for Conda. First, install the `conda-libmamba-solver` package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda install conda-libmamba-solver
|
||||||
|
```
|
||||||
|
|
||||||
|
Then configure Conda to use `libmamba` as the solver:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conda config --set solver libmamba
|
||||||
|
```
|
||||||
|
|
||||||
|
This setup provides faster and more efficient package management. For more tips on optimizing your environment, read about [libmamba installation](https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community).
|
||||||
287
docs/en/guides/coral-edge-tpu-on-raspberry-pi.md
Executable file
287
docs/en/guides/coral-edge-tpu-on-raspberry-pi.md
Executable file
@@ -0,0 +1,287 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to boost your Raspberry Pi's ML performance using Coral Edge TPU with Ultralytics YOLO26. Follow our detailed setup and installation guide.
|
||||||
|
keywords: Coral Edge TPU, Raspberry Pi, YOLO26, Ultralytics, TensorFlow Lite, ML inference, machine learning, AI, installation guide, setup tutorial
|
||||||
|
---
|
||||||
|
|
||||||
|
# Coral Edge TPU on a Raspberry Pi with Ultralytics YOLO26 🚀
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/edge-tpu-usb-accelerator-and-pi.avif" alt="Raspberry Pi with Edge TPU accelerator">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## What is a Coral Edge TPU?
|
||||||
|
|
||||||
|
The Coral Edge TPU is a compact device that adds an Edge TPU coprocessor to your system. It enables low-power, high-performance ML inference for [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) Lite models. Read more at the [Coral Edge TPU home page](https://developers.google.com/coral).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/w4yHORvDBw0"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Run Inference on Raspberry Pi using Google Coral Edge TPU
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Boost Raspberry Pi Model Performance with Coral Edge TPU
|
||||||
|
|
||||||
|
Many people want to run their models on an embedded or mobile device such as a Raspberry Pi, since they are very power efficient and can be used in many different applications. However, the inference performance on these devices is usually poor even when using formats like [ONNX](../integrations/onnx.md) or [OpenVINO](../integrations/openvino.md). The Coral Edge TPU is a great solution to this problem, since it can be used with a Raspberry Pi and accelerate inference performance greatly.
|
||||||
|
|
||||||
|
## Edge TPU on Raspberry Pi with TensorFlow Lite (New)⭐
|
||||||
|
|
||||||
|
The [existing guide](https://gweb-coral-full.uc.r.appspot.com/docs/accelerator/get-started/) by Coral on how to use the Edge TPU with a Raspberry Pi is outdated, and the current Coral Edge TPU runtime builds do not work with the current TensorFlow Lite runtime versions anymore. In addition to that, Google seems to have completely abandoned the Coral project, and there have not been any updates between 2021 and 2025. This guide will show you how to get the Edge TPU working with the latest versions of the TensorFlow Lite runtime and an updated Coral Edge TPU runtime on a Raspberry Pi single board computer (SBC).
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- [Raspberry Pi 4B](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/) (2GB or more recommended) or [Raspberry Pi 5](https://www.raspberrypi.com/products/raspberry-pi-5/) (Recommended)
|
||||||
|
- [Raspberry Pi OS](https://www.raspberrypi.com/software/) Bullseye/Bookworm (64-bit) with desktop (Recommended)
|
||||||
|
- [Coral USB Accelerator](https://developers.google.com/coral)
|
||||||
|
- A non-ARM based platform for exporting an Ultralytics [PyTorch](https://www.ultralytics.com/glossary/pytorch) model
|
||||||
|
|
||||||
|
## Installation Walkthrough
|
||||||
|
|
||||||
|
This guide assumes that you already have a working Raspberry Pi OS install and have installed `ultralytics` and all dependencies. To get `ultralytics` installed, visit the [quickstart guide](../quickstart.md) to get set up before continuing here.
|
||||||
|
|
||||||
|
### Installing the Edge TPU runtime
|
||||||
|
|
||||||
|
First, we need to install the Edge TPU runtime. There are many different versions available, so you need to choose the right version for your operating system.
|
||||||
|
The high-frequency version runs the Edge TPU at a higher clock speed, which improves performance. However, it might result in Edge TPU thermal throttling, so it is recommended to have some sort of cooling mechanism in place.
|
||||||
|
|
||||||
|
| Raspberry Pi OS | High frequency mode | Version to download |
|
||||||
|
| --------------- | :-----------------: | ------------------------------------------ |
|
||||||
|
| Bullseye 32bit | No | `libedgetpu1-std_ ... .bullseye_armhf.deb` |
|
||||||
|
| Bullseye 64bit | No | `libedgetpu1-std_ ... .bullseye_arm64.deb` |
|
||||||
|
| Bullseye 32bit | Yes | `libedgetpu1-max_ ... .bullseye_armhf.deb` |
|
||||||
|
| Bullseye 64bit | Yes | `libedgetpu1-max_ ... .bullseye_arm64.deb` |
|
||||||
|
| Bookworm 32bit | No | `libedgetpu1-std_ ... .bookworm_armhf.deb` |
|
||||||
|
| Bookworm 64bit | No | `libedgetpu1-std_ ... .bookworm_arm64.deb` |
|
||||||
|
| Bookworm 32bit | Yes | `libedgetpu1-max_ ... .bookworm_armhf.deb` |
|
||||||
|
| Bookworm 64bit | Yes | `libedgetpu1-max_ ... .bookworm_arm64.deb` |
|
||||||
|
|
||||||
|
[Download the latest version from here](https://github.com/feranick/libedgetpu/releases).
|
||||||
|
|
||||||
|
After downloading the file, you can install it with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i path/to/package.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
After installing the runtime, plug your Coral Edge TPU into a USB 3.0 port on the Raspberry Pi so the new `udev` rule can take effect.
|
||||||
|
|
||||||
|
???+ warning "Important"
|
||||||
|
|
||||||
|
If you already have the Coral Edge TPU runtime installed, uninstall it using the following command.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# If you installed the standard version
|
||||||
|
sudo apt remove libedgetpu1-std
|
||||||
|
|
||||||
|
# If you installed the high-frequency version
|
||||||
|
sudo apt remove libedgetpu1-max
|
||||||
|
```
|
||||||
|
|
||||||
|
## Export to Edge TPU
|
||||||
|
|
||||||
|
To use the Edge TPU, you need to convert your model into a compatible format. It is recommended that you run export on Google Colab, x86_64 Linux machine, using the official [Ultralytics Docker container](docker-quickstart.md), or using [Ultralytics Platform](../platform/quickstart.md), since the Edge TPU compiler is not available on ARM. See the [Export Mode](../modes/export.md) for the available arguments.
|
||||||
|
|
||||||
|
!!! example "Exporting the model"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/model.pt") # Load an official model or custom model
|
||||||
|
|
||||||
|
# Export the model
|
||||||
|
model.export(format="edgetpu")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model
|
||||||
|
```
|
||||||
|
|
||||||
|
The exported model will be saved in the `<model_name>_saved_model/` folder with the name `<model_name>_full_integer_quant_edgetpu.tflite`. Make sure the file name ends with the `_edgetpu.tflite` suffix; otherwise, Ultralytics will not detect that you're using an Edge TPU model.
|
||||||
|
|
||||||
|
## Running the model
|
||||||
|
|
||||||
|
Before you can actually run the model, you will need to install the correct libraries.
|
||||||
|
|
||||||
|
If you already have TensorFlow installed, uninstall it with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip uninstall tensorflow tensorflow-aarch64
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install or update `tflite-runtime`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -U tflite-runtime
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you can run inference using the following code:
|
||||||
|
|
||||||
|
!!! example "Running the model"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/<model_name>_full_integer_quant_edgetpu.tflite") # Load an official model or custom model
|
||||||
|
|
||||||
|
# Run Prediction
|
||||||
|
model.predict("path/to/source.png")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo predict model=path/to/MODEL_NAME_full_integer_quant_edgetpu.tflite source=path/to/source.png # Load an official model or custom model
|
||||||
|
```
|
||||||
|
|
||||||
|
Find comprehensive information on the [Predict](../modes/predict.md) page for full prediction mode details.
|
||||||
|
|
||||||
|
!!! note "Inference with multiple Edge TPUs"
|
||||||
|
|
||||||
|
If you have multiple Edge TPUs, you can use the following code to select a specific TPU.
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/<model_name>_full_integer_quant_edgetpu.tflite") # Load an official model or custom model
|
||||||
|
|
||||||
|
# Run Prediction
|
||||||
|
model.predict("path/to/source.png") # Inference defaults to the first TPU
|
||||||
|
|
||||||
|
model.predict("path/to/source.png", device="tpu:0") # Select the first TPU
|
||||||
|
|
||||||
|
model.predict("path/to/source.png", device="tpu:1") # Select the second TPU
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
!!! tip "Benchmarks"
|
||||||
|
|
||||||
|
Tested with Raspberry Pi OS Bookworm 64-bit and a USB Coral Edge TPU.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
Shown is the inference time, pre-/postprocessing is not included.
|
||||||
|
|
||||||
|
=== "Raspberry Pi 4B 2GB"
|
||||||
|
|
||||||
|
| Image Size | Model | Standard Inference Time (ms) | High-Frequency Inference Time (ms) |
|
||||||
|
|------------|---------|------------------------------|------------------------------------|
|
||||||
|
| 320 | YOLOv8n | 32.2 | 26.7 |
|
||||||
|
| 320 | YOLOv8s | 47.1 | 39.8 |
|
||||||
|
| 512 | YOLOv8n | 73.5 | 60.7 |
|
||||||
|
| 512 | YOLOv8s | 149.6 | 125.3 |
|
||||||
|
|
||||||
|
=== "Raspberry Pi 5 8GB"
|
||||||
|
|
||||||
|
| Image Size | Model | Standard Inference Time (ms) | High Frequency Inference Time (ms) |
|
||||||
|
|------------|---------|------------------------------|------------------------------------|
|
||||||
|
| 320 | YOLOv8n | 22.2 | 16.7 |
|
||||||
|
| 320 | YOLOv8s | 40.1 | 32.2 |
|
||||||
|
| 512 | YOLOv8n | 53.5 | 41.6 |
|
||||||
|
| 512 | YOLOv8s | 132.0 | 103.3 |
|
||||||
|
|
||||||
|
On average:
|
||||||
|
|
||||||
|
- The Raspberry Pi 5 is 22% faster with the standard mode than the Raspberry Pi 4B.
|
||||||
|
- The Raspberry Pi 5 is 30.2% faster with the high-frequency mode than the Raspberry Pi 4B.
|
||||||
|
- The high-frequency mode is 28.4% faster than the standard mode.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is a Coral Edge TPU and how does it enhance Raspberry Pi's performance with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The Coral Edge TPU is a compact device designed to add an Edge TPU coprocessor to your system. This coprocessor enables low-power, high-performance [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) inference, particularly optimized for TensorFlow Lite models. When using a Raspberry Pi, the Edge TPU accelerates ML model inference, significantly boosting performance, especially for Ultralytics YOLO26 models. You can read more about the Coral Edge TPU on their [home page](https://developers.google.com/coral).
|
||||||
|
|
||||||
|
### How do I install the Coral Edge TPU runtime on a Raspberry Pi?
|
||||||
|
|
||||||
|
To install the Coral Edge TPU runtime on your Raspberry Pi, download the appropriate `.deb` package for your Raspberry Pi OS version from [this link](https://github.com/feranick/libedgetpu/releases). Once downloaded, use the following command to install it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i path/to/package.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to uninstall any previous Coral Edge TPU runtime versions by following the steps outlined in the [Installation Walkthrough](#installation-walkthrough) section.
|
||||||
|
|
||||||
|
### Can I export my Ultralytics YOLO26 model to be compatible with Coral Edge TPU?
|
||||||
|
|
||||||
|
Yes, you can export your Ultralytics YOLO26 model to be compatible with the Coral Edge TPU. It is recommended to perform the export on Google Colab, an x86_64 Linux machine, or using the [Ultralytics Docker container](docker-quickstart.md). You can also use [Ultralytics Platform](../platform/quickstart.md) for exporting. Here is how you can export your model using Python and CLI:
|
||||||
|
|
||||||
|
!!! example "Exporting the model"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/model.pt") # Load an official model or custom model
|
||||||
|
|
||||||
|
# Export the model
|
||||||
|
model.export(format="edgetpu")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, refer to the [Export Mode](../modes/export.md) documentation.
|
||||||
|
|
||||||
|
### What should I do if TensorFlow is already installed on my Raspberry Pi, but I want to use tflite-runtime instead?
|
||||||
|
|
||||||
|
If you have TensorFlow installed on your Raspberry Pi and need to switch to `tflite-runtime`, you'll need to uninstall TensorFlow first using:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip uninstall tensorflow tensorflow-aarch64
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, install or update `tflite-runtime` with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -U tflite-runtime
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed instructions, refer to the [Running the Model](#running-the-model) section.
|
||||||
|
|
||||||
|
### How do I run inference with an exported YOLO26 model on a Raspberry Pi using the Coral Edge TPU?
|
||||||
|
|
||||||
|
After exporting your YOLO26 model to an Edge TPU-compatible format, you can run inference using the following code snippets:
|
||||||
|
|
||||||
|
!!! example "Running the model"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("path/to/edgetpu_model.tflite") # Load an official model or custom model
|
||||||
|
|
||||||
|
# Run Prediction
|
||||||
|
model.predict("path/to/source.png")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo predict model=path/to/edgetpu_model.tflite source=path/to/source.png # Load an official model or custom model
|
||||||
|
```
|
||||||
|
|
||||||
|
Comprehensive details on full prediction mode features can be found on the [Predict Page](../modes/predict.md).
|
||||||
368
docs/en/guides/custom-trainer.md
Executable file
368
docs/en/guides/custom-trainer.md
Executable file
@@ -0,0 +1,368 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to customize the Ultralytics YOLO trainer with custom metrics, class-weighted loss, custom model saving, backbone freezing, and per-layer learning rates.
|
||||||
|
keywords: Ultralytics, YOLO, Custom Trainer, DetectionTrainer, BaseTrainer, Custom Metrics, F1 Score, Class Weights, Backbone Freezing, Per-Layer Learning Rate, Fine-Tuning, Transfer Learning
|
||||||
|
---
|
||||||
|
|
||||||
|
# Customizing Trainer
|
||||||
|
|
||||||
|
The Ultralytics training pipeline is built around `BaseTrainer` and task-specific trainers like `DetectionTrainer`. These classes handle the training loop, validation, checkpointing, and logging out of the box. When you need more control — tracking custom metrics, adjusting loss weighting, or implementing learning rate schedules — you can subclass the trainer and override specific methods.
|
||||||
|
|
||||||
|
This guide walks through five common customizations:
|
||||||
|
|
||||||
|
1. [Logging custom metrics (F1 score)](#logging-custom-metrics) at the end of each [epoch](https://www.ultralytics.com/glossary/epoch)
|
||||||
|
2. [Adding class weights](#adding-class-weights) to handle class imbalance
|
||||||
|
3. [Saving the best model](#saving-the-best-model-by-custom-metric) based on a different metric
|
||||||
|
4. [Freezing the backbone](#freezing-and-unfreezing-the-backbone) for the first N epochs, then unfreezing
|
||||||
|
5. [Specifying per-layer learning rates](#per-layer-learning-rates)
|
||||||
|
|
||||||
|
!!! tip "Prerequisites"
|
||||||
|
|
||||||
|
Before reading this guide, make sure you're familiar with the basics of [training YOLO models](../modes/train.md) and the [Advanced Customization](../usage/engine.md) page, which covers the `BaseTrainer` architecture.
|
||||||
|
|
||||||
|
## How Custom Trainers Work
|
||||||
|
|
||||||
|
The `YOLO` model class accepts a `trainer` parameter in the `train()` method. This allows you to pass your own trainer class that extends the default behavior:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
|
||||||
|
|
||||||
|
class CustomTrainer(DetectionTrainer):
|
||||||
|
"""A custom trainer that extends DetectionTrainer with additional functionality."""
|
||||||
|
|
||||||
|
pass # Add your customizations here
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=10, trainer=CustomTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
Your custom trainer inherits all functionality from `DetectionTrainer`, so you only need to override the specific methods you want to customize.
|
||||||
|
|
||||||
|
## Logging Custom Metrics
|
||||||
|
|
||||||
|
The [validation](../modes/val.md) step computes [precision](https://www.ultralytics.com/glossary/precision), [recall](https://www.ultralytics.com/glossary/recall), and [mAP](https://www.ultralytics.com/glossary/mean-average-precision-map). If you need additional metrics like per-class [F1 score](https://www.ultralytics.com/glossary/f1-score), override `validate()`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
from ultralytics.utils import LOGGER
|
||||||
|
|
||||||
|
|
||||||
|
class MetricsTrainer(DetectionTrainer):
|
||||||
|
"""Custom trainer that computes and logs F1 score at the end of each epoch."""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
"""Run validation and compute per-class F1 scores."""
|
||||||
|
metrics, fitness = super().validate()
|
||||||
|
if metrics is None:
|
||||||
|
return metrics, fitness
|
||||||
|
|
||||||
|
if hasattr(self.validator, "metrics") and hasattr(self.validator.metrics, "box"):
|
||||||
|
box = self.validator.metrics.box
|
||||||
|
f1_per_class = box.f1
|
||||||
|
class_indices = box.ap_class_index
|
||||||
|
names = self.validator.names
|
||||||
|
|
||||||
|
valid_f1 = f1_per_class[f1_per_class > 0]
|
||||||
|
mean_f1 = np.mean(valid_f1) if len(valid_f1) > 0 else 0.0
|
||||||
|
|
||||||
|
LOGGER.info(f"Mean F1 Score: {mean_f1:.4f}")
|
||||||
|
per_class_str = [
|
||||||
|
f"{names[i]}: {f1_per_class[j]:.3f}" for j, i in enumerate(class_indices) if f1_per_class[j] > 0
|
||||||
|
]
|
||||||
|
LOGGER.info(f"Per-class F1: {per_class_str}")
|
||||||
|
|
||||||
|
return metrics, fitness
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=5, trainer=MetricsTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
This logs the mean F1 score across all classes and a per-class breakdown after each validation run.
|
||||||
|
|
||||||
|
!!! note "Available Metrics"
|
||||||
|
|
||||||
|
The validator provides access to many metrics through `self.validator.metrics.box`:
|
||||||
|
|
||||||
|
| Attribute | Description |
|
||||||
|
|---|---|
|
||||||
|
| `f1` | F1 score per class |
|
||||||
|
| `p` | Precision per class |
|
||||||
|
| `r` | Recall per class |
|
||||||
|
| `ap50` | AP at IoU 0.5 per class |
|
||||||
|
| `ap` | AP at IoU 0.5:0.95 per class |
|
||||||
|
| `mp`, `mr` | Mean precision and recall |
|
||||||
|
| `map50`, `map` | Mean AP metrics |
|
||||||
|
|
||||||
|
## Adding Class Weights
|
||||||
|
|
||||||
|
If your dataset has imbalanced classes (e.g., a rare defect in manufacturing inspection), you can upweight underrepresented classes in the [loss function](https://www.ultralytics.com/glossary/loss-function). This makes the model penalize misclassifications on rare classes more heavily.
|
||||||
|
|
||||||
|
To customize the loss, subclass the loss classes, model, and trainer:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
from torch import nn
|
||||||
|
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
from ultralytics.nn.tasks import DetectionModel
|
||||||
|
from ultralytics.utils import RANK
|
||||||
|
from ultralytics.utils.loss import E2ELoss, v8DetectionLoss
|
||||||
|
|
||||||
|
|
||||||
|
class WeightedDetectionLoss(v8DetectionLoss):
|
||||||
|
"""Detection loss with class weights applied to BCE classification loss."""
|
||||||
|
|
||||||
|
def __init__(self, model, class_weights=None, tal_topk=10, tal_topk2=None):
|
||||||
|
"""Initialize loss with optional per-class weights for BCE."""
|
||||||
|
super().__init__(model, tal_topk=tal_topk, tal_topk2=tal_topk2)
|
||||||
|
if class_weights is not None:
|
||||||
|
self.bce = nn.BCEWithLogitsLoss(
|
||||||
|
pos_weight=class_weights.to(self.device),
|
||||||
|
reduction="none",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class WeightedE2ELoss(E2ELoss):
|
||||||
|
"""E2E Loss with class weights for YOLO26."""
|
||||||
|
|
||||||
|
def __init__(self, model, class_weights=None):
|
||||||
|
"""Initialize E2E loss with weighted detection loss."""
|
||||||
|
|
||||||
|
def weighted_loss_fn(model, tal_topk=10, tal_topk2=None):
|
||||||
|
return WeightedDetectionLoss(model, class_weights=class_weights, tal_topk=tal_topk, tal_topk2=tal_topk2)
|
||||||
|
|
||||||
|
super().__init__(model, loss_fn=weighted_loss_fn)
|
||||||
|
|
||||||
|
|
||||||
|
class WeightedDetectionModel(DetectionModel):
|
||||||
|
"""Detection model that uses class-weighted loss."""
|
||||||
|
|
||||||
|
def init_criterion(self):
|
||||||
|
"""Initialize weighted loss criterion with per-class weights."""
|
||||||
|
class_weights = torch.ones(self.nc)
|
||||||
|
class_weights[0] = 2.0 # upweight class 0
|
||||||
|
class_weights[1] = 3.0 # upweight rare class 1
|
||||||
|
return WeightedE2ELoss(self, class_weights=class_weights)
|
||||||
|
|
||||||
|
|
||||||
|
class WeightedTrainer(DetectionTrainer):
|
||||||
|
"""Trainer that returns a WeightedDetectionModel."""
|
||||||
|
|
||||||
|
def get_model(self, cfg=None, weights=None, verbose=True):
|
||||||
|
"""Return a WeightedDetectionModel."""
|
||||||
|
model = WeightedDetectionModel(cfg, nc=self.data["nc"], verbose=verbose and RANK == -1)
|
||||||
|
if weights:
|
||||||
|
model.load(weights)
|
||||||
|
return model
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=10, trainer=WeightedTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip "Computing Weights from Dataset"
|
||||||
|
|
||||||
|
You can compute class weights automatically from your dataset's label distribution. A common approach is inverse frequency weighting:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# class_counts: number of instances per class
|
||||||
|
class_counts = np.array([5000, 200, 3000])
|
||||||
|
# Inverse frequency: rarer classes get higher weight
|
||||||
|
class_weights = max(class_counts) / class_counts
|
||||||
|
# Result: [1.0, 25.0, 1.67]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Saving the Best Model by Custom Metric
|
||||||
|
|
||||||
|
The trainer saves `best.pt` based on fitness, which defaults to `0.9 × mAP@0.5:0.95 + 0.1 × mAP@0.5`. To use a different metric (like `mAP@0.5` or recall), override `validate()` and return your chosen metric as the fitness value. The built-in `save_model()` will then use it automatically:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
|
||||||
|
|
||||||
|
class CustomSaveTrainer(DetectionTrainer):
|
||||||
|
"""Trainer that saves the best model based on mAP@0.5 instead of default fitness."""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
"""Override fitness to use mAP@0.5 for best model selection."""
|
||||||
|
metrics, fitness = super().validate()
|
||||||
|
if metrics:
|
||||||
|
fitness = metrics.get("metrics/mAP50(B)", fitness)
|
||||||
|
if self.best_fitness is None or fitness > self.best_fitness:
|
||||||
|
self.best_fitness = fitness
|
||||||
|
return metrics, fitness
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=20, trainer=CustomSaveTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note "Available Metrics"
|
||||||
|
|
||||||
|
Common metrics available in `self.metrics` after validation include:
|
||||||
|
|
||||||
|
| Key | Description |
|
||||||
|
|---|---|
|
||||||
|
| `metrics/precision(B)` | Precision |
|
||||||
|
| `metrics/recall(B)` | Recall |
|
||||||
|
| `metrics/mAP50(B)` | mAP at IoU 0.5 |
|
||||||
|
| `metrics/mAP50-95(B)` | mAP at IoU 0.5:0.95 |
|
||||||
|
|
||||||
|
## Freezing and Unfreezing the Backbone
|
||||||
|
|
||||||
|
[Transfer learning](https://www.ultralytics.com/glossary/transfer-learning) workflows often benefit from freezing the pretrained backbone for the first N epochs, allowing the detection head to adapt before [fine-tuning](https://www.ultralytics.com/glossary/fine-tuning) the entire network. Ultralytics provides a `freeze` parameter to freeze layers at the start of training, and you can use a [callback](../usage/callbacks.md) to unfreeze them after N epochs:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
from ultralytics.utils import LOGGER
|
||||||
|
|
||||||
|
FREEZE_EPOCHS = 5
|
||||||
|
|
||||||
|
|
||||||
|
def unfreeze_backbone(trainer):
|
||||||
|
"""Callback to unfreeze all layers after FREEZE_EPOCHS."""
|
||||||
|
if trainer.epoch == FREEZE_EPOCHS:
|
||||||
|
LOGGER.info(f"Epoch {trainer.epoch}: Unfreezing all layers for fine-tuning")
|
||||||
|
for name, param in trainer.model.named_parameters():
|
||||||
|
if not param.requires_grad:
|
||||||
|
param.requires_grad = True
|
||||||
|
LOGGER.info(f" Unfroze: {name}")
|
||||||
|
trainer.freeze_layer_names = [".dfl"]
|
||||||
|
|
||||||
|
|
||||||
|
class FreezingTrainer(DetectionTrainer):
|
||||||
|
"""Trainer with backbone freezing for first N epochs."""
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
"""Initialize and register the unfreeze callback."""
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.add_callback("on_train_epoch_start", unfreeze_backbone)
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=20, freeze=10, trainer=FreezingTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `freeze=10` parameter freezes the first 10 layers (the backbone) at training start. The `on_train_epoch_start` callback fires at the beginning of each epoch and unfreezes all parameters once the freeze period is complete.
|
||||||
|
|
||||||
|
!!! tip "Choosing What to Freeze"
|
||||||
|
|
||||||
|
- `freeze=10` freezes the first 10 layers (typically the backbone in YOLO architectures)
|
||||||
|
- `freeze=[0, 1, 2, 3]` freezes specific layers by index
|
||||||
|
- Higher `FREEZE_EPOCHS` values give the head more time to adapt before the backbone changes
|
||||||
|
|
||||||
|
## Per-Layer Learning Rates
|
||||||
|
|
||||||
|
Different parts of the network can benefit from different [learning rates](https://www.ultralytics.com/glossary/learning-rate). A common strategy is to use a lower learning rate for the pretrained backbone to preserve learned features, while allowing the detection head to adapt more quickly with a higher rate:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
|
||||||
|
from ultralytics import YOLO
|
||||||
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
from ultralytics.utils import LOGGER
|
||||||
|
from ultralytics.utils.torch_utils import unwrap_model
|
||||||
|
|
||||||
|
|
||||||
|
class PerLayerLRTrainer(DetectionTrainer):
|
||||||
|
"""Trainer with different learning rates for backbone and head."""
|
||||||
|
|
||||||
|
def build_optimizer(self, model, name="auto", lr=0.001, momentum=0.9, decay=1e-5, iterations=1e5):
|
||||||
|
"""Build optimizer with separate learning rates for backbone and head."""
|
||||||
|
backbone_params = []
|
||||||
|
head_params = []
|
||||||
|
|
||||||
|
for k, v in unwrap_model(model).named_parameters():
|
||||||
|
if not v.requires_grad:
|
||||||
|
continue
|
||||||
|
is_backbone = any(k.startswith(f"model.{i}.") for i in range(10))
|
||||||
|
if is_backbone:
|
||||||
|
backbone_params.append(v)
|
||||||
|
else:
|
||||||
|
head_params.append(v)
|
||||||
|
|
||||||
|
backbone_lr = lr * 0.1
|
||||||
|
|
||||||
|
optimizer = torch.optim.AdamW(
|
||||||
|
[
|
||||||
|
{"params": backbone_params, "lr": backbone_lr, "weight_decay": decay},
|
||||||
|
{"params": head_params, "lr": lr, "weight_decay": decay},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
LOGGER.info(
|
||||||
|
f"PerLayerLR optimizer: backbone ({len(backbone_params)} params, lr={backbone_lr}) "
|
||||||
|
f"| head ({len(head_params)} params, lr={lr})"
|
||||||
|
)
|
||||||
|
return optimizer
|
||||||
|
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", epochs=20, trainer=PerLayerLRTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note "Learning Rate Scheduler"
|
||||||
|
|
||||||
|
The built-in learning rate scheduler (`cosine` or `linear`) still applies on top of the per-group base learning rates. Both the backbone and head learning rates will follow the same decay schedule, maintaining the ratio between them throughout training.
|
||||||
|
|
||||||
|
!!! tip "Combining Techniques"
|
||||||
|
|
||||||
|
These customizations can be combined into a single trainer class by overriding multiple methods and adding callbacks as needed.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I pass a custom trainer to YOLO?
|
||||||
|
|
||||||
|
Pass your custom trainer class (not an instance) to the `trainer` parameter in `model.train()`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
model.train(data="coco8.yaml", trainer=MyCustomTrainer)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `YOLO` class handles trainer instantiation internally. See the [Advanced Customization](../usage/engine.md) page for more details on the trainer architecture.
|
||||||
|
|
||||||
|
### Which BaseTrainer methods can I override?
|
||||||
|
|
||||||
|
Key methods available for customization:
|
||||||
|
|
||||||
|
| Method | Purpose |
|
||||||
|
| -------------------- | --------------------------------- |
|
||||||
|
| `validate()` | Run validation and return metrics |
|
||||||
|
| `build_optimizer()` | Construct the optimizer |
|
||||||
|
| `save_model()` | Save training checkpoints |
|
||||||
|
| `get_model()` | Return the model instance |
|
||||||
|
| `get_validator()` | Return the validator instance |
|
||||||
|
| `get_dataloader()` | Build the dataloader |
|
||||||
|
| `preprocess_batch()` | Preprocess input batch |
|
||||||
|
| `label_loss_items()` | Format loss items for logging |
|
||||||
|
|
||||||
|
For the full API reference, see the [`BaseTrainer` documentation](../reference/engine/trainer.md).
|
||||||
|
|
||||||
|
### Can I use callbacks instead of subclassing the trainer?
|
||||||
|
|
||||||
|
Yes, for simpler customizations, [callbacks](../usage/callbacks.md) are often sufficient. Available callback events include `on_train_start`, `on_train_epoch_start`, `on_train_epoch_end`, `on_fit_epoch_end`, and `on_model_save`. These allow you to hook into the training loop without subclassing. The backbone freezing example above demonstrates this approach.
|
||||||
|
|
||||||
|
### How do I customize the loss function without subclassing the model?
|
||||||
|
|
||||||
|
If your change is simpler (such as adjusting loss gains), you can modify the [hyperparameters](https://www.ultralytics.com/glossary/hyperparameter-tuning) directly:
|
||||||
|
|
||||||
|
```python
|
||||||
|
model.train(data="coco8.yaml", box=10.0, cls=1.5, dfl=2.0)
|
||||||
|
```
|
||||||
|
|
||||||
|
For structural changes to the loss (such as adding class weights), you need to subclass the loss and model as shown in the [class weights section](#adding-class-weights).
|
||||||
208
docs/en/guides/data-collection-and-annotation.md
Executable file
208
docs/en/guides/data-collection-and-annotation.md
Executable file
@@ -0,0 +1,208 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Data collection and annotation are vital steps in any computer vision project. Explore the tools, techniques, and best practices for collecting and annotating data.
|
||||||
|
keywords: What is Data Annotation, Data Annotation Tools, Annotating Data, Avoiding Bias in Data Collection, Ethical Data Collection, Annotation Strategies
|
||||||
|
---
|
||||||
|
|
||||||
|
# Data Collection and Annotation Strategies for Computer Vision
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The key to success in any [computer vision project](./steps-of-a-cv-project.md) starts with effective data collection and annotation strategies. The quality of the data directly impacts model performance, so it's important to understand the best practices related to data collection and data annotation.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/iBk6S-PHwS0"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Build Effective Data Collection and Annotation Strategies for Computer Vision 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Every consideration regarding the data should closely align with [your project's goals](./defining-project-goals.md). Changes in your annotation strategies could shift the project's focus or effectiveness and vice versa. With this in mind, let's take a closer look at the best ways to approach data collection and annotation.
|
||||||
|
|
||||||
|
## Setting Up Classes and Collecting Data
|
||||||
|
|
||||||
|
Collecting images and video for a computer vision project involves defining the number of classes, sourcing data, and considering ethical implications. Before you start gathering your data, you need to be clear about:
|
||||||
|
|
||||||
|
### Choosing the Right Classes for Your Project
|
||||||
|
|
||||||
|
One of the first questions when starting a computer vision project is how many classes to include. You need to determine the class membership, which involves the different categories or labels that you want your model to recognize and differentiate. The number of classes should be determined by the specific goals of your project.
|
||||||
|
|
||||||
|
For example, if you want to monitor traffic, your classes might include "car," "truck," "bus," "motorcycle," and "bicycle." On the other hand, for tracking items in a store, your classes could be "fruits," "vegetables," "beverages," and "snacks." Defining classes based on your project goals helps keep your dataset relevant and focused.
|
||||||
|
|
||||||
|
When you define your classes, another important distinction to make is whether to choose coarse or fine class counts. 'Count' refers to the number of distinct classes you are interested in. This decision influences the granularity of your data and the complexity of your model. Here are the considerations for each approach:
|
||||||
|
|
||||||
|
- **Coarse Class-Count**: These are broader, more inclusive categories, such as "vehicle" and "non-vehicle." They simplify annotation and require fewer computational resources but provide less detailed information, potentially limiting the model's effectiveness in complex scenarios.
|
||||||
|
- **Fine Class-Count**: More categories with finer distinctions, such as "sedan," "SUV," "pickup truck," and "motorcycle." They capture more detailed information, improving model accuracy and performance. However, they are more time-consuming and labor-intensive to annotate and require more computational resources.
|
||||||
|
|
||||||
|
Starting with more specific classes can be very helpful, especially in complex projects where details are important. More specific classes let you collect more detailed data, gain deeper insights, and establish clearer distinctions between categories. Not only does it improve the accuracy of the model, but it also makes it easier to adjust the model later if needed, saving both time and resources.
|
||||||
|
|
||||||
|
### Sources of Data
|
||||||
|
|
||||||
|
You can use public datasets or gather your own custom data. Public datasets like those on [Kaggle](https://www.kaggle.com/datasets) and [Google Dataset Search Engine](https://datasetsearch.research.google.com/) offer well-annotated, standardized data, making them great starting points for training and validating models.
|
||||||
|
|
||||||
|
Custom data collection, on the other hand, allows you to customize your dataset to your specific needs. You might capture images and videos with cameras or drones, scrape the web for images, or use existing internal data from your organization. Custom data gives you more control over its quality and relevance. Combining both public and custom data sources helps create a diverse and comprehensive dataset.
|
||||||
|
|
||||||
|
### Avoiding Bias in Data Collection
|
||||||
|
|
||||||
|
Bias occurs when certain groups or scenarios are underrepresented or overrepresented in your dataset. It leads to a model that performs well on some data but poorly on others. It's crucial to avoid [bias in AI](https://www.ultralytics.com/glossary/bias-in-ai) so that your computer vision model can perform well in a variety of scenarios.
|
||||||
|
|
||||||
|
Here is how you can avoid bias while collecting data:
|
||||||
|
|
||||||
|
- **Diverse Sources**: Collect data from many sources to capture different perspectives and scenarios.
|
||||||
|
- **Balanced Representation**: Include balanced representation from all relevant groups. For example, consider different ages, genders, and ethnicities.
|
||||||
|
- **Continuous Monitoring**: Regularly review and update your dataset to identify and address any emerging biases.
|
||||||
|
- **Bias Mitigation Techniques**: Use methods like oversampling underrepresented classes, [data augmentation](https://www.ultralytics.com/glossary/data-augmentation), and fairness-aware algorithms.
|
||||||
|
|
||||||
|
Following these practices helps create a more robust and fair model that can generalize well in real-world applications.
|
||||||
|
|
||||||
|
## What is Data Annotation?
|
||||||
|
|
||||||
|
Data annotation is the process of labeling data to make it usable for training [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models. In computer vision, this means labeling images or videos with the information that a model needs to learn from. Without properly annotated data, models cannot accurately learn the relationships between inputs and outputs.
|
||||||
|
|
||||||
|
### Types of Data Annotation
|
||||||
|
|
||||||
|
Depending on the specific requirements of a [computer vision task](../tasks/index.md), there are different types of data annotation. Here are some examples:
|
||||||
|
|
||||||
|
- **Bounding Boxes**: Rectangular boxes drawn around objects in an image, used primarily for object detection tasks. These boxes are defined by their top-left and bottom-right coordinates.
|
||||||
|
- **Polygons**: Detailed outlines for objects, allowing for more precise annotation than bounding boxes. Polygons are used in tasks like [instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation), where the shape of the object is important.
|
||||||
|
- **Masks**: Binary masks where each pixel is either part of an object or the background. Masks are used in [semantic segmentation](https://www.ultralytics.com/glossary/semantic-segmentation) tasks to provide pixel-level detail.
|
||||||
|
- **Keypoints**: Specific points marked within an image to identify locations of interest. Keypoints are used in tasks like [pose estimation](../tasks/pose.md) and facial landmark detection.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/types-of-data-annotation.avif" alt="Data annotation types including bounding boxes, polygons, and masks">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Common Annotation Formats
|
||||||
|
|
||||||
|
After selecting a type of annotation, it's important to choose the appropriate format for storing and sharing annotations.
|
||||||
|
|
||||||
|
Commonly used formats include [COCO](../datasets/detect/coco.md), which supports various annotation types like [object detection](https://www.ultralytics.com/glossary/object-detection), keypoint detection, stuff segmentation, [panoptic segmentation](https://www.ultralytics.com/glossary/panoptic-segmentation), and image captioning, stored in JSON. [Pascal VOC](../datasets/detect/voc.md) uses XML files and is popular for object detection tasks. YOLO, on the other hand, creates a .txt file for each image, containing annotations like object class, coordinates, height, and width, making it suitable for object detection.
|
||||||
|
|
||||||
|
### Techniques of Annotation
|
||||||
|
|
||||||
|
Now, assuming you've chosen a type of annotation and format, it's time to establish clear and objective labeling rules. These rules are like a roadmap for consistency and [accuracy](https://www.ultralytics.com/glossary/accuracy) throughout the annotation process. Key aspects of these rules include:
|
||||||
|
|
||||||
|
- **Clarity and Detail**: Make sure your instructions are clear. Use examples and illustrations to show what's expected.
|
||||||
|
- **Consistency**: Keep your annotations uniform. Set standard criteria for annotating different types of data, so all annotations follow the same rules.
|
||||||
|
- **Reducing Bias**: Stay neutral. Train yourself to be objective and minimize personal biases to ensure fair annotations.
|
||||||
|
- **Efficiency**: Work smarter, not harder. Use tools and workflows that automate repetitive tasks, making the annotation process faster and more efficient.
|
||||||
|
|
||||||
|
Regularly reviewing and updating your labeling rules will help keep your annotations accurate, consistent, and aligned with your project goals.
|
||||||
|
|
||||||
|
### Popular Annotation Tools
|
||||||
|
|
||||||
|
Let's say you are ready to annotate now. There are several open-source tools available to help streamline the data annotation process. Here are some useful open annotation tools:
|
||||||
|
|
||||||
|
- **[Label Studio](https://github.com/HumanSignal/label-studio)**: A flexible tool that supports a wide range of annotation tasks and includes features for managing projects and quality control.
|
||||||
|
- **[CVAT](https://github.com/cvat-ai/cvat)**: A powerful tool that supports various annotation formats and customizable workflows, making it suitable for complex projects.
|
||||||
|
- **[Labelme](https://github.com/wkentaro/labelme)**: A simple and easy-to-use tool that allows for quick annotation of images with polygons, making it ideal for straightforward tasks.
|
||||||
|
- **[LabelImg](https://github.com/HumanSignal/labelImg)**: An easy-to-use graphical image annotation tool that's particularly good for creating bounding box annotations in YOLO format.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/labelme-instance-segmentation-annotation.avif" alt="LabelMe annotation tool for instance segmentation">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
These open-source tools are budget-friendly and provide a range of features to meet different annotation needs.
|
||||||
|
|
||||||
|
### Some More Things to Consider Before Annotating Data
|
||||||
|
|
||||||
|
Before you dive into annotating your data, there are a few more things to keep in mind. You should be aware of accuracy, [precision](https://www.ultralytics.com/glossary/precision), outliers, and quality control to avoid labeling your data in a counterproductive manner.
|
||||||
|
|
||||||
|
#### Understanding Accuracy and Precision
|
||||||
|
|
||||||
|
It's important to understand the difference between accuracy and precision and how it relates to annotation. Accuracy refers to how close the annotated data is to the true values. It helps us measure how closely the labels reflect real-world scenarios. Precision indicates the consistency of annotations. It checks if you are giving the same label to the same object or feature throughout the dataset. High accuracy and precision lead to better-trained models by reducing noise and improving the model's ability to generalize from the [training data](https://www.ultralytics.com/glossary/training-data).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/example-of-precision.avif" alt="Accuracy vs precision comparison for data annotation">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
#### Identifying Outliers
|
||||||
|
|
||||||
|
Outliers are data points that deviate quite a bit from other observations in the dataset. With respect to annotations, an outlier could be an incorrectly labeled image or an annotation that doesn't fit with the rest of the dataset. Outliers are concerning because they can distort the model's learning process, leading to inaccurate predictions and poor generalization.
|
||||||
|
|
||||||
|
You can use various methods to detect and correct outliers:
|
||||||
|
|
||||||
|
- **Statistical Techniques**: To detect outliers in numerical features like pixel values, [bounding box](https://www.ultralytics.com/glossary/bounding-box) coordinates, or object sizes, you can use methods such as box plots, histograms, or z-scores.
|
||||||
|
- **Visual Techniques**: To spot anomalies in categorical features like object classes, colors, or shapes, use visual methods like plotting images, labels, or heat maps.
|
||||||
|
- **Algorithmic Methods**: Use tools like clustering (e.g., K-means clustering, [DBSCAN](https://www.ultralytics.com/glossary/dbscan-density-based-spatial-clustering-of-applications-with-noise)) and [anomaly detection](https://www.ultralytics.com/glossary/anomaly-detection) algorithms to identify outliers based on data distribution patterns.
|
||||||
|
|
||||||
|
#### Quality Control of Annotated Data
|
||||||
|
|
||||||
|
Just like other technical projects, quality control is a must for annotated data. It is a good practice to regularly check annotations to make sure they are accurate and consistent. This can be done in a few different ways:
|
||||||
|
|
||||||
|
- Reviewing samples of annotated data
|
||||||
|
- Using automated tools to spot common errors
|
||||||
|
- Having another person double-check the annotations
|
||||||
|
|
||||||
|
If you are working with multiple people, consistency between different annotators is important. Good inter-annotator agreement means that the guidelines are clear and everyone is following them the same way. It keeps everyone on the same page and the annotations consistent.
|
||||||
|
|
||||||
|
While reviewing, if you find errors, correct them and update the guidelines to avoid future mistakes. Provide feedback to annotators and offer regular training to help reduce errors. Having a strong process for handling errors keeps your dataset accurate and reliable.
|
||||||
|
|
||||||
|
## Efficient Data Labeling Strategies
|
||||||
|
|
||||||
|
To make the process of data labeling smoother and more effective, consider implementing these strategies:
|
||||||
|
|
||||||
|
- **Clear Annotation Guidelines**: Provide detailed instructions with examples to ensure all annotators interpret tasks consistently. For instance, when labeling birds, specify whether to include the entire bird or just specific parts.
|
||||||
|
- **Regular Quality Checks**: Set benchmarks and use specific metrics to review work, maintaining high standards through continuous feedback.
|
||||||
|
- **Use Pre-annotation Tools**: Many modern annotation platforms offer AI-assisted pre-annotation features that can significantly speed up the process by automatically generating initial annotations that humans can then refine.
|
||||||
|
- **Implement Active Learning**: This approach prioritizes labeling the most informative samples first, which can reduce the total number of annotations needed while maintaining model performance.
|
||||||
|
- **Batch Processing**: Group similar images together for annotation to maintain consistency and improve efficiency.
|
||||||
|
|
||||||
|
These strategies can help maintain high-quality annotations while reducing the time and resources required for the labeling process.
|
||||||
|
|
||||||
|
## Share Your Thoughts with the Community
|
||||||
|
|
||||||
|
Bouncing your ideas and queries off other [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) enthusiasts can help accelerate your projects. Here are some great ways to learn, troubleshoot, and network:
|
||||||
|
|
||||||
|
### Where to Find Help and Support
|
||||||
|
|
||||||
|
- **GitHub Issues:** Visit the YOLO26 GitHub repository and use the [Issues tab](https://github.com/ultralytics/ultralytics/issues) to raise questions, report bugs, and suggest features. The community and maintainers are there to help with any issues you face.
|
||||||
|
- **Ultralytics Discord Server:** Join the [Ultralytics Discord server](https://discord.com/invite/ultralytics) to connect with other users and developers, get support, share knowledge, and brainstorm ideas.
|
||||||
|
|
||||||
|
### Official Documentation
|
||||||
|
|
||||||
|
- **Ultralytics YOLO26 Documentation:** Refer to the [official YOLO26 documentation](./index.md) for thorough guides and valuable insights on numerous computer vision tasks and projects.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
By following the best practices for collecting and annotating data, avoiding bias, and using the right tools and techniques, you can significantly improve your model's performance. Engaging with the community and using available resources will keep you informed and help you troubleshoot issues effectively. Remember, quality data is the foundation of a successful project, and the right strategies will help you build robust and reliable models.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is the best way to avoid bias in data collection for computer vision projects?
|
||||||
|
|
||||||
|
Avoiding bias in data collection ensures that your computer vision model performs well across various scenarios. To minimize bias, consider collecting data from diverse sources to capture different perspectives and scenarios. Ensure balanced representation among all relevant groups, such as different ages, genders, and ethnicities. Regularly review and update your dataset to identify and address any emerging biases. Techniques such as oversampling underrepresented classes, data augmentation, and fairness-aware algorithms can also help mitigate bias. By employing these strategies, you maintain a robust and fair dataset that enhances your model's generalization capability.
|
||||||
|
|
||||||
|
### How can I ensure high consistency and accuracy in data annotation?
|
||||||
|
|
||||||
|
Ensuring high consistency and accuracy in data annotation involves establishing clear and objective labeling guidelines. Your instructions should be detailed, with examples and illustrations to clarify expectations. Consistency is achieved by setting standard criteria for annotating various data types, ensuring all annotations follow the same rules. To reduce personal biases, train annotators to stay neutral and objective. Regular reviews and updates of labeling rules help maintain accuracy and alignment with project goals. Using automated tools to check for consistency and getting feedback from other annotators also contribute to maintaining high-quality annotations.
|
||||||
|
|
||||||
|
### How many images do I need for training Ultralytics YOLO models?
|
||||||
|
|
||||||
|
For effective [transfer learning](https://www.ultralytics.com/glossary/transfer-learning) and object detection with Ultralytics YOLO models, start with a minimum of a few hundred annotated objects per class. If training for just one class, begin with at least 100 annotated images and train for approximately 100 [epochs](https://www.ultralytics.com/glossary/epoch). More complex tasks might require thousands of images per class to achieve high reliability and performance. Quality annotations are crucial, so ensure your data collection and annotation processes are rigorous and aligned with your project's specific goals. Explore detailed training strategies in the [YOLO26 training guide](../modes/train.md).
|
||||||
|
|
||||||
|
### What are some popular tools for data annotation?
|
||||||
|
|
||||||
|
Several popular open-source tools can streamline the data annotation process:
|
||||||
|
|
||||||
|
- **[Label Studio](https://github.com/HumanSignal/label-studio)**: A flexible tool supporting various annotation tasks, project management, and quality control features.
|
||||||
|
- **[CVAT](https://www.cvat.ai/)**: Offers multiple annotation formats and customizable workflows, making it suitable for complex projects.
|
||||||
|
- **[Labelme](https://github.com/wkentaro/labelme)**: Ideal for quick and straightforward image annotation with polygons.
|
||||||
|
- **[LabelImg](https://github.com/HumanSignal/labelImg)**: Perfect for creating bounding box annotations in YOLO format with a simple interface.
|
||||||
|
|
||||||
|
These tools can help enhance the efficiency and accuracy of your annotation workflows. For extensive feature lists and guides, refer to our [data annotation tools documentation](../datasets/index.md).
|
||||||
|
|
||||||
|
### What types of data annotation are commonly used in computer vision?
|
||||||
|
|
||||||
|
Different types of data annotation cater to various computer vision tasks:
|
||||||
|
|
||||||
|
- **Bounding Boxes**: Used primarily for object detection, these are rectangular boxes around objects in an image.
|
||||||
|
- **Polygons**: Provide more precise object outlines suitable for instance segmentation tasks.
|
||||||
|
- **Masks**: Offer pixel-level detail, used in semantic segmentation to differentiate objects from the background.
|
||||||
|
- **Keypoints**: Identify specific points of interest within an image, useful for tasks like pose estimation and facial landmark detection.
|
||||||
|
|
||||||
|
Selecting the appropriate annotation type depends on your project's requirements. Learn more about how to implement these annotations and their formats in our [data annotation guide](#what-is-data-annotation).
|
||||||
433
docs/en/guides/deepstream-nvidia-jetson.md
Executable file
433
docs/en/guides/deepstream-nvidia-jetson.md
Executable file
@@ -0,0 +1,433 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to deploy Ultralytics YOLO26 on NVIDIA Jetson devices using TensorRT and DeepStream SDK. Explore performance benchmarks and maximize AI capabilities.
|
||||||
|
keywords: Ultralytics, YOLO26, NVIDIA Jetson, JetPack, AI deployment, embedded systems, deep learning, TensorRT, DeepStream SDK, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# Ultralytics YOLO26 on NVIDIA Jetson using DeepStream SDK and TensorRT
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/hvGqrVT2wPg"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to use Ultralytics YOLO26 models with NVIDIA Deepstream on Jetson Orin NX 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This comprehensive guide provides a detailed walkthrough for deploying Ultralytics YOLO26 on [NVIDIA Jetson](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/) devices using DeepStream SDK and TensorRT. Here we use TensorRT to maximize the inference performance on the Jetson platform.
|
||||||
|
|
||||||
|
<img width="1024" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/deepstream-nvidia-jetson.avif" alt="NVIDIA DeepStream SDK on Jetson platform">
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
This guide has been tested with [NVIDIA Jetson Orin Nano Super Developer Kit](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/nano-super-developer-kit) running the latest stable JetPack release of [JP6.1](https://developer.nvidia.com/embedded/jetpack-sdk-61),
|
||||||
|
[Seeed Studio reComputer J4012](https://www.seeedstudio.com/reComputer-J4012-p-5586.html) which is based on NVIDIA Jetson Orin NX 16GB running JetPack release of [JP5.1.3](https://developer.nvidia.com/embedded/jetpack-sdk-513) and [Seeed Studio reComputer J1020 v2](https://www.seeedstudio.com/reComputer-J1020-v2-p-5498.html) which is based on NVIDIA Jetson Nano 4GB running JetPack release of [JP4.6.4](https://developer.nvidia.com/jetpack-sdk-464). It is expected to work across all the NVIDIA Jetson hardware lineup including latest and legacy.
|
||||||
|
|
||||||
|
## What is NVIDIA DeepStream?
|
||||||
|
|
||||||
|
[NVIDIA's DeepStream SDK](https://developer.nvidia.com/deepstream-sdk) is a complete streaming analytics toolkit based on GStreamer for AI-based multi-sensor processing, video, audio, and image understanding. It's ideal for vision AI developers, software partners, startups, and OEMs building IVA (Intelligent Video Analytics) apps and services. You can now create stream-processing pipelines that incorporate [neural networks](https://www.ultralytics.com/glossary/neural-network-nn) and other complex processing tasks like tracking, video encoding/decoding, and video rendering. These pipelines enable real-time analytics on video, image, and sensor data. DeepStream's multi-platform support gives you a faster, easier way to develop vision AI applications and services on-premise, at the edge, and in the cloud.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before you start to follow this guide:
|
||||||
|
|
||||||
|
- Visit our documentation, [Quick Start Guide: NVIDIA Jetson with Ultralytics YOLO26](nvidia-jetson.md) to set up your NVIDIA Jetson device with Ultralytics YOLO26
|
||||||
|
- Install [DeepStream SDK](https://developer.nvidia.com/deepstream-getting-started) according to the JetPack version
|
||||||
|
- For JetPack 4.6.4, install [DeepStream 6.0.1](https://docs.nvidia.com/metropolis/deepstream/6.0.1/dev-guide/text/DS_Quickstart.html)
|
||||||
|
- For JetPack 5.1.3, install [DeepStream 6.3](https://docs.nvidia.com/metropolis/deepstream/6.3/dev-guide/text/DS_Quickstart.html)
|
||||||
|
- For JetPack 6.1, install [DeepStream 7.1](https://docs.nvidia.com/metropolis/deepstream/7.0/dev-guide/text/DS_Overview.html)
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
In this guide we have used the Debian package method of installing DeepStream SDK to the Jetson device. You can also visit the [DeepStream SDK on Jetson (Archived)](https://developer.nvidia.com/embedded/deepstream-on-jetson-downloads-archived) to access legacy versions of DeepStream.
|
||||||
|
|
||||||
|
## DeepStream Configuration for YOLO26
|
||||||
|
|
||||||
|
Here we are using [marcoslucianops/DeepStream-Yolo](https://github.com/marcoslucianops/DeepStream-Yolo) GitHub repository which includes NVIDIA DeepStream SDK support for YOLO models. We appreciate the efforts of marcoslucianops for his contributions!
|
||||||
|
|
||||||
|
1. Install Ultralytics with necessary dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~
|
||||||
|
pip install -U pip
|
||||||
|
git clone https://github.com/ultralytics/ultralytics
|
||||||
|
cd ultralytics
|
||||||
|
pip install -e ".[export]" onnxslim
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Clone the DeepStream-Yolo repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~
|
||||||
|
git clone https://github.com/marcoslucianops/DeepStream-Yolo
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Copy the `export_yolo26.py` file from `DeepStream-Yolo/utils` directory to the `ultralytics` folder
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ~/DeepStream-Yolo/utils/export_yolo26.py ~/ultralytics
|
||||||
|
cd ultralytics
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Download Ultralytics YOLO26 detection model (.pt) of your choice from [YOLO26 releases](https://github.com/ultralytics/assets/releases). Here we use [yolo26s.pt](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
You can also use a [custom-trained YOLO26 model](https://docs.ultralytics.com/modes/train/).
|
||||||
|
|
||||||
|
5. Convert model to ONNX
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 export_yolo26.py -w yolo26s.pt
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note "Pass the below arguments to the above command"
|
||||||
|
|
||||||
|
For DeepStream 5.1, remove the `--dynamic` arg and use `opset` 12 or lower. The default `opset` is 17.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--opset 12
|
||||||
|
```
|
||||||
|
|
||||||
|
To change the inference size (default: 640)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
-s SIZE
|
||||||
|
--size SIZE
|
||||||
|
-s HEIGHT WIDTH
|
||||||
|
--size HEIGHT WIDTH
|
||||||
|
```
|
||||||
|
|
||||||
|
Example for 1280:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
-s 1280
|
||||||
|
or
|
||||||
|
-s 1280 1280
|
||||||
|
```
|
||||||
|
|
||||||
|
To simplify the ONNX model (DeepStream >= 6.0)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--simplify
|
||||||
|
```
|
||||||
|
|
||||||
|
To use dynamic batch-size (DeepStream >= 6.1)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--dynamic
|
||||||
|
```
|
||||||
|
|
||||||
|
To use static batch-size (example for batch-size = 4)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--batch 4
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Copy the generated `.onnx` model file and `labels.txt` file to the `DeepStream-Yolo` folder
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp yolo26s.pt.onnx labels.txt ~/DeepStream-Yolo
|
||||||
|
cd ~/DeepStream-Yolo
|
||||||
|
```
|
||||||
|
|
||||||
|
7. Set the CUDA version according to the JetPack version installed
|
||||||
|
|
||||||
|
For JetPack 4.6.4:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export CUDA_VER=10.2
|
||||||
|
```
|
||||||
|
|
||||||
|
For JetPack 5.1.3:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export CUDA_VER=11.4
|
||||||
|
```
|
||||||
|
|
||||||
|
For JetPack 6.1:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export CUDA_VER=12.6
|
||||||
|
```
|
||||||
|
|
||||||
|
8. Compile the library
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make -C nvdsinfer_custom_impl_Yolo clean && make -C nvdsinfer_custom_impl_Yolo
|
||||||
|
```
|
||||||
|
|
||||||
|
9. Edit the `config_infer_primary_yolo26.txt` file according to your model (for YOLO26s with 80 classes)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[property]
|
||||||
|
...
|
||||||
|
onnx-file=yolo26s.pt.onnx
|
||||||
|
...
|
||||||
|
num-detected-classes=80
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
10. Edit the `deepstream_app_config` file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
...
|
||||||
|
[primary-gie]
|
||||||
|
...
|
||||||
|
config-file=config_infer_primary_yolo26.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
11. You can also change the video source in `deepstream_app_config` file. Here, a default video file is loaded
|
||||||
|
|
||||||
|
```bash
|
||||||
|
...
|
||||||
|
[source0]
|
||||||
|
...
|
||||||
|
uri=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run Inference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deepstream-app -c deepstream_app_config.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
It will take a long time to generate the TensorRT engine file before starting the inference. So please be patient.
|
||||||
|
|
||||||
|
<div align=center><img width=1000 src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/yolov8-with-deepstream.avif" alt="YOLO26 with deepstream"></div>
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
If you want to convert the model to FP16 precision, simply set `model-engine-file=model_b1_gpu0_fp16.engine` and `network-mode=2` inside `config_infer_primary_yolo26.txt`
|
||||||
|
|
||||||
|
## INT8 Calibration
|
||||||
|
|
||||||
|
If you want to use INT8 precision for inference, you need to follow the steps below:
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
Currently INT8 does not work with TensorRT 10.x. This section of the guide has been tested with TensorRT 8.x which is expected to work.
|
||||||
|
|
||||||
|
1. Set `OPENCV` environment variable
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export OPENCV=1
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Compile the library
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make -C nvdsinfer_custom_impl_Yolo clean && make -C nvdsinfer_custom_impl_Yolo
|
||||||
|
```
|
||||||
|
|
||||||
|
3. For COCO dataset, download the [val2017](http://images.cocodataset.org/zips/val2017.zip), extract, and move to `DeepStream-Yolo` folder
|
||||||
|
|
||||||
|
4. Make a new directory for calibration images
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir calibration
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run the following to select 1000 random images from COCO dataset to run calibration
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for jpg in $(ls -1 val2017/*.jpg | sort -R | head -1000); do
|
||||||
|
cp ${jpg} calibration/
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
NVIDIA recommends at least 500 images to get a good [accuracy](https://www.ultralytics.com/glossary/accuracy). On this example, 1000 images are chosen to get better accuracy (more images = more accuracy). You can set it from **head -1000**. For example, for 2000 images, **head -2000**. This process can take a long time.
|
||||||
|
|
||||||
|
6. Create the `calibration.txt` file with all selected images
|
||||||
|
|
||||||
|
```bash
|
||||||
|
realpath calibration/*jpg > calibration.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
7. Set environment variables
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export INT8_CALIB_IMG_PATH=calibration.txt
|
||||||
|
export INT8_CALIB_BATCH_SIZE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
Higher INT8_CALIB_BATCH_SIZE values will result in more accuracy and faster calibration speed. Set it according to your GPU memory.
|
||||||
|
|
||||||
|
8. Update the `config_infer_primary_yolo26.txt` file
|
||||||
|
|
||||||
|
From
|
||||||
|
|
||||||
|
```bash
|
||||||
|
...
|
||||||
|
model-engine-file=model_b1_gpu0_fp32.engine
|
||||||
|
#int8-calib-file=calib.table
|
||||||
|
...
|
||||||
|
network-mode=0
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
To
|
||||||
|
|
||||||
|
```bash
|
||||||
|
...
|
||||||
|
model-engine-file=model_b1_gpu0_int8.engine
|
||||||
|
int8-calib-file=calib.table
|
||||||
|
...
|
||||||
|
network-mode=1
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run Inference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deepstream-app -c deepstream_app_config.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## MultiStream Setup
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/wWmXKIteRLA"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Run Multiple Streams with DeepStream SDK on Jetson Nano using Ultralytics YOLO26 🎉
|
||||||
|
</p>
|
||||||
|
|
||||||
|
To set up multiple streams under a single DeepStream application, make the following changes to the `deepstream_app_config.txt` file:
|
||||||
|
|
||||||
|
1. Change the rows and columns to build a grid display according to the number of streams you want to have. For example, for 4 streams, we can add 2 rows and 2 columns.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[tiled-display]
|
||||||
|
rows=2
|
||||||
|
columns=2
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Set `num-sources=4` and add the `uri` entries for all four streams.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[source0]
|
||||||
|
enable=1
|
||||||
|
type=3
|
||||||
|
uri=path/to/video1.jpg
|
||||||
|
uri=path/to/video2.jpg
|
||||||
|
uri=path/to/video3.jpg
|
||||||
|
uri=path/to/video4.jpg
|
||||||
|
num-sources=4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run Inference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deepstream-app -c deepstream_app_config.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
<div align=center><img width=1000 src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/multistream-setup.avif" alt="DeepStream multi-camera streaming configuration"></div>
|
||||||
|
|
||||||
|
## Benchmark Results
|
||||||
|
|
||||||
|
The following benchmarks summarizes how YOLO26 models perform at different TensorRT precision levels with an input size of 640x640 on NVIDIA Jetson Orin NX 16GB.
|
||||||
|
|
||||||
|
### Comparison Chart
|
||||||
|
|
||||||
|
<div align=center><img width=1000 src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/jetson-deepstream-benchmarks.avif" alt="NVIDIA Jetson DeepStream performance benchmarks"></div>
|
||||||
|
|
||||||
|
### Detailed Comparison Table
|
||||||
|
|
||||||
|
!!! tip "Performance"
|
||||||
|
|
||||||
|
=== "YOLO11n"
|
||||||
|
|
||||||
|
| Format | Status | Inference time (ms/im) |
|
||||||
|
|-----------------|--------|------------------------|
|
||||||
|
| TensorRT (FP32) | ✅ | 8.64 |
|
||||||
|
| TensorRT (FP16) | ✅ | 5.27 |
|
||||||
|
| TensorRT (INT8) | ✅ | 4.54 |
|
||||||
|
|
||||||
|
=== "YOLO11s"
|
||||||
|
|
||||||
|
| Format | Status | Inference time (ms/im) |
|
||||||
|
|-----------------|--------|------------------------|
|
||||||
|
| TensorRT (FP32) | ✅ | 14.53 |
|
||||||
|
| TensorRT (FP16) | ✅ | 7.91 |
|
||||||
|
| TensorRT (INT8) | ✅ | 6.05 |
|
||||||
|
|
||||||
|
=== "YOLO11m"
|
||||||
|
|
||||||
|
| Format | Status | Inference time (ms/im) |
|
||||||
|
|-----------------|--------|------------------------|
|
||||||
|
| TensorRT (FP32) | ✅ | 32.05 |
|
||||||
|
| TensorRT (FP16) | ✅ | 15.55 |
|
||||||
|
| TensorRT (INT8) | ✅ | 10.43 |
|
||||||
|
|
||||||
|
=== "YOLO11l"
|
||||||
|
|
||||||
|
| Format | Status | Inference time (ms/im) |
|
||||||
|
|-----------------|--------|------------------------|
|
||||||
|
| TensorRT (FP32) | ✅ | 39.68 |
|
||||||
|
| TensorRT (FP16) | ✅ | 19.88 |
|
||||||
|
| TensorRT (INT8) | ✅ | 13.64 |
|
||||||
|
|
||||||
|
=== "YOLO11x"
|
||||||
|
|
||||||
|
| Format | Status | Inference time (ms/im) |
|
||||||
|
|-----------------|--------|------------------------|
|
||||||
|
| TensorRT (FP32) | ✅ | 80.65 |
|
||||||
|
| TensorRT (FP16) | ✅ | 39.06 |
|
||||||
|
| TensorRT (INT8) | ✅ | 22.83 |
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
This guide was initially created by our friends at Seeed Studio, Lakshantha and Elaine.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I set up Ultralytics YOLO26 on an NVIDIA Jetson device?
|
||||||
|
|
||||||
|
To set up Ultralytics YOLO26 on an [NVIDIA Jetson](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/) device, you first need to install the [DeepStream SDK](https://developer.nvidia.com/deepstream-getting-started) compatible with your JetPack version. Follow the step-by-step guide in our [Quick Start Guide](nvidia-jetson.md) to configure your NVIDIA Jetson for YOLO26 deployment.
|
||||||
|
|
||||||
|
### What is the benefit of using TensorRT with YOLO26 on NVIDIA Jetson?
|
||||||
|
|
||||||
|
Using TensorRT with YOLO26 optimizes the model for inference, significantly reducing latency and improving throughput on NVIDIA Jetson devices. TensorRT provides high-performance, low-latency [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) inference through layer fusion, precision calibration, and kernel auto-tuning. This leads to faster and more efficient execution, particularly useful for real-time applications like video analytics and autonomous machines.
|
||||||
|
|
||||||
|
### Can I run Ultralytics YOLO26 with DeepStream SDK across different NVIDIA Jetson hardware?
|
||||||
|
|
||||||
|
Yes, the guide for deploying Ultralytics YOLO26 with the DeepStream SDK and TensorRT is compatible across the entire NVIDIA Jetson lineup. This includes devices like the Jetson Orin NX 16GB with [JetPack 5.1.3](https://developer.nvidia.com/embedded/jetpack-sdk-513) and the Jetson Nano 4GB with [JetPack 4.6.4](https://developer.nvidia.com/jetpack-sdk-464). Refer to the section [DeepStream Configuration for YOLO26](#deepstream-configuration-for-yolo26) for detailed steps.
|
||||||
|
|
||||||
|
### How can I convert a YOLO26 model to ONNX for DeepStream?
|
||||||
|
|
||||||
|
To convert a YOLO26 model to ONNX format for deployment with DeepStream, use the `utils/export_yolo26.py` script from the [DeepStream-Yolo](https://github.com/marcoslucianops/DeepStream-Yolo) repository.
|
||||||
|
|
||||||
|
Here's an example command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 utils/export_yolo26.py -w yolo26s.pt --opset 12 --simplify
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on model conversion, check out our [model export section](../modes/export.md).
|
||||||
|
|
||||||
|
### What are the performance benchmarks for YOLO on NVIDIA Jetson Orin NX?
|
||||||
|
|
||||||
|
The performance of YOLO26 models on NVIDIA Jetson Orin NX 16GB varies based on TensorRT precision levels. For example, YOLO26s models achieve:
|
||||||
|
|
||||||
|
- **FP32 Precision**: 14.6 ms/im, 68.5 FPS
|
||||||
|
- **FP16 Precision**: 7.94 ms/im, 126 FPS
|
||||||
|
- **INT8 Precision**: 5.95 ms/im, 168 FPS
|
||||||
|
|
||||||
|
These benchmarks underscore the efficiency and capability of using TensorRT-optimized YOLO26 models on NVIDIA Jetson hardware. For further details, see our [Benchmark Results](#benchmark-results) section.
|
||||||
187
docs/en/guides/defining-project-goals.md
Executable file
187
docs/en/guides/defining-project-goals.md
Executable file
@@ -0,0 +1,187 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to define clear goals and objectives for your computer vision project with our practical guide. Includes tips on problem statements, measurable objectives, and key decisions.
|
||||||
|
keywords: computer vision, project planning, problem statement, measurable objectives, dataset preparation, model selection, YOLO26, Ultralytics
|
||||||
|
---
|
||||||
|
|
||||||
|
# A Practical Guide for Defining Your Computer Vision Project
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The first step in any computer vision project is defining what you want to achieve. It's crucial to have a clear roadmap from the start, which includes everything from data collection to deploying your model.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/q1tXfShvbAw"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to define Computer Vision Project's Goal | Problem Statement and VisionAI Tasks Connection 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
If you need a quick refresher on the basics of a computer vision project, take a moment to read our guide on [the key steps in a computer vision project](./steps-of-a-cv-project.md). It will give you a solid overview of the whole process. Once you're caught up, come back here to dive into how exactly you can define and refine the goals for your project.
|
||||||
|
|
||||||
|
Now, let's get to the heart of defining a clear problem statement for your project and exploring the key decisions you'll need to make along the way.
|
||||||
|
|
||||||
|
## Defining A Clear Problem Statement
|
||||||
|
|
||||||
|
Setting clear goals and objectives for your project is the first big step toward finding the most effective solutions. Let's understand how you can clearly define your project's problem statement:
|
||||||
|
|
||||||
|
- **Identify the Core Issue:** Pinpoint the specific challenge your computer vision project aims to solve.
|
||||||
|
- **Determine the Scope:** Define the boundaries of your problem.
|
||||||
|
- **Consider End Users and Stakeholders:** Identify who will be affected by the solution.
|
||||||
|
- **Analyze Project Requirements and Constraints:** Assess available resources (time, budget, personnel) and identify any technical or regulatory constraints.
|
||||||
|
|
||||||
|
### Example of a Business Problem Statement
|
||||||
|
|
||||||
|
Let's walk through an example.
|
||||||
|
|
||||||
|
Consider a computer vision project where you want to [estimate the speed of vehicles](./speed-estimation.md) on a highway. The core issue is that current speed monitoring methods are inefficient and error-prone due to outdated radar systems and manual processes. The project aims to develop a real-time computer vision system that can replace legacy [speed estimation](https://www.ultralytics.com/blog/ultralytics-yolov8-for-speed-estimation-in-computer-vision-projects) systems.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/speed-estimation-using-yolov8.avif" alt="Speed Estimation Using YOLO26">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Primary users include traffic management authorities and law enforcement, while secondary stakeholders are highway planners and the public benefiting from safer roads. Key requirements involve evaluating budget, time, and personnel, as well as addressing technical needs like high-resolution cameras and real-time data processing. Additionally, regulatory constraints on privacy and [data security](https://www.ultralytics.com/glossary/data-security) must be considered.
|
||||||
|
|
||||||
|
### Setting Measurable Objectives
|
||||||
|
|
||||||
|
Setting measurable objectives is key to the success of a computer vision project. These goals should be clear, achievable, and time-bound.
|
||||||
|
|
||||||
|
For example, if you are developing a system to estimate vehicle speeds on a highway, you could consider the following measurable objectives:
|
||||||
|
|
||||||
|
- To achieve at least 95% [accuracy](https://www.ultralytics.com/glossary/accuracy) in speed detection within six months, using a dataset of 10,000 vehicle images.
|
||||||
|
- The system should be able to process real-time video feeds at 30 frames per second with minimal delay.
|
||||||
|
|
||||||
|
By setting specific and quantifiable goals, you can effectively track progress, identify areas for improvement, and ensure the project stays on course.
|
||||||
|
|
||||||
|
## The Connection Between The Problem Statement and The Computer Vision Tasks
|
||||||
|
|
||||||
|
Your problem statement helps you conceptualize which computer vision task can solve your issue.
|
||||||
|
|
||||||
|
For example, if your problem is monitoring vehicle speeds on a highway, the relevant computer vision task is object tracking. [Object tracking](../modes/track.md) is suitable because it allows the system to continuously follow each vehicle in the video feed, which is crucial for accurately calculating their speeds.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/example-of-object-tracking.avif" alt="YOLO vehicle tracking on highway">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Other tasks, like [object detection](../tasks/detect.md), are not suitable as they don't provide continuous location or movement information. Once you've identified the appropriate computer vision task, it guides several critical aspects of your project, like model selection, dataset preparation, and model training approaches.
|
||||||
|
|
||||||
|
## Which Comes First: Model Selection, Dataset Preparation, or Model Training Approach?
|
||||||
|
|
||||||
|
The order of model selection, dataset preparation, and training approach depends on the specifics of your project. Here are a few tips to help you decide:
|
||||||
|
|
||||||
|
- **Clear Understanding of the Problem**: If your problem and objectives are well-defined, start with model selection. Then, prepare your dataset and decide on the training approach based on the model's requirements.
|
||||||
|
- **Example**: Start by selecting a model for a traffic monitoring system that estimates vehicle speeds. Choose an object tracking model, gather and annotate highway videos, and then train the model with techniques for real-time video processing.
|
||||||
|
|
||||||
|
- **Unique or Limited Data**: If your project is constrained by unique or limited data, begin with dataset preparation. For instance, if you have a rare dataset of medical images, annotate and prepare the data first. Then, select a model that performs well on such data, followed by choosing a suitable training approach.
|
||||||
|
- **Example**: Prepare the data first for a facial recognition system with a small dataset. Annotate it, then select a model that works well with limited data, such as a pretrained model for [transfer learning](https://www.ultralytics.com/glossary/transfer-learning). Finally, decide on a training approach, including [data augmentation](https://www.ultralytics.com/glossary/data-augmentation), to expand the dataset.
|
||||||
|
|
||||||
|
- **Need for Experimentation**: In projects where experimentation is crucial, start with the training approach. This is common in research projects where you might initially test different training techniques. Refine your model selection after identifying a promising method and prepare the dataset based on your findings.
|
||||||
|
- **Example**: In a project exploring new methods for detecting manufacturing defects, start with experimenting on a small data subset. Once you find a promising technique, select a model tailored to those findings and prepare a comprehensive dataset.
|
||||||
|
|
||||||
|
## Common Discussion Points in the Community
|
||||||
|
|
||||||
|
Next, let's look at a few common discussion points in the community regarding computer vision tasks and project planning.
|
||||||
|
|
||||||
|
### What Are the Different Computer Vision Tasks?
|
||||||
|
|
||||||
|
The most popular computer vision tasks include [image classification](https://www.ultralytics.com/glossary/image-classification), [object detection](https://www.ultralytics.com/glossary/object-detection), and [image segmentation](https://www.ultralytics.com/glossary/image-segmentation).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/image-classification-vs-object-detection-vs-image-segmentation.avif" alt="Classification vs detection vs segmentation comparison">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
For a detailed explanation of various tasks, please take a look at the Ultralytics Docs page on [YOLO26 Tasks](../tasks/index.md).
|
||||||
|
|
||||||
|
### Can a Pretrained Model Remember Classes It Knew Before Custom Training?
|
||||||
|
|
||||||
|
No, pretrained models don't "remember" classes in the traditional sense. They learn patterns from massive datasets, and during custom training (fine-tuning), these patterns are adjusted for your specific task. The model's capacity is limited, and focusing on new information can overwrite some previous learnings.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/overview-of-transfer-learning.avif" alt="Transfer learning from pretrained to custom model">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
If you want to use the classes the model was pretrained on, a practical approach is to use two models: one retains the original performance, and the other is fine-tuned for your specific task. This way, you can combine the outputs of both models. There are other options like freezing layers, using the pretrained model as a feature extractor, and task-specific branching, but these are more complex solutions and require more expertise.
|
||||||
|
|
||||||
|
### How Do Deployment Options Affect My Computer Vision Project?
|
||||||
|
|
||||||
|
[Model deployment options](./model-deployment-options.md) critically impact the performance of your computer vision project. For instance, the deployment environment must handle the computational load of your model. Here are some practical examples:
|
||||||
|
|
||||||
|
- **Edge Devices**: Deploying on edge devices like smartphones or IoT devices requires lightweight models due to their limited computational resources. Example technologies include [TensorFlow Lite](../integrations/tflite.md) and [ONNX Runtime](../integrations/onnx.md), which are optimized for such environments.
|
||||||
|
- **Cloud Servers**: Cloud deployments can handle more complex models with larger computational demands. Cloud platforms like [AWS](../integrations/amazon-sagemaker.md), Google Cloud, and Azure offer robust hardware options that can scale based on the project's needs.
|
||||||
|
- **On-Premise Servers**: For scenarios requiring high [data privacy](https://www.ultralytics.com/glossary/data-privacy) and security, deploying on-premise might be necessary. This involves significant upfront hardware investment but allows full control over the data and infrastructure.
|
||||||
|
- **Hybrid Solutions**: Some projects might benefit from a hybrid approach, where some processing is done on the edge, while more complex analyses are offloaded to the cloud. This can balance performance needs with cost and latency considerations.
|
||||||
|
|
||||||
|
Each deployment option offers different benefits and challenges, and the choice depends on specific project requirements like performance, cost, and security.
|
||||||
|
|
||||||
|
## Connecting with the Community
|
||||||
|
|
||||||
|
Connecting with other computer vision enthusiasts can be incredibly helpful for your projects by providing support, solutions, and new ideas. Here are some great ways to learn, troubleshoot, and network:
|
||||||
|
|
||||||
|
### Community Support Channels
|
||||||
|
|
||||||
|
- **GitHub Issues:** Head over to the YOLO26 GitHub repository. You can use the [Issues tab](https://github.com/ultralytics/ultralytics/issues) to raise questions, report bugs, and suggest features. The community and maintainers can assist with specific problems you encounter.
|
||||||
|
- **Ultralytics Discord Server:** Become part of the [Ultralytics Discord server](https://discord.com/invite/ultralytics). Connect with fellow users and developers, seek support, exchange knowledge, and discuss ideas.
|
||||||
|
|
||||||
|
### Comprehensive Guides and Documentation
|
||||||
|
|
||||||
|
- **Ultralytics YOLO26 Documentation:** Explore the [official YOLO26 documentation](./index.md) for in-depth guides and valuable tips on various computer vision tasks and projects.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
Defining a clear problem and setting measurable goals is key to a successful computer vision project. We've highlighted the importance of being clear and focused from the start. Having specific goals helps avoid oversight. Also, staying connected with others in the community through platforms like [GitHub](https://github.com/ultralytics/ultralytics) or [Discord](https://discord.com/invite/ultralytics) is important for learning and staying current. In short, good planning and engaging with the community are a huge part of successful computer vision projects.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I define a clear problem statement for my Ultralytics computer vision project?
|
||||||
|
|
||||||
|
To define a clear problem statement for your Ultralytics computer vision project, follow these steps:
|
||||||
|
|
||||||
|
1. **Identify the Core Issue:** Pinpoint the specific challenge your project aims to solve.
|
||||||
|
2. **Determine the Scope:** Clearly outline the boundaries of your problem.
|
||||||
|
3. **Consider End Users and Stakeholders:** Identify who will be affected by your solution.
|
||||||
|
4. **Analyze Project Requirements and Constraints:** Assess available resources and any technical or regulatory limitations.
|
||||||
|
|
||||||
|
Providing a well-defined problem statement ensures that the project remains focused and aligned with your objectives. For a detailed guide, refer to our [practical guide](#defining-a-clear-problem-statement).
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 for speed estimation in my computer vision project?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 is ideal for speed estimation because of its real-time object tracking capabilities, high accuracy, and robust performance in detecting and monitoring vehicle speeds. It overcomes inefficiencies and inaccuracies of traditional radar systems by leveraging cutting-edge computer vision technology. Check out our blog on [speed estimation using YOLO26](https://www.ultralytics.com/blog/ultralytics-yolov8-for-speed-estimation-in-computer-vision-projects) for more insights and practical examples.
|
||||||
|
|
||||||
|
### How do I set effective measurable objectives for my computer vision project with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
Set effective and measurable objectives using the SMART criteria:
|
||||||
|
|
||||||
|
- **Specific:** Define clear and detailed goals.
|
||||||
|
- **Measurable:** Ensure objectives are quantifiable.
|
||||||
|
- **Achievable:** Set realistic targets within your capabilities.
|
||||||
|
- **Relevant:** Align objectives with your overall project goals.
|
||||||
|
- **Time-bound:** Set deadlines for each objective.
|
||||||
|
|
||||||
|
For example, "Achieve 95% accuracy in speed detection within six months using a 10,000 vehicle image dataset." This approach helps track progress and identifies areas for improvement. Read more about [setting measurable objectives](#setting-measurable-objectives).
|
||||||
|
|
||||||
|
### How do deployment options affect the performance of my Ultralytics YOLO models?
|
||||||
|
|
||||||
|
Deployment options critically impact the performance of your Ultralytics YOLO models. Here are key options:
|
||||||
|
|
||||||
|
- **Edge Devices:** Use lightweight models like [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) Lite or ONNX Runtime for deployment on devices with limited resources.
|
||||||
|
- **Cloud Servers:** Utilize robust cloud platforms like AWS, Google Cloud, or Azure for handling complex models.
|
||||||
|
- **On-Premise Servers:** High data privacy and security needs may require on-premise deployments.
|
||||||
|
- **Hybrid Solutions:** Combine edge and cloud approaches for balanced performance and cost-efficiency.
|
||||||
|
|
||||||
|
For more information, refer to our [detailed guide on model deployment options](./model-deployment-options.md).
|
||||||
|
|
||||||
|
### What are the most common challenges in defining the problem for a computer vision project with Ultralytics?
|
||||||
|
|
||||||
|
Common challenges include:
|
||||||
|
|
||||||
|
- Vague or overly broad problem statements.
|
||||||
|
- Unrealistic objectives.
|
||||||
|
- Lack of stakeholder alignment.
|
||||||
|
- Insufficient understanding of technical constraints.
|
||||||
|
- Underestimating data requirements.
|
||||||
|
|
||||||
|
Address these challenges through thorough initial research, clear communication with stakeholders, and iterative refinement of the problem statement and objectives. Learn more about these challenges in our [Computer Vision Project guide](steps-of-a-cv-project.md).
|
||||||
161
docs/en/guides/distance-calculation.md
Executable file
161
docs/en/guides/distance-calculation.md
Executable file
@@ -0,0 +1,161 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn how to calculate distances between objects using Ultralytics YOLO26 for accurate spatial positioning and scene understanding.
|
||||||
|
keywords: Ultralytics, YOLO26, distance calculation, computer vision, object tracking, spatial positioning
|
||||||
|
---
|
||||||
|
|
||||||
|
# Distance Calculation using Ultralytics YOLO26
|
||||||
|
|
||||||
|
## What is Distance Calculation?
|
||||||
|
|
||||||
|
Measuring the gap between two objects is known as distance calculation within a specified space. In the case of [Ultralytics YOLO26](https://github.com/ultralytics/ultralytics), the [bounding box](https://www.ultralytics.com/glossary/bounding-box) centroid is employed to calculate the distance for bounding boxes highlighted by the user.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Oe0vmsvnY74"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to estimate distance between detected objects with Ultralytics YOLO in Pixels 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Visuals
|
||||||
|
|
||||||
|
| Distance Calculation using Ultralytics YOLO26 |
|
||||||
|
| :----------------------------------------------------------------------------------------------------------------------------: |
|
||||||
|
|  |
|
||||||
|
|
||||||
|
## Advantages of Distance Calculation
|
||||||
|
|
||||||
|
- **Localization [Precision](https://www.ultralytics.com/glossary/precision):** Enhances accurate spatial positioning in [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks.
|
||||||
|
- **Size Estimation:** Allows estimation of object size for better contextual understanding.
|
||||||
|
- **Scene Understanding:** Improves 3D scene comprehension for better decision-making in applications like [autonomous vehicles](https://www.ultralytics.com/glossary/autonomous-vehicles) and surveillance systems.
|
||||||
|
- **Collision Avoidance:** Enables systems to detect potential collisions by monitoring distances between moving objects.
|
||||||
|
- **Spatial Analysis:** Facilitates analysis of object relationships and interactions within the monitored environment.
|
||||||
|
|
||||||
|
???+ tip "Distance Calculation"
|
||||||
|
|
||||||
|
- Click any two bounding boxes with the left mouse button to calculate distance.
|
||||||
|
- Use the right mouse button to delete all drawn points.
|
||||||
|
- Left-click anywhere in the frame to add new points.
|
||||||
|
|
||||||
|
???+ warning "Distance is an estimate"
|
||||||
|
|
||||||
|
Distance is an estimate and may not be fully accurate because it is calculated using 2D data,
|
||||||
|
which lacks depth information.
|
||||||
|
|
||||||
|
!!! example "Distance Calculation using Ultralytics YOLO"
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
# Video writer
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
video_writer = cv2.VideoWriter("distance_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
||||||
|
|
||||||
|
# Initialize distance calculation object
|
||||||
|
distancecalculator = solutions.DistanceCalculation(
|
||||||
|
model="yolo26n.pt", # path to the YOLO26 model file.
|
||||||
|
show=True, # display the output
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process video
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
print("Video frame is empty or processing is complete.")
|
||||||
|
break
|
||||||
|
|
||||||
|
results = distancecalculator(im0)
|
||||||
|
|
||||||
|
print(results) # access the output
|
||||||
|
|
||||||
|
video_writer.write(results.plot_im) # write the processed frame.
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
video_writer.release()
|
||||||
|
cv2.destroyAllWindows() # destroy all opened windows
|
||||||
|
```
|
||||||
|
|
||||||
|
### `DistanceCalculation()` Arguments
|
||||||
|
|
||||||
|
Here's a table with the `DistanceCalculation` arguments:
|
||||||
|
|
||||||
|
{% from "macros/solutions-args.md" import param_table %}
|
||||||
|
{{ param_table(["model"]) }}
|
||||||
|
|
||||||
|
You can also make use of various `track` arguments in the `DistanceCalculation` solution.
|
||||||
|
|
||||||
|
{% from "macros/track-args.md" import param_table %}
|
||||||
|
{{ param_table(["tracker", "conf", "iou", "classes", "verbose", "device"]) }}
|
||||||
|
|
||||||
|
Moreover, the following visualization arguments are available:
|
||||||
|
|
||||||
|
{% from "macros/visualization-args.md" import param_table %}
|
||||||
|
{{ param_table(["show", "line_width", "show_conf", "show_labels"]) }}
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
The `DistanceCalculation` class works by tracking objects across video frames and calculating the Euclidean distance between the centroids of selected bounding boxes. When you click on two objects, the solution:
|
||||||
|
|
||||||
|
1. Extracts the centroids (center points) of the selected bounding boxes
|
||||||
|
2. Calculates the Euclidean distance between these centroids in pixels
|
||||||
|
3. Displays the distance on the frame with a connecting line between the objects
|
||||||
|
|
||||||
|
The implementation uses the `mouse_event_for_distance` method to handle mouse interactions, allowing users to select objects and clear selections as needed. The `process` method handles the frame-by-frame processing, tracking objects, and calculating distances.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
|
||||||
|
Distance calculation with YOLO26 has numerous practical applications:
|
||||||
|
|
||||||
|
- **Retail Analytics:** Measure customer proximity to products and analyze store layout effectiveness
|
||||||
|
- **Industrial Safety:** Monitor safe distances between workers and machinery
|
||||||
|
- **Traffic Management:** Analyze vehicle spacing and detect tailgating
|
||||||
|
- **Sports Analysis:** Calculate distances between players, the ball, and key field positions
|
||||||
|
- **Healthcare:** Ensure proper distancing in waiting areas and monitor patient movement
|
||||||
|
- **Robotics:** Enable robots to maintain appropriate distances from obstacles and people
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I calculate distances between objects using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
To calculate distances between objects using [Ultralytics YOLO26](https://github.com/ultralytics/ultralytics), you need to identify the bounding box centroids of the detected objects. This process involves initializing the `DistanceCalculation` class from Ultralytics' `solutions` module and using the model's tracking outputs to calculate the distances.
|
||||||
|
|
||||||
|
### What are the advantages of using distance calculation with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
Using distance calculation with Ultralytics YOLO26 offers several advantages:
|
||||||
|
|
||||||
|
- **Localization Precision:** Provides accurate spatial positioning for objects.
|
||||||
|
- **Size Estimation:** Helps estimate physical sizes, contributing to better contextual understanding.
|
||||||
|
- **Scene Understanding:** Enhances 3D scene comprehension, aiding improved decision-making in applications like autonomous driving and surveillance.
|
||||||
|
- **Real-time Processing:** Performs calculations on-the-fly, making it suitable for live video analysis.
|
||||||
|
- **Integration Capabilities:** Works seamlessly with other YOLO26 solutions like [object tracking](../modes/track.md) and [speed estimation](speed-estimation.md).
|
||||||
|
|
||||||
|
### Can I perform distance calculation in real-time video streams with Ultralytics YOLO26?
|
||||||
|
|
||||||
|
Yes, you can perform distance calculation in real-time video streams with Ultralytics YOLO26. The process involves capturing video frames using [OpenCV](https://www.ultralytics.com/glossary/opencv), running YOLO26 [object detection](https://www.ultralytics.com/glossary/object-detection), and using the `DistanceCalculation` class to calculate distances between objects in successive frames. For a detailed implementation, see the [video stream example](#distance-calculation-using-ultralytics-yolo26).
|
||||||
|
|
||||||
|
### How do I delete points drawn during distance calculation using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
To delete points drawn during distance calculation with Ultralytics YOLO26, you can use a right mouse click. This action will clear all the points you have drawn. For more details, refer to the note section under the [distance calculation example](#distance-calculation-using-ultralytics-yolo26).
|
||||||
|
|
||||||
|
### What are the key arguments for initializing the DistanceCalculation class in Ultralytics YOLO26?
|
||||||
|
|
||||||
|
The key arguments for initializing the `DistanceCalculation` class in Ultralytics YOLO26 include:
|
||||||
|
|
||||||
|
- `model`: Path to the YOLO26 model file.
|
||||||
|
- `tracker`: Tracking algorithm to use (default is 'botsort.yaml').
|
||||||
|
- `conf`: Confidence threshold for detections.
|
||||||
|
- `show`: Flag to display the output.
|
||||||
|
|
||||||
|
For an exhaustive list and default values, see the [arguments of DistanceCalculation](#distancecalculation-arguments).
|
||||||
359
docs/en/guides/docker-quickstart.md
Executable file
359
docs/en/guides/docker-quickstart.md
Executable file
@@ -0,0 +1,359 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn to effortlessly set up Ultralytics in Docker, from installation to running with CPU/GPU support. Follow our comprehensive guide for seamless container experience.
|
||||||
|
keywords: Ultralytics, Docker, Quickstart Guide, CPU support, GPU support, NVIDIA Docker, NVIDIA Container Toolkit, container setup, Docker environment, Docker Hub, Ultralytics projects
|
||||||
|
---
|
||||||
|
|
||||||
|
# Docker Quickstart Guide for Ultralytics
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/ultralytics-docker-package-visual.avif" alt="Ultralytics Docker Package Visual">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This guide serves as a comprehensive introduction to setting up a Docker environment for your Ultralytics projects. [Docker](https://www.docker.com/) is a platform for developing, shipping, and running applications in containers. It is particularly beneficial for ensuring that the software will always run the same, regardless of where it's deployed. For more details, visit the Ultralytics Docker repository on [Docker Hub](https://hub.docker.com/r/ultralytics/ultralytics).
|
||||||
|
|
||||||
|
[](https://hub.docker.com/r/ultralytics/ultralytics)
|
||||||
|
[](https://hub.docker.com/r/ultralytics/ultralytics)
|
||||||
|
|
||||||
|
## What You Will Learn
|
||||||
|
|
||||||
|
- Setting up Docker with NVIDIA support
|
||||||
|
- Installing Ultralytics Docker images
|
||||||
|
- Running Ultralytics in a Docker container with CPU or GPU support
|
||||||
|
- Using a display server with Docker to show Ultralytics detection results
|
||||||
|
- Mounting local directories into the container
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/IYWQZvtOy_Q"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Get started with Docker | Usage of Ultralytics Python Package inside Docker live demo 🎉
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Make sure Docker is installed on your system. If not, you can download and install it from [Docker's website](https://www.docker.com/products/docker-desktop/).
|
||||||
|
- Ensure that your system has an NVIDIA GPU and NVIDIA drivers are installed.
|
||||||
|
- If you are using NVIDIA Jetson devices, ensure that you have the appropriate JetPack version installed. Refer to the [NVIDIA Jetson guide](https://docs.ultralytics.com/guides/nvidia-jetson/) for more details.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setting up Docker with NVIDIA Support
|
||||||
|
|
||||||
|
First, verify that the NVIDIA drivers are properly installed by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nvidia-smi
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installing NVIDIA Container Toolkit
|
||||||
|
|
||||||
|
Now, let's install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html) to enable GPU support in Docker containers:
|
||||||
|
|
||||||
|
=== "Ubuntu/Debian"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
||||||
|
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
|
||||||
|
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
|
||||||
|
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
||||||
|
```
|
||||||
|
Update the package lists and install the nvidia-container-toolkit package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the latest version of `nvidia-container-toolkit`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install -y nvidia-container-toolkit \
|
||||||
|
nvidia-container-toolkit-base libnvidia-container-tools \
|
||||||
|
libnvidia-container1
|
||||||
|
```
|
||||||
|
|
||||||
|
??? info "Optional: Install specific version of nvidia-container-toolkit"
|
||||||
|
|
||||||
|
Optionally, you can install a specific version of the nvidia-container-toolkit by setting the `NVIDIA_CONTAINER_TOOLKIT_VERSION` environment variable:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
|
||||||
|
sudo apt-get install -y \
|
||||||
|
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nvidia-ctk runtime configure --runtime=docker
|
||||||
|
sudo systemctl restart docker
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "RHEL/CentOS/Fedora/Amazon Linux"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo \
|
||||||
|
| sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
|
||||||
|
```
|
||||||
|
|
||||||
|
Update the package lists and install the nvidia-container-toolkit package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dnf clean expire-cache
|
||||||
|
sudo dnf check-update
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dnf install \
|
||||||
|
nvidia-container-toolkit \
|
||||||
|
nvidia-container-toolkit-base \
|
||||||
|
libnvidia-container-tools \
|
||||||
|
libnvidia-container1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
??? info "Optional: Install specific version of nvidia-container-toolkit"
|
||||||
|
|
||||||
|
Optionally, you can install a specific version of the nvidia-container-toolkit by setting the `NVIDIA_CONTAINER_TOOLKIT_VERSION` environment variable:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
|
||||||
|
sudo dnf install -y \
|
||||||
|
nvidia-container-toolkit-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
nvidia-container-toolkit-base-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
libnvidia-container-tools-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||||
|
libnvidia-container1-${NVIDIA_CONTAINER_TOOLKIT_VERSION}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nvidia-ctk runtime configure --runtime=docker
|
||||||
|
sudo systemctl restart docker
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verify NVIDIA Runtime with Docker
|
||||||
|
|
||||||
|
Run `docker info | grep -i runtime` to ensure that `nvidia` appears in the list of runtimes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker info | grep -i runtime
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installing Ultralytics Docker Images
|
||||||
|
|
||||||
|
Ultralytics offers several Docker images optimized for various platforms and use-cases:
|
||||||
|
|
||||||
|
- **Dockerfile:** GPU image, ideal for training.
|
||||||
|
- **Dockerfile-arm64:** For ARM64 architecture, suitable for devices like [Raspberry Pi](raspberry-pi.md).
|
||||||
|
- **Dockerfile-cpu:** CPU-only version for inference and non-GPU environments.
|
||||||
|
- **Dockerfile-jetson-jetpack4:** Optimized for [NVIDIA Jetson](https://docs.ultralytics.com/guides/nvidia-jetson/) devices running [NVIDIA JetPack 4](https://developer.nvidia.com/embedded/jetpack-sdk-461).
|
||||||
|
- **Dockerfile-jetson-jetpack5:** Optimized for [NVIDIA Jetson](https://docs.ultralytics.com/guides/nvidia-jetson/) devices running [NVIDIA JetPack 5](https://developer.nvidia.com/embedded/jetpack-sdk-512).
|
||||||
|
- **Dockerfile-jetson-jetpack6:** Optimized for [NVIDIA Jetson](https://docs.ultralytics.com/guides/nvidia-jetson/) devices running [NVIDIA JetPack 6](https://developer.nvidia.com/embedded/jetpack-sdk-61).
|
||||||
|
- **Dockerfile-jupyter:** For interactive development using JupyterLab in the browser.
|
||||||
|
- **Dockerfile-python:** Minimal Python environment for lightweight applications.
|
||||||
|
- **Dockerfile-conda:** Includes [Miniconda3](https://www.anaconda.com/docs/main) and Ultralytics package installed via Conda.
|
||||||
|
|
||||||
|
To pull the latest image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set image name as a variable
|
||||||
|
t=ultralytics/ultralytics:latest
|
||||||
|
|
||||||
|
# Pull the latest Ultralytics image from Docker Hub
|
||||||
|
sudo docker pull $t
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Running Ultralytics in Docker Container
|
||||||
|
|
||||||
|
Here's how to execute the Ultralytics Docker container:
|
||||||
|
|
||||||
|
### Using only the CPU
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run without GPU
|
||||||
|
sudo docker run -it --ipc=host $t
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using GPUs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run with all GPUs
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all $t
|
||||||
|
|
||||||
|
# Run specifying which GPUs to use
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus '"device=2,3"' $t
|
||||||
|
```
|
||||||
|
|
||||||
|
The `-it` flag assigns a pseudo-TTY and keeps stdin open, allowing you to interact with the container. The `--ipc=host` flag enables sharing of host's IPC namespace, essential for sharing memory between processes. The `--gpus` flag allows the container to access the host's GPUs.
|
||||||
|
|
||||||
|
### Note on File Accessibility
|
||||||
|
|
||||||
|
To work with files on your local machine within the container, you can use Docker volumes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Mount a local directory into the container
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all -v /path/on/host:/path/in/container $t
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `/path/on/host` with the directory path on your local machine and `/path/in/container` with the desired path inside the Docker container.
|
||||||
|
|
||||||
|
### Persisting Training Outputs
|
||||||
|
|
||||||
|
Training outputs save to `/ultralytics/runs/<task>/<name>/` inside the container by default. Without mounting a host directory, outputs are lost when the container is removed.
|
||||||
|
|
||||||
|
To persist training outputs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Recommended: mount workspace and specify project path
|
||||||
|
sudo docker run --rm -it -v "$(pwd)":/w -w /w ultralytics/ultralytics:latest \
|
||||||
|
yolo train model=yolo26n.pt data=coco8.yaml project=/w/runs
|
||||||
|
```
|
||||||
|
|
||||||
|
This saves all training outputs to `./runs` on your host machine.
|
||||||
|
|
||||||
|
## Run graphical user interface (GUI) applications in a Docker Container
|
||||||
|
|
||||||
|
!!! danger "Highly Experimental - User Assumes All Risk"
|
||||||
|
|
||||||
|
The following instructions are experimental. Sharing a X11 socket with a Docker container poses potential security risks. Therefore, it's recommended to test this solution only in a controlled environment. For more information, refer to these resources on how to use `xhost`<sup>[(1)](http://users.stat.umn.edu/~geyer/secure.html)[(2)](https://linux.die.net/man/1/xhost)</sup>.
|
||||||
|
|
||||||
|
Docker is primarily used to containerize background applications and CLI programs, but it can also run graphical programs. In the Linux world, two main graphic servers handle graphical display: [X11](https://www.x.org/wiki/) (also known as the X Window System) and [Wayland](<https://en.wikipedia.org/wiki/Wayland_(protocol)>). Before starting, it's essential to determine which graphics server you are currently using. Run this command to find out:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
env | grep -E -i 'x11|xorg|wayland'
|
||||||
|
```
|
||||||
|
|
||||||
|
Setup and configuration of an X11 or Wayland display server is outside the scope of this guide. If the above command returns nothing, then you'll need to start by getting either working for your system before continuing.
|
||||||
|
|
||||||
|
### Running a Docker Container with a GUI
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
??? info "Use GPUs"
|
||||||
|
If you're using [GPUs](#using-gpus), you can add the `--gpus all` flag to the command.
|
||||||
|
|
||||||
|
??? info "Docker runtime flag"
|
||||||
|
If your Docker installation does not use the `nvidia` runtime by default, you can add the `--runtime=nvidia` flag to the command.
|
||||||
|
|
||||||
|
=== "X11"
|
||||||
|
|
||||||
|
If you're using X11, you can run the following command to allow the Docker container to access the X11 socket:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xhost +local:docker && docker run -e DISPLAY=$DISPLAY \
|
||||||
|
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||||
|
-v ~/.Xauthority:/root/.Xauthority \
|
||||||
|
-it --ipc=host $t
|
||||||
|
```
|
||||||
|
|
||||||
|
This command sets the `DISPLAY` environment variable to the host's display, mounts the X11 socket, and maps the `.Xauthority` file to the container. The `xhost +local:docker` command allows the Docker container to access the X11 server.
|
||||||
|
|
||||||
|
|
||||||
|
=== "Wayland"
|
||||||
|
|
||||||
|
For Wayland, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xhost +local:docker && docker run -e DISPLAY=$DISPLAY \
|
||||||
|
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
|
||||||
|
--net=host -it --ipc=host $t
|
||||||
|
```
|
||||||
|
|
||||||
|
This command sets the `DISPLAY` environment variable to the host's display, mounts the Wayland socket, and allows the Docker container to access the Wayland server.
|
||||||
|
|
||||||
|
### Using Docker with a GUI
|
||||||
|
|
||||||
|
Now you can display graphical applications inside your Docker container. For example, you can run the following [CLI command](../usage/cli.md) to visualize the [predictions](../modes/predict.md) from a [YOLO26 model](../models/yolo26.md):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo predict model=yolo26n.pt show=True
|
||||||
|
```
|
||||||
|
|
||||||
|
??? info "Testing"
|
||||||
|
|
||||||
|
A simple way to validate that the Docker group has access to the X11 server is to run a container with a GUI program like [`xclock`](https://www.x.org/archive/X11R6.8.1/doc/xclock.1.html) or [`xeyes`](https://www.x.org/releases/X11R7.5/doc/man/man1/xeyes.1.html). Alternatively, you can also install these programs in the Ultralytics Docker container to test the access to the X11 server of your GNU-Linux display server. If you run into any problems, consider setting the environment variable `-e QT_DEBUG_PLUGINS=1`. Setting this environment variable enables the output of debugging information, aiding in the troubleshooting process.
|
||||||
|
|
||||||
|
### When finished with Docker GUI
|
||||||
|
|
||||||
|
!!! warning "Revoke access"
|
||||||
|
|
||||||
|
In both cases, don't forget to revoke access from the Docker group when you're done.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xhost -local:docker
|
||||||
|
```
|
||||||
|
|
||||||
|
??? question "Want to view image results directly in the Terminal?"
|
||||||
|
|
||||||
|
Refer to the following guide on [viewing the image results using a terminal](./view-results-in-terminal.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You are now set up to use Ultralytics with Docker and ready to take advantage of its capabilities. For alternative installation methods, see the [Ultralytics quickstart documentation](../quickstart.md).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I set up Ultralytics with Docker?
|
||||||
|
|
||||||
|
To set up Ultralytics with Docker, first ensure that Docker is installed on your system. If you have an NVIDIA GPU, install the [NVIDIA Container Toolkit](#installing-nvidia-container-toolkit) to enable GPU support. Then, pull the latest Ultralytics Docker image from Docker Hub using the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker pull ultralytics/ultralytics:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed steps, refer to our Docker Quickstart Guide.
|
||||||
|
|
||||||
|
### What are the benefits of using Ultralytics Docker images for machine learning projects?
|
||||||
|
|
||||||
|
Using Ultralytics Docker images ensures a consistent environment across different machines, replicating the same software and dependencies. This is particularly useful for [collaborating across teams](https://www.ultralytics.com/blog/how-ultralytics-integration-can-enhance-your-workflow), running models on various hardware, and maintaining reproducibility. For GPU-based training, Ultralytics provides optimized Docker images such as `Dockerfile` for general GPU usage and `Dockerfile-jetson` for NVIDIA Jetson devices. Explore [Ultralytics Docker Hub](https://hub.docker.com/r/ultralytics/ultralytics) for more details.
|
||||||
|
|
||||||
|
### How can I run Ultralytics YOLO in a Docker container with GPU support?
|
||||||
|
|
||||||
|
First, ensure that the [NVIDIA Container Toolkit](#installing-nvidia-container-toolkit) is installed and configured. Then, use the following command to run Ultralytics YOLO with GPU support:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all ultralytics/ultralytics:latest # all GPUs
|
||||||
|
```
|
||||||
|
|
||||||
|
This command sets up a Docker container with GPU access. For additional details, see the Docker Quickstart Guide.
|
||||||
|
|
||||||
|
### How do I visualize YOLO prediction results in a Docker container with a display server?
|
||||||
|
|
||||||
|
To visualize YOLO prediction results with a GUI in a Docker container, you need to allow Docker to access your display server. For systems running X11, the command is:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xhost +local:docker && docker run -e DISPLAY=$DISPLAY \
|
||||||
|
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||||
|
-v ~/.Xauthority:/root/.Xauthority \
|
||||||
|
-it --ipc=host ultralytics/ultralytics:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
For systems running Wayland, use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xhost +local:docker && docker run -e DISPLAY=$DISPLAY \
|
||||||
|
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
|
||||||
|
--net=host -it --ipc=host ultralytics/ultralytics:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
More information can be found in the [Run graphical user interface (GUI) applications in a Docker Container](#run-graphical-user-interface-gui-applications-in-a-docker-container) section.
|
||||||
|
|
||||||
|
### Can I mount local directories into the Ultralytics Docker container?
|
||||||
|
|
||||||
|
Yes, you can mount local directories into the Ultralytics Docker container using the `-v` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker run -it --ipc=host --runtime=nvidia --gpus all -v /path/on/host:/path/in/container ultralytics/ultralytics:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `/path/on/host` with the directory on your local machine and `/path/in/container` with the desired path inside the container. This setup allows you to work with your local files within the container. For more information, refer to the [Note on File Accessibility](#note-on-file-accessibility) section.
|
||||||
219
docs/en/guides/heatmaps.md
Executable file
219
docs/en/guides/heatmaps.md
Executable file
@@ -0,0 +1,219 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Transform complex data into insightful heatmaps using Ultralytics YOLO26. Discover patterns, trends, and anomalies with vibrant visualizations.
|
||||||
|
keywords: Ultralytics, YOLO26, heatmaps, data visualization, data analysis, complex data, patterns, trends, anomalies
|
||||||
|
---
|
||||||
|
|
||||||
|
# Advanced [Data Visualization](https://www.ultralytics.com/glossary/data-visualization): Heatmaps using Ultralytics YOLO26 🚀
|
||||||
|
|
||||||
|
## Introduction to Heatmaps
|
||||||
|
|
||||||
|
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-generate-heatmaps-using-ultralytics-yolo.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Heatmaps In Colab"></a>
|
||||||
|
|
||||||
|
A heatmap generated with [Ultralytics YOLO26](https://github.com/ultralytics/ultralytics/) transforms complex data into a vibrant, color-coded matrix. This visual tool employs a spectrum of colors to represent varying data values, where warmer hues indicate higher intensities and cooler tones signify lower values. Heatmaps excel in visualizing intricate data patterns, correlations, and anomalies, offering an accessible and engaging approach to data interpretation across diverse domains.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/4ezde5-nZZw"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Heatmaps using Ultralytics YOLO26
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Why Choose Heatmaps for Data Analysis?
|
||||||
|
|
||||||
|
- **Intuitive Data Distribution Visualization:** Heatmaps simplify the comprehension of data concentration and distribution, converting complex datasets into easy-to-understand visual formats.
|
||||||
|
- **Efficient Pattern Detection:** By visualizing data in heatmap format, it becomes easier to spot trends, clusters, and outliers, facilitating quicker analysis and insights.
|
||||||
|
- **Enhanced Spatial Analysis and Decision-Making:** Heatmaps are instrumental in illustrating spatial relationships, aiding in decision-making processes in sectors such as business intelligence, environmental studies, and urban planning.
|
||||||
|
|
||||||
|
## Real World Applications
|
||||||
|
|
||||||
|
| Transportation | Retail |
|
||||||
|
| :---------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: |
|
||||||
|
|  |  |
|
||||||
|
| Ultralytics YOLO26 Transportation Heatmap | Ultralytics YOLO26 Retail Heatmap |
|
||||||
|
|
||||||
|
!!! example "Heatmaps using Ultralytics YOLO"
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run a heatmap example
|
||||||
|
yolo solutions heatmap show=True
|
||||||
|
|
||||||
|
# Pass a source video
|
||||||
|
yolo solutions heatmap source="path/to/video.mp4"
|
||||||
|
|
||||||
|
# Pass a custom colormap
|
||||||
|
yolo solutions heatmap colormap=cv2.COLORMAP_INFERNO
|
||||||
|
|
||||||
|
# Heatmaps + object counting
|
||||||
|
yolo solutions heatmap region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]"
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
# Video writer
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
||||||
|
|
||||||
|
# For object counting with heatmap, you can pass region points.
|
||||||
|
# region_points = [(20, 400), (1080, 400)] # line points
|
||||||
|
# region_points = [(20, 400), (1080, 400), (1080, 360), (20, 360)] # rectangle region
|
||||||
|
# region_points = [(20, 400), (1080, 400), (1080, 360), (20, 360), (20, 400)] # polygon points
|
||||||
|
|
||||||
|
# Initialize heatmap object
|
||||||
|
heatmap = solutions.Heatmap(
|
||||||
|
show=True, # display the output
|
||||||
|
model="yolo26n.pt", # path to the YOLO26 model file
|
||||||
|
colormap=cv2.COLORMAP_PARULA, # colormap of heatmap
|
||||||
|
# region=region_points, # object counting with heatmaps, you can pass region_points
|
||||||
|
# classes=[0, 2], # generate heatmap for specific classes, e.g., person and car.
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process video
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
print("Video frame is empty or processing is complete.")
|
||||||
|
break
|
||||||
|
|
||||||
|
results = heatmap(im0)
|
||||||
|
|
||||||
|
# print(results) # access the output
|
||||||
|
|
||||||
|
video_writer.write(results.plot_im) # write the processed frame.
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
video_writer.release()
|
||||||
|
cv2.destroyAllWindows() # destroy all opened windows
|
||||||
|
```
|
||||||
|
|
||||||
|
### `Heatmap()` Arguments
|
||||||
|
|
||||||
|
Here's a table with the `Heatmap` arguments:
|
||||||
|
|
||||||
|
{% from "macros/solutions-args.md" import param_table %}
|
||||||
|
{{ param_table(["model", "colormap", "show_in", "show_out", "region"]) }}
|
||||||
|
|
||||||
|
You can also apply different `track` arguments in the `Heatmap` solution.
|
||||||
|
|
||||||
|
{% from "macros/track-args.md" import param_table %}
|
||||||
|
{{ param_table(["tracker", "conf", "iou", "classes", "verbose", "device"]) }}
|
||||||
|
|
||||||
|
Additionally, the supported visualization arguments are listed below:
|
||||||
|
|
||||||
|
{% from "macros/visualization-args.md" import param_table %}
|
||||||
|
{{ param_table(["show", "line_width", "show_conf", "show_labels"]) }}
|
||||||
|
|
||||||
|
#### Heatmap COLORMAPs
|
||||||
|
|
||||||
|
| Colormap Name | Description |
|
||||||
|
| ------------------------------- | -------------------------------------- |
|
||||||
|
| `cv::COLORMAP_AUTUMN` | Autumn color map |
|
||||||
|
| `cv::COLORMAP_BONE` | Bone color map |
|
||||||
|
| `cv::COLORMAP_JET` | Jet color map |
|
||||||
|
| `cv::COLORMAP_WINTER` | Winter color map |
|
||||||
|
| `cv::COLORMAP_RAINBOW` | Rainbow color map |
|
||||||
|
| `cv::COLORMAP_OCEAN` | Ocean color map |
|
||||||
|
| `cv::COLORMAP_SUMMER` | Summer color map |
|
||||||
|
| `cv::COLORMAP_SPRING` | Spring color map |
|
||||||
|
| `cv::COLORMAP_COOL` | Cool color map |
|
||||||
|
| `cv::COLORMAP_HSV` | HSV (Hue, Saturation, Value) color map |
|
||||||
|
| `cv::COLORMAP_PINK` | Pink color map |
|
||||||
|
| `cv::COLORMAP_HOT` | Hot color map |
|
||||||
|
| `cv::COLORMAP_PARULA` | Parula color map |
|
||||||
|
| `cv::COLORMAP_MAGMA` | Magma color map |
|
||||||
|
| `cv::COLORMAP_INFERNO` | Inferno color map |
|
||||||
|
| `cv::COLORMAP_PLASMA` | Plasma color map |
|
||||||
|
| `cv::COLORMAP_VIRIDIS` | Viridis color map |
|
||||||
|
| `cv::COLORMAP_CIVIDIS` | Cividis color map |
|
||||||
|
| `cv::COLORMAP_TWILIGHT` | Twilight color map |
|
||||||
|
| `cv::COLORMAP_TWILIGHT_SHIFTED` | Shifted Twilight color map |
|
||||||
|
| `cv::COLORMAP_TURBO` | Turbo color map |
|
||||||
|
| `cv::COLORMAP_DEEPGREEN` | Deep Green color map |
|
||||||
|
|
||||||
|
These colormaps are commonly used for visualizing data with different color representations.
|
||||||
|
|
||||||
|
## How Heatmaps Work in Ultralytics YOLO26
|
||||||
|
|
||||||
|
The [Heatmap solution](../reference/solutions/heatmap.md) in Ultralytics YOLO26 extends the [ObjectCounter](../reference/solutions/object_counter.md) class to generate and visualize movement patterns in video streams. When initialized, the solution creates a blank heatmap layer that gets updated as objects move through the frame.
|
||||||
|
|
||||||
|
For each detected object, the solution:
|
||||||
|
|
||||||
|
1. Tracks the object across frames using YOLO26's tracking capabilities
|
||||||
|
2. Updates the heatmap intensity at the object's location
|
||||||
|
3. Applies a selected colormap to visualize the intensity values
|
||||||
|
4. Overlays the colored heatmap on the original frame
|
||||||
|
|
||||||
|
The result is a dynamic visualization that builds up over time, revealing traffic patterns, crowd movements, or other spatial behaviors in your video data.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How does Ultralytics YOLO26 generate heatmaps and what are their benefits?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 generates heatmaps by transforming complex data into a color-coded matrix where different hues represent data intensities. Heatmaps make it easier to visualize patterns, correlations, and anomalies in the data. Warmer hues indicate higher values, while cooler tones represent lower values. The primary benefits include intuitive visualization of data distribution, efficient pattern detection, and enhanced spatial analysis for decision-making. For more details and configuration options, refer to the [Heatmap Configuration](#heatmap-arguments) section.
|
||||||
|
|
||||||
|
### Can I use Ultralytics YOLO26 to perform object tracking and generate a heatmap simultaneously?
|
||||||
|
|
||||||
|
Yes, Ultralytics YOLO26 supports object tracking and heatmap generation concurrently. This can be achieved through its `Heatmap` solution integrated with object tracking models. To do so, you need to initialize the heatmap object and use YOLO26's tracking capabilities. Here's a simple example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
heatmap = solutions.Heatmap(colormap=cv2.COLORMAP_PARULA, show=True, model="yolo26n.pt")
|
||||||
|
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if not success:
|
||||||
|
break
|
||||||
|
results = heatmap(im0)
|
||||||
|
cap.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
For further guidance, check the [Tracking Mode](../modes/track.md) page.
|
||||||
|
|
||||||
|
### What makes Ultralytics YOLO26 heatmaps different from other data visualization tools like those from [OpenCV](https://www.ultralytics.com/glossary/opencv) or Matplotlib?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 heatmaps are specifically designed for integration with its [object detection](https://www.ultralytics.com/glossary/object-detection) and tracking models, providing an end-to-end solution for real-time data analysis. Unlike generic visualization tools like OpenCV or Matplotlib, YOLO26 heatmaps are optimized for performance and automated processing, supporting features like persistent tracking, decay factor adjustment, and real-time video overlay. For more information on YOLO26's unique features, visit the [Ultralytics YOLO26 Introduction](https://www.ultralytics.com/blog/introducing-ultralytics-yolov8).
|
||||||
|
|
||||||
|
### How can I visualize only specific object classes in heatmaps using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
You can visualize specific object classes by specifying the desired classes in the `track()` method of the YOLO model. For instance, if you only want to visualize cars and persons (assuming their class indices are 0 and 2), you can set the `classes` parameter accordingly.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
heatmap = solutions.Heatmap(show=True, model="yolo26n.pt", classes=[0, 2])
|
||||||
|
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if not success:
|
||||||
|
break
|
||||||
|
results = heatmap(im0)
|
||||||
|
cap.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Why should businesses choose Ultralytics YOLO26 for heatmap generation in data analysis?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 offers seamless integration of advanced object detection and real-time heatmap generation, making it an ideal choice for businesses looking to visualize data more effectively. The key advantages include intuitive data distribution visualization, efficient pattern detection, and enhanced spatial analysis for better decision-making. Additionally, YOLO26's cutting-edge features such as persistent tracking, customizable colormaps, and support for various export formats make it superior to other tools like [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) and OpenCV for comprehensive data analysis. Learn more about business applications at [Ultralytics Plans](https://www.ultralytics.com/plans).
|
||||||
347
docs/en/guides/hyperparameter-tuning.md
Executable file
347
docs/en/guides/hyperparameter-tuning.md
Executable file
@@ -0,0 +1,347 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Master hyperparameter tuning for Ultralytics YOLO to optimize model performance with our comprehensive guide. Elevate your machine learning models today!
|
||||||
|
keywords: Ultralytics YOLO, hyperparameter tuning, machine learning, model optimization, genetic algorithms, learning rate, batch size, epochs
|
||||||
|
---
|
||||||
|
|
||||||
|
# Ultralytics YOLO [Hyperparameter Tuning](https://www.ultralytics.com/glossary/hyperparameter-tuning) Guide
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
Hyperparameter tuning is not just a one-time setup but an iterative process aimed at optimizing the [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) model's performance metrics, such as accuracy, precision, and recall. In the context of Ultralytics YOLO, these hyperparameters could range from learning rate to architectural details, such as the number of layers or types of activation functions used.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/j0MOGKBqx7E"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Tune Hyperparameters for Better Model Performance 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### What are Hyperparameters?
|
||||||
|
|
||||||
|
Hyperparameters are high-level, structural settings for the algorithm. They are set prior to the training phase and remain constant during it. Here are some commonly tuned hyperparameters in Ultralytics YOLO:
|
||||||
|
|
||||||
|
- **Learning Rate** `lr0`: Determines the step size at each iteration while moving towards a minimum in the [loss function](https://www.ultralytics.com/glossary/loss-function).
|
||||||
|
- **[Batch Size](https://www.ultralytics.com/glossary/batch-size)** `batch`: Number of images processed simultaneously in a forward pass.
|
||||||
|
- **Number of [Epochs](https://www.ultralytics.com/glossary/epoch)** `epochs`: An epoch is one complete forward and backward pass of all the training examples.
|
||||||
|
- **Architecture Specifics**: Such as channel counts, number of layers, types of activation functions, etc.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/hyperparameter-tuning-visual.avif" alt="Hyperparameter optimization search space visualization">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
For a full list of augmentation hyperparameters used in YOLO26 please refer to the [configurations page](../usage/cfg.md#augmentation-settings).
|
||||||
|
|
||||||
|
### Genetic Evolution and Mutation
|
||||||
|
|
||||||
|
Ultralytics YOLO uses [genetic algorithms](https://en.wikipedia.org/wiki/Genetic_algorithm) to optimize hyperparameters. Genetic algorithms are inspired by the mechanism of natural selection and genetics.
|
||||||
|
|
||||||
|
- **Mutation**: In the context of Ultralytics YOLO, mutation helps in locally searching the hyperparameter space by applying small, random changes to existing hyperparameters, producing new candidates for evaluation.
|
||||||
|
- **Crossover**: Although crossover is a popular genetic algorithm technique, it is not currently used in Ultralytics YOLO for hyperparameter tuning. The focus is mainly on mutation for generating new hyperparameter sets.
|
||||||
|
|
||||||
|
## Preparing for Hyperparameter Tuning
|
||||||
|
|
||||||
|
Before you begin the tuning process, it's important to:
|
||||||
|
|
||||||
|
1. **Identify the Metrics**: Determine the metrics you will use to evaluate the model's performance. This could be AP50, F1-score, or others.
|
||||||
|
2. **Set the Tuning Budget**: Define how much computational resources you're willing to allocate. Hyperparameter tuning can be computationally intensive.
|
||||||
|
|
||||||
|
## Steps Involved
|
||||||
|
|
||||||
|
### Initialize Hyperparameters
|
||||||
|
|
||||||
|
Start with a reasonable set of initial hyperparameters. This could either be the default hyperparameters set by Ultralytics YOLO or something based on your domain knowledge or previous experiments.
|
||||||
|
|
||||||
|
### Mutate Hyperparameters
|
||||||
|
|
||||||
|
Use the `_mutate` method to produce a new set of hyperparameters based on the existing set. The [Tuner class](https://docs.ultralytics.com/reference/engine/tuner/) handles this process automatically.
|
||||||
|
|
||||||
|
### Train Model
|
||||||
|
|
||||||
|
Training is performed using the mutated set of hyperparameters. The training performance is then assessed using your chosen metrics.
|
||||||
|
|
||||||
|
### Evaluate Model
|
||||||
|
|
||||||
|
Use metrics like AP50, F1-score, or custom metrics to evaluate the model's performance. The [evaluation process](https://docs.ultralytics.com/modes/val/) helps determine if the current hyperparameters are better than previous ones.
|
||||||
|
|
||||||
|
### Log Results
|
||||||
|
|
||||||
|
It's crucial to log both the performance metrics and the corresponding hyperparameters for future reference. Ultralytics YOLO automatically saves these results in CSV format.
|
||||||
|
|
||||||
|
### Repeat
|
||||||
|
|
||||||
|
The process is repeated until either the set number of iterations is reached or the performance metric is satisfactory. Each iteration builds upon the knowledge gained from previous runs.
|
||||||
|
|
||||||
|
## Default Search Space Description
|
||||||
|
|
||||||
|
The following table lists the default search space parameters for hyperparameter tuning in YOLO26. Each parameter has a specific value range defined by a tuple `(min, max)`.
|
||||||
|
|
||||||
|
| Parameter | Type | Value Range | Description |
|
||||||
|
| ----------------- | ------- | -------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `lr0` | `float` | `(1e-5, 1e-1)` | Initial learning rate at the start of training. Lower values provide more stable training but slower convergence |
|
||||||
|
| `lrf` | `float` | `(0.01, 1.0)` | Final learning rate factor as a fraction of lr0. Controls how much the learning rate decreases during training |
|
||||||
|
| `momentum` | `float` | `(0.6, 0.98)` | SGD momentum factor. Higher values help maintain consistent gradient direction and can speed up convergence |
|
||||||
|
| `weight_decay` | `float` | `(0.0, 0.001)` | L2 regularization factor to prevent overfitting. Larger values enforce stronger regularization |
|
||||||
|
| `warmup_epochs` | `float` | `(0.0, 5.0)` | Number of epochs for linear learning rate warmup. Helps prevent early training instability |
|
||||||
|
| `warmup_momentum` | `float` | `(0.0, 0.95)` | Initial momentum during warmup phase. Gradually increases to the final momentum value |
|
||||||
|
| `box` | `float` | `(0.02, 0.2)` | Bounding box loss weight in the total loss function. Balances box regression vs classification |
|
||||||
|
| `cls` | `float` | `(0.2, 4.0)` | Classification loss weight in the total loss function. Higher values emphasize correct class prediction |
|
||||||
|
| `dfl` | `float` | `(0.4, 6.0)` | DFL (Distribution Focal Loss) weight in the total loss function. Higher values emphasize precise bounding box localization |
|
||||||
|
| `hsv_h` | `float` | `(0.0, 0.1)` | Random hue augmentation range in HSV color space. Helps model generalize across color variations |
|
||||||
|
| `hsv_s` | `float` | `(0.0, 0.9)` | Random saturation augmentation range in HSV space. Simulates different lighting conditions |
|
||||||
|
| `hsv_v` | `float` | `(0.0, 0.9)` | Random value (brightness) augmentation range. Helps model handle different exposure levels |
|
||||||
|
| `degrees` | `float` | `(0.0, 45.0)` | Maximum rotation augmentation in degrees. Helps model become invariant to object orientation |
|
||||||
|
| `translate` | `float` | `(0.0, 0.9)` | Maximum translation augmentation as fraction of image size. Improves robustness to object position |
|
||||||
|
| `scale` | `float` | `(0.0, 0.9)` | Random scaling augmentation range. Helps model detect objects at different sizes |
|
||||||
|
| `shear` | `float` | `(0.0, 10.0)` | Maximum shear augmentation in degrees. Adds perspective-like distortions to training images |
|
||||||
|
| `perspective` | `float` | `(0.0, 0.001)` | Random perspective augmentation range. Simulates different viewing angles |
|
||||||
|
| `flipud` | `float` | `(0.0, 1.0)` | Probability of vertical image flip during training. Useful for overhead/aerial imagery |
|
||||||
|
| `fliplr` | `float` | `(0.0, 1.0)` | Probability of horizontal image flip. Helps model become invariant to object direction |
|
||||||
|
| `bgr` | `float` | `(0.0, 1.0)` | Probability of using BGR augmentation, which swaps color channels. Can help with color invariance |
|
||||||
|
| `mosaic` | `float` | `(0.0, 1.0)` | Probability of using mosaic augmentation, which combines 4 images. Especially useful for small object detection |
|
||||||
|
| `mixup` | `float` | `(0.0, 1.0)` | Probability of using mixup augmentation, which blends two images. Can improve model robustness |
|
||||||
|
| `copy_paste` | `float` | `(0.0, 1.0)` | Probability of using copy-paste augmentation. Helps improve instance segmentation performance |
|
||||||
|
| `close_mosaic` | `int` | `(0, 10)` | Disables mosaic in the last N epochs to stabilize training before completion. |
|
||||||
|
|
||||||
|
## Custom Search Space Example
|
||||||
|
|
||||||
|
Here's how to define a search space and use the `model.tune()` method to utilize the `Tuner` class for hyperparameter tuning of YOLO26n on COCO8 for 30 epochs with an AdamW optimizer and skipping plotting, checkpointing and validation other than on final epoch for faster Tuning.
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
|
||||||
|
This example is for **demonstration** only. Hyperparameters derived from short or small-scale tuning runs are rarely optimal for real-world training. In practice, tuning should be performed under settings similar to full training — including comparable datasets, epochs, and augmentations — to ensure reliable and transferable results. Quick tuning may bias parameters toward faster convergence or short-term validation gains that do not generalize.
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Initialize the YOLO model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Define search space
|
||||||
|
search_space = {
|
||||||
|
"lr0": (1e-5, 1e-1),
|
||||||
|
"degrees": (0.0, 45.0),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tune hyperparameters on COCO8 for 30 epochs
|
||||||
|
model.tune(
|
||||||
|
data="coco8.yaml",
|
||||||
|
epochs=30,
|
||||||
|
iterations=300,
|
||||||
|
optimizer="AdamW",
|
||||||
|
space=search_space,
|
||||||
|
plots=False,
|
||||||
|
save=False,
|
||||||
|
val=False,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resuming an Interrupted Hyperparameter Tuning Session
|
||||||
|
|
||||||
|
You can resume an interrupted hyperparameter tuning session by passing `resume=True`. You can optionally pass the directory `name` used under `runs/{task}` to resume. Otherwise, it would resume the last interrupted session. You also need to provide all the previous training arguments including `data`, `epochs`, `iterations` and `space`.
|
||||||
|
|
||||||
|
!!! example "Using `resume=True` with `model.tune()`"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Define a YOLO model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Define search space
|
||||||
|
search_space = {
|
||||||
|
"lr0": (1e-5, 1e-1),
|
||||||
|
"degrees": (0.0, 45.0),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Resume previous run
|
||||||
|
results = model.tune(data="coco8.yaml", epochs=50, iterations=300, space=search_space, resume=True)
|
||||||
|
|
||||||
|
# Resume tuning run with name 'tune_exp'
|
||||||
|
results = model.tune(data="coco8.yaml", epochs=50, iterations=300, space=search_space, name="tune_exp", resume=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
After you've successfully completed the hyperparameter tuning process, you will obtain several files and directories that encapsulate the results of the tuning. The following describes each:
|
||||||
|
|
||||||
|
### File Structure
|
||||||
|
|
||||||
|
Here's what the directory structure of the results will look like. Training directories like `train1/` contain individual tuning iterations, i.e., one model trained with one set of hyperparameters. The `tune/` directory contains tuning results from all the individual model trainings:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
runs/
|
||||||
|
└── detect/
|
||||||
|
├── train1/
|
||||||
|
├── train2/
|
||||||
|
├── ...
|
||||||
|
└── tune/
|
||||||
|
├── best_hyperparameters.yaml
|
||||||
|
├── best_fitness.png
|
||||||
|
├── tune_results.csv
|
||||||
|
├── tune_scatter_plots.png
|
||||||
|
└── weights/
|
||||||
|
├── last.pt
|
||||||
|
└── best.pt
|
||||||
|
```
|
||||||
|
|
||||||
|
### File Descriptions
|
||||||
|
|
||||||
|
#### best_hyperparameters.yaml
|
||||||
|
|
||||||
|
This YAML file contains the best-performing hyperparameters found during the tuning process. You can use this file to initialize future trainings with these optimized settings.
|
||||||
|
|
||||||
|
- **Format**: YAML
|
||||||
|
- **Usage**: Hyperparameter results
|
||||||
|
- **Example**:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# 558/900 iterations complete ✅ (45536.81s)
|
||||||
|
# Results saved to /usr/src/ultralytics/runs/detect/tune
|
||||||
|
# Best fitness=0.64297 observed at iteration 498
|
||||||
|
# Best fitness metrics are {'metrics/precision(B)': 0.87247, 'metrics/recall(B)': 0.71387, 'metrics/mAP50(B)': 0.79106, 'metrics/mAP50-95(B)': 0.62651, 'val/box_loss': 2.79884, 'val/cls_loss': 2.72386, 'val/dfl_loss': 0.68503, 'fitness': 0.64297}
|
||||||
|
# Best fitness model is /usr/src/ultralytics/runs/detect/train498
|
||||||
|
# Best fitness hyperparameters are printed below.
|
||||||
|
|
||||||
|
lr0: 0.00269
|
||||||
|
lrf: 0.00288
|
||||||
|
momentum: 0.73375
|
||||||
|
weight_decay: 0.00015
|
||||||
|
warmup_epochs: 1.22935
|
||||||
|
warmup_momentum: 0.1525
|
||||||
|
box: 18.27875
|
||||||
|
cls: 1.32899
|
||||||
|
dfl: 0.56016
|
||||||
|
hsv_h: 0.01148
|
||||||
|
hsv_s: 0.53554
|
||||||
|
hsv_v: 0.13636
|
||||||
|
degrees: 0.0
|
||||||
|
translate: 0.12431
|
||||||
|
scale: 0.07643
|
||||||
|
shear: 0.0
|
||||||
|
perspective: 0.0
|
||||||
|
flipud: 0.0
|
||||||
|
fliplr: 0.08631
|
||||||
|
mosaic: 0.42551
|
||||||
|
mixup: 0.0
|
||||||
|
copy_paste: 0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
#### best_fitness.png
|
||||||
|
|
||||||
|
This is a plot displaying fitness (typically a performance metric like AP50) against the number of iterations. It helps you visualize how well the genetic algorithm performed over time.
|
||||||
|
|
||||||
|
- **Format**: PNG
|
||||||
|
- **Usage**: Performance visualization
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="640" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/best-fitness.avif" alt="Hyperparameter Tuning Fitness vs Iteration">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
#### tune_results.csv
|
||||||
|
|
||||||
|
A CSV file containing detailed results of each iteration during the tuning. Each row in the file represents one iteration, and it includes metrics like fitness score, [precision](https://www.ultralytics.com/glossary/precision), [recall](https://www.ultralytics.com/glossary/recall), as well as the hyperparameters used.
|
||||||
|
|
||||||
|
- **Format**: CSV
|
||||||
|
- **Usage**: Per-iteration results tracking.
|
||||||
|
- **Example**:
|
||||||
|
```csv
|
||||||
|
fitness,lr0,lrf,momentum,weight_decay,warmup_epochs,warmup_momentum,box,cls,dfl,hsv_h,hsv_s,hsv_v,degrees,translate,scale,shear,perspective,flipud,fliplr,mosaic,mixup,copy_paste
|
||||||
|
0.05021,0.01,0.01,0.937,0.0005,3.0,0.8,7.5,0.5,1.5,0.015,0.7,0.4,0.0,0.1,0.5,0.0,0.0,0.0,0.5,1.0,0.0,0.0
|
||||||
|
0.07217,0.01003,0.00967,0.93897,0.00049,2.79757,0.81075,7.5,0.50746,1.44826,0.01503,0.72948,0.40658,0.0,0.0987,0.4922,0.0,0.0,0.0,0.49729,1.0,0.0,0.0
|
||||||
|
0.06584,0.01003,0.00855,0.91009,0.00073,3.42176,0.95,8.64301,0.54594,1.72261,0.01503,0.59179,0.40658,0.0,0.0987,0.46955,0.0,0.0,0.0,0.49729,0.80187,0.0,0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
#### tune_scatter_plots.png
|
||||||
|
|
||||||
|
This file contains scatter plots generated from `tune_results.csv`, helping you visualize relationships between different hyperparameters and performance metrics. Note that hyperparameters initialized to 0 will not be tuned, such as `degrees` and `shear` below.
|
||||||
|
|
||||||
|
- **Format**: PNG
|
||||||
|
- **Usage**: Exploratory data analysis
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="1000" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/tune-scatter-plots.avif" alt="Hyperparameter tuning results scatter plot analysis">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
#### weights/
|
||||||
|
|
||||||
|
This directory contains the saved [PyTorch](https://www.ultralytics.com/glossary/pytorch) models for the last and the best iterations during the hyperparameter tuning process.
|
||||||
|
|
||||||
|
- **`last.pt`**: The last.pt are the weights from the last epoch of training.
|
||||||
|
- **`best.pt`**: The best.pt weights for the iteration that achieved the best fitness score.
|
||||||
|
|
||||||
|
Using these results, you can make more informed decisions for your future model trainings and analyses. Feel free to consult these artifacts to understand how well your model performed and how you might improve it further.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
The hyperparameter tuning process in Ultralytics YOLO is simplified yet powerful, thanks to its genetic algorithm-based approach focused on mutation. Following the steps outlined in this guide will assist you in systematically tuning your model to achieve better performance.
|
||||||
|
|
||||||
|
### Further Reading
|
||||||
|
|
||||||
|
1. [Hyperparameter Optimization in Wikipedia](https://en.wikipedia.org/wiki/Hyperparameter_optimization)
|
||||||
|
2. [YOLOv5 Hyperparameter Evolution Guide](../yolov5/tutorials/hyperparameter_evolution.md)
|
||||||
|
3. [Efficient Hyperparameter Tuning with Ray Tune and YOLO26](../integrations/ray-tune.md)
|
||||||
|
|
||||||
|
For deeper insights, you can explore the [`Tuner` class](https://docs.ultralytics.com/reference/engine/tuner/) source code and accompanying documentation. Should you have any questions, feature requests, or need further assistance, feel free to reach out to us on [GitHub](https://github.com/ultralytics/ultralytics/issues/new/choose) or [Discord](https://discord.com/invite/ultralytics).
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I optimize the [learning rate](https://www.ultralytics.com/glossary/learning-rate) for Ultralytics YOLO during hyperparameter tuning?
|
||||||
|
|
||||||
|
To optimize the learning rate for Ultralytics YOLO, start by setting an initial learning rate using the `lr0` parameter. Common values range from `0.001` to `0.01`. During the hyperparameter tuning process, this value will be mutated to find the optimal setting. You can utilize the `model.tune()` method to automate this process. For example:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Initialize the YOLO model
|
||||||
|
model = YOLO("yolo26n.pt")
|
||||||
|
|
||||||
|
# Tune hyperparameters on COCO8 for 30 epochs
|
||||||
|
model.tune(data="coco8.yaml", epochs=30, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, check the [Ultralytics YOLO configuration page](../usage/cfg.md#augmentation-settings).
|
||||||
|
|
||||||
|
### What are the benefits of using genetic algorithms for hyperparameter tuning in YOLO26?
|
||||||
|
|
||||||
|
Genetic algorithms in Ultralytics YOLO26 provide a robust method for exploring the hyperparameter space, leading to highly optimized model performance. Key benefits include:
|
||||||
|
|
||||||
|
- **Efficient Search**: Genetic algorithms like mutation can quickly explore a large set of hyperparameters.
|
||||||
|
- **Avoiding Local Minima**: By introducing randomness, they help in avoiding local minima, ensuring better global optimization.
|
||||||
|
- **Performance Metrics**: They adapt based on performance metrics such as AP50 and F1-score.
|
||||||
|
|
||||||
|
To see how genetic algorithms can optimize hyperparameters, check out the [hyperparameter evolution guide](../yolov5/tutorials/hyperparameter_evolution.md).
|
||||||
|
|
||||||
|
### How long does the hyperparameter tuning process take for Ultralytics YOLO?
|
||||||
|
|
||||||
|
The time required for hyperparameter tuning with Ultralytics YOLO largely depends on several factors such as the size of the dataset, the complexity of the model architecture, the number of iterations, and the computational resources available. For instance, tuning YOLO26n on a dataset like COCO8 for 30 epochs might take several hours to days, depending on the hardware.
|
||||||
|
|
||||||
|
To effectively manage tuning time, define a clear tuning budget beforehand ([internal section link](#preparing-for-hyperparameter-tuning)). This helps in balancing resource allocation and optimization goals.
|
||||||
|
|
||||||
|
### What metrics should I use to evaluate model performance during hyperparameter tuning in YOLO?
|
||||||
|
|
||||||
|
When evaluating model performance during hyperparameter tuning in YOLO, you can use several key metrics:
|
||||||
|
|
||||||
|
- **AP50**: The average precision at IoU threshold of 0.50.
|
||||||
|
- **F1-Score**: The harmonic mean of precision and recall.
|
||||||
|
- **Precision and Recall**: Individual metrics indicating the model's [accuracy](https://www.ultralytics.com/glossary/accuracy) in identifying true positives versus false positives and false negatives.
|
||||||
|
|
||||||
|
These metrics help you understand different aspects of your model's performance. Refer to the [Ultralytics YOLO performance metrics](../guides/yolo-performance-metrics.md) guide for a comprehensive overview.
|
||||||
|
|
||||||
|
### Can I use Ray Tune for advanced hyperparameter optimization with YOLO26?
|
||||||
|
|
||||||
|
Yes, Ultralytics YOLO26 integrates with [Ray Tune](https://docs.ray.io/en/latest/tune/index.html) for advanced hyperparameter optimization. Ray Tune offers sophisticated search algorithms like Bayesian Optimization and Hyperband, along with parallel execution capabilities to speed up the tuning process.
|
||||||
|
|
||||||
|
To use Ray Tune with YOLO26, simply set the `use_ray=True` parameter in your `model.tune()` method call. For more details and examples, check out the [Ray Tune integration guide](../integrations/ray-tune.md).
|
||||||
107
docs/en/guides/index.md
Executable file
107
docs/en/guides/index.md
Executable file
@@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Master YOLO with Ultralytics tutorials covering training, deployment and optimization. Find solutions, improve metrics, and deploy with ease.
|
||||||
|
keywords: Ultralytics, YOLO, tutorials, guides, object detection, deep learning, PyTorch, training, deployment, optimization, computer vision
|
||||||
|
---
|
||||||
|
|
||||||
|
# Comprehensive Tutorials for Ultralytics YOLO
|
||||||
|
|
||||||
|
Welcome to Ultralytics' YOLO Guides. Our comprehensive tutorials cover various aspects of the YOLO [object detection](https://www.ultralytics.com/glossary/object-detection) model, ranging from training and prediction to deployment. Built on [PyTorch](https://www.ultralytics.com/glossary/pytorch), YOLO stands out for its exceptional speed and [accuracy](https://www.ultralytics.com/glossary/accuracy) in real-time object detection tasks.
|
||||||
|
|
||||||
|
Whether you're a beginner or an expert in [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl), our tutorials offer valuable insights into the implementation and optimization of YOLO for your [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) projects.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/96NkhsV-W1U"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Ultralytics YOLO26 Guides Overview
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Guides
|
||||||
|
|
||||||
|
Here's a compilation of in-depth guides to help you master different aspects of Ultralytics YOLO.
|
||||||
|
|
||||||
|
- [A Guide on Model Testing](model-testing.md): A thorough guide on testing your computer vision models in realistic settings. Learn how to verify accuracy, reliability, and performance in line with project goals.
|
||||||
|
- [AzureML Quickstart](azureml-quickstart.md): Get up and running with Ultralytics YOLO models on Microsoft's Azure [Machine Learning](https://www.ultralytics.com/glossary/machine-learning-ml) platform. Learn how to train, deploy, and scale your object detection projects in the cloud.
|
||||||
|
- [Best Practices for Model Deployment](model-deployment-practices.md): Walk through tips and best practices for efficiently deploying models in computer vision projects, with a focus on optimization, troubleshooting, and security.
|
||||||
|
- [Conda Quickstart](conda-quickstart.md): Step-by-step guide to setting up a [Conda](https://anaconda.org/conda-forge/ultralytics) environment for Ultralytics. Learn how to install and start using the Ultralytics package efficiently with Conda.
|
||||||
|
- [Customizing Trainer](custom-trainer.md): Learn how to subclass the YOLO trainer to log custom metrics, add class-weighted loss, customize model saving, freeze/unfreeze the backbone, and set per-layer learning rates.
|
||||||
|
- [Data Collection and Annotation](data-collection-and-annotation.md): Explore the tools, techniques, and best practices for collecting and annotating data to create high-quality inputs for your computer vision models.
|
||||||
|
- [DeepStream on NVIDIA Jetson](deepstream-nvidia-jetson.md): Quickstart guide for deploying YOLO models on NVIDIA Jetson devices using DeepStream and TensorRT.
|
||||||
|
- [Defining A Computer Vision Project's Goals](defining-project-goals.md): Walk through how to effectively define clear and measurable goals for your computer vision project. Learn the importance of a well-defined problem statement and how it creates a roadmap for your project.
|
||||||
|
- [Docker Quickstart](docker-quickstart.md): Complete guide to setting up and using Ultralytics YOLO models with [Docker](https://hub.docker.com/r/ultralytics/ultralytics). Learn how to install Docker, manage GPU support, and run YOLO models in isolated containers for consistent development and deployment.
|
||||||
|
- [Edge TPU on Raspberry Pi](coral-edge-tpu-on-raspberry-pi.md): [Google Edge TPU](https://developers.google.com/coral) accelerates YOLO inference on [Raspberry Pi](https://www.raspberrypi.com/).
|
||||||
|
- [Hyperparameter Tuning](hyperparameter-tuning.md): Discover how to optimize your YOLO models by fine-tuning hyperparameters using the Tuner class and genetic evolution algorithms.
|
||||||
|
- [Insights on Model Evaluation and Fine-Tuning](model-evaluation-insights.md): Gain insights into the strategies and best practices for evaluating and fine-tuning your computer vision models. Learn about the iterative process of refining models to achieve optimal results.
|
||||||
|
- [Isolating Segmentation Objects](isolating-segmentation-objects.md): Step-by-step recipe and explanation on how to extract and/or isolate objects from images using Ultralytics Segmentation.
|
||||||
|
- [K-Fold Cross Validation](kfold-cross-validation.md): Learn how to improve model generalization using K-Fold cross-validation technique.
|
||||||
|
- [Maintaining Your Computer Vision Model](model-monitoring-and-maintenance.md): Understand the key practices for monitoring, maintaining, and documenting computer vision models to guarantee accuracy, spot anomalies, and mitigate data drift.
|
||||||
|
- [Model Deployment Options](model-deployment-options.md): Overview of YOLO [model deployment](https://www.ultralytics.com/glossary/model-deployment) formats like ONNX, OpenVINO, and TensorRT, with pros and cons for each to inform your deployment strategy.
|
||||||
|
- [Model YAML Configuration Guide](model-yaml-config.md): A comprehensive deep dive into Ultralytics' model architecture definitions. Explore the YAML format, understand the module resolution system, and learn how to integrate custom modules seamlessly.
|
||||||
|
- [NVIDIA DGX Spark](nvidia-dgx-spark.md): Quickstart guide for deploying YOLO models on NVIDIA DGX Spark devices.
|
||||||
|
- [NVIDIA Jetson](nvidia-jetson.md): Quickstart guide for deploying YOLO models on NVIDIA Jetson devices.
|
||||||
|
- [OpenVINO Latency vs Throughput Modes](optimizing-openvino-latency-vs-throughput-modes.md): Learn latency and throughput optimization techniques for peak YOLO inference performance.
|
||||||
|
- [Preprocessing Annotated Data](preprocessing_annotated_data.md): Learn about preprocessing and augmenting image data in computer vision projects using YOLO26, including normalization, dataset augmentation, splitting, and exploratory data analysis (EDA).
|
||||||
|
- [Raspberry Pi](raspberry-pi.md): Quickstart tutorial to run YOLO models on the latest Raspberry Pi hardware.
|
||||||
|
- [ROS Quickstart](ros-quickstart.md): Learn how to integrate YOLO with the Robot Operating System (ROS) for real-time object detection in robotics applications, including Point Cloud and Depth images.
|
||||||
|
- [SAHI Tiled Inference](sahi-tiled-inference.md): Comprehensive guide on leveraging SAHI's sliced inference capabilities with YOLO26 for object detection in high-resolution images.
|
||||||
|
- [Steps of a Computer Vision Project](steps-of-a-cv-project.md): Learn about the key steps involved in a computer vision project, including defining goals, selecting models, preparing data, and evaluating results.
|
||||||
|
- [Tips for Model Training](model-training-tips.md): Explore tips on optimizing [batch sizes](https://www.ultralytics.com/glossary/batch-size), using [mixed precision](https://www.ultralytics.com/glossary/mixed-precision), applying pretrained weights, and more to make training your computer vision model a breeze.
|
||||||
|
- [Triton Inference Server Integration](triton-inference-server.md): Dive into the integration of Ultralytics YOLO26 with NVIDIA's Triton Inference Server for scalable and efficient deep learning inference deployments.
|
||||||
|
- [Vertex AI Deployment with Docker](vertex-ai-deployment-with-docker.md): Streamlined guide to containerizing YOLO models with Docker and deploying them on Google Cloud Vertex AI—covering build, push, autoscaling, and monitoring.
|
||||||
|
- [View Inference Images in a Terminal](view-results-in-terminal.md): Use VSCode's integrated terminal to view inference results when using Remote Tunnel or SSH sessions.
|
||||||
|
- [YOLO Common Issues](yolo-common-issues.md) ⭐ RECOMMENDED: Practical solutions and troubleshooting tips to the most frequently encountered issues when working with Ultralytics YOLO models.
|
||||||
|
- [YOLO Data Augmentation](yolo-data-augmentation.md): Master the complete range of data augmentation techniques in YOLO, from basic transformations to advanced strategies for improving model robustness and performance.
|
||||||
|
- [YOLO Performance Metrics](yolo-performance-metrics.md) ⭐ ESSENTIAL: Understand the key metrics like mAP, IoU, and [F1 score](https://www.ultralytics.com/glossary/f1-score) used to evaluate the performance of your YOLO models. Includes practical examples and tips on how to improve detection accuracy and speed.
|
||||||
|
- [YOLO Thread-Safe Inference](yolo-thread-safe-inference.md): Guidelines for performing inference with YOLO models in a thread-safe manner. Learn the importance of thread safety and best practices to prevent race conditions and ensure consistent predictions.
|
||||||
|
|
||||||
|
## Contribute to Our Guides
|
||||||
|
|
||||||
|
We welcome contributions from the community! If you've mastered a particular aspect of Ultralytics YOLO that's not yet covered in our guides, we encourage you to share your expertise. Writing a guide is a great way to give back to the community and help us make our documentation more comprehensive and user-friendly.
|
||||||
|
|
||||||
|
To get started, please read our [Contributing Guide](../help/contributing.md) for guidelines on how to open a Pull Request (PR). We look forward to your contributions.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I train a custom object detection model using Ultralytics YOLO?
|
||||||
|
|
||||||
|
Training a custom object detection model with Ultralytics YOLO is straightforward. Start by preparing your dataset in the correct format and installing the Ultralytics package. Use the following code to initiate training:
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n.pt") # Load a pretrained YOLO model
|
||||||
|
model.train(data="path/to/dataset.yaml", epochs=50) # Train on custom dataset
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yolo task=detect mode=train model=yolo26n.pt data=path/to/dataset.yaml epochs=50
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed dataset formatting and additional options, refer to our [Tips for Model Training](model-training-tips.md) guide.
|
||||||
|
|
||||||
|
### What performance metrics should I use to evaluate my YOLO model?
|
||||||
|
|
||||||
|
Evaluating your YOLO model performance is crucial to understanding its efficacy. Key metrics include [Mean Average Precision](https://www.ultralytics.com/glossary/mean-average-precision-map) (mAP), [Intersection over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) (IoU), and F1 score. These metrics help assess the accuracy and [precision](https://www.ultralytics.com/glossary/precision) of object detection tasks. You can learn more about these metrics and how to improve your model in our [YOLO Performance Metrics](yolo-performance-metrics.md) guide.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics Platform for my computer vision projects?
|
||||||
|
|
||||||
|
Ultralytics Platform is a no-code platform that simplifies managing, training, and deploying YOLO models. It supports seamless integration, real-time tracking, and cloud training, making it ideal for both beginners and professionals. Discover more about its features and how it can streamline your workflow with our [Ultralytics Platform](https://docs.ultralytics.com/platform/) quickstart guide.
|
||||||
|
|
||||||
|
### What are the common issues faced during YOLO model training, and how can I resolve them?
|
||||||
|
|
||||||
|
Common issues during YOLO model training include data formatting errors, model architecture mismatches, and insufficient [training data](https://www.ultralytics.com/glossary/training-data). To address these, ensure your dataset is correctly formatted, check for compatible model versions, and augment your training data. For a comprehensive list of solutions, refer to our [YOLO Common Issues](yolo-common-issues.md) guide.
|
||||||
|
|
||||||
|
### How can I deploy my YOLO model for real-time object detection on edge devices?
|
||||||
|
|
||||||
|
Deploying YOLO models on edge devices like NVIDIA Jetson and Raspberry Pi requires converting the model to a compatible format such as TensorRT or TFLite. Follow our step-by-step guides for [NVIDIA Jetson](nvidia-jetson.md) and [Raspberry Pi](raspberry-pi.md) deployments to get started with real-time object detection on edge hardware. These guides will walk you through installation, configuration, and performance optimization.
|
||||||
185
docs/en/guides/instance-segmentation-and-tracking.md
Executable file
185
docs/en/guides/instance-segmentation-and-tracking.md
Executable file
@@ -0,0 +1,185 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Master instance segmentation and tracking with Ultralytics YOLO26. Learn techniques for precise object identification and tracking.
|
||||||
|
keywords: instance segmentation, tracking, YOLO26, Ultralytics, object detection, machine learning, computer vision, python
|
||||||
|
---
|
||||||
|
|
||||||
|
# Instance Segmentation and Tracking using Ultralytics YOLO26 🚀
|
||||||
|
|
||||||
|
## What is Instance Segmentation?
|
||||||
|
|
||||||
|
[Instance segmentation](https://www.ultralytics.com/glossary/instance-segmentation) is a computer vision task that involves identifying and outlining individual objects in an image at the pixel level. Unlike [semantic segmentation](https://www.ultralytics.com/glossary/semantic-segmentation) which only classifies pixels by category, instance segmentation uniquely labels and precisely delineates each object instance, making it crucial for applications requiring detailed spatial understanding like medical imaging, autonomous driving, and industrial automation.
|
||||||
|
|
||||||
|
[Ultralytics YOLO26](https://github.com/ultralytics/ultralytics/) provides powerful instance segmentation capabilities that enable precise object boundary detection while maintaining the speed and efficiency YOLO models are known for.
|
||||||
|
|
||||||
|
There are two types of instance segmentation tracking available in the Ultralytics package:
|
||||||
|
|
||||||
|
- **Instance Segmentation with Class Objects:** Each class object is assigned a unique color for clear visual separation.
|
||||||
|
|
||||||
|
- **Instance Segmentation with Object Tracks:** Every track is represented by a distinct color, facilitating easy identification and tracking across video frames.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/75G_S1Ngji8"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> Instance Segmentation with Object Tracking using Ultralytics YOLO26
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Samples
|
||||||
|
|
||||||
|
| Instance Segmentation | Instance Segmentation + Object Tracking |
|
||||||
|
| :-----------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
||||||
|
|  |  |
|
||||||
|
| Ultralytics Instance Segmentation 😍 | Ultralytics Instance Segmentation with Object Tracking 🔥 |
|
||||||
|
|
||||||
|
!!! example "Instance segmentation using Ultralytics YOLO"
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Instance segmentation using Ultralytics YOLO26
|
||||||
|
yolo solutions isegment show=True
|
||||||
|
|
||||||
|
# Pass a source video
|
||||||
|
yolo solutions isegment source="path/to/video.mp4"
|
||||||
|
|
||||||
|
# Monitor the specific classes
|
||||||
|
yolo solutions isegment classes="[0, 5]"
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
# Video writer
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
video_writer = cv2.VideoWriter("isegment_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
||||||
|
|
||||||
|
# Initialize instance segmentation object
|
||||||
|
isegment = solutions.InstanceSegmentation(
|
||||||
|
show=True, # display the output
|
||||||
|
model="yolo26n-seg.pt", # model="yolo26n-seg.pt" for object segmentation using YOLO26.
|
||||||
|
# classes=[0, 2], # segment specific classes, e.g., person and car with the pretrained model.
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process video
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
print("Video frame is empty or video processing has been successfully completed.")
|
||||||
|
break
|
||||||
|
|
||||||
|
results = isegment(im0)
|
||||||
|
|
||||||
|
# print(results) # access the output
|
||||||
|
|
||||||
|
video_writer.write(results.plot_im) # write the processed frame.
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
video_writer.release()
|
||||||
|
cv2.destroyAllWindows() # destroy all opened windows
|
||||||
|
```
|
||||||
|
|
||||||
|
### `InstanceSegmentation` Arguments
|
||||||
|
|
||||||
|
Here's a table with the `InstanceSegmentation` arguments:
|
||||||
|
|
||||||
|
{% from "macros/solutions-args.md" import param_table %}
|
||||||
|
{{ param_table(["model", "region"]) }}
|
||||||
|
|
||||||
|
You can also take advantage of `track` arguments within the `InstanceSegmentation` solution:
|
||||||
|
|
||||||
|
{% from "macros/track-args.md" import param_table %}
|
||||||
|
{{ param_table(["tracker", "conf", "iou", "classes", "verbose", "device"]) }}
|
||||||
|
|
||||||
|
Moreover, the following visualization arguments are available:
|
||||||
|
|
||||||
|
{% from "macros/visualization-args.md" import param_table %}
|
||||||
|
{{ param_table(["show", "line_width", "show_conf", "show_labels"]) }}
|
||||||
|
|
||||||
|
## Applications of Instance Segmentation
|
||||||
|
|
||||||
|
Instance segmentation with YOLO26 has numerous real-world applications across various industries:
|
||||||
|
|
||||||
|
### Waste Management and Recycling
|
||||||
|
|
||||||
|
YOLO26 can be used in [waste management facilities](https://www.ultralytics.com/blog/simplifying-e-waste-management-with-ai-innovations) to identify and sort different types of materials. The model can segment plastic waste, cardboard, metal, and other recyclables with high precision, enabling automated sorting systems to process waste more efficiently. This is particularly valuable considering that only about 10% of the 7 billion tonnes of plastic waste generated globally gets recycled.
|
||||||
|
|
||||||
|
### Autonomous Vehicles
|
||||||
|
|
||||||
|
In [self-driving cars](https://www.ultralytics.com/solutions/ai-in-automotive), instance segmentation helps identify and track pedestrians, vehicles, traffic signs, and other road elements at the pixel level. This precise understanding of the environment is crucial for navigation and safety decisions. YOLO26's real-time performance makes it ideal for these time-sensitive applications.
|
||||||
|
|
||||||
|
### Medical Imaging
|
||||||
|
|
||||||
|
Instance segmentation can identify and outline tumors, organs, or cellular structures in medical scans. YOLO26's ability to precisely delineate object boundaries makes it valuable for [medical diagnostics](https://www.ultralytics.com/blog/ai-and-radiology-a-new-era-of-precision-and-efficiency) and treatment planning.
|
||||||
|
|
||||||
|
### Construction Site Monitoring
|
||||||
|
|
||||||
|
At construction sites, instance segmentation can track heavy machinery, workers, and materials. This helps ensure safety by monitoring equipment positions and detecting when workers enter hazardous areas, while also optimizing workflow and resource allocation.
|
||||||
|
|
||||||
|
## Note
|
||||||
|
|
||||||
|
For any inquiries, feel free to post your questions in the [Ultralytics Issue Section](https://github.com/ultralytics/ultralytics/issues/new/choose) or the discussion section mentioned below.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I perform instance segmentation using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
To perform instance segmentation using Ultralytics YOLO26, initialize the YOLO model with a segmentation version of YOLO26 and process video frames through it. Here's a simplified code example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from ultralytics import solutions
|
||||||
|
|
||||||
|
cap = cv2.VideoCapture("path/to/video.mp4")
|
||||||
|
assert cap.isOpened(), "Error reading video file"
|
||||||
|
|
||||||
|
# Video writer
|
||||||
|
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
|
||||||
|
video_writer = cv2.VideoWriter("instance-segmentation.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
||||||
|
|
||||||
|
# Init InstanceSegmentation
|
||||||
|
isegment = solutions.InstanceSegmentation(
|
||||||
|
show=True, # display the output
|
||||||
|
model="yolo26n-seg.pt", # model="yolo26n-seg.pt" for object segmentation using YOLO26.
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process video
|
||||||
|
while cap.isOpened():
|
||||||
|
success, im0 = cap.read()
|
||||||
|
if not success:
|
||||||
|
print("Video frame is empty or processing is complete.")
|
||||||
|
break
|
||||||
|
results = isegment(im0)
|
||||||
|
video_writer.write(results.plot_im)
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
video_writer.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
```
|
||||||
|
|
||||||
|
Learn more about instance segmentation in the [Ultralytics YOLO26 guide](https://docs.ultralytics.com/tasks/segment/).
|
||||||
|
|
||||||
|
### What is the difference between instance segmentation and object tracking in Ultralytics YOLO26?
|
||||||
|
|
||||||
|
Instance segmentation identifies and outlines individual objects within an image, giving each object a unique label and mask. Object tracking extends this by assigning consistent IDs to objects across video frames, facilitating continuous tracking of the same objects over time. When combined, as in YOLO26's implementation, you get powerful capabilities for analyzing object movement and behavior in videos while maintaining precise boundary information.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 for instance segmentation and tracking over other models like Mask R-CNN or Faster R-CNN?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 offers real-time performance, superior [accuracy](https://www.ultralytics.com/glossary/accuracy), and ease of use compared to other models like Mask R-CNN or Faster R-CNN. YOLO26 processes images in a single pass (one-stage detection), making it significantly faster while maintaining high precision. It also provides seamless integration with [Ultralytics Platform](https://platform.ultralytics.com), allowing users to manage models, datasets, and training pipelines efficiently. For applications requiring both speed and accuracy, YOLO26 provides an optimal balance.
|
||||||
|
|
||||||
|
### Are there any datasets provided by Ultralytics suitable for training YOLO26 models for instance segmentation and tracking?
|
||||||
|
|
||||||
|
Yes, Ultralytics offers several datasets suitable for training YOLO26 models for instance segmentation, including [COCO-Seg](https://docs.ultralytics.com/datasets/segment/coco/), [COCO8-Seg](https://docs.ultralytics.com/datasets/segment/coco8-seg/) (a smaller subset for quick testing), [Package-Seg](https://docs.ultralytics.com/datasets/segment/package-seg/), and [Crack-Seg](https://docs.ultralytics.com/datasets/segment/crack-seg/). These datasets come with pixel-level annotations needed for instance segmentation tasks. For more specialized applications, you can also create custom datasets following the Ultralytics format. Complete dataset information and usage instructions can be found in the [Ultralytics Datasets documentation](https://docs.ultralytics.com/datasets/).
|
||||||
396
docs/en/guides/isolating-segmentation-objects.md
Executable file
396
docs/en/guides/isolating-segmentation-objects.md
Executable file
@@ -0,0 +1,396 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn to extract isolated objects from inference results using Ultralytics Predict Mode. Step-by-step guide for segmentation object isolation.
|
||||||
|
keywords: Ultralytics, segmentation, object isolation, Predict Mode, YOLO26, machine learning, object detection, binary mask, image processing
|
||||||
|
---
|
||||||
|
|
||||||
|
# Isolating Segmentation Objects
|
||||||
|
|
||||||
|
After performing the [Segment Task](../tasks/segment.md), it's sometimes desirable to extract the isolated objects from the inference results. This guide provides a generic recipe on how to accomplish this using the Ultralytics [Predict Mode](../modes/predict.md).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/5HBB5IBuJ6c"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Remove Background and Isolate Objects with Ultralytics YOLO Segmentation & OpenCV in Python 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Recipe Walkthrough
|
||||||
|
|
||||||
|
1. See the [Ultralytics Quickstart Installation section](../quickstart.md) for a quick walkthrough on installing the required libraries.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
2. Load a model and run `predict()` method on a source.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# Load a model
|
||||||
|
model = YOLO("yolo26n-seg.pt")
|
||||||
|
|
||||||
|
# Run inference
|
||||||
|
results = model.predict()
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! question "No Prediction Arguments?"
|
||||||
|
|
||||||
|
Without specifying a source, the example images from the library will be used:
|
||||||
|
|
||||||
|
```
|
||||||
|
'ultralytics/assets/bus.jpg'
|
||||||
|
'ultralytics/assets/zidane.jpg'
|
||||||
|
```
|
||||||
|
|
||||||
|
This is helpful for rapid testing with the `predict()` method.
|
||||||
|
|
||||||
|
For additional information about Segmentation Models, visit the [Segment Task](../tasks/segment.md#models) page. To learn more about `predict()` method, see [Predict Mode](../modes/predict.md) section of the Documentation.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
3. Now iterate over the results and the contours. For workflows that want to save an image to file, the source image `base-name` and the detection `class-label` are retrieved for later use (optional).
|
||||||
|
|
||||||
|
```{ .py .annotate }
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# (2) Iterate detection results (helpful for multiple images)
|
||||||
|
for r in results:
|
||||||
|
img = np.copy(r.orig_img)
|
||||||
|
img_name = Path(r.path).stem # source image base-name
|
||||||
|
|
||||||
|
# Iterate each object contour (multiple detections)
|
||||||
|
for ci, c in enumerate(r):
|
||||||
|
# (1) Get detection class name
|
||||||
|
label = c.names[c.boxes.cls.tolist().pop()]
|
||||||
|
```
|
||||||
|
|
||||||
|
1. To learn more about working with detection results, see [Boxes Section for Predict Mode](../modes/predict.md#boxes).
|
||||||
|
2. To learn more about `predict()` results see [Working with Results for Predict Mode](../modes/predict.md#working-with-results)
|
||||||
|
|
||||||
|
??? info "For-Loop"
|
||||||
|
|
||||||
|
A single image will only iterate the first loop once. A single image with only a single detection will iterate each loop _only_ once.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
4. Start with generating a binary mask from the source image and then draw a filled contour onto the mask. This will allow the object to be isolated from the other parts of the image. An example from `bus.jpg` for one of the detected `person` class objects is shown on the right.
|
||||||
|
|
||||||
|
{ width="240", align="right" }
|
||||||
|
|
||||||
|
```{ .py .annotate }
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
# Create binary mask
|
||||||
|
b_mask = np.zeros(img.shape[:2], np.uint8)
|
||||||
|
|
||||||
|
# (1) Extract contour result
|
||||||
|
contour = c.masks.xy.pop()
|
||||||
|
# (2) Changing the type
|
||||||
|
contour = contour.astype(np.int32)
|
||||||
|
# (3) Reshaping
|
||||||
|
contour = contour.reshape(-1, 1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
# Draw contour onto mask
|
||||||
|
_ = cv2.drawContours(b_mask, [contour], -1, (255, 255, 255), cv2.FILLED)
|
||||||
|
```
|
||||||
|
|
||||||
|
1. For more info on `c.masks.xy` see [Masks Section from Predict Mode](../modes/predict.md#masks).
|
||||||
|
|
||||||
|
2. Here the values are cast into `np.int32` for compatibility with `drawContours()` function from [OpenCV](https://www.ultralytics.com/glossary/opencv).
|
||||||
|
|
||||||
|
3. The OpenCV `drawContours()` function expects contours to have a shape of `[N, 1, 2]` expand section below for more details.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary> Expand to understand what is happening when defining the <code>contour</code> variable.</summary>
|
||||||
|
<p>
|
||||||
|
- `c.masks.xy` :: Provides the coordinates of the mask contour points in the format `(x, y)`. For more details, refer to the [Masks Section from Predict Mode](../modes/predict.md#masks).
|
||||||
|
- `.pop()` :: As `masks.xy` is a list containing a single element, this element is extracted using the `pop()` method.
|
||||||
|
- `.astype(np.int32)` :: Using `masks.xy` will return with a data type of `float32`, but this won't be compatible with the OpenCV `drawContours()` function, so this will change the data type to `int32` for compatibility.
|
||||||
|
- `.reshape(-1, 1, 2)` :: Reformats the data into the required shape of `[N, 1, 2]` where `N` is the number of contour points, with each point represented by a single entry `1`, and the entry is composed of `2` values. The `-1` denotes that the number of values along this dimension is flexible.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<p></p>
|
||||||
|
<details>
|
||||||
|
<summary> Expand for an explanation of the <code>drawContours()</code> configuration.</summary>
|
||||||
|
<p>
|
||||||
|
- Encapsulating the `contour` variable within square brackets, `[contour]`, was found to effectively generate the desired contour mask during testing.
|
||||||
|
- The value `-1` specified for the `drawContours()` parameter instructs the function to draw all contours present in the image.
|
||||||
|
- The `tuple` `(255, 255, 255)` represents the color white, which is the desired color for drawing the contour in this binary mask.
|
||||||
|
- The addition of `cv2.FILLED` will color all pixels enclosed by the contour boundary the same, in this case, all enclosed pixels will be white.
|
||||||
|
- See [OpenCV Documentation on `drawContours()`](https://docs.opencv.org/4.8.0/d6/d6e/group__imgproc__draw.html#ga746c0625f1781f1ffc9056259103edbc) for more information.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
5. Next there are 2 options for how to move forward with the image from this point and a subsequent option for each.
|
||||||
|
|
||||||
|
### Object Isolation Options
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Black Background Pixels"
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Create 3-channel mask
|
||||||
|
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
||||||
|
|
||||||
|
# Isolate object with binary mask
|
||||||
|
isolated = cv2.bitwise_and(mask3ch, img)
|
||||||
|
```
|
||||||
|
|
||||||
|
??? question "How does this work?"
|
||||||
|
|
||||||
|
- First, the binary mask is first converted from a single-channel image to a three-channel image. This conversion is necessary for the subsequent step where the mask and the original image are combined. Both images must have the same number of channels to be compatible with the blending operation.
|
||||||
|
|
||||||
|
- The original image and the three-channel binary mask are merged using the OpenCV function `bitwise_and()`. This operation retains <u>only</u> pixel values that are greater than zero `(> 0)` from both images. Since the mask pixels are greater than zero `(> 0)` <u>only</u> within the contour region, the pixels remaining from the original image are those that overlap with the contour.
|
||||||
|
|
||||||
|
### Isolate with Black Pixels: Sub-options
|
||||||
|
|
||||||
|
??? info "Full-size Image"
|
||||||
|
|
||||||
|
There are no additional steps required if keeping full size image.
|
||||||
|
|
||||||
|
<figure markdown>
|
||||||
|
{ width=240 }
|
||||||
|
<figcaption>Example full-size output</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
??? info "Cropped object Image"
|
||||||
|
|
||||||
|
Additional steps required to crop image to only include object region.
|
||||||
|
|
||||||
|
{ align="right" }
|
||||||
|
```{ .py .annotate }
|
||||||
|
# (1) Bounding box coordinates
|
||||||
|
x1, y1, x2, y2 = c.boxes.xyxy.cpu().numpy().squeeze().astype(np.int32)
|
||||||
|
# Crop image to object region
|
||||||
|
iso_crop = isolated[y1:y2, x1:x2]
|
||||||
|
```
|
||||||
|
|
||||||
|
1. For more information on [bounding box](https://www.ultralytics.com/glossary/bounding-box) results, see [Boxes Section from Predict Mode](../modes/predict.md#boxes)
|
||||||
|
|
||||||
|
??? question "What does this code do?"
|
||||||
|
|
||||||
|
- The `c.boxes.xyxy.cpu().numpy()` call retrieves the bounding boxes as a NumPy array in the `xyxy` format, where `xmin`, `ymin`, `xmax`, and `ymax` represent the coordinates of the bounding box rectangle. See [Boxes Section from Predict Mode](../modes/predict.md#boxes) for more details.
|
||||||
|
|
||||||
|
- The `squeeze()` operation removes any unnecessary dimensions from the NumPy array, ensuring it has the expected shape.
|
||||||
|
|
||||||
|
- Converting the coordinate values using `.astype(np.int32)` changes the box coordinates data type from `float32` to `int32`, making them compatible for image cropping using index slices.
|
||||||
|
|
||||||
|
- Finally, the bounding box region is cropped from the image using index slicing. The bounds are defined by the `[ymin:ymax, xmin:xmax]` coordinates of the detection bounding box.
|
||||||
|
|
||||||
|
=== "Transparent Background Pixels"
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Isolate object with transparent background (when saved as PNG)
|
||||||
|
isolated = np.dstack([img, b_mask])
|
||||||
|
```
|
||||||
|
|
||||||
|
??? question "How does this work?"
|
||||||
|
|
||||||
|
- Using the NumPy `dstack()` function (array stacking along depth-axis) in conjunction with the binary mask generated, will create an image with four channels. This allows for all pixels outside of the object contour to be transparent when saving as a `PNG` file.
|
||||||
|
|
||||||
|
### Isolate with Transparent Pixels: Sub-options
|
||||||
|
|
||||||
|
??? info "Full-size Image"
|
||||||
|
|
||||||
|
There are no additional steps required if keeping full size image.
|
||||||
|
|
||||||
|
<figure markdown>
|
||||||
|
{ width=240 }
|
||||||
|
<figcaption>Example full-size output + transparent background</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
??? info "Cropped object Image"
|
||||||
|
|
||||||
|
Additional steps required to crop image to only include object region.
|
||||||
|
|
||||||
|
{ align="right" }
|
||||||
|
```{ .py .annotate }
|
||||||
|
# (1) Bounding box coordinates
|
||||||
|
x1, y1, x2, y2 = c.boxes.xyxy.cpu().numpy().squeeze().astype(np.int32)
|
||||||
|
# Crop image to object region
|
||||||
|
iso_crop = isolated[y1:y2, x1:x2]
|
||||||
|
```
|
||||||
|
|
||||||
|
1. For more information on bounding box results, see [Boxes Section from Predict Mode](../modes/predict.md#boxes)
|
||||||
|
|
||||||
|
??? question "What does this code do?"
|
||||||
|
|
||||||
|
- When using `c.boxes.xyxy.cpu().numpy()`, the bounding boxes are returned as a NumPy array, using the `xyxy` box coordinates format, which correspond to the points `xmin, ymin, xmax, ymax` for the bounding box (rectangle), see [Boxes Section from Predict Mode](../modes/predict.md#boxes) for more information.
|
||||||
|
|
||||||
|
- Adding `squeeze()` ensures that any extraneous dimensions are removed from the NumPy array.
|
||||||
|
|
||||||
|
- Converting the coordinate values using `.astype(np.int32)` changes the box coordinates data type from `float32` to `int32` which will be compatible when cropping the image using index slices.
|
||||||
|
|
||||||
|
- Finally the image region for the bounding box is cropped using index slicing, where the bounds are set using the `[ymin:ymax, xmin:xmax]` coordinates of the detection bounding box.
|
||||||
|
|
||||||
|
??? question "What if I want the cropped object **including** the background?"
|
||||||
|
|
||||||
|
This is a built-in feature for the Ultralytics library. See the `save_crop` argument for [Predict Mode Inference Arguments](../modes/predict.md#inference-arguments) for details.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
6. <u>What to do next is entirely left to you as the developer.</u> A basic example of one possible next step (saving the image to file for future use) is shown.
|
||||||
|
- **NOTE:** this step is optional and can be skipped if not required for your specific use case.
|
||||||
|
|
||||||
|
??? example "Example Final Step"
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Save isolated object to file
|
||||||
|
_ = cv2.imwrite(f"{img_name}_{label}-{ci}.png", iso_crop)
|
||||||
|
```
|
||||||
|
|
||||||
|
- In this example, the `img_name` is the base-name of the source image file, `label` is the detected class-name, and `ci` is the index of the [object detection](https://www.ultralytics.com/glossary/object-detection) (in case of multiple instances with the same class name).
|
||||||
|
|
||||||
|
## Full Example code
|
||||||
|
|
||||||
|
Here, all steps from the previous section are combined into a single block of code. For repeated use, it would be optimal to define a function to do some or all commands contained in the `for`-loops, but that is an exercise left to the reader.
|
||||||
|
|
||||||
|
```{ .py .annotate }
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
m = YOLO("yolo26n-seg.pt") # (4)!
|
||||||
|
res = m.predict(source="path/to/image.jpg") # (3)!
|
||||||
|
|
||||||
|
# Iterate detection results (5)
|
||||||
|
for r in res:
|
||||||
|
img = np.copy(r.orig_img)
|
||||||
|
img_name = Path(r.path).stem
|
||||||
|
|
||||||
|
# Iterate each object contour (6)
|
||||||
|
for ci, c in enumerate(r):
|
||||||
|
label = c.names[c.boxes.cls.tolist().pop()]
|
||||||
|
|
||||||
|
b_mask = np.zeros(img.shape[:2], np.uint8)
|
||||||
|
|
||||||
|
# Create contour mask (1)
|
||||||
|
contour = c.masks.xy.pop().astype(np.int32).reshape(-1, 1, 2)
|
||||||
|
_ = cv2.drawContours(b_mask, [contour], -1, (255, 255, 255), cv2.FILLED)
|
||||||
|
|
||||||
|
# Choose one:
|
||||||
|
|
||||||
|
# OPTION-1: Isolate object with black background
|
||||||
|
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
||||||
|
isolated = cv2.bitwise_and(mask3ch, img)
|
||||||
|
|
||||||
|
# OPTION-2: Isolate object with transparent background (when saved as PNG)
|
||||||
|
isolated = np.dstack([img, b_mask])
|
||||||
|
|
||||||
|
# OPTIONAL: detection crop (from either OPT1 or OPT2)
|
||||||
|
x1, y1, x2, y2 = c.boxes.xyxy.cpu().numpy().squeeze().astype(np.int32)
|
||||||
|
iso_crop = isolated[y1:y2, x1:x2]
|
||||||
|
|
||||||
|
# Add your custom post-processing here (2)
|
||||||
|
```
|
||||||
|
|
||||||
|
1. The line populating `contour` is combined into a single line here, where it was split to multiple above.
|
||||||
|
2. {==What goes here is up to you!==}
|
||||||
|
3. See [Predict Mode](../modes/predict.md) for additional information.
|
||||||
|
4. See [Segment Task](../tasks/segment.md#models) for more information.
|
||||||
|
5. Learn more about [Working with Results](../modes/predict.md#working-with-results)
|
||||||
|
6. Learn more about [Segmentation Mask Results](../modes/predict.md#masks)
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### How do I isolate objects using Ultralytics YOLO26 for segmentation tasks?
|
||||||
|
|
||||||
|
To isolate objects using Ultralytics YOLO26, follow these steps:
|
||||||
|
|
||||||
|
1. **Load the model and run inference:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
model = YOLO("yolo26n-seg.pt")
|
||||||
|
results = model.predict(source="path/to/your/image.jpg")
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Generate a binary mask and draw contours:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
img = np.copy(results[0].orig_img)
|
||||||
|
b_mask = np.zeros(img.shape[:2], np.uint8)
|
||||||
|
contour = results[0].masks.xy[0].astype(np.int32).reshape(-1, 1, 2)
|
||||||
|
cv2.drawContours(b_mask, [contour], -1, (255, 255, 255), cv2.FILLED)
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Isolate the object using the binary mask:**
|
||||||
|
```python
|
||||||
|
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
||||||
|
isolated = cv2.bitwise_and(mask3ch, img)
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the guide on [Predict Mode](../modes/predict.md) and the [Segment Task](../tasks/segment.md) for more information.
|
||||||
|
|
||||||
|
### What options are available for saving the isolated objects after segmentation?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 offers two main options for saving isolated objects:
|
||||||
|
|
||||||
|
1. **With a Black Background:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
||||||
|
isolated = cv2.bitwise_and(mask3ch, img)
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **With a Transparent Background:**
|
||||||
|
```python
|
||||||
|
isolated = np.dstack([img, b_mask])
|
||||||
|
```
|
||||||
|
|
||||||
|
For further details, visit the [Predict Mode](../modes/predict.md) section.
|
||||||
|
|
||||||
|
### How can I crop isolated objects to their bounding boxes using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
To crop isolated objects to their bounding boxes:
|
||||||
|
|
||||||
|
1. **Retrieve bounding box coordinates:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
x1, y1, x2, y2 = results[0].boxes.xyxy[0].cpu().numpy().astype(np.int32)
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Crop the isolated image:**
|
||||||
|
```python
|
||||||
|
iso_crop = isolated[y1:y2, x1:x2]
|
||||||
|
```
|
||||||
|
|
||||||
|
Learn more about bounding box results in the [Predict Mode](../modes/predict.md#boxes) documentation.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO26 for object isolation in segmentation tasks?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 provides:
|
||||||
|
|
||||||
|
- **High-speed** real-time object detection and segmentation.
|
||||||
|
- **Accurate bounding box and mask generation** for precise object isolation.
|
||||||
|
- **Comprehensive documentation** and easy-to-use API for efficient development.
|
||||||
|
|
||||||
|
Explore the benefits of using YOLO in the [Segment Task documentation](../tasks/segment.md).
|
||||||
|
|
||||||
|
### Can I save isolated objects including the background using Ultralytics YOLO26?
|
||||||
|
|
||||||
|
Yes, this is a built-in feature in Ultralytics YOLO26. Use the `save_crop` argument in the `predict()` method. For example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
results = model.predict(source="path/to/your/image.jpg", save_crop=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
Read more about the `save_crop` argument in the [Predict Mode Inference Arguments](../modes/predict.md#inference-arguments) section.
|
||||||
324
docs/en/guides/kfold-cross-validation.md
Executable file
324
docs/en/guides/kfold-cross-validation.md
Executable file
@@ -0,0 +1,324 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn to implement K-Fold Cross Validation for object detection datasets using Ultralytics YOLO. Improve your model's reliability and robustness.
|
||||||
|
keywords: Ultralytics, YOLO, K-Fold Cross Validation, object detection, sklearn, pandas, PyYAML, machine learning, dataset split
|
||||||
|
---
|
||||||
|
|
||||||
|
# K-Fold Cross Validation with Ultralytics
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This comprehensive guide illustrates the implementation of K-Fold Cross Validation for [object detection](https://www.ultralytics.com/glossary/object-detection) datasets within the Ultralytics ecosystem. We'll leverage the YOLO detection format and key Python libraries such as sklearn, pandas, and PyYAML to guide you through the necessary setup, the process of generating feature vectors, and the execution of a K-Fold dataset split.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="https://cdn.jsdelivr.net/gh/ultralytics/assets@main/docs/k-fold-cross-validation-overview.avif" alt="K-fold cross validation data splitting">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Whether your project involves the Fruit Detection dataset or a custom data source, this tutorial aims to help you comprehend and apply K-Fold Cross Validation to bolster the reliability and robustness of your [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models. While we're applying `k=5` folds for this tutorial, keep in mind that the optimal number of folds can vary depending on your dataset and the specifics of your project.
|
||||||
|
|
||||||
|
Let's get started.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
- Your annotations should be in the [YOLO detection format](../datasets/detect/index.md).
|
||||||
|
|
||||||
|
- This guide assumes that annotation files are locally available.
|
||||||
|
|
||||||
|
- For our demonstration, we use the [Fruit Detection](https://www.kaggle.com/datasets/lakshaytyagi01/fruit-detection/code) dataset.
|
||||||
|
- This dataset contains a total of 8479 images.
|
||||||
|
- It includes 6 class labels, each with its total instance counts listed below.
|
||||||
|
|
||||||
|
| Class Label | Instance Count |
|
||||||
|
| :---------- | :------------: |
|
||||||
|
| Apple | 7049 |
|
||||||
|
| Grapes | 7202 |
|
||||||
|
| Pineapple | 1613 |
|
||||||
|
| Orange | 15549 |
|
||||||
|
| Banana | 3536 |
|
||||||
|
| Watermelon | 1976 |
|
||||||
|
|
||||||
|
- Necessary Python packages include:
|
||||||
|
- `ultralytics`
|
||||||
|
- `sklearn`
|
||||||
|
- `pandas`
|
||||||
|
- `pyyaml`
|
||||||
|
|
||||||
|
- This tutorial operates with `k=5` folds. However, you should determine the best number of folds for your specific dataset.
|
||||||
|
|
||||||
|
1. Initiate a new Python virtual environment (`venv`) for your project and activate it. Use `pip` (or your preferred package manager) to install:
|
||||||
|
- The Ultralytics library: `pip install -U ultralytics`. Alternatively, you can clone the official [repo](https://github.com/ultralytics/ultralytics).
|
||||||
|
- Scikit-learn, pandas, and PyYAML: `pip install -U scikit-learn pandas pyyaml`.
|
||||||
|
|
||||||
|
2. Verify that your annotations are in the [YOLO detection format](../datasets/detect/index.md).
|
||||||
|
- For this tutorial, all annotation files are found in the `Fruit-Detection/labels` directory.
|
||||||
|
|
||||||
|
## Generating Feature Vectors for Object Detection Dataset
|
||||||
|
|
||||||
|
1. Start by creating a new `example.py` Python file for the steps below.
|
||||||
|
|
||||||
|
2. Proceed to retrieve all label files for your dataset.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
dataset_path = Path("./Fruit-detection") # replace with 'path/to/dataset' for your custom data
|
||||||
|
labels = sorted(dataset_path.rglob("*labels/*.txt")) # all data in 'labels'
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Now, read the contents of the dataset YAML file and extract the indices of the class labels.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
yaml_file = "path/to/data.yaml" # your data YAML with data directories and names dictionary
|
||||||
|
with open(yaml_file, encoding="utf8") as y:
|
||||||
|
classes = yaml.safe_load(y)["names"]
|
||||||
|
cls_idx = sorted(classes.keys())
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Initialize an empty `pandas` DataFrame.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
index = [label.stem for label in labels] # uses base filename as ID (no extension)
|
||||||
|
labels_df = pd.DataFrame([], columns=cls_idx, index=index)
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Count the instances of each class-label present in the annotation files.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from collections import Counter
|
||||||
|
|
||||||
|
for label in labels:
|
||||||
|
lbl_counter = Counter()
|
||||||
|
|
||||||
|
with open(label) as lf:
|
||||||
|
lines = lf.readlines()
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
# classes for YOLO label uses integer at first position of each line
|
||||||
|
lbl_counter[int(line.split(" ", 1)[0])] += 1
|
||||||
|
|
||||||
|
labels_df.loc[label.stem] = lbl_counter
|
||||||
|
|
||||||
|
labels_df = labels_df.fillna(0.0) # replace `nan` values with `0.0`
|
||||||
|
```
|
||||||
|
|
||||||
|
6. The following is a sample view of the populated DataFrame:
|
||||||
|
|
||||||
|
```
|
||||||
|
0 1 2 3 4 5
|
||||||
|
'0000a16e4b057580_jpg.rf.00ab48988370f64f5ca8ea4...' 0.0 0.0 0.0 0.0 0.0 7.0
|
||||||
|
'0000a16e4b057580_jpg.rf.7e6dce029fb67f01eb19aa7...' 0.0 0.0 0.0 0.0 0.0 7.0
|
||||||
|
'0000a16e4b057580_jpg.rf.bc4d31cdcbe229dd022957a...' 0.0 0.0 0.0 0.0 0.0 7.0
|
||||||
|
'00020ebf74c4881c_jpg.rf.508192a0a97aa6c4a3b6882...' 0.0 0.0 0.0 1.0 0.0 0.0
|
||||||
|
'00020ebf74c4881c_jpg.rf.5af192a2254c8ecc4188a25...' 0.0 0.0 0.0 1.0 0.0 0.0
|
||||||
|
... ... ... ... ... ... ...
|
||||||
|
'ff4cd45896de38be_jpg.rf.c4b5e967ca10c7ced3b9e97...' 0.0 0.0 0.0 0.0 0.0 2.0
|
||||||
|
'ff4cd45896de38be_jpg.rf.ea4c1d37d2884b3e3cbce08...' 0.0 0.0 0.0 0.0 0.0 2.0
|
||||||
|
'ff5fd9c3c624b7dc_jpg.rf.bb519feaa36fc4bf630a033...' 1.0 0.0 0.0 0.0 0.0 0.0
|
||||||
|
'ff5fd9c3c624b7dc_jpg.rf.f0751c9c3aa4519ea3c9d6a...' 1.0 0.0 0.0 0.0 0.0 0.0
|
||||||
|
'fffe28b31f2a70d4_jpg.rf.7ea16bd637ba0711c53b540...' 0.0 6.0 0.0 0.0 0.0 0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
The rows index the label files, each corresponding to an image in your dataset, and the columns correspond to your class-label indices. Each row represents a pseudo feature-vector, with the count of each class-label present in your dataset. This data structure enables the application of [K-Fold Cross Validation](https://www.ultralytics.com/glossary/cross-validation) to an object detection dataset.
|
||||||
|
|
||||||
|
## K-Fold Dataset Split
|
||||||
|
|
||||||
|
1. Now we will use the `KFold` class from `sklearn.model_selection` to generate `k` splits of the dataset.
|
||||||
|
- Important:
|
||||||
|
- Setting `shuffle=True` ensures a randomized distribution of classes in your splits.
|
||||||
|
- By setting `random_state=M` where `M` is a chosen integer, you can obtain repeatable results.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import random
|
||||||
|
|
||||||
|
from sklearn.model_selection import KFold
|
||||||
|
|
||||||
|
random.seed(0) # for reproducibility
|
||||||
|
ksplit = 5
|
||||||
|
kf = KFold(n_splits=ksplit, shuffle=True, random_state=20) # setting random_state for repeatable results
|
||||||
|
|
||||||
|
kfolds = list(kf.split(labels_df))
|
||||||
|
```
|
||||||
|
|
||||||
|
2. The dataset has now been split into `k` folds, each having a list of `train` and `val` indices. We will construct a DataFrame to display these results more clearly.
|
||||||
|
|
||||||
|
```python
|
||||||
|
folds = [f"split_{n}" for n in range(1, ksplit + 1)]
|
||||||
|
folds_df = pd.DataFrame(index=index, columns=folds)
|
||||||
|
|
||||||
|
for i, (train, val) in enumerate(kfolds, start=1):
|
||||||
|
folds_df[f"split_{i}"].loc[labels_df.iloc[train].index] = "train"
|
||||||
|
folds_df[f"split_{i}"].loc[labels_df.iloc[val].index] = "val"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Now we will calculate the distribution of class labels for each fold as a ratio of the classes present in `val` to those present in `train`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
fold_lbl_distrb = pd.DataFrame(index=folds, columns=cls_idx)
|
||||||
|
|
||||||
|
for n, (train_indices, val_indices) in enumerate(kfolds, start=1):
|
||||||
|
train_totals = labels_df.iloc[train_indices].sum()
|
||||||
|
val_totals = labels_df.iloc[val_indices].sum()
|
||||||
|
|
||||||
|
# To avoid division by zero, we add a small value (1E-7) to the denominator
|
||||||
|
ratio = val_totals / (train_totals + 1e-7)
|
||||||
|
fold_lbl_distrb.loc[f"split_{n}"] = ratio
|
||||||
|
```
|
||||||
|
|
||||||
|
The ideal scenario is for all class ratios to be reasonably similar for each split and across classes. This, however, will be subject to the specifics of your dataset.
|
||||||
|
|
||||||
|
4. Next, we create the directories and dataset YAML files for each split.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
supported_extensions = [".jpg", ".jpeg", ".png"]
|
||||||
|
|
||||||
|
# Initialize an empty list to store image file paths
|
||||||
|
images = []
|
||||||
|
|
||||||
|
# Loop through supported extensions and gather image files
|
||||||
|
for ext in supported_extensions:
|
||||||
|
images.extend(sorted((dataset_path / "images").rglob(f"*{ext}")))
|
||||||
|
|
||||||
|
# Create the necessary directories and dataset YAML files
|
||||||
|
save_path = Path(dataset_path / f"{datetime.date.today().isoformat()}_{ksplit}-Fold_Cross-val")
|
||||||
|
save_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
ds_yamls = []
|
||||||
|
|
||||||
|
for split in folds_df.columns:
|
||||||
|
# Create directories
|
||||||
|
split_dir = save_path / split
|
||||||
|
split_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
(split_dir / "train" / "images").mkdir(parents=True, exist_ok=True)
|
||||||
|
(split_dir / "train" / "labels").mkdir(parents=True, exist_ok=True)
|
||||||
|
(split_dir / "val" / "images").mkdir(parents=True, exist_ok=True)
|
||||||
|
(split_dir / "val" / "labels").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Create dataset YAML files
|
||||||
|
dataset_yaml = split_dir / f"{split}_dataset.yaml"
|
||||||
|
ds_yamls.append(dataset_yaml)
|
||||||
|
|
||||||
|
with open(dataset_yaml, "w") as ds_y:
|
||||||
|
yaml.safe_dump(
|
||||||
|
{
|
||||||
|
"path": split_dir.as_posix(),
|
||||||
|
"train": "train",
|
||||||
|
"val": "val",
|
||||||
|
"names": classes,
|
||||||
|
},
|
||||||
|
ds_y,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Lastly, copy images and labels into the respective directory ('train' or 'val') for each split.
|
||||||
|
- **NOTE:** The time required for this portion of the code will vary based on the size of your dataset and your system hardware.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
for image, label in tqdm(zip(images, labels), total=len(images), desc="Copying files"):
|
||||||
|
for split, k_split in folds_df.loc[image.stem].items():
|
||||||
|
# Destination directory
|
||||||
|
img_to_path = save_path / split / k_split / "images"
|
||||||
|
lbl_to_path = save_path / split / k_split / "labels"
|
||||||
|
|
||||||
|
# Copy image and label files to new directory (SamefileError if file already exists)
|
||||||
|
shutil.copy(image, img_to_path / image.name)
|
||||||
|
shutil.copy(label, lbl_to_path / label.name)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Save Records (Optional)
|
||||||
|
|
||||||
|
Optionally, you can save the records of the K-Fold split and label distribution DataFrames as CSV files for future reference.
|
||||||
|
|
||||||
|
```python
|
||||||
|
folds_df.to_csv(save_path / "kfold_datasplit.csv")
|
||||||
|
fold_lbl_distrb.to_csv(save_path / "kfold_label_distribution.csv")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Train YOLO using K-Fold Data Splits
|
||||||
|
|
||||||
|
1. First, load the YOLO model.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
weights_path = "path/to/weights.pt" # use yolo26n.pt for a small model
|
||||||
|
model = YOLO(weights_path, task="detect")
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Next, iterate over the dataset YAML files to run training. The results will be saved to a directory specified by the `project` and `name` arguments. By default, this directory is 'runs/detect/train#' where # is an integer index.
|
||||||
|
|
||||||
|
```python
|
||||||
|
results = {}
|
||||||
|
|
||||||
|
# Define your additional arguments here
|
||||||
|
batch = 16
|
||||||
|
project = "kfold_demo"
|
||||||
|
epochs = 100
|
||||||
|
|
||||||
|
for k, dataset_yaml in enumerate(ds_yamls):
|
||||||
|
model = YOLO(weights_path, task="detect")
|
||||||
|
results[k] = model.train(
|
||||||
|
data=dataset_yaml, epochs=epochs, batch=batch, project=project, name=f"fold_{k + 1}"
|
||||||
|
) # include any additional train arguments
|
||||||
|
```
|
||||||
|
|
||||||
|
3. You can also use [Ultralytics data.utils.autosplit](https://docs.ultralytics.com/reference/data/utils/) function for automatic dataset splitting:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ultralytics.data.split import autosplit
|
||||||
|
|
||||||
|
# Automatically split dataset into train/val/test
|
||||||
|
autosplit(path="path/to/images", weights=(0.8, 0.2, 0.0), annotated_only=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
In this guide, we have explored the process of using K-Fold cross-validation for training the YOLO object detection model. We learned how to split our dataset into K partitions, ensuring a balanced class distribution across the different folds.
|
||||||
|
|
||||||
|
We also explored the procedure for creating report DataFrames to visualize the data splits and label distributions across these splits, providing us a clear insight into the structure of our training and validation sets.
|
||||||
|
|
||||||
|
Optionally, we saved our records for future reference, which could be particularly useful in large-scale projects or when troubleshooting model performance.
|
||||||
|
|
||||||
|
Finally, we implemented the actual model training using each split in a loop, saving our training results for further analysis and comparison.
|
||||||
|
|
||||||
|
This technique of K-Fold cross-validation is a robust way of making the most out of your available data, and it helps to ensure that your model performance is reliable and consistent across different data subsets. This results in a more generalizable and reliable model that is less likely to [overfit](https://www.ultralytics.com/glossary/overfitting) to specific data patterns.
|
||||||
|
|
||||||
|
Remember that although we used YOLO in this guide, these steps are mostly transferable to other machine learning models. Understanding these steps allows you to apply cross-validation effectively in your own machine learning projects.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What is K-Fold Cross Validation and why is it useful in object detection?
|
||||||
|
|
||||||
|
K-Fold Cross Validation is a technique where the dataset is divided into 'k' subsets (folds) to evaluate model performance more reliably. Each fold serves as both training and [validation data](https://www.ultralytics.com/glossary/validation-data). In the context of object detection, using K-Fold Cross Validation helps to ensure your Ultralytics YOLO model's performance is robust and generalizable across different data splits, enhancing its reliability. For detailed instructions on setting up K-Fold Cross Validation with Ultralytics YOLO, refer to [K-Fold Cross Validation with Ultralytics](#introduction).
|
||||||
|
|
||||||
|
### How do I implement K-Fold Cross Validation using Ultralytics YOLO?
|
||||||
|
|
||||||
|
To implement K-Fold Cross Validation with Ultralytics YOLO, you need to follow these steps:
|
||||||
|
|
||||||
|
1. Verify annotations are in the [YOLO detection format](../datasets/detect/index.md).
|
||||||
|
2. Use Python libraries like `sklearn`, `pandas`, and `pyyaml`.
|
||||||
|
3. Create feature vectors from your dataset.
|
||||||
|
4. Split your dataset using `KFold` from `sklearn.model_selection`.
|
||||||
|
5. Train the YOLO model on each split.
|
||||||
|
|
||||||
|
For a comprehensive guide, see the [K-Fold Dataset Split](#k-fold-dataset-split) section in our documentation.
|
||||||
|
|
||||||
|
### Why should I use Ultralytics YOLO for object detection?
|
||||||
|
|
||||||
|
Ultralytics YOLO offers state-of-the-art, real-time object detection with high [accuracy](https://www.ultralytics.com/glossary/accuracy) and efficiency. It's versatile, supporting multiple [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) tasks such as detection, segmentation, and classification. Additionally, it integrates seamlessly with tools like [Ultralytics Platform](https://docs.ultralytics.com/platform/) for no-code model training and deployment. For more details, explore the benefits and features on our [Ultralytics YOLO page](https://www.ultralytics.com/yolo).
|
||||||
|
|
||||||
|
### How can I ensure my annotations are in the correct format for Ultralytics YOLO?
|
||||||
|
|
||||||
|
Your annotations should follow the YOLO detection format. Each annotation file must list the object class, alongside its [bounding box](https://www.ultralytics.com/glossary/bounding-box) coordinates in the image. The YOLO format ensures streamlined and standardized data processing for training object detection models. For more information on proper annotation formatting, visit the [YOLO detection format guide](../datasets/detect/index.md).
|
||||||
|
|
||||||
|
### Can I use K-Fold Cross Validation with custom datasets other than Fruit Detection?
|
||||||
|
|
||||||
|
Yes, you can use K-Fold Cross Validation with any custom dataset as long as the annotations are in the YOLO detection format. Replace the dataset paths and class labels with those specific to your custom dataset. This flexibility ensures that any object detection project can benefit from robust model evaluation using K-Fold Cross Validation. For a practical example, review our [Generating Feature Vectors](#generating-feature-vectors-for-object-detection-dataset) section.
|
||||||
317
docs/en/guides/model-deployment-options.md
Executable file
317
docs/en/guides/model-deployment-options.md
Executable file
@@ -0,0 +1,317 @@
|
|||||||
|
---
|
||||||
|
comments: true
|
||||||
|
description: Learn about YOLO26's diverse deployment options to maximize your model's performance. Explore PyTorch, TensorRT, OpenVINO, TF Lite, and more!
|
||||||
|
keywords: YOLO26, deployment options, export formats, PyTorch, TensorRT, OpenVINO, TF Lite, machine learning, model deployment
|
||||||
|
---
|
||||||
|
|
||||||
|
# Comparative Analysis of YOLO26 Deployment Options
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
You've come a long way on your journey with YOLO26. You've diligently collected data, meticulously annotated it, and put in the hours to train and rigorously evaluate your custom YOLO26 model. Now, it's time to put your model to work for your specific application, use case, or project. But there's a critical decision that stands before you: how to export and deploy your model effectively.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<br>
|
||||||
|
<iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/QkCsj2SvZc4"
|
||||||
|
title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
<br>
|
||||||
|
<strong>Watch:</strong> How to Choose the Best Ultralytics YOLO26 Deployment Format for Your Project | TensorRT | OpenVINO 🚀
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This guide walks you through YOLO26's deployment options and the essential factors to consider to choose the right option for your project.
|
||||||
|
|
||||||
|
## How to Select the Right Deployment Option for Your YOLO26 Model
|
||||||
|
|
||||||
|
When it's time to deploy your YOLO26 model, selecting a suitable export format is very important. As outlined in the [Ultralytics YOLO26 Modes documentation](../modes/export.md#usage-examples), the `model.export()` function allows you to convert your trained model into a variety of formats tailored to diverse environments and performance requirements.
|
||||||
|
|
||||||
|
The ideal format depends on your model's intended operational context, balancing speed, hardware constraints, and ease of integration. In the following section, we'll take a closer look at each export option, understanding when to choose each one.
|
||||||
|
|
||||||
|
## YOLO26's Deployment Options
|
||||||
|
|
||||||
|
Let's walk through the different YOLO26 deployment options. For a detailed walkthrough of the export process, visit the [Ultralytics documentation page on exporting](../modes/export.md).
|
||||||
|
|
||||||
|
### PyTorch
|
||||||
|
|
||||||
|
PyTorch is an open-source machine learning library widely used for applications in [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) and [artificial intelligence](https://www.ultralytics.com/glossary/artificial-intelligence-ai). It provides a high level of flexibility and speed, which has made it a favorite among researchers and developers.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: PyTorch is known for its ease of use and flexibility, which may result in a slight trade-off in raw performance when compared to other frameworks that are more specialized and optimized.
|
||||||
|
- **Compatibility and Integration**: Offers excellent compatibility with various data science and machine learning libraries in Python.
|
||||||
|
- **Community Support and Ecosystem**: One of the most vibrant communities, with extensive resources for learning and troubleshooting.
|
||||||
|
- **Case Studies**: Commonly used in research prototypes, many academic papers reference models deployed in PyTorch.
|
||||||
|
- **Maintenance and Updates**: Regular updates with active development and support for new features.
|
||||||
|
- **Security Considerations**: Regular patches for security issues, but security is largely dependent on the overall environment it's deployed in.
|
||||||
|
- **Hardware Acceleration**: Supports CUDA for GPU acceleration, essential for speeding up model training and inference.
|
||||||
|
|
||||||
|
### TorchScript
|
||||||
|
|
||||||
|
TorchScript extends PyTorch's capabilities by allowing the exportation of models to be run in a C++ runtime environment. This makes it suitable for production environments where Python is unavailable.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Can offer improved performance over native PyTorch, especially in production environments.
|
||||||
|
- **Compatibility and Integration**: Designed for seamless transition from PyTorch to C++ production environments, though some advanced features might not translate perfectly.
|
||||||
|
- **Community Support and Ecosystem**: Benefits from PyTorch's large community but has a narrower scope of specialized developers.
|
||||||
|
- **Case Studies**: Widely used in industry settings where Python's performance overhead is a bottleneck.
|
||||||
|
- **Maintenance and Updates**: Maintained alongside PyTorch with consistent updates.
|
||||||
|
- **Security Considerations**: Offers improved security by enabling the running of models in environments without full Python installations.
|
||||||
|
- **Hardware Acceleration**: Inherits PyTorch's CUDA support, ensuring efficient GPU utilization.
|
||||||
|
|
||||||
|
### ONNX
|
||||||
|
|
||||||
|
The Open [Neural Network](https://www.ultralytics.com/glossary/neural-network-nn) Exchange (ONNX) is a format that allows for model interoperability across different frameworks, which can be critical when deploying to various platforms.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: ONNX models may experience a variable performance depending on the specific runtime they are deployed on.
|
||||||
|
- **Compatibility and Integration**: High interoperability across multiple platforms and hardware due to its framework-agnostic nature.
|
||||||
|
- **Community Support and Ecosystem**: Supported by many organizations, leading to a broad ecosystem and a variety of tools for optimization.
|
||||||
|
- **Case Studies**: Frequently used to move models between different machine learning frameworks, demonstrating its flexibility.
|
||||||
|
- **Maintenance and Updates**: As an open standard, ONNX is regularly updated to support new operations and models.
|
||||||
|
- **Security Considerations**: As with any cross-platform tool, it's essential to ensure secure practices in the conversion and deployment pipeline.
|
||||||
|
- **Hardware Acceleration**: With ONNX Runtime, models can leverage various hardware optimizations.
|
||||||
|
|
||||||
|
### OpenVINO
|
||||||
|
|
||||||
|
OpenVINO is an Intel toolkit designed to facilitate the deployment of deep learning models across Intel hardware, enhancing performance and speed.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Specifically optimized for Intel CPUs, GPUs, and VPUs, offering significant performance boosts on compatible hardware.
|
||||||
|
- **Compatibility and Integration**: Works best within the Intel ecosystem but also supports a range of other platforms.
|
||||||
|
- **Community Support and Ecosystem**: Backed by Intel, with a solid user base especially in the [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) domain.
|
||||||
|
- **Case Studies**: Often utilized in IoT and [edge computing](https://www.ultralytics.com/glossary/edge-computing) scenarios where Intel hardware is prevalent.
|
||||||
|
- **Maintenance and Updates**: Intel regularly updates OpenVINO to support the latest deep learning models and Intel hardware.
|
||||||
|
- **Security Considerations**: Provides robust security features suitable for deployment in sensitive applications.
|
||||||
|
- **Hardware Acceleration**: Tailored for acceleration on Intel hardware, leveraging dedicated instruction sets and hardware features.
|
||||||
|
|
||||||
|
For more details on deployment using OpenVINO, refer to the Ultralytics Integration documentation: [Intel OpenVINO Export](../integrations/openvino.md).
|
||||||
|
|
||||||
|
### TensorRT
|
||||||
|
|
||||||
|
TensorRT is a high-performance deep learning inference optimizer and runtime from NVIDIA, ideal for applications needing speed and efficiency.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Delivers top-tier performance on NVIDIA GPUs with support for high-speed inference.
|
||||||
|
- **Compatibility and Integration**: Best suited for NVIDIA hardware, with limited support outside this environment.
|
||||||
|
- **Community Support and Ecosystem**: Strong support network through NVIDIA's developer forums and documentation.
|
||||||
|
- **Case Studies**: Widely adopted in industries requiring real-time inference on video and image data.
|
||||||
|
- **Maintenance and Updates**: NVIDIA maintains TensorRT with frequent updates to enhance performance and support new GPU architectures.
|
||||||
|
- **Security Considerations**: Like many NVIDIA products, it has a strong emphasis on security, but specifics depend on the deployment environment.
|
||||||
|
- **Hardware Acceleration**: Exclusively designed for NVIDIA GPUs, providing deep optimization and acceleration.
|
||||||
|
|
||||||
|
For more information on TensorRT deployment, check out the [TensorRT integration guide](../integrations/tensorrt.md).
|
||||||
|
|
||||||
|
### CoreML
|
||||||
|
|
||||||
|
CoreML is Apple's machine learning framework, optimized for on-device performance in the Apple ecosystem, including iOS, macOS, watchOS, and tvOS.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Optimized for on-device performance on Apple hardware with minimal battery usage.
|
||||||
|
- **Compatibility and Integration**: Exclusively for Apple's ecosystem, providing a streamlined workflow for iOS and macOS applications.
|
||||||
|
- **Community Support and Ecosystem**: Strong support from Apple and a dedicated developer community, with extensive documentation and tools.
|
||||||
|
- **Case Studies**: Commonly used in applications that require on-device machine learning capabilities on Apple products.
|
||||||
|
- **Maintenance and Updates**: Regularly updated by Apple to support the latest machine learning advancements and Apple hardware.
|
||||||
|
- **Security Considerations**: Benefits from Apple's focus on user privacy and [data security](https://www.ultralytics.com/glossary/data-security).
|
||||||
|
- **Hardware Acceleration**: Takes full advantage of Apple's neural engine and GPU for accelerated machine learning tasks.
|
||||||
|
|
||||||
|
### TF SavedModel
|
||||||
|
|
||||||
|
TF SavedModel is TensorFlow's format for saving and serving machine learning models, particularly suited for scalable server environments.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Offers scalable performance in server environments, especially when used with TensorFlow Serving.
|
||||||
|
- **Compatibility and Integration**: Wide compatibility across TensorFlow's ecosystem, including cloud and enterprise server deployments.
|
||||||
|
- **Community Support and Ecosystem**: Large community support due to TensorFlow's popularity, with a vast array of tools for deployment and optimization.
|
||||||
|
- **Case Studies**: Extensively used in production environments for serving deep learning models at scale.
|
||||||
|
- **Maintenance and Updates**: Supported by Google and the TensorFlow community, ensuring regular updates and new features.
|
||||||
|
- **Security Considerations**: Deployment using TensorFlow Serving includes robust security features for enterprise-grade applications.
|
||||||
|
- **Hardware Acceleration**: Supports various hardware accelerations through TensorFlow's backends.
|
||||||
|
|
||||||
|
### TF GraphDef
|
||||||
|
|
||||||
|
TF GraphDef is a TensorFlow format that represents the model as a graph, which is beneficial for environments where a static computation graph is required.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Provides stable performance for static computation graphs, with a focus on consistency and reliability.
|
||||||
|
- **Compatibility and Integration**: Easily integrates within TensorFlow's infrastructure but less flexible compared to SavedModel.
|
||||||
|
- **Community Support and Ecosystem**: Good support from TensorFlow's ecosystem, with many resources available for optimizing static graphs.
|
||||||
|
- **Case Studies**: Useful in scenarios where a static graph is necessary, such as in certain embedded systems.
|
||||||
|
- **Maintenance and Updates**: Regular updates alongside TensorFlow's core updates.
|
||||||
|
- **Security Considerations**: Ensures safe deployment with TensorFlow's established security practices.
|
||||||
|
- **Hardware Acceleration**: Can utilize TensorFlow's hardware acceleration options, though not as flexible as SavedModel.
|
||||||
|
|
||||||
|
Learn more about TF GraphDef in our [TF GraphDef integration guide](../integrations/tf-graphdef.md).
|
||||||
|
|
||||||
|
### TF Lite
|
||||||
|
|
||||||
|
TF Lite is TensorFlow's solution for mobile and embedded device machine learning, providing a lightweight library for on-device inference.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Designed for speed and efficiency on mobile and embedded devices.
|
||||||
|
- **Compatibility and Integration**: Can be used on a wide range of devices due to its lightweight nature.
|
||||||
|
- **Community Support and Ecosystem**: Backed by Google, it has a robust community and a growing number of resources for developers.
|
||||||
|
- **Case Studies**: Popular in mobile applications that require on-device inference with minimal footprint.
|
||||||
|
- **Maintenance and Updates**: Regularly updated to include the latest features and optimizations for mobile devices.
|
||||||
|
- **Security Considerations**: Provides a secure environment for running models on end-user devices.
|
||||||
|
- **Hardware Acceleration**: Supports a variety of hardware acceleration options, including GPU and DSP.
|
||||||
|
|
||||||
|
### TF Edge TPU
|
||||||
|
|
||||||
|
TF Edge TPU is designed for high-speed, efficient computing on Google's Edge TPU hardware, perfect for IoT devices requiring real-time processing.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Specifically optimized for high-speed, efficient computing on Google's Edge TPU hardware.
|
||||||
|
- **Compatibility and Integration**: Works exclusively with TensorFlow Lite models on Edge TPU devices.
|
||||||
|
- **Community Support and Ecosystem**: Growing support with resources provided by Google and third-party developers.
|
||||||
|
- **Case Studies**: Used in IoT devices and applications that require real-time processing with low latency.
|
||||||
|
- **Maintenance and Updates**: Continually improved upon to leverage the capabilities of new Edge TPU hardware releases.
|
||||||
|
- **Security Considerations**: Integrates with Google's robust security for IoT and edge devices.
|
||||||
|
- **Hardware Acceleration**: Custom-designed to take full advantage of Google Coral devices.
|
||||||
|
|
||||||
|
### TF.js
|
||||||
|
|
||||||
|
TensorFlow.js (TF.js) is a library that brings machine learning capabilities directly to the browser, offering a new realm of possibilities for web developers and users alike. It allows for the integration of machine learning models in web applications without the need for back-end infrastructure.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Enables machine learning directly in the browser with reasonable performance, depending on the client device.
|
||||||
|
- **Compatibility and Integration**: High compatibility with web technologies, allowing for easy integration into web applications.
|
||||||
|
- **Community Support and Ecosystem**: Support from a community of web and Node.js developers, with a variety of tools for deploying ML models in browsers.
|
||||||
|
- **Case Studies**: Ideal for interactive web applications that benefit from client-side machine learning without the need for server-side processing.
|
||||||
|
- **Maintenance and Updates**: Maintained by the TensorFlow team with contributions from the open-source community.
|
||||||
|
- **Security Considerations**: Runs within the browser's secure context, utilizing the security model of the web platform.
|
||||||
|
- **Hardware Acceleration**: Performance can be enhanced with web-based APIs that access hardware acceleration like WebGL.
|
||||||
|
|
||||||
|
### PaddlePaddle
|
||||||
|
|
||||||
|
PaddlePaddle is an open-source deep learning framework developed by Baidu. It is designed to be both efficient for researchers and easy to use for developers. It's particularly popular in China and offers specialized support for Chinese language processing.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Offers competitive performance with a focus on ease of use and scalability.
|
||||||
|
- **Compatibility and Integration**: Well-integrated within Baidu's ecosystem and supports a wide range of applications.
|
||||||
|
- **Community Support and Ecosystem**: While the community is smaller globally, it's rapidly growing, especially in China.
|
||||||
|
- **Case Studies**: Commonly used in Chinese markets and by developers looking for alternatives to other major frameworks.
|
||||||
|
- **Maintenance and Updates**: Regularly updated with a focus on serving Chinese language AI applications and services.
|
||||||
|
- **Security Considerations**: Emphasizes [data privacy](https://www.ultralytics.com/glossary/data-privacy) and security, catering to Chinese data governance standards.
|
||||||
|
- **Hardware Acceleration**: Supports various hardware accelerations, including Baidu's own Kunlun chips.
|
||||||
|
|
||||||
|
### MNN
|
||||||
|
|
||||||
|
MNN is a highly efficient and lightweight deep learning framework. It supports inference and training of deep learning models and has industry-leading performance for inference and training on-device. In addition, MNN is also used on embedded devices, such as IoT.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: High-performance for mobile devices with excellent optimization for ARM systems.
|
||||||
|
- **Compatibility and Integration**: Works well with mobile and embedded ARM systems and X86-64 CPU architectures.
|
||||||
|
- **Community Support and Ecosystem**: Supported by the mobile and embedded machine learning community.
|
||||||
|
- **Case Studies**: Ideal for applications requiring efficient performance on mobile systems.
|
||||||
|
- **Maintenance and Updates**: Regularly maintained to ensure high performance on mobile devices.
|
||||||
|
- **Security Considerations**: Provides on-device security advantages by keeping data local.
|
||||||
|
- **Hardware Acceleration**: Optimized for ARM CPUs and GPUs for maximum efficiency.
|
||||||
|
|
||||||
|
### NCNN
|
||||||
|
|
||||||
|
NCNN is a high-performance neural network inference framework optimized for the mobile platform. It stands out for its lightweight nature and efficiency, making it particularly well-suited for mobile and embedded devices where resources are limited.
|
||||||
|
|
||||||
|
- **Performance Benchmarks**: Highly optimized for mobile platforms, offering efficient inference on ARM-based devices.
|
||||||
|
- **Compatibility and Integration**: Suitable for applications on mobile phones and embedded systems with ARM architecture.
|
||||||
|
- **Community Support and Ecosystem**: Supported by a niche but active community focused on mobile and embedded ML applications.
|
||||||
|
- **Case Studies**: Favored for mobile applications where efficiency and speed are critical on Android and other ARM-based systems.
|
||||||
|
- **Maintenance and Updates**: Continuously improved to maintain high performance on a range of ARM devices.
|
||||||
|
- **Security Considerations**: Focuses on running locally on the device, leveraging the inherent security of on-device processing.
|
||||||
|
- **Hardware Acceleration**: Tailored for ARM CPUs and GPUs, with specific optimizations for these architectures.
|
||||||
|
|
||||||
|
## Comparative Analysis of YOLO26 Deployment Options
|
||||||
|
|
||||||
|
The following table provides a snapshot of the various deployment options available for YOLO26 models, helping you to assess which may best fit your project needs based on several critical criteria. For an in-depth look at each deployment option's format, please see the [Ultralytics documentation page on export formats](../modes/export.md#export-formats).
|
||||||
|
|
||||||
|
| Deployment Option | Performance Benchmarks | Compatibility and Integration | Community Support and Ecosystem | Case Studies | Maintenance and Updates | Security Considerations | Hardware Acceleration |
|
||||||
|
| ----------------- | ----------------------------------------------- | ---------------------------------------------- | --------------------------------------------- | ------------------------------------------ | ---------------------------------------------- | ------------------------------------------------- | ---------------------------------- |
|
||||||
|
| PyTorch | Good flexibility; may trade off raw performance | Excellent with Python libraries | Extensive resources and community | Research and prototypes | Regular, active development | Dependent on deployment environment | CUDA support for GPU acceleration |
|
||||||
|
| TorchScript | Better for production than PyTorch | Smooth transition from PyTorch to C++ | Specialized but narrower than PyTorch | Industry where Python is a bottleneck | Consistent updates with PyTorch | Improved security without full Python | Inherits CUDA support from PyTorch |
|
||||||
|
| ONNX | Variable depending on runtime | High across different frameworks | Broad ecosystem, supported by many orgs | Flexibility across ML frameworks | Regular updates for new operations | Ensure secure conversion and deployment practices | Various hardware optimizations |
|
||||||
|
| OpenVINO | Optimized for Intel hardware | Best within Intel ecosystem | Solid in computer vision domain | IoT and edge with Intel hardware | Regular updates for Intel hardware | Robust features for sensitive applications | Tailored for Intel hardware |
|
||||||
|
| TensorRT | Top-tier on NVIDIA GPUs | Best for NVIDIA hardware | Strong network through NVIDIA | Real-time video and image inference | Frequent updates for new GPUs | Emphasis on security | Designed for NVIDIA GPUs |
|
||||||
|
| CoreML | Optimized for on-device Apple hardware | Exclusive to Apple ecosystem | Strong Apple and developer support | On-device ML on Apple products | Regular Apple updates | Focus on privacy and security | Apple neural engine and GPU |
|
||||||
|
| TF SavedModel | Scalable in server environments | Wide compatibility in TensorFlow ecosystem | Large support due to TensorFlow popularity | Serving models at scale | Regular updates by Google and community | Robust features for enterprise | Various hardware accelerations |
|
||||||
|
| TF GraphDef | Stable for static computation graphs | Integrates well with TensorFlow infrastructure | Resources for optimizing static graphs | Scenarios requiring static graphs | Updates alongside TensorFlow core | Established TensorFlow security practices | TensorFlow acceleration options |
|
||||||
|
| TF Lite | Speed and efficiency on mobile/embedded | Wide range of device support | Robust community, Google backed | Mobile applications with minimal footprint | Latest features for mobile | Secure environment on end-user devices | GPU and DSP among others |
|
||||||
|
| TF Edge TPU | Optimized for Google's Edge TPU hardware | Exclusive to Edge TPU devices | Growing with Google and third-party resources | IoT devices requiring real-time processing | Improvements for new Edge TPU hardware | Google's robust IoT security | Custom-designed for Google Coral |
|
||||||
|
| TF.js | Reasonable in-browser performance | High with web technologies | Web and Node.js developers support | Interactive web applications | TensorFlow team and community contributions | Web platform security model | Enhanced with WebGL and other APIs |
|
||||||
|
| PaddlePaddle | Competitive, easy to use and scalable | Baidu ecosystem, wide application support | Rapidly growing, especially in China | Chinese market and language processing | Focus on Chinese AI applications | Emphasizes data privacy and security | Including Baidu's Kunlun chips |
|
||||||
|
| MNN | High-performance for mobile devices. | Mobile and embedded ARM systems and X86-64 CPU | Mobile/embedded ML community | Mobile systems efficiency | High performance maintenance on Mobile Devices | On-device security advantages | ARM CPUs and GPUs optimizations |
|
||||||
|
| NCNN | Optimized for mobile ARM-based devices | Mobile and embedded ARM systems | Niche but active mobile/embedded ML community | Android and ARM systems efficiency | High performance maintenance on ARM | On-device security advantages | ARM CPUs and GPUs optimizations |
|
||||||
|
|
||||||
|
This comparative analysis gives you a high-level overview. For deployment, it's essential to consider the specific requirements and constraints of your project, and consult the detailed documentation and resources available for each option.
|
||||||
|
|
||||||
|
## Community and Support
|
||||||
|
|
||||||
|
When you're getting started with YOLO26, having a helpful community and support can make a significant impact. Here's how to connect with others who share your interests and get the assistance you need.
|
||||||
|
|
||||||
|
### Engage with the Broader Community
|
||||||
|
|
||||||
|
- **GitHub Discussions:** The [YOLO26 repository on GitHub](https://github.com/ultralytics/ultralytics) has a "Discussions" section where you can ask questions, report issues, and suggest improvements.
|
||||||
|
- **Ultralytics Discord Server:** Ultralytics has a [Discord server](https://discord.com/invite/ultralytics) where you can interact with other users and developers.
|
||||||
|
|
||||||
|
### Official Documentation and Resources
|
||||||
|
|
||||||
|
- **Ultralytics YOLO26 Docs:** The [official documentation](../index.md) provides a comprehensive overview of YOLO26, along with guides on installation, usage, and troubleshooting.
|
||||||
|
|
||||||
|
These resources will help you tackle challenges and stay updated on the latest trends and best practices in the YOLO26 community.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
In this guide, we've explored the different deployment options for YOLO26. We've also discussed the important factors to consider when making your choice. These options allow you to customize your model for various environments and performance requirements, making it suitable for real-world applications.
|
||||||
|
|
||||||
|
Don't forget that the YOLO26 and [Ultralytics community](https://github.com/orgs/ultralytics/discussions) is a valuable source of help. Connect with other developers and experts to learn unique tips and solutions you might not find in regular documentation. Keep seeking knowledge, exploring new ideas, and sharing your experiences.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### What are the deployment options available for YOLO26 on different hardware platforms?
|
||||||
|
|
||||||
|
Ultralytics YOLO26 supports various deployment formats, each designed for specific environments and hardware platforms. Key formats include:
|
||||||
|
|
||||||
|
- **PyTorch** for research and prototyping, with excellent Python integration.
|
||||||
|
- **TorchScript** for production environments where Python is unavailable.
|
||||||
|
- **ONNX** for cross-platform compatibility and hardware acceleration.
|
||||||
|
- **OpenVINO** for optimized performance on Intel hardware.
|
||||||
|
- **TensorRT** for high-speed inference on NVIDIA GPUs.
|
||||||
|
|
||||||
|
Each format has unique advantages. For a detailed walkthrough, see our [export process documentation](../modes/export.md#usage-examples).
|
||||||
|
|
||||||
|
### How do I improve the inference speed of my YOLO26 model on an Intel CPU?
|
||||||
|
|
||||||
|
To enhance inference speed on Intel CPUs, you can deploy your YOLO26 model using Intel's OpenVINO toolkit. OpenVINO offers significant performance boosts by optimizing models to leverage Intel hardware efficiently.
|
||||||
|
|
||||||
|
1. Convert your YOLO26 model to the OpenVINO format using the `model.export()` function.
|
||||||
|
2. Follow the detailed setup guide in the [Intel OpenVINO Export documentation](../integrations/openvino.md).
|
||||||
|
|
||||||
|
For more insights, check out our [blog post](https://www.ultralytics.com/blog/achieve-faster-inference-speeds-ultralytics-yolov8-openvino).
|
||||||
|
|
||||||
|
### Can I deploy YOLO26 models on mobile devices?
|
||||||
|
|
||||||
|
Yes, YOLO26 models can be deployed on mobile devices using [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) Lite (TF Lite) for both Android and iOS platforms. TF Lite is designed for mobile and embedded devices, providing efficient on-device inference.
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Export command for TFLite format
|
||||||
|
model.export(format="tflite")
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "CLI"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# CLI command for TFLite export
|
||||||
|
yolo export --format tflite
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on deploying models to mobile, refer to our [TF Lite integration guide](../integrations/tflite.md).
|
||||||
|
|
||||||
|
### What factors should I consider when choosing a deployment format for my YOLO26 model?
|
||||||
|
|
||||||
|
When choosing a deployment format for YOLO26, consider the following factors:
|
||||||
|
|
||||||
|
- **Performance**: Some formats like TensorRT provide exceptional speeds on NVIDIA GPUs, while OpenVINO is optimized for Intel hardware.
|
||||||
|
- **Compatibility**: ONNX offers broad compatibility across different platforms.
|
||||||
|
- **Ease of Integration**: Formats like CoreML or TF Lite are tailored for specific ecosystems like iOS and Android, respectively.
|
||||||
|
- **Community Support**: Formats like [PyTorch](https://www.ultralytics.com/glossary/pytorch) and TensorFlow have extensive community resources and support.
|
||||||
|
|
||||||
|
For a comparative analysis, refer to our [export formats documentation](../modes/export.md#export-formats).
|
||||||
|
|
||||||
|
### How can I deploy YOLO26 models in a web application?
|
||||||
|
|
||||||
|
To deploy YOLO26 models in a web application, you can use TensorFlow.js (TF.js), which allows for running [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models directly in the browser. This approach eliminates the need for backend infrastructure and provides real-time performance.
|
||||||
|
|
||||||
|
1. Export the YOLO26 model to the TF.js format.
|
||||||
|
2. Integrate the exported model into your web application.
|
||||||
|
|
||||||
|
For step-by-step instructions, refer to our guide on [TensorFlow.js integration](../integrations/tfjs.md).
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user