diff --git a/docker/Dockerfile b/docker/Dockerfile
index beaff83..656c074 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -41,7 +41,7 @@ ENV OMP_NUM_THREADS=1
# t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
# Pull and Run
-# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host $t
+# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
# Pull and Run with local directory access
# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/datasets:/usr/src/datasets $t
diff --git a/docker/Dockerfile-jetson b/docker/Dockerfile-jetson
index a7a0775..a20eb8c 100644
--- a/docker/Dockerfile-jetson
+++ b/docker/Dockerfile-jetson
@@ -14,10 +14,6 @@ RUN apt update \
&& apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++
# RUN alias python=python3
-# Security updates
-# https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
-RUN apt upgrade --no-install-recommends -y openssl tar
-
# Create working directory
RUN mkdir -p /usr/src/ultralytics
WORKDIR /usr/src/ultralytics
@@ -38,7 +34,7 @@ ENV OMP_NUM_THREADS=1
# Usage Examples -------------------------------------------------------------------------------------------------------
# Build and Push
-# t=ultralytics/ultralytics:jetson && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
+# t=ultralytics/ultralytics:latest-jetson && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson -t $t . && sudo docker push $t
# Pull and Run
-# t=ultralytics/ultralytics:jetson && sudo docker pull $t && sudo docker run -it --ipc=host $t
+# t=ultralytics/ultralytics:jetson && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
diff --git a/docs/build_reference.py b/docs/build_reference.py
new file mode 100644
index 0000000..b8f6d88
--- /dev/null
+++ b/docs/build_reference.py
@@ -0,0 +1,108 @@
+# Ultralytics YOLO 🚀, AGPL-3.0 license
+"""
+Helper file to build Ultralytics Docs reference section. Recursively walks through ultralytics dir and builds an MkDocs
+reference section of *.md files composed of classes and functions, and also creates a nav menu for use in mkdocs.yaml.
+
+Note: Must be run from repository root directory. Do not run from docs directory.
+"""
+
+import os
+import re
+from collections import defaultdict
+from pathlib import Path
+
+TARGET_DIR = Path('..')
+
+
+def extract_classes_and_functions(filepath):
+ with open(filepath, 'r') as file:
+ content = file.read()
+
+ class_pattern = r"(?:^|\n)class\s(\w+)(?:\(|:)"
+ func_pattern = r"(?:^|\n)def\s(\w+)\("
+
+ classes = re.findall(class_pattern, content)
+ functions = re.findall(func_pattern, content)
+
+ return classes, functions
+
+
+def create_markdown(py_filepath, module_path, classes, functions):
+ md_filepath = py_filepath.with_suffix('.md')
+
+ md_content = [f"# {class_name}\n---\n:::{module_path}.{class_name}\n
\n" for class_name in classes]
+ md_content.extend(f"# {func_name}\n---\n:::{module_path}.{func_name}\n
\n" for func_name in functions)
+ md_content = "\n".join(md_content)
+
+ os.makedirs(os.path.dirname(md_filepath), exist_ok=True)
+ with open(md_filepath, 'w') as file:
+ file.write(md_content)
+
+ return md_filepath.relative_to(TARGET_DIR)
+
+
+def nested_dict():
+ return defaultdict(nested_dict)
+
+
+def sort_nested_dict(d):
+ return {
+ key: sort_nested_dict(value) if isinstance(value, dict) else value
+ for key, value in sorted(d.items())
+ }
+
+
+def create_nav_menu_yaml(nav_items):
+ nav_tree = nested_dict()
+
+ for item_str in nav_items:
+ item = Path(item_str)
+ parts = item.parts
+ current_level = nav_tree['reference']
+ for part in parts[2:-1]: # skip the first two parts (docs and reference) and the last part (filename)
+ current_level = current_level[part]
+
+ md_file_name = parts[-1].replace('.md', '')
+ current_level[md_file_name] = item
+
+ nav_tree_sorted = sort_nested_dict(nav_tree)
+
+ def _dict_to_yaml(d, level=0):
+ yaml_str = ""
+ indent = " " * level
+ for k, v in d.items():
+ if isinstance(v, dict):
+ yaml_str += f"{indent}- {k}:\n{_dict_to_yaml(v, level + 1)}"
+ else:
+ yaml_str += f"{indent}- {k}: {str(v).replace('docs/', '')}\n"
+ return yaml_str
+
+ with open(TARGET_DIR / 'nav_menu_updated.yml', 'w') as file:
+ yaml_str = _dict_to_yaml(nav_tree_sorted)
+ file.write(yaml_str)
+
+
+def main():
+ source_dir = Path("../ultralytics")
+ target_dir = Path("reference")
+
+ nav_items = []
+
+ for root, _, files in os.walk(source_dir):
+ for file in files:
+ if file.endswith(".py") and file != "__init__.py":
+ py_filepath = Path(root) / file
+ classes, functions = extract_classes_and_functions(py_filepath)
+
+ if classes or functions:
+ py_filepath_rel = py_filepath.relative_to(source_dir)
+ md_filepath = target_dir / py_filepath_rel
+ module_path = f"ultralytics.{py_filepath_rel.with_suffix('').as_posix().replace('/', '.')}"
+ md_rel_filepath = create_markdown(md_filepath, module_path, classes, functions)
+ nav_items.append(str(md_rel_filepath))
+
+ create_nav_menu_yaml(nav_items)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/docs/modes/predict.md b/docs/modes/predict.md
index 6db2a9f..a5189d4 100644
--- a/docs/modes/predict.md
+++ b/docs/modes/predict.md
@@ -202,7 +202,7 @@ operations are cached, meaning they're only calculated once per object, and thos
results[0].probs # cls prob, (num_class, )
```
-Class reference documentation for `Results` module and its components can be found [here](../reference/results.md)
+Class reference documentation for `Results` module and its components can be found [here](../reference/yolo/engine/results.md)
## Plotting results
diff --git a/docs/quickstart.md b/docs/quickstart.md
index 8725b77..af00fcd 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -25,7 +25,7 @@ See the `ultralytics` [requirements.txt](https://github.com/ultralytics/ultralyt
PyTorch requirements vary by operating system and CUDA requirements, so it's recommended to install PyTorch first following instructions at [https://pytorch.org/get-started/locally](https://pytorch.org/get-started/locally).
-
+
diff --git a/docs/reference/base_pred.md b/docs/reference/base_pred.md
deleted file mode 100644
index 5a61c50..0000000
--- a/docs/reference/base_pred.md
+++ /dev/null
@@ -1,8 +0,0 @@
-All task Predictors are inherited from `BasePredictors` class that contains the model validation routine boilerplate.
-You can override any function of these Trainers to suit your needs.
-
----
-
-### BasePredictor API Reference
-
-:::ultralytics.yolo.engine.predictor.BasePredictor
\ No newline at end of file
diff --git a/docs/reference/base_trainer.md b/docs/reference/base_trainer.md
deleted file mode 100644
index a93af69..0000000
--- a/docs/reference/base_trainer.md
+++ /dev/null
@@ -1,8 +0,0 @@
-All task Trainers are inherited from `BaseTrainer` class that contains the model training and optimization routine
-boilerplate. You can override any function of these Trainers to suit your needs.
-
----
-
-### BaseTrainer API Reference
-
-:::ultralytics.yolo.engine.trainer.BaseTrainer
\ No newline at end of file
diff --git a/docs/reference/base_val.md b/docs/reference/base_val.md
deleted file mode 100644
index 37b7d9c..0000000
--- a/docs/reference/base_val.md
+++ /dev/null
@@ -1,8 +0,0 @@
-All task Validators are inherited from `BaseValidator` class that contains the model validation routine boilerplate. You
-can override any function of these Trainers to suit your needs.
-
----
-
-### BaseValidator API Reference
-
-:::ultralytics.yolo.engine.validator.BaseValidator
\ No newline at end of file
diff --git a/docs/reference/exporter.md b/docs/reference/exporter.md
deleted file mode 100644
index 4ce31e1..0000000
--- a/docs/reference/exporter.md
+++ /dev/null
@@ -1,3 +0,0 @@
-### Exporter API Reference
-
-:::ultralytics.yolo.engine.exporter.Exporter
\ No newline at end of file
diff --git a/docs/reference/hub/auth.md b/docs/reference/hub/auth.md
new file mode 100644
index 0000000..c8e5f8e
--- /dev/null
+++ b/docs/reference/hub/auth.md
@@ -0,0 +1,4 @@
+# Auth
+---
+:::ultralytics.hub.auth.Auth
+
diff --git a/docs/reference/hub/session.md b/docs/reference/hub/session.md
new file mode 100644
index 0000000..d945729
--- /dev/null
+++ b/docs/reference/hub/session.md
@@ -0,0 +1,4 @@
+# HUBTrainingSession
+---
+:::ultralytics.hub.session.HUBTrainingSession
+
diff --git a/docs/reference/hub/utils.md b/docs/reference/hub/utils.md
new file mode 100644
index 0000000..5f1b00c
--- /dev/null
+++ b/docs/reference/hub/utils.md
@@ -0,0 +1,24 @@
+# Traces
+---
+:::ultralytics.hub.utils.Traces
+
+
+# check_dataset_disk_space
+---
+:::ultralytics.hub.utils.check_dataset_disk_space
+
+
+# request_with_credentials
+---
+:::ultralytics.hub.utils.request_with_credentials
+
+
+# requests_with_progress
+---
+:::ultralytics.hub.utils.requests_with_progress
+
+
+# smart_request
+---
+:::ultralytics.hub.utils.smart_request
+
diff --git a/docs/reference/model.md b/docs/reference/model.md
deleted file mode 100644
index 6edc97b..0000000
--- a/docs/reference/model.md
+++ /dev/null
@@ -1 +0,0 @@
-::: ultralytics.yolo.engine.model
diff --git a/docs/reference/nn.md b/docs/reference/nn.md
deleted file mode 100644
index 0c7b1a8..0000000
--- a/docs/reference/nn.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# nn Module
-
-Ultralytics nn module contains 3 main components:
-
-1. **AutoBackend**: A module that can run inference on all popular model formats
-2. **BaseModel**: `BaseModel` class defines the operations supported by tasks like Detection and Segmentation
-3. **modules**: Optimized and reusable neural network blocks built on PyTorch.
-
-## AutoBackend
-
-:::ultralytics.nn.autobackend.AutoBackend
-
-## BaseModel
-
-:::ultralytics.nn.tasks.BaseModel
-
-## Modules
-
-TODO
\ No newline at end of file
diff --git a/docs/reference/nn/autobackend.md b/docs/reference/nn/autobackend.md
new file mode 100644
index 0000000..9b93b73
--- /dev/null
+++ b/docs/reference/nn/autobackend.md
@@ -0,0 +1,9 @@
+# AutoBackend
+---
+:::ultralytics.nn.autobackend.AutoBackend
+
+
+# check_class_names
+---
+:::ultralytics.nn.autobackend.check_class_names
+
diff --git a/docs/reference/nn/autoshape.md b/docs/reference/nn/autoshape.md
new file mode 100644
index 0000000..d432ac7
--- /dev/null
+++ b/docs/reference/nn/autoshape.md
@@ -0,0 +1,9 @@
+# AutoShape
+---
+:::ultralytics.nn.autoshape.AutoShape
+
+
+# Detections
+---
+:::ultralytics.nn.autoshape.Detections
+
diff --git a/docs/reference/nn/modules.md b/docs/reference/nn/modules.md
new file mode 100644
index 0000000..05cd7bc
--- /dev/null
+++ b/docs/reference/nn/modules.md
@@ -0,0 +1,159 @@
+# Conv
+---
+:::ultralytics.nn.modules.Conv
+
+
+# DWConv
+---
+:::ultralytics.nn.modules.DWConv
+
+
+# DWConvTranspose2d
+---
+:::ultralytics.nn.modules.DWConvTranspose2d
+
+
+# ConvTranspose
+---
+:::ultralytics.nn.modules.ConvTranspose
+
+
+# DFL
+---
+:::ultralytics.nn.modules.DFL
+
+
+# TransformerLayer
+---
+:::ultralytics.nn.modules.TransformerLayer
+
+
+# TransformerBlock
+---
+:::ultralytics.nn.modules.TransformerBlock
+
+
+# Bottleneck
+---
+:::ultralytics.nn.modules.Bottleneck
+
+
+# BottleneckCSP
+---
+:::ultralytics.nn.modules.BottleneckCSP
+
+
+# C3
+---
+:::ultralytics.nn.modules.C3
+
+
+# C2
+---
+:::ultralytics.nn.modules.C2
+
+
+# C2f
+---
+:::ultralytics.nn.modules.C2f
+
+
+# ChannelAttention
+---
+:::ultralytics.nn.modules.ChannelAttention
+
+
+# SpatialAttention
+---
+:::ultralytics.nn.modules.SpatialAttention
+
+
+# CBAM
+---
+:::ultralytics.nn.modules.CBAM
+
+
+# C1
+---
+:::ultralytics.nn.modules.C1
+
+
+# C3x
+---
+:::ultralytics.nn.modules.C3x
+
+
+# C3TR
+---
+:::ultralytics.nn.modules.C3TR
+
+
+# C3Ghost
+---
+:::ultralytics.nn.modules.C3Ghost
+
+
+# SPP
+---
+:::ultralytics.nn.modules.SPP
+
+
+# SPPF
+---
+:::ultralytics.nn.modules.SPPF
+
+
+# Focus
+---
+:::ultralytics.nn.modules.Focus
+
+
+# GhostConv
+---
+:::ultralytics.nn.modules.GhostConv
+
+
+# GhostBottleneck
+---
+:::ultralytics.nn.modules.GhostBottleneck
+
+
+# Concat
+---
+:::ultralytics.nn.modules.Concat
+
+
+# Proto
+---
+:::ultralytics.nn.modules.Proto
+
+
+# Ensemble
+---
+:::ultralytics.nn.modules.Ensemble
+
+
+# Detect
+---
+:::ultralytics.nn.modules.Detect
+
+
+# Segment
+---
+:::ultralytics.nn.modules.Segment
+
+
+# Pose
+---
+:::ultralytics.nn.modules.Pose
+
+
+# Classify
+---
+:::ultralytics.nn.modules.Classify
+
+
+# autopad
+---
+:::ultralytics.nn.modules.autopad
+
diff --git a/docs/reference/nn/tasks.md b/docs/reference/nn/tasks.md
new file mode 100644
index 0000000..45a231a
--- /dev/null
+++ b/docs/reference/nn/tasks.md
@@ -0,0 +1,59 @@
+# BaseModel
+---
+:::ultralytics.nn.tasks.BaseModel
+
+
+# DetectionModel
+---
+:::ultralytics.nn.tasks.DetectionModel
+
+
+# SegmentationModel
+---
+:::ultralytics.nn.tasks.SegmentationModel
+
+
+# PoseModel
+---
+:::ultralytics.nn.tasks.PoseModel
+
+
+# ClassificationModel
+---
+:::ultralytics.nn.tasks.ClassificationModel
+
+
+# torch_safe_load
+---
+:::ultralytics.nn.tasks.torch_safe_load
+
+
+# attempt_load_weights
+---
+:::ultralytics.nn.tasks.attempt_load_weights
+
+
+# attempt_load_one_weight
+---
+:::ultralytics.nn.tasks.attempt_load_one_weight
+
+
+# parse_model
+---
+:::ultralytics.nn.tasks.parse_model
+
+
+# yaml_model_load
+---
+:::ultralytics.nn.tasks.yaml_model_load
+
+
+# guess_model_scale
+---
+:::ultralytics.nn.tasks.guess_model_scale
+
+
+# guess_model_task
+---
+:::ultralytics.nn.tasks.guess_model_task
+
diff --git a/docs/reference/ops.md b/docs/reference/ops.md
deleted file mode 100644
index 3f8246d..0000000
--- a/docs/reference/ops.md
+++ /dev/null
@@ -1,208 +0,0 @@
-This module contains optimized deep learning related operations used in the Ultralytics YOLO framework
-
-## Non-max suppression
-
-:::ultralytics.yolo.utils.ops.non_max_suppression
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## Scale boxes
-
-:::ultralytics.yolo.utils.ops.scale_boxes
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## Scale image
-
-:::ultralytics.yolo.utils.ops.scale_image
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## clip boxes
-
-:::ultralytics.yolo.utils.ops.clip_boxes
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-# Box Format Conversion
-
-## xyxy2xywh
-
-:::ultralytics.yolo.utils.ops.xyxy2xywh
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xywh2xyxy
-
-:::ultralytics.yolo.utils.ops.xywh2xyxy
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xywhn2xyxy
-
-:::ultralytics.yolo.utils.ops.xywhn2xyxy
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xyxy2xywhn
-
-:::ultralytics.yolo.utils.ops.xyxy2xywhn
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xyn2xy
-
-:::ultralytics.yolo.utils.ops.xyn2xy
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xywh2ltwh
-
-:::ultralytics.yolo.utils.ops.xywh2ltwh
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## xyxy2ltwh
-
-:::ultralytics.yolo.utils.ops.xyxy2ltwh
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## ltwh2xywh
-
-:::ultralytics.yolo.utils.ops.ltwh2xywh
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## ltwh2xyxy
-
-:::ultralytics.yolo.utils.ops.ltwh2xyxy
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## segment2box
-
-:::ultralytics.yolo.utils.ops.segment2box
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-# Mask Operations
-
-## resample_segments
-
-:::ultralytics.yolo.utils.ops.resample_segments
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## crop_mask
-
-:::ultralytics.yolo.utils.ops.crop_mask
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## process_mask_upsample
-
-:::ultralytics.yolo.utils.ops.process_mask_upsample
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## process_mask
-
-:::ultralytics.yolo.utils.ops.process_mask
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## process_mask_native
-
-:::ultralytics.yolo.utils.ops.process_mask_native
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## scale_coords
-
-:::ultralytics.yolo.utils.ops.scale_coords
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## masks2segments
-
-:::ultralytics.yolo.utils.ops.masks2segments
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-## clip_coords
-
-:::ultralytics.yolo.utils.ops.clip_coords
-handler: python
-options:
-show_source: false
-show_root_toc_entry: false
----
-
-
-
-
-
diff --git a/docs/reference/results.md b/docs/reference/results.md
deleted file mode 100644
index e222ec4..0000000
--- a/docs/reference/results.md
+++ /dev/null
@@ -1,11 +0,0 @@
-### Results API Reference
-
-:::ultralytics.yolo.engine.results.Results
-
-### Boxes API Reference
-
-:::ultralytics.yolo.engine.results.Boxes
-
-### Masks API Reference
-
-:::ultralytics.yolo.engine.results.Masks
diff --git a/docs/reference/tracker/track.md b/docs/reference/tracker/track.md
new file mode 100644
index 0000000..59a2ee2
--- /dev/null
+++ b/docs/reference/tracker/track.md
@@ -0,0 +1,14 @@
+# on_predict_start
+---
+:::ultralytics.tracker.track.on_predict_start
+
+
+# on_predict_postprocess_end
+---
+:::ultralytics.tracker.track.on_predict_postprocess_end
+
+
+# register_tracker
+---
+:::ultralytics.tracker.track.register_tracker
+
diff --git a/docs/reference/tracker/trackers/basetrack.md b/docs/reference/tracker/trackers/basetrack.md
new file mode 100644
index 0000000..902da78
--- /dev/null
+++ b/docs/reference/tracker/trackers/basetrack.md
@@ -0,0 +1,9 @@
+# TrackState
+---
+:::ultralytics.tracker.trackers.basetrack.TrackState
+
+
+# BaseTrack
+---
+:::ultralytics.tracker.trackers.basetrack.BaseTrack
+
diff --git a/docs/reference/tracker/trackers/bot_sort.md b/docs/reference/tracker/trackers/bot_sort.md
new file mode 100644
index 0000000..0f299c8
--- /dev/null
+++ b/docs/reference/tracker/trackers/bot_sort.md
@@ -0,0 +1,9 @@
+# BOTrack
+---
+:::ultralytics.tracker.trackers.bot_sort.BOTrack
+
+
+# BOTSORT
+---
+:::ultralytics.tracker.trackers.bot_sort.BOTSORT
+
diff --git a/docs/reference/tracker/trackers/byte_tracker.md b/docs/reference/tracker/trackers/byte_tracker.md
new file mode 100644
index 0000000..3799975
--- /dev/null
+++ b/docs/reference/tracker/trackers/byte_tracker.md
@@ -0,0 +1,9 @@
+# STrack
+---
+:::ultralytics.tracker.trackers.byte_tracker.STrack
+
+
+# BYTETracker
+---
+:::ultralytics.tracker.trackers.byte_tracker.BYTETracker
+
diff --git a/docs/reference/tracker/utils/gmc.md b/docs/reference/tracker/utils/gmc.md
new file mode 100644
index 0000000..63ae5d5
--- /dev/null
+++ b/docs/reference/tracker/utils/gmc.md
@@ -0,0 +1,4 @@
+# GMC
+---
+:::ultralytics.tracker.utils.gmc.GMC
+
diff --git a/docs/reference/tracker/utils/kalman_filter.md b/docs/reference/tracker/utils/kalman_filter.md
new file mode 100644
index 0000000..0203c02
--- /dev/null
+++ b/docs/reference/tracker/utils/kalman_filter.md
@@ -0,0 +1,9 @@
+# KalmanFilterXYAH
+---
+:::ultralytics.tracker.utils.kalman_filter.KalmanFilterXYAH
+
+
+# KalmanFilterXYWH
+---
+:::ultralytics.tracker.utils.kalman_filter.KalmanFilterXYWH
+
diff --git a/docs/reference/tracker/utils/matching.md b/docs/reference/tracker/utils/matching.md
new file mode 100644
index 0000000..bd24450
--- /dev/null
+++ b/docs/reference/tracker/utils/matching.md
@@ -0,0 +1,59 @@
+# merge_matches
+---
+:::ultralytics.tracker.utils.matching.merge_matches
+
+
+# _indices_to_matches
+---
+:::ultralytics.tracker.utils.matching._indices_to_matches
+
+
+# linear_assignment
+---
+:::ultralytics.tracker.utils.matching.linear_assignment
+
+
+# ious
+---
+:::ultralytics.tracker.utils.matching.ious
+
+
+# iou_distance
+---
+:::ultralytics.tracker.utils.matching.iou_distance
+
+
+# v_iou_distance
+---
+:::ultralytics.tracker.utils.matching.v_iou_distance
+
+
+# embedding_distance
+---
+:::ultralytics.tracker.utils.matching.embedding_distance
+
+
+# gate_cost_matrix
+---
+:::ultralytics.tracker.utils.matching.gate_cost_matrix
+
+
+# fuse_motion
+---
+:::ultralytics.tracker.utils.matching.fuse_motion
+
+
+# fuse_iou
+---
+:::ultralytics.tracker.utils.matching.fuse_iou
+
+
+# fuse_score
+---
+:::ultralytics.tracker.utils.matching.fuse_score
+
+
+# bbox_ious
+---
+:::ultralytics.tracker.utils.matching.bbox_ious
+
diff --git a/docs/reference/yolo/data/augment.md b/docs/reference/yolo/data/augment.md
new file mode 100644
index 0000000..59c9a6e
--- /dev/null
+++ b/docs/reference/yolo/data/augment.md
@@ -0,0 +1,89 @@
+# BaseTransform
+---
+:::ultralytics.yolo.data.augment.BaseTransform
+
+
+# Compose
+---
+:::ultralytics.yolo.data.augment.Compose
+
+
+# BaseMixTransform
+---
+:::ultralytics.yolo.data.augment.BaseMixTransform
+
+
+# Mosaic
+---
+:::ultralytics.yolo.data.augment.Mosaic
+
+
+# MixUp
+---
+:::ultralytics.yolo.data.augment.MixUp
+
+
+# RandomPerspective
+---
+:::ultralytics.yolo.data.augment.RandomPerspective
+
+
+# RandomHSV
+---
+:::ultralytics.yolo.data.augment.RandomHSV
+
+
+# RandomFlip
+---
+:::ultralytics.yolo.data.augment.RandomFlip
+
+
+# LetterBox
+---
+:::ultralytics.yolo.data.augment.LetterBox
+
+
+# CopyPaste
+---
+:::ultralytics.yolo.data.augment.CopyPaste
+
+
+# Albumentations
+---
+:::ultralytics.yolo.data.augment.Albumentations
+
+
+# Format
+---
+:::ultralytics.yolo.data.augment.Format
+
+
+# ClassifyLetterBox
+---
+:::ultralytics.yolo.data.augment.ClassifyLetterBox
+
+
+# CenterCrop
+---
+:::ultralytics.yolo.data.augment.CenterCrop
+
+
+# ToTensor
+---
+:::ultralytics.yolo.data.augment.ToTensor
+
+
+# v8_transforms
+---
+:::ultralytics.yolo.data.augment.v8_transforms
+
+
+# classify_transforms
+---
+:::ultralytics.yolo.data.augment.classify_transforms
+
+
+# classify_albumentations
+---
+:::ultralytics.yolo.data.augment.classify_albumentations
+
diff --git a/docs/reference/yolo/data/base.md b/docs/reference/yolo/data/base.md
new file mode 100644
index 0000000..3a84e74
--- /dev/null
+++ b/docs/reference/yolo/data/base.md
@@ -0,0 +1,4 @@
+# BaseDataset
+---
+:::ultralytics.yolo.data.base.BaseDataset
+
diff --git a/docs/reference/yolo/data/build.md b/docs/reference/yolo/data/build.md
new file mode 100644
index 0000000..8b9b5a8
--- /dev/null
+++ b/docs/reference/yolo/data/build.md
@@ -0,0 +1,34 @@
+# InfiniteDataLoader
+---
+:::ultralytics.yolo.data.build.InfiniteDataLoader
+
+
+# _RepeatSampler
+---
+:::ultralytics.yolo.data.build._RepeatSampler
+
+
+# seed_worker
+---
+:::ultralytics.yolo.data.build.seed_worker
+
+
+# build_dataloader
+---
+:::ultralytics.yolo.data.build.build_dataloader
+
+
+# build_classification_dataloader
+---
+:::ultralytics.yolo.data.build.build_classification_dataloader
+
+
+# check_source
+---
+:::ultralytics.yolo.data.build.check_source
+
+
+# load_inference_source
+---
+:::ultralytics.yolo.data.build.load_inference_source
+
diff --git a/docs/reference/yolo/data/dataloaders/stream_loaders.md b/docs/reference/yolo/data/dataloaders/stream_loaders.md
new file mode 100644
index 0000000..7af3b90
--- /dev/null
+++ b/docs/reference/yolo/data/dataloaders/stream_loaders.md
@@ -0,0 +1,34 @@
+# SourceTypes
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.SourceTypes
+
+
+# LoadStreams
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.LoadStreams
+
+
+# LoadScreenshots
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.LoadScreenshots
+
+
+# LoadImages
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.LoadImages
+
+
+# LoadPilAndNumpy
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.LoadPilAndNumpy
+
+
+# LoadTensor
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.LoadTensor
+
+
+# autocast_list
+---
+:::ultralytics.yolo.data.dataloaders.stream_loaders.autocast_list
+
diff --git a/docs/reference/yolo/data/dataloaders/v5augmentations.md b/docs/reference/yolo/data/dataloaders/v5augmentations.md
new file mode 100644
index 0000000..67b31e8
--- /dev/null
+++ b/docs/reference/yolo/data/dataloaders/v5augmentations.md
@@ -0,0 +1,84 @@
+# Albumentations
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.Albumentations
+
+
+# LetterBox
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.LetterBox
+
+
+# CenterCrop
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.CenterCrop
+
+
+# ToTensor
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.ToTensor
+
+
+# normalize
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.normalize
+
+
+# denormalize
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.denormalize
+
+
+# augment_hsv
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.augment_hsv
+
+
+# hist_equalize
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.hist_equalize
+
+
+# replicate
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.replicate
+
+
+# letterbox
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.letterbox
+
+
+# random_perspective
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.random_perspective
+
+
+# copy_paste
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.copy_paste
+
+
+# cutout
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.cutout
+
+
+# mixup
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.mixup
+
+
+# box_candidates
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.box_candidates
+
+
+# classify_albumentations
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.classify_albumentations
+
+
+# classify_transforms
+---
+:::ultralytics.yolo.data.dataloaders.v5augmentations.classify_transforms
+
diff --git a/docs/reference/yolo/data/dataloaders/v5loader.md b/docs/reference/yolo/data/dataloaders/v5loader.md
new file mode 100644
index 0000000..90df8c1
--- /dev/null
+++ b/docs/reference/yolo/data/dataloaders/v5loader.md
@@ -0,0 +1,89 @@
+# InfiniteDataLoader
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.InfiniteDataLoader
+
+
+# _RepeatSampler
+---
+:::ultralytics.yolo.data.dataloaders.v5loader._RepeatSampler
+
+
+# LoadScreenshots
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.LoadScreenshots
+
+
+# LoadImages
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.LoadImages
+
+
+# LoadStreams
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.LoadStreams
+
+
+# LoadImagesAndLabels
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.LoadImagesAndLabels
+
+
+# ClassificationDataset
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.ClassificationDataset
+
+
+# get_hash
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.get_hash
+
+
+# exif_size
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.exif_size
+
+
+# exif_transpose
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.exif_transpose
+
+
+# seed_worker
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.seed_worker
+
+
+# create_dataloader
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.create_dataloader
+
+
+# img2label_paths
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.img2label_paths
+
+
+# flatten_recursive
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.flatten_recursive
+
+
+# extract_boxes
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.extract_boxes
+
+
+# autosplit
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.autosplit
+
+
+# verify_image_label
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.verify_image_label
+
+
+# create_classification_dataloader
+---
+:::ultralytics.yolo.data.dataloaders.v5loader.create_classification_dataloader
+
diff --git a/docs/reference/yolo/data/dataset.md b/docs/reference/yolo/data/dataset.md
new file mode 100644
index 0000000..c0de822
--- /dev/null
+++ b/docs/reference/yolo/data/dataset.md
@@ -0,0 +1,14 @@
+# YOLODataset
+---
+:::ultralytics.yolo.data.dataset.YOLODataset
+
+
+# ClassificationDataset
+---
+:::ultralytics.yolo.data.dataset.ClassificationDataset
+
+
+# SemanticDataset
+---
+:::ultralytics.yolo.data.dataset.SemanticDataset
+
diff --git a/docs/reference/yolo/data/dataset_wrappers.md b/docs/reference/yolo/data/dataset_wrappers.md
new file mode 100644
index 0000000..59f9f93
--- /dev/null
+++ b/docs/reference/yolo/data/dataset_wrappers.md
@@ -0,0 +1,4 @@
+# MixAndRectDataset
+---
+:::ultralytics.yolo.data.dataset_wrappers.MixAndRectDataset
+
diff --git a/docs/reference/yolo/data/utils.md b/docs/reference/yolo/data/utils.md
new file mode 100644
index 0000000..a7067ec
--- /dev/null
+++ b/docs/reference/yolo/data/utils.md
@@ -0,0 +1,64 @@
+# HUBDatasetStats
+---
+:::ultralytics.yolo.data.utils.HUBDatasetStats
+
+
+# img2label_paths
+---
+:::ultralytics.yolo.data.utils.img2label_paths
+
+
+# get_hash
+---
+:::ultralytics.yolo.data.utils.get_hash
+
+
+# exif_size
+---
+:::ultralytics.yolo.data.utils.exif_size
+
+
+# verify_image_label
+---
+:::ultralytics.yolo.data.utils.verify_image_label
+
+
+# polygon2mask
+---
+:::ultralytics.yolo.data.utils.polygon2mask
+
+
+# polygons2masks
+---
+:::ultralytics.yolo.data.utils.polygons2masks
+
+
+# polygons2masks_overlap
+---
+:::ultralytics.yolo.data.utils.polygons2masks_overlap
+
+
+# check_det_dataset
+---
+:::ultralytics.yolo.data.utils.check_det_dataset
+
+
+# check_cls_dataset
+---
+:::ultralytics.yolo.data.utils.check_cls_dataset
+
+
+# compress_one_image
+---
+:::ultralytics.yolo.data.utils.compress_one_image
+
+
+# delete_dsstore
+---
+:::ultralytics.yolo.data.utils.delete_dsstore
+
+
+# zip_directory
+---
+:::ultralytics.yolo.data.utils.zip_directory
+
diff --git a/docs/reference/yolo/engine/exporter.md b/docs/reference/yolo/engine/exporter.md
new file mode 100644
index 0000000..d3a0f3d
--- /dev/null
+++ b/docs/reference/yolo/engine/exporter.md
@@ -0,0 +1,29 @@
+# iOSDetectModel
+---
+:::ultralytics.yolo.engine.exporter.iOSDetectModel
+
+
+# Exporter
+---
+:::ultralytics.yolo.engine.exporter.Exporter
+
+
+# export_formats
+---
+:::ultralytics.yolo.engine.exporter.export_formats
+
+
+# gd_outputs
+---
+:::ultralytics.yolo.engine.exporter.gd_outputs
+
+
+# try_export
+---
+:::ultralytics.yolo.engine.exporter.try_export
+
+
+# export
+---
+:::ultralytics.yolo.engine.exporter.export
+
diff --git a/docs/reference/yolo/engine/model.md b/docs/reference/yolo/engine/model.md
new file mode 100644
index 0000000..6b2b318
--- /dev/null
+++ b/docs/reference/yolo/engine/model.md
@@ -0,0 +1,4 @@
+# YOLO
+---
+:::ultralytics.yolo.engine.model.YOLO
+
diff --git a/docs/reference/yolo/engine/predictor.md b/docs/reference/yolo/engine/predictor.md
new file mode 100644
index 0000000..2617160
--- /dev/null
+++ b/docs/reference/yolo/engine/predictor.md
@@ -0,0 +1,4 @@
+# BasePredictor
+---
+:::ultralytics.yolo.engine.predictor.BasePredictor
+
diff --git a/docs/reference/yolo/engine/results.md b/docs/reference/yolo/engine/results.md
new file mode 100644
index 0000000..aa25373
--- /dev/null
+++ b/docs/reference/yolo/engine/results.md
@@ -0,0 +1,19 @@
+# BaseTensor
+---
+:::ultralytics.yolo.engine.results.BaseTensor
+
+
+# Results
+---
+:::ultralytics.yolo.engine.results.Results
+
+
+# Boxes
+---
+:::ultralytics.yolo.engine.results.Boxes
+
+
+# Masks
+---
+:::ultralytics.yolo.engine.results.Masks
+
diff --git a/docs/reference/yolo/engine/trainer.md b/docs/reference/yolo/engine/trainer.md
new file mode 100644
index 0000000..9112838
--- /dev/null
+++ b/docs/reference/yolo/engine/trainer.md
@@ -0,0 +1,9 @@
+# BaseTrainer
+---
+:::ultralytics.yolo.engine.trainer.BaseTrainer
+
+
+# check_amp
+---
+:::ultralytics.yolo.engine.trainer.check_amp
+
diff --git a/docs/reference/yolo/engine/validator.md b/docs/reference/yolo/engine/validator.md
new file mode 100644
index 0000000..4a15794
--- /dev/null
+++ b/docs/reference/yolo/engine/validator.md
@@ -0,0 +1,4 @@
+# BaseValidator
+---
+:::ultralytics.yolo.engine.validator.BaseValidator
+
diff --git a/docs/reference/yolo/utils/autobatch.md b/docs/reference/yolo/utils/autobatch.md
new file mode 100644
index 0000000..a9e075b
--- /dev/null
+++ b/docs/reference/yolo/utils/autobatch.md
@@ -0,0 +1,9 @@
+# check_train_batch_size
+---
+:::ultralytics.yolo.utils.autobatch.check_train_batch_size
+
+
+# autobatch
+---
+:::ultralytics.yolo.utils.autobatch.autobatch
+
diff --git a/docs/reference/yolo/utils/benchmarks.md b/docs/reference/yolo/utils/benchmarks.md
new file mode 100644
index 0000000..6333b0b
--- /dev/null
+++ b/docs/reference/yolo/utils/benchmarks.md
@@ -0,0 +1,4 @@
+# benchmark
+---
+:::ultralytics.yolo.utils.benchmarks.benchmark
+
diff --git a/docs/reference/yolo/utils/callbacks/base.md b/docs/reference/yolo/utils/callbacks/base.md
new file mode 100644
index 0000000..210a981
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/base.md
@@ -0,0 +1,134 @@
+# on_pretrain_routine_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_pretrain_routine_start
+
+
+# on_pretrain_routine_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_pretrain_routine_end
+
+
+# on_train_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_start
+
+
+# on_train_epoch_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_epoch_start
+
+
+# on_train_batch_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_batch_start
+
+
+# optimizer_step
+---
+:::ultralytics.yolo.utils.callbacks.base.optimizer_step
+
+
+# on_before_zero_grad
+---
+:::ultralytics.yolo.utils.callbacks.base.on_before_zero_grad
+
+
+# on_train_batch_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_batch_end
+
+
+# on_train_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_epoch_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_fit_epoch_end
+
+
+# on_model_save
+---
+:::ultralytics.yolo.utils.callbacks.base.on_model_save
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_train_end
+
+
+# on_params_update
+---
+:::ultralytics.yolo.utils.callbacks.base.on_params_update
+
+
+# teardown
+---
+:::ultralytics.yolo.utils.callbacks.base.teardown
+
+
+# on_val_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_val_start
+
+
+# on_val_batch_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_val_batch_start
+
+
+# on_val_batch_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_val_batch_end
+
+
+# on_val_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_val_end
+
+
+# on_predict_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_predict_start
+
+
+# on_predict_batch_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_predict_batch_start
+
+
+# on_predict_batch_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_predict_batch_end
+
+
+# on_predict_postprocess_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_predict_postprocess_end
+
+
+# on_predict_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_predict_end
+
+
+# on_export_start
+---
+:::ultralytics.yolo.utils.callbacks.base.on_export_start
+
+
+# on_export_end
+---
+:::ultralytics.yolo.utils.callbacks.base.on_export_end
+
+
+# get_default_callbacks
+---
+:::ultralytics.yolo.utils.callbacks.base.get_default_callbacks
+
+
+# add_integration_callbacks
+---
+:::ultralytics.yolo.utils.callbacks.base.add_integration_callbacks
+
diff --git a/docs/reference/yolo/utils/callbacks/clearml.md b/docs/reference/yolo/utils/callbacks/clearml.md
new file mode 100644
index 0000000..ab0df6e
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/clearml.md
@@ -0,0 +1,34 @@
+# _log_debug_samples
+---
+:::ultralytics.yolo.utils.callbacks.clearml._log_debug_samples
+
+
+# _log_plot
+---
+:::ultralytics.yolo.utils.callbacks.clearml._log_plot
+
+
+# on_pretrain_routine_start
+---
+:::ultralytics.yolo.utils.callbacks.clearml.on_pretrain_routine_start
+
+
+# on_train_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.clearml.on_train_epoch_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.clearml.on_fit_epoch_end
+
+
+# on_val_end
+---
+:::ultralytics.yolo.utils.callbacks.clearml.on_val_end
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.clearml.on_train_end
+
diff --git a/docs/reference/yolo/utils/callbacks/comet.md b/docs/reference/yolo/utils/callbacks/comet.md
new file mode 100644
index 0000000..3d3b5e0
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/comet.md
@@ -0,0 +1,84 @@
+# _get_experiment_type
+---
+:::ultralytics.yolo.utils.callbacks.comet._get_experiment_type
+
+
+# _create_experiment
+---
+:::ultralytics.yolo.utils.callbacks.comet._create_experiment
+
+
+# _fetch_trainer_metadata
+---
+:::ultralytics.yolo.utils.callbacks.comet._fetch_trainer_metadata
+
+
+# _scale_bounding_box_to_original_image_shape
+---
+:::ultralytics.yolo.utils.callbacks.comet._scale_bounding_box_to_original_image_shape
+
+
+# _format_ground_truth_annotations_for_detection
+---
+:::ultralytics.yolo.utils.callbacks.comet._format_ground_truth_annotations_for_detection
+
+
+# _format_prediction_annotations_for_detection
+---
+:::ultralytics.yolo.utils.callbacks.comet._format_prediction_annotations_for_detection
+
+
+# _fetch_annotations
+---
+:::ultralytics.yolo.utils.callbacks.comet._fetch_annotations
+
+
+# _create_prediction_metadata_map
+---
+:::ultralytics.yolo.utils.callbacks.comet._create_prediction_metadata_map
+
+
+# _log_confusion_matrix
+---
+:::ultralytics.yolo.utils.callbacks.comet._log_confusion_matrix
+
+
+# _log_images
+---
+:::ultralytics.yolo.utils.callbacks.comet._log_images
+
+
+# _log_image_predictions
+---
+:::ultralytics.yolo.utils.callbacks.comet._log_image_predictions
+
+
+# _log_plots
+---
+:::ultralytics.yolo.utils.callbacks.comet._log_plots
+
+
+# _log_model
+---
+:::ultralytics.yolo.utils.callbacks.comet._log_model
+
+
+# on_pretrain_routine_start
+---
+:::ultralytics.yolo.utils.callbacks.comet.on_pretrain_routine_start
+
+
+# on_train_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.comet.on_train_epoch_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.comet.on_fit_epoch_end
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.comet.on_train_end
+
diff --git a/docs/reference/yolo/utils/callbacks/hub.md b/docs/reference/yolo/utils/callbacks/hub.md
new file mode 100644
index 0000000..d6d35c2
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/hub.md
@@ -0,0 +1,39 @@
+# on_pretrain_routine_end
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_pretrain_routine_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_fit_epoch_end
+
+
+# on_model_save
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_model_save
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_train_end
+
+
+# on_train_start
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_train_start
+
+
+# on_val_start
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_val_start
+
+
+# on_predict_start
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_predict_start
+
+
+# on_export_start
+---
+:::ultralytics.yolo.utils.callbacks.hub.on_export_start
+
diff --git a/docs/reference/yolo/utils/callbacks/mlflow.md b/docs/reference/yolo/utils/callbacks/mlflow.md
new file mode 100644
index 0000000..50b0592
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/mlflow.md
@@ -0,0 +1,19 @@
+# on_pretrain_routine_end
+---
+:::ultralytics.yolo.utils.callbacks.mlflow.on_pretrain_routine_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.mlflow.on_fit_epoch_end
+
+
+# on_model_save
+---
+:::ultralytics.yolo.utils.callbacks.mlflow.on_model_save
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.mlflow.on_train_end
+
diff --git a/docs/reference/yolo/utils/callbacks/raytune.md b/docs/reference/yolo/utils/callbacks/raytune.md
new file mode 100644
index 0000000..ba5ca79
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/raytune.md
@@ -0,0 +1,4 @@
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.raytune.on_fit_epoch_end
+
diff --git a/docs/reference/yolo/utils/callbacks/tensorboard.md b/docs/reference/yolo/utils/callbacks/tensorboard.md
new file mode 100644
index 0000000..7362d39
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/tensorboard.md
@@ -0,0 +1,19 @@
+# _log_scalars
+---
+:::ultralytics.yolo.utils.callbacks.tensorboard._log_scalars
+
+
+# on_pretrain_routine_start
+---
+:::ultralytics.yolo.utils.callbacks.tensorboard.on_pretrain_routine_start
+
+
+# on_batch_end
+---
+:::ultralytics.yolo.utils.callbacks.tensorboard.on_batch_end
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.tensorboard.on_fit_epoch_end
+
diff --git a/docs/reference/yolo/utils/callbacks/wb.md b/docs/reference/yolo/utils/callbacks/wb.md
new file mode 100644
index 0000000..f62af85
--- /dev/null
+++ b/docs/reference/yolo/utils/callbacks/wb.md
@@ -0,0 +1,19 @@
+# on_pretrain_routine_start
+---
+:::ultralytics.yolo.utils.callbacks.wb.on_pretrain_routine_start
+
+
+# on_fit_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.wb.on_fit_epoch_end
+
+
+# on_train_epoch_end
+---
+:::ultralytics.yolo.utils.callbacks.wb.on_train_epoch_end
+
+
+# on_train_end
+---
+:::ultralytics.yolo.utils.callbacks.wb.on_train_end
+
diff --git a/docs/reference/yolo/utils/checks.md b/docs/reference/yolo/utils/checks.md
new file mode 100644
index 0000000..b943ff1
--- /dev/null
+++ b/docs/reference/yolo/utils/checks.md
@@ -0,0 +1,79 @@
+# is_ascii
+---
+:::ultralytics.yolo.utils.checks.is_ascii
+
+
+# check_imgsz
+---
+:::ultralytics.yolo.utils.checks.check_imgsz
+
+
+# check_version
+---
+:::ultralytics.yolo.utils.checks.check_version
+
+
+# check_latest_pypi_version
+---
+:::ultralytics.yolo.utils.checks.check_latest_pypi_version
+
+
+# check_pip_update_available
+---
+:::ultralytics.yolo.utils.checks.check_pip_update_available
+
+
+# check_font
+---
+:::ultralytics.yolo.utils.checks.check_font
+
+
+# check_python
+---
+:::ultralytics.yolo.utils.checks.check_python
+
+
+# check_requirements
+---
+:::ultralytics.yolo.utils.checks.check_requirements
+
+
+# check_suffix
+---
+:::ultralytics.yolo.utils.checks.check_suffix
+
+
+# check_yolov5u_filename
+---
+:::ultralytics.yolo.utils.checks.check_yolov5u_filename
+
+
+# check_file
+---
+:::ultralytics.yolo.utils.checks.check_file
+
+
+# check_yaml
+---
+:::ultralytics.yolo.utils.checks.check_yaml
+
+
+# check_imshow
+---
+:::ultralytics.yolo.utils.checks.check_imshow
+
+
+# check_yolo
+---
+:::ultralytics.yolo.utils.checks.check_yolo
+
+
+# git_describe
+---
+:::ultralytics.yolo.utils.checks.git_describe
+
+
+# print_args
+---
+:::ultralytics.yolo.utils.checks.print_args
+
diff --git a/docs/reference/yolo/utils/dist.md b/docs/reference/yolo/utils/dist.md
new file mode 100644
index 0000000..33b8b23
--- /dev/null
+++ b/docs/reference/yolo/utils/dist.md
@@ -0,0 +1,19 @@
+# find_free_network_port
+---
+:::ultralytics.yolo.utils.dist.find_free_network_port
+
+
+# generate_ddp_file
+---
+:::ultralytics.yolo.utils.dist.generate_ddp_file
+
+
+# generate_ddp_command
+---
+:::ultralytics.yolo.utils.dist.generate_ddp_command
+
+
+# ddp_cleanup
+---
+:::ultralytics.yolo.utils.dist.ddp_cleanup
+
diff --git a/docs/reference/yolo/utils/downloads.md b/docs/reference/yolo/utils/downloads.md
new file mode 100644
index 0000000..103c261
--- /dev/null
+++ b/docs/reference/yolo/utils/downloads.md
@@ -0,0 +1,24 @@
+# is_url
+---
+:::ultralytics.yolo.utils.downloads.is_url
+
+
+# unzip_file
+---
+:::ultralytics.yolo.utils.downloads.unzip_file
+
+
+# safe_download
+---
+:::ultralytics.yolo.utils.downloads.safe_download
+
+
+# attempt_download_asset
+---
+:::ultralytics.yolo.utils.downloads.attempt_download_asset
+
+
+# download
+---
+:::ultralytics.yolo.utils.downloads.download
+
diff --git a/docs/reference/yolo/utils/errors.md b/docs/reference/yolo/utils/errors.md
new file mode 100644
index 0000000..b0b3c79
--- /dev/null
+++ b/docs/reference/yolo/utils/errors.md
@@ -0,0 +1,4 @@
+# HUBModelError
+---
+:::ultralytics.yolo.utils.errors.HUBModelError
+
diff --git a/docs/reference/yolo/utils/files.md b/docs/reference/yolo/utils/files.md
new file mode 100644
index 0000000..f9d85ab
--- /dev/null
+++ b/docs/reference/yolo/utils/files.md
@@ -0,0 +1,29 @@
+# WorkingDirectory
+---
+:::ultralytics.yolo.utils.files.WorkingDirectory
+
+
+# increment_path
+---
+:::ultralytics.yolo.utils.files.increment_path
+
+
+# file_age
+---
+:::ultralytics.yolo.utils.files.file_age
+
+
+# file_date
+---
+:::ultralytics.yolo.utils.files.file_date
+
+
+# file_size
+---
+:::ultralytics.yolo.utils.files.file_size
+
+
+# get_latest_run
+---
+:::ultralytics.yolo.utils.files.get_latest_run
+
diff --git a/docs/reference/yolo/utils/instance.md b/docs/reference/yolo/utils/instance.md
new file mode 100644
index 0000000..33fb9b8
--- /dev/null
+++ b/docs/reference/yolo/utils/instance.md
@@ -0,0 +1,14 @@
+# Bboxes
+---
+:::ultralytics.yolo.utils.instance.Bboxes
+
+
+# Instances
+---
+:::ultralytics.yolo.utils.instance.Instances
+
+
+# _ntuple
+---
+:::ultralytics.yolo.utils.instance._ntuple
+
diff --git a/docs/reference/yolo/utils/loss.md b/docs/reference/yolo/utils/loss.md
new file mode 100644
index 0000000..2e6822a
--- /dev/null
+++ b/docs/reference/yolo/utils/loss.md
@@ -0,0 +1,14 @@
+# VarifocalLoss
+---
+:::ultralytics.yolo.utils.loss.VarifocalLoss
+
+
+# BboxLoss
+---
+:::ultralytics.yolo.utils.loss.BboxLoss
+
+
+# KeypointLoss
+---
+:::ultralytics.yolo.utils.loss.KeypointLoss
+
diff --git a/docs/reference/yolo/utils/metrics.md b/docs/reference/yolo/utils/metrics.md
new file mode 100644
index 0000000..067595a
--- /dev/null
+++ b/docs/reference/yolo/utils/metrics.md
@@ -0,0 +1,94 @@
+# FocalLoss
+---
+:::ultralytics.yolo.utils.metrics.FocalLoss
+
+
+# ConfusionMatrix
+---
+:::ultralytics.yolo.utils.metrics.ConfusionMatrix
+
+
+# Metric
+---
+:::ultralytics.yolo.utils.metrics.Metric
+
+
+# DetMetrics
+---
+:::ultralytics.yolo.utils.metrics.DetMetrics
+
+
+# SegmentMetrics
+---
+:::ultralytics.yolo.utils.metrics.SegmentMetrics
+
+
+# PoseMetrics
+---
+:::ultralytics.yolo.utils.metrics.PoseMetrics
+
+
+# ClassifyMetrics
+---
+:::ultralytics.yolo.utils.metrics.ClassifyMetrics
+
+
+# box_area
+---
+:::ultralytics.yolo.utils.metrics.box_area
+
+
+# bbox_ioa
+---
+:::ultralytics.yolo.utils.metrics.bbox_ioa
+
+
+# box_iou
+---
+:::ultralytics.yolo.utils.metrics.box_iou
+
+
+# bbox_iou
+---
+:::ultralytics.yolo.utils.metrics.bbox_iou
+
+
+# mask_iou
+---
+:::ultralytics.yolo.utils.metrics.mask_iou
+
+
+# kpt_iou
+---
+:::ultralytics.yolo.utils.metrics.kpt_iou
+
+
+# smooth_BCE
+---
+:::ultralytics.yolo.utils.metrics.smooth_BCE
+
+
+# smooth
+---
+:::ultralytics.yolo.utils.metrics.smooth
+
+
+# plot_pr_curve
+---
+:::ultralytics.yolo.utils.metrics.plot_pr_curve
+
+
+# plot_mc_curve
+---
+:::ultralytics.yolo.utils.metrics.plot_mc_curve
+
+
+# compute_ap
+---
+:::ultralytics.yolo.utils.metrics.compute_ap
+
+
+# ap_per_class
+---
+:::ultralytics.yolo.utils.metrics.ap_per_class
+
diff --git a/docs/reference/yolo/utils/ops.md b/docs/reference/yolo/utils/ops.md
new file mode 100644
index 0000000..d357d29
--- /dev/null
+++ b/docs/reference/yolo/utils/ops.md
@@ -0,0 +1,134 @@
+# Profile
+---
+:::ultralytics.yolo.utils.ops.Profile
+
+
+# coco80_to_coco91_class
+---
+:::ultralytics.yolo.utils.ops.coco80_to_coco91_class
+
+
+# segment2box
+---
+:::ultralytics.yolo.utils.ops.segment2box
+
+
+# scale_boxes
+---
+:::ultralytics.yolo.utils.ops.scale_boxes
+
+
+# make_divisible
+---
+:::ultralytics.yolo.utils.ops.make_divisible
+
+
+# non_max_suppression
+---
+:::ultralytics.yolo.utils.ops.non_max_suppression
+
+
+# clip_boxes
+---
+:::ultralytics.yolo.utils.ops.clip_boxes
+
+
+# clip_coords
+---
+:::ultralytics.yolo.utils.ops.clip_coords
+
+
+# scale_image
+---
+:::ultralytics.yolo.utils.ops.scale_image
+
+
+# xyxy2xywh
+---
+:::ultralytics.yolo.utils.ops.xyxy2xywh
+
+
+# xywh2xyxy
+---
+:::ultralytics.yolo.utils.ops.xywh2xyxy
+
+
+# xywhn2xyxy
+---
+:::ultralytics.yolo.utils.ops.xywhn2xyxy
+
+
+# xyxy2xywhn
+---
+:::ultralytics.yolo.utils.ops.xyxy2xywhn
+
+
+# xyn2xy
+---
+:::ultralytics.yolo.utils.ops.xyn2xy
+
+
+# xywh2ltwh
+---
+:::ultralytics.yolo.utils.ops.xywh2ltwh
+
+
+# xyxy2ltwh
+---
+:::ultralytics.yolo.utils.ops.xyxy2ltwh
+
+
+# ltwh2xywh
+---
+:::ultralytics.yolo.utils.ops.ltwh2xywh
+
+
+# ltwh2xyxy
+---
+:::ultralytics.yolo.utils.ops.ltwh2xyxy
+
+
+# segments2boxes
+---
+:::ultralytics.yolo.utils.ops.segments2boxes
+
+
+# resample_segments
+---
+:::ultralytics.yolo.utils.ops.resample_segments
+
+
+# crop_mask
+---
+:::ultralytics.yolo.utils.ops.crop_mask
+
+
+# process_mask_upsample
+---
+:::ultralytics.yolo.utils.ops.process_mask_upsample
+
+
+# process_mask
+---
+:::ultralytics.yolo.utils.ops.process_mask
+
+
+# process_mask_native
+---
+:::ultralytics.yolo.utils.ops.process_mask_native
+
+
+# scale_coords
+---
+:::ultralytics.yolo.utils.ops.scale_coords
+
+
+# masks2segments
+---
+:::ultralytics.yolo.utils.ops.masks2segments
+
+
+# clean_str
+---
+:::ultralytics.yolo.utils.ops.clean_str
+
diff --git a/docs/reference/yolo/utils/plotting.md b/docs/reference/yolo/utils/plotting.md
new file mode 100644
index 0000000..04164ef
--- /dev/null
+++ b/docs/reference/yolo/utils/plotting.md
@@ -0,0 +1,34 @@
+# Colors
+---
+:::ultralytics.yolo.utils.plotting.Colors
+
+
+# Annotator
+---
+:::ultralytics.yolo.utils.plotting.Annotator
+
+
+# plot_labels
+---
+:::ultralytics.yolo.utils.plotting.plot_labels
+
+
+# save_one_box
+---
+:::ultralytics.yolo.utils.plotting.save_one_box
+
+
+# plot_images
+---
+:::ultralytics.yolo.utils.plotting.plot_images
+
+
+# plot_results
+---
+:::ultralytics.yolo.utils.plotting.plot_results
+
+
+# output_to_target
+---
+:::ultralytics.yolo.utils.plotting.output_to_target
+
diff --git a/docs/reference/yolo/utils/tal.md b/docs/reference/yolo/utils/tal.md
new file mode 100644
index 0000000..71171f5
--- /dev/null
+++ b/docs/reference/yolo/utils/tal.md
@@ -0,0 +1,29 @@
+# TaskAlignedAssigner
+---
+:::ultralytics.yolo.utils.tal.TaskAlignedAssigner
+
+
+# select_candidates_in_gts
+---
+:::ultralytics.yolo.utils.tal.select_candidates_in_gts
+
+
+# select_highest_overlaps
+---
+:::ultralytics.yolo.utils.tal.select_highest_overlaps
+
+
+# make_anchors
+---
+:::ultralytics.yolo.utils.tal.make_anchors
+
+
+# dist2bbox
+---
+:::ultralytics.yolo.utils.tal.dist2bbox
+
+
+# bbox2dist
+---
+:::ultralytics.yolo.utils.tal.bbox2dist
+
diff --git a/docs/reference/yolo/utils/torch_utils.md b/docs/reference/yolo/utils/torch_utils.md
new file mode 100644
index 0000000..67add55
--- /dev/null
+++ b/docs/reference/yolo/utils/torch_utils.md
@@ -0,0 +1,119 @@
+# ModelEMA
+---
+:::ultralytics.yolo.utils.torch_utils.ModelEMA
+
+
+# EarlyStopping
+---
+:::ultralytics.yolo.utils.torch_utils.EarlyStopping
+
+
+# torch_distributed_zero_first
+---
+:::ultralytics.yolo.utils.torch_utils.torch_distributed_zero_first
+
+
+# smart_inference_mode
+---
+:::ultralytics.yolo.utils.torch_utils.smart_inference_mode
+
+
+# select_device
+---
+:::ultralytics.yolo.utils.torch_utils.select_device
+
+
+# time_sync
+---
+:::ultralytics.yolo.utils.torch_utils.time_sync
+
+
+# fuse_conv_and_bn
+---
+:::ultralytics.yolo.utils.torch_utils.fuse_conv_and_bn
+
+
+# fuse_deconv_and_bn
+---
+:::ultralytics.yolo.utils.torch_utils.fuse_deconv_and_bn
+
+
+# model_info
+---
+:::ultralytics.yolo.utils.torch_utils.model_info
+
+
+# get_num_params
+---
+:::ultralytics.yolo.utils.torch_utils.get_num_params
+
+
+# get_num_gradients
+---
+:::ultralytics.yolo.utils.torch_utils.get_num_gradients
+
+
+# get_flops
+---
+:::ultralytics.yolo.utils.torch_utils.get_flops
+
+
+# initialize_weights
+---
+:::ultralytics.yolo.utils.torch_utils.initialize_weights
+
+
+# scale_img
+---
+:::ultralytics.yolo.utils.torch_utils.scale_img
+
+
+# make_divisible
+---
+:::ultralytics.yolo.utils.torch_utils.make_divisible
+
+
+# copy_attr
+---
+:::ultralytics.yolo.utils.torch_utils.copy_attr
+
+
+# get_latest_opset
+---
+:::ultralytics.yolo.utils.torch_utils.get_latest_opset
+
+
+# intersect_dicts
+---
+:::ultralytics.yolo.utils.torch_utils.intersect_dicts
+
+
+# is_parallel
+---
+:::ultralytics.yolo.utils.torch_utils.is_parallel
+
+
+# de_parallel
+---
+:::ultralytics.yolo.utils.torch_utils.de_parallel
+
+
+# one_cycle
+---
+:::ultralytics.yolo.utils.torch_utils.one_cycle
+
+
+# init_seeds
+---
+:::ultralytics.yolo.utils.torch_utils.init_seeds
+
+
+# strip_optimizer
+---
+:::ultralytics.yolo.utils.torch_utils.strip_optimizer
+
+
+# profile
+---
+:::ultralytics.yolo.utils.torch_utils.profile
+
diff --git a/docs/reference/yolo/v8/classify/predict.md b/docs/reference/yolo/v8/classify/predict.md
new file mode 100644
index 0000000..3b72459
--- /dev/null
+++ b/docs/reference/yolo/v8/classify/predict.md
@@ -0,0 +1,9 @@
+# ClassificationPredictor
+---
+:::ultralytics.yolo.v8.classify.predict.ClassificationPredictor
+
+
+# predict
+---
+:::ultralytics.yolo.v8.classify.predict.predict
+
diff --git a/docs/reference/yolo/v8/classify/train.md b/docs/reference/yolo/v8/classify/train.md
new file mode 100644
index 0000000..365249e
--- /dev/null
+++ b/docs/reference/yolo/v8/classify/train.md
@@ -0,0 +1,9 @@
+# ClassificationTrainer
+---
+:::ultralytics.yolo.v8.classify.train.ClassificationTrainer
+
+
+# train
+---
+:::ultralytics.yolo.v8.classify.train.train
+
diff --git a/docs/reference/yolo/v8/classify/val.md b/docs/reference/yolo/v8/classify/val.md
new file mode 100644
index 0000000..0c53d6f
--- /dev/null
+++ b/docs/reference/yolo/v8/classify/val.md
@@ -0,0 +1,9 @@
+# ClassificationValidator
+---
+:::ultralytics.yolo.v8.classify.val.ClassificationValidator
+
+
+# val
+---
+:::ultralytics.yolo.v8.classify.val.val
+
diff --git a/docs/reference/yolo/v8/detect/predict.md b/docs/reference/yolo/v8/detect/predict.md
new file mode 100644
index 0000000..df40e4f
--- /dev/null
+++ b/docs/reference/yolo/v8/detect/predict.md
@@ -0,0 +1,9 @@
+# DetectionPredictor
+---
+:::ultralytics.yolo.v8.detect.predict.DetectionPredictor
+
+
+# predict
+---
+:::ultralytics.yolo.v8.detect.predict.predict
+
diff --git a/docs/reference/yolo/v8/detect/train.md b/docs/reference/yolo/v8/detect/train.md
new file mode 100644
index 0000000..96606c1
--- /dev/null
+++ b/docs/reference/yolo/v8/detect/train.md
@@ -0,0 +1,14 @@
+# DetectionTrainer
+---
+:::ultralytics.yolo.v8.detect.train.DetectionTrainer
+
+
+# Loss
+---
+:::ultralytics.yolo.v8.detect.train.Loss
+
+
+# train
+---
+:::ultralytics.yolo.v8.detect.train.train
+
diff --git a/docs/reference/yolo/v8/detect/val.md b/docs/reference/yolo/v8/detect/val.md
new file mode 100644
index 0000000..665f073
--- /dev/null
+++ b/docs/reference/yolo/v8/detect/val.md
@@ -0,0 +1,9 @@
+# DetectionValidator
+---
+:::ultralytics.yolo.v8.detect.val.DetectionValidator
+
+
+# val
+---
+:::ultralytics.yolo.v8.detect.val.val
+
diff --git a/docs/reference/yolo/v8/pose/predict.md b/docs/reference/yolo/v8/pose/predict.md
new file mode 100644
index 0000000..a95ba1a
--- /dev/null
+++ b/docs/reference/yolo/v8/pose/predict.md
@@ -0,0 +1,9 @@
+# PosePredictor
+---
+:::ultralytics.yolo.v8.pose.predict.PosePredictor
+
+
+# predict
+---
+:::ultralytics.yolo.v8.pose.predict.predict
+
diff --git a/docs/reference/yolo/v8/pose/train.md b/docs/reference/yolo/v8/pose/train.md
new file mode 100644
index 0000000..f22e347
--- /dev/null
+++ b/docs/reference/yolo/v8/pose/train.md
@@ -0,0 +1,14 @@
+# PoseTrainer
+---
+:::ultralytics.yolo.v8.pose.train.PoseTrainer
+
+
+# PoseLoss
+---
+:::ultralytics.yolo.v8.pose.train.PoseLoss
+
+
+# train
+---
+:::ultralytics.yolo.v8.pose.train.train
+
diff --git a/docs/reference/yolo/v8/pose/val.md b/docs/reference/yolo/v8/pose/val.md
new file mode 100644
index 0000000..323624d
--- /dev/null
+++ b/docs/reference/yolo/v8/pose/val.md
@@ -0,0 +1,9 @@
+# PoseValidator
+---
+:::ultralytics.yolo.v8.pose.val.PoseValidator
+
+
+# val
+---
+:::ultralytics.yolo.v8.pose.val.val
+
diff --git a/docs/reference/yolo/v8/segment/predict.md b/docs/reference/yolo/v8/segment/predict.md
new file mode 100644
index 0000000..e632ae6
--- /dev/null
+++ b/docs/reference/yolo/v8/segment/predict.md
@@ -0,0 +1,9 @@
+# SegmentationPredictor
+---
+:::ultralytics.yolo.v8.segment.predict.SegmentationPredictor
+
+
+# predict
+---
+:::ultralytics.yolo.v8.segment.predict.predict
+
diff --git a/docs/reference/yolo/v8/segment/train.md b/docs/reference/yolo/v8/segment/train.md
new file mode 100644
index 0000000..208dc5b
--- /dev/null
+++ b/docs/reference/yolo/v8/segment/train.md
@@ -0,0 +1,14 @@
+# SegmentationTrainer
+---
+:::ultralytics.yolo.v8.segment.train.SegmentationTrainer
+
+
+# SegLoss
+---
+:::ultralytics.yolo.v8.segment.train.SegLoss
+
+
+# train
+---
+:::ultralytics.yolo.v8.segment.train.train
+
diff --git a/docs/reference/yolo/v8/segment/val.md b/docs/reference/yolo/v8/segment/val.md
new file mode 100644
index 0000000..dbe4e22
--- /dev/null
+++ b/docs/reference/yolo/v8/segment/val.md
@@ -0,0 +1,9 @@
+# SegmentationValidator
+---
+:::ultralytics.yolo.v8.segment.val.SegmentationValidator
+
+
+# val
+---
+:::ultralytics.yolo.v8.segment.val.val
+
diff --git a/docs/usage/engine.md b/docs/usage/engine.md
index 9cc85a1..205ebc0 100644
--- a/docs/usage/engine.md
+++ b/docs/usage/engine.md
@@ -9,7 +9,7 @@ custom model and dataloader by just overriding these functions:
* `get_model(cfg, weights)` - The function that builds the model to be trained
* `get_dataloder()` - The function that builds the dataloader
- More details and source code can be found in [`BaseTrainer` Reference](../reference/base_trainer.md)
+ More details and source code can be found in [`BaseTrainer` Reference](../reference/yolo/engine/trainer.md)
## DetectionTrainer
diff --git a/mkdocs.yml b/mkdocs.yml
index 8071cc3..830c257 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -37,8 +37,9 @@ theme:
- search.share
- search.suggest
- toc.follow
+ - toc.integrate
- navigation.top
- - navigation.expand
+ - navigation.tabs
- navigation.footer
- navigation.tracking
- navigation.instant
@@ -143,16 +144,88 @@ nav:
- Advanced Customization: usage/engine.md
- Ultralytics HUB: hub.md
- iOS and Android App: app.md
+
- Reference:
- - Engine:
- - Model: reference/model.md
- - Trainer: reference/base_trainer.md
- - Validator: reference/base_val.md
- - Predictor: reference/base_pred.md
- - Exporter: reference/exporter.md
- - Results: reference/results.md
- - ultralytics.nn: reference/nn.md
- - Operations: reference/ops.md
+ - hub:
+ - auth: reference/hub/auth.md
+ - session: reference/hub/session.md
+ - utils: reference/hub/utils.md
+ - nn:
+ - autobackend: reference/nn/autobackend.md
+ - autoshape: reference/nn/autoshape.md
+ - modules: reference/nn/modules.md
+ - tasks: reference/nn/tasks.md
+ - tracker:
+ - track: reference/tracker/track.md
+ - trackers:
+ - basetrack: reference/tracker/trackers/basetrack.md
+ - bot_sort: reference/tracker/trackers/bot_sort.md
+ - byte_tracker: reference/tracker/trackers/byte_tracker.md
+ - utils:
+ - gmc: reference/tracker/utils/gmc.md
+ - kalman_filter: reference/tracker/utils/kalman_filter.md
+ - matching: reference/tracker/utils/matching.md
+ - yolo:
+ - data:
+ - augment: reference/yolo/data/augment.md
+ - base: reference/yolo/data/base.md
+ - build: reference/yolo/data/build.md
+ - dataloaders:
+ - stream_loaders: reference/yolo/data/dataloaders/stream_loaders.md
+ - v5augmentations: reference/yolo/data/dataloaders/v5augmentations.md
+ - v5loader: reference/yolo/data/dataloaders/v5loader.md
+ - dataset: reference/yolo/data/dataset.md
+ - dataset_wrappers: reference/yolo/data/dataset_wrappers.md
+ - utils: reference/yolo/data/utils.md
+ - engine:
+ - exporter: reference/yolo/engine/exporter.md
+ - model: reference/yolo/engine/model.md
+ - predictor: reference/yolo/engine/predictor.md
+ - results: reference/yolo/engine/results.md
+ - trainer: reference/yolo/engine/trainer.md
+ - validator: reference/yolo/engine/validator.md
+ - utils:
+ - autobatch: reference/yolo/utils/autobatch.md
+ - benchmarks: reference/yolo/utils/benchmarks.md
+ - callbacks:
+ - base: reference/yolo/utils/callbacks/base.md
+ - clearml: reference/yolo/utils/callbacks/clearml.md
+ - comet: reference/yolo/utils/callbacks/comet.md
+ - hub: reference/yolo/utils/callbacks/hub.md
+ - mlflow: reference/yolo/utils/callbacks/mlflow.md
+ - raytune: reference/yolo/utils/callbacks/raytune.md
+ - tensorboard: reference/yolo/utils/callbacks/tensorboard.md
+ - wb: reference/yolo/utils/callbacks/wb.md
+ - checks: reference/yolo/utils/checks.md
+ - dist: reference/yolo/utils/dist.md
+ - downloads: reference/yolo/utils/downloads.md
+ - errors: reference/yolo/utils/errors.md
+ - files: reference/yolo/utils/files.md
+ - instance: reference/yolo/utils/instance.md
+ - loss: reference/yolo/utils/loss.md
+ - metrics: reference/yolo/utils/metrics.md
+ - ops: reference/yolo/utils/ops.md
+ - plotting: reference/yolo/utils/plotting.md
+ - tal: reference/yolo/utils/tal.md
+ - torch_utils: reference/yolo/utils/torch_utils.md
+ - v8:
+ - classify:
+ - predict: reference/yolo/v8/classify/predict.md
+ - train: reference/yolo/v8/classify/train.md
+ - val: reference/yolo/v8/classify/val.md
+ - detect:
+ - predict: reference/yolo/v8/detect/predict.md
+ - train: reference/yolo/v8/detect/train.md
+ - val: reference/yolo/v8/detect/val.md
+ - pose:
+ - predict: reference/yolo/v8/pose/predict.md
+ - train: reference/yolo/v8/pose/train.md
+ - val: reference/yolo/v8/pose/val.md
+ - segment:
+ - predict: reference/yolo/v8/segment/predict.md
+ - train: reference/yolo/v8/segment/train.md
+ - val: reference/yolo/v8/segment/val.md
+
- YOLOv5:
- yolov5/index.md
- Train Custom Data: yolov5/train_custom_data.md
@@ -171,5 +244,4 @@ nav:
- Neural Magic's DeepSparse: yolov5/neural_magic.md
- Comet Logging: yolov5/comet.md
- Clearml Logging: yolov5/clearml.md
-
- Security: SECURITY.md
diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py
index 8b7d0a2..aade2e1 100644
--- a/ultralytics/__init__.py
+++ b/ultralytics/__init__.py
@@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
-__version__ = '8.0.78'
+__version__ = '8.0.79'
from ultralytics.hub import start
from ultralytics.yolo.engine.model import YOLO
diff --git a/ultralytics/hub/auth.py b/ultralytics/hub/auth.py
index d8a37b6..960b3dc 100644
--- a/ultralytics/hub/auth.py
+++ b/ultralytics/hub/auth.py
@@ -111,7 +111,7 @@ class Auth:
Get the authentication header for making API requests.
Returns:
- dict: The authentication header if id_token or API key is set, None otherwise.
+ (dict): The authentication header if id_token or API key is set, None otherwise.
"""
if self.id_token:
return {'authorization': f'Bearer {self.id_token}'}
diff --git a/ultralytics/hub/utils.py b/ultralytics/hub/utils.py
index a1b65aa..bf1eb27 100644
--- a/ultralytics/hub/utils.py
+++ b/ultralytics/hub/utils.py
@@ -30,7 +30,7 @@ def check_dataset_disk_space(url='https://ultralytics.com/assets/coco128.zip', s
sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
Returns:
- bool: True if there is sufficient disk space, False otherwise.
+ (bool): True if there is sufficient disk space, False otherwise.
"""
gib = 1 << 30 # bytes per GiB
data = int(requests.head(url).headers['Content-Length']) / gib # dataset size (GB)
@@ -51,7 +51,7 @@ def request_with_credentials(url: str) -> any:
url (str): The URL to make the request to.
Returns:
- any: The response data from the AJAX request.
+ (any): The response data from the AJAX request.
Raises:
OSError: If the function is not run in a Google Colab environment.
@@ -87,11 +87,14 @@ def requests_with_progress(method, url, **kwargs):
Args:
method (str): The HTTP method to use (e.g. 'GET', 'POST').
url (str): The URL to send the request to.
- progress (bool, optional): Whether to display a progress bar. Defaults to False.
- **kwargs: Additional keyword arguments to pass to the underlying `requests.request` function.
+ **kwargs (dict): Additional keyword arguments to pass to the underlying `requests.request` function.
Returns:
- requests.Response: The response from the HTTP request.
+ (requests.Response): The response object from the HTTP request.
+
+ Note:
+ If 'progress' is set to True, the progress bar will display the download progress
+ for responses with a known content length.
"""
progress = kwargs.pop('progress', False)
if not progress:
@@ -118,10 +121,10 @@ def smart_request(method, url, retry=3, timeout=30, thread=True, code=-1, verbos
code (int, optional): An identifier for the request, used for logging purposes. Default is -1.
verbose (bool, optional): A flag to determine whether to print out to console or not. Default is True.
progress (bool, optional): Whether to show a progress bar during the request. Default is False.
- **kwargs: Keyword arguments to be passed to the requests function specified in method.
+ **kwargs (dict): Keyword arguments to be passed to the requests function specified in method.
Returns:
- requests.Response: The HTTP response object. If the request is executed in a separate thread, returns None.
+ (requests.Response): The HTTP response object. If the request is executed in a separate thread, returns None.
"""
retry_codes = (408, 500) # retry only these codes
diff --git a/ultralytics/nn/tasks.py b/ultralytics/nn/tasks.py
index d637f3b..847f755 100644
--- a/ultralytics/nn/tasks.py
+++ b/ultralytics/nn/tasks.py
@@ -337,7 +337,7 @@ def torch_safe_load(weight):
weight (str): The file path of the PyTorch model.
Returns:
- The loaded PyTorch model.
+ (dict): The loaded PyTorch model.
"""
from ultralytics.yolo.utils.downloads import attempt_download_asset
@@ -398,7 +398,7 @@ def attempt_load_weights(weights, device=None, inplace=True, fuse=False):
for k in 'names', 'nc', 'yaml':
setattr(ensemble, k, getattr(ensemble[0], k))
ensemble.stride = ensemble[torch.argmax(torch.tensor([m.stride.max() for m in ensemble])).int()].stride
- assert all(ensemble[0].nc == m.nc for m in ensemble), f'Models differ in class counts: {[m.nc for m in ensemble]}'
+ assert all(ensemble[0].nc == m.nc for m in ensemble), f'Models differ in class counts {[m.nc for m in ensemble]}'
return ensemble
@@ -520,7 +520,7 @@ def guess_model_scale(model_path):
which is denoted by n, s, m, l, or x. The function returns the size character of the model scale as a string.
Args:
- model_path (str or Path): The path to the YOLO model's YAML file.
+ model_path (str) or (Path): The path to the YOLO model's YAML file.
Returns:
(str): The size character of the model's scale, which can be n, s, m, l, or x.
@@ -539,7 +539,7 @@ def guess_model_task(model):
model (nn.Module) or (dict): PyTorch model or model configuration in YAML format.
Returns:
- str: Task of the model ('detect', 'segment', 'classify', 'pose').
+ (str): Task of the model ('detect', 'segment', 'classify', 'pose').
Raises:
SyntaxError: If the task of the model could not be determined.
diff --git a/ultralytics/tracker/utils/matching.py b/ultralytics/tracker/utils/matching.py
index b04777e..72682e1 100644
--- a/ultralytics/tracker/utils/matching.py
+++ b/ultralytics/tracker/utils/matching.py
@@ -190,11 +190,24 @@ def fuse_score(cost_matrix, detections):
def bbox_ious(box1, box2, eps=1e-7):
- """Boxes are x1y1x2y2
- box1: np.array of shape(nx4)
- box2: np.array of shape(mx4)
- returns: np.array of shape(nxm)
"""
+ Calculate the Intersection over Union (IoU) between pairs of bounding boxes.
+
+ Args:
+ box1 (np.array): A numpy array of shape (n, 4) representing 'n' bounding boxes.
+ Each row is in the format (x1, y1, x2, y2).
+ box2 (np.array): A numpy array of shape (m, 4) representing 'm' bounding boxes.
+ Each row is in the format (x1, y1, x2, y2).
+ eps (float, optional): A small constant to prevent division by zero. Defaults to 1e-7.
+
+ Returns:
+ (np.array): A numpy array of shape (n, m) representing the IoU scores for each pair
+ of bounding boxes from box1 and box2.
+
+ Note:
+ The bounding box coordinates are expected to be in the format (x1, y1, x2, y2).
+ """
+
# Get the coordinates of bounding boxes
b1_x1, b1_y1, b1_x2, b1_y2 = box1.T
b2_x1, b2_y1, b2_x2, b2_y2 = box2.T
diff --git a/ultralytics/yolo/data/augment.py b/ultralytics/yolo/data/augment.py
index 529775d..8acc951 100644
--- a/ultralytics/yolo/data/augment.py
+++ b/ultralytics/yolo/data/augment.py
@@ -262,13 +262,15 @@ class RandomPerspective:
return img, M, s
def apply_bboxes(self, bboxes, M):
- """apply affine to bboxes only.
+ """
+ Apply affine to bboxes only.
Args:
- bboxes(ndarray): list of bboxes, xyxy format, with shape (num_bboxes, 4).
- M(ndarray): affine matrix.
+ bboxes (ndarray): list of bboxes, xyxy format, with shape (num_bboxes, 4).
+ M (ndarray): affine matrix.
+
Returns:
- new_bboxes(ndarray): bboxes after affine, [num_bboxes, 4].
+ new_bboxes (ndarray): bboxes after affine, [num_bboxes, 4].
"""
n = len(bboxes)
if n == 0:
@@ -285,14 +287,16 @@ class RandomPerspective:
return np.concatenate((x.min(1), y.min(1), x.max(1), y.max(1)), dtype=bboxes.dtype).reshape(4, n).T
def apply_segments(self, segments, M):
- """apply affine to segments and generate new bboxes from segments.
+ """
+ Apply affine to segments and generate new bboxes from segments.
Args:
- segments(ndarray): list of segments, [num_samples, 500, 2].
- M(ndarray): affine matrix.
+ segments (ndarray): list of segments, [num_samples, 500, 2].
+ M (ndarray): affine matrix.
+
Returns:
- new_segments(ndarray): list of segments after affine, [num_samples, 500, 2].
- new_bboxes(ndarray): bboxes after affine, [N, 4].
+ new_segments (ndarray): list of segments after affine, [num_samples, 500, 2].
+ new_bboxes (ndarray): bboxes after affine, [N, 4].
"""
n, num = segments.shape[:2]
if n == 0:
@@ -308,13 +312,15 @@ class RandomPerspective:
return bboxes, segments
def apply_keypoints(self, keypoints, M):
- """apply affine to keypoints.
+ """
+ Apply affine to keypoints.
Args:
- keypoints(ndarray): keypoints, [N, 17, 3].
- M(ndarray): affine matrix.
+ keypoints (ndarray): keypoints, [N, 17, 3].
+ M (ndarray): affine matrix.
+
Return:
- new_keypoints(ndarray): keypoints after affine, [N, 17, 3].
+ new_keypoints (ndarray): keypoints after affine, [N, 17, 3].
"""
n, nkpt = keypoints.shape[:2]
if n == 0:
@@ -333,7 +339,7 @@ class RandomPerspective:
Affine images and targets.
Args:
- labels(Dict): a dict of `bboxes`, `segments`, `keypoints`.
+ labels (dict): a dict of `bboxes`, `segments`, `keypoints`.
"""
if self.pre_transform and 'mosaic_border' not in labels:
labels = self.pre_transform(labels)
diff --git a/ultralytics/yolo/data/base.py b/ultralytics/yolo/data/base.py
index 96e82b4..5b00e56 100644
--- a/ultralytics/yolo/data/base.py
+++ b/ultralytics/yolo/data/base.py
@@ -18,11 +18,30 @@ from .utils import HELP_URL, IMG_FORMATS
class BaseDataset(Dataset):
- """Base Dataset.
+ """
+ Base dataset class for loading and processing image data.
+
Args:
- img_path (str): image path.
- pipeline (dict): a dict of image transforms.
- label_path (str): label path, this can also be an ann_file or other custom label path.
+ img_path (str): Image path.
+ imgsz (int): Target image size for resizing. Default is 640.
+ cache (bool): Cache images in memory or on disk for faster loading. Default is False.
+ augment (bool): Apply data augmentation. Default is True.
+ hyp (dict): Dictionary of hyperparameters for data augmentation. Default is None.
+ prefix (str): Prefix for file paths. Default is an empty string.
+ rect (bool): Enable rectangular training. Default is False.
+ batch_size (int): Batch size for rectangular training. Default is None.
+ stride (int): Stride for rectangular training. Default is 32.
+ pad (float): Padding for rectangular training. Default is 0.5.
+ single_cls (bool): Use a single class for all labels. Default is False.
+ classes (list): List of included classes. Default is None.
+
+ Attributes:
+ im_files (list): List of image file paths.
+ labels (list): List of label data dictionaries.
+ ni (int): Number of images in the dataset.
+ ims (list): List of loaded images.
+ npy_files (list): List of numpy file paths.
+ transforms (callable): Image transformation function.
"""
def __init__(self,
diff --git a/ultralytics/yolo/data/build.py b/ultralytics/yolo/data/build.py
index e8d7403..7817466 100644
--- a/ultralytics/yolo/data/build.py
+++ b/ultralytics/yolo/data/build.py
@@ -21,10 +21,7 @@ from .utils import PIN_MEMORY
class InfiniteDataLoader(dataloader.DataLoader):
- """Dataloader that reuses workers
-
- Uses same syntax as vanilla DataLoader
- """
+ """Dataloader that reuses workers. Uses same syntax as vanilla DataLoader."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -40,10 +37,11 @@ class InfiniteDataLoader(dataloader.DataLoader):
class _RepeatSampler:
- """Sampler that repeats forever
+ """
+ Sampler that repeats forever.
Args:
- sampler (Sampler)
+ sampler (Dataset.sampler): The sampler to repeat.
"""
def __init__(self, sampler):
@@ -173,7 +171,7 @@ def load_inference_source(source=None, transforms=None, imgsz=640, vid_stride=1,
auto (bool, optional): Automatically apply pre-processing. Default is True.
Returns:
- dataset: A dataset object for the specified input source.
+ dataset (Dataset): A dataset object for the specified input source.
"""
source, webcam, screenshot, from_img, in_memory, tensor = check_source(source)
source_type = source.source_type if in_memory else SourceTypes(webcam, screenshot, from_img, tensor)
diff --git a/ultralytics/yolo/data/dataloaders/v5loader.py b/ultralytics/yolo/data/dataloaders/v5loader.py
index e5774f3..71b5cf2 100644
--- a/ultralytics/yolo/data/dataloaders/v5loader.py
+++ b/ultralytics/yolo/data/dataloaders/v5loader.py
@@ -178,7 +178,7 @@ class _RepeatSampler:
""" Sampler that repeats forever
Args:
- sampler (Sampler)
+ sampler (Dataset.sampler): The sampler to repeat.
"""
def __init__(self, sampler):
diff --git a/ultralytics/yolo/data/dataset.py b/ultralytics/yolo/data/dataset.py
index c8c682d..3946e06 100644
--- a/ultralytics/yolo/data/dataset.py
+++ b/ultralytics/yolo/data/dataset.py
@@ -17,31 +17,31 @@ from .utils import HELP_URL, LOGGER, get_hash, img2label_paths, verify_image_lab
class YOLODataset(BaseDataset):
- cache_version = '1.0.2' # dataset labels *.cache version, >= 1.0.0 for YOLOv8
- rand_interp_methods = [cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS4]
"""
- Dataset class for loading images object detection and/or segmentation labels in YOLO format.
+ Dataset class for loading object detection and/or segmentation labels in YOLO format.
Args:
- img_path (str): path to the folder containing images.
- imgsz (int): image size (default: 640).
- cache (bool): if True, a cache file of the labels is created to speed up future creation of dataset instances
- (default: False).
- augment (bool): if True, data augmentation is applied (default: True).
- hyp (dict): hyperparameters to apply data augmentation (default: None).
- prefix (str): prefix to print in log messages (default: '').
- rect (bool): if True, rectangular training is used (default: False).
- batch_size (int): size of batches (default: None).
- stride (int): stride (default: 32).
- pad (float): padding (default: 0.0).
- single_cls (bool): if True, single class training is used (default: False).
- use_segments (bool): if True, segmentation masks are used as labels (default: False).
- use_keypoints (bool): if True, keypoints are used as labels (default: False).
- names (dict): A dictionary of class names. (default: None).
+ img_path (str): Path to the folder containing images.
+ imgsz (int, optional): Image size. Defaults to 640.
+ cache (bool, optional): Cache images to RAM or disk during training. Defaults to False.
+ augment (bool, optional): If True, data augmentation is applied. Defaults to True.
+ hyp (dict, optional): Hyperparameters to apply data augmentation. Defaults to None.
+ prefix (str, optional): Prefix to print in log messages. Defaults to ''.
+ rect (bool, optional): If True, rectangular training is used. Defaults to False.
+ batch_size (int, optional): Size of batches. Defaults to None.
+ stride (int, optional): Stride. Defaults to 32.
+ pad (float, optional): Padding. Defaults to 0.0.
+ single_cls (bool, optional): If True, single class training is used. Defaults to False.
+ use_segments (bool, optional): If True, segmentation masks are used as labels. Defaults to False.
+ use_keypoints (bool, optional): If True, keypoints are used as labels. Defaults to False.
+ data (dict, optional): A dataset YAML dictionary. Defaults to None.
+ classes (list): List of included classes. Default is None.
Returns:
- A PyTorch dataset object that can be used for training an object detection or segmentation model.
+ (torch.utils.data.Dataset): A PyTorch dataset object that can be used for training an object detection model.
"""
+ cache_version = '1.0.2' # dataset labels *.cache version, >= 1.0.0 for YOLOv8
+ rand_interp_methods = [cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS4]
def __init__(self,
img_path,
diff --git a/ultralytics/yolo/data/dataset_wrappers.py b/ultralytics/yolo/data/dataset_wrappers.py
index 666de66..9b707dd 100644
--- a/ultralytics/yolo/data/dataset_wrappers.py
+++ b/ultralytics/yolo/data/dataset_wrappers.py
@@ -7,21 +7,36 @@ from .augment import LetterBox
class MixAndRectDataset:
- """A wrapper of multiple images mixed dataset.
+ """
+ A dataset class that applies mosaic and mixup transformations as well as rectangular training.
- Args:
- dataset (:obj:`BaseDataset`): The dataset to be mixed.
- transforms (Sequence[dict]): config dict to be composed.
+ Attributes:
+ dataset: The base dataset.
+ imgsz: The size of the images in the dataset.
"""
def __init__(self, dataset):
+ """
+ Args:
+ dataset (BaseDataset): The base dataset to apply transformations to.
+ """
self.dataset = dataset
self.imgsz = dataset.imgsz
def __len__(self):
+ """Returns the number of items in the dataset."""
return len(self.dataset)
def __getitem__(self, index):
+ """
+ Applies mosaic, mixup and rectangular training transformations to an item in the dataset.
+
+ Args:
+ index (int): Index of the item in the dataset.
+
+ Returns:
+ (dict): A dictionary containing the transformed item data.
+ """
labels = deepcopy(self.dataset[index])
for transform in self.dataset.transforms.tolist():
# mosaic and mixup
diff --git a/ultralytics/yolo/data/utils.py b/ultralytics/yolo/data/utils.py
index aacd042..c234060 100644
--- a/ultralytics/yolo/data/utils.py
+++ b/ultralytics/yolo/data/utils.py
@@ -270,9 +270,8 @@ def check_cls_dataset(dataset: str):
"""
Check a classification dataset such as Imagenet.
- Copy code
This function takes a `dataset` name as input and returns a dictionary containing information about the dataset.
- If the dataset is not found, it attempts to download the dataset from the internet and save it to the local file system.
+ If the dataset is not found, it attempts to download the dataset from the internet and save it locally.
Args:
dataset (str): Name of the dataset.
@@ -306,7 +305,8 @@ def check_cls_dataset(dataset: str):
class HUBDatasetStats():
- """ Class for generating HUB dataset JSON and `-hub` dataset directory
+ """
+ Class for generating HUB dataset JSON and `-hub` dataset directory
Arguments
path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
@@ -427,9 +427,6 @@ def compress_one_image(f, f_new=None, max_dim=1920, quality=50):
max_dim (int, optional): The maximum dimension (width or height) of the output image. Default is 1920 pixels.
quality (int, optional): The image compression quality as a percentage. Default is 50%.
- Returns:
- None
-
Usage:
from pathlib import Path
from ultralytics.yolo.data.utils import compress_one_image
@@ -459,9 +456,6 @@ def delete_dsstore(path):
Args:
path (str, optional): The directory path where the ".DS_store" files should be deleted.
- Returns:
- None
-
Usage:
from ultralytics.yolo.data.utils import delete_dsstore
delete_dsstore('/Users/glennjocher/Downloads/dataset')
@@ -478,15 +472,13 @@ def delete_dsstore(path):
def zip_directory(dir, use_zipfile_library=True):
- """Zips a directory and saves the archive to the specified output path.
+ """
+ Zips a directory and saves the archive to the specified output path.
Args:
dir (str): The path to the directory to be zipped.
use_zipfile_library (bool): Whether to use zipfile library or shutil for zipping.
- Returns:
- None
-
Usage:
from ultralytics.yolo.data.utils import zip_directory
zip_directory('/Users/glennjocher/Downloads/playground')
diff --git a/ultralytics/yolo/engine/exporter.py b/ultralytics/yolo/engine/exporter.py
index 9be685f..33947f5 100644
--- a/ultralytics/yolo/engine/exporter.py
+++ b/ultralytics/yolo/engine/exporter.py
@@ -73,7 +73,7 @@ ARM64 = platform.machine() in ('arm64', 'aarch64')
def export_formats():
- # YOLOv8 export formats
+ """YOLOv8 export formats"""
import pandas
x = [
['PyTorch', '-', '.pt', True, True],
@@ -92,7 +92,7 @@ def export_formats():
def gd_outputs(gd):
- # TensorFlow GraphDef model output node names
+ """TensorFlow GraphDef model output node names"""
name_list, input_list = [], []
for node in gd.node: # tensorflow.core.framework.node_def_pb2.NodeDef
name_list.append(node.name)
@@ -101,7 +101,7 @@ def gd_outputs(gd):
def try_export(inner_func):
- # YOLOv8 export decorator, i..e @try_export
+ """YOLOv8 export decorator, i..e @try_export"""
inner_args = get_default_args(inner_func)
def outer_func(*args, **kwargs):
@@ -118,10 +118,26 @@ def try_export(inner_func):
return outer_func
+class iOSDetectModel(torch.nn.Module):
+ """Wrap an Ultralytics YOLO model for iOS export"""
+
+ def __init__(self, model, im):
+ super().__init__()
+ b, c, h, w = im.shape # batch, channel, height, width
+ self.model = model
+ self.nc = len(model.names) # number of classes
+ if w == h:
+ self.normalize = 1.0 / w # scalar
+ else:
+ self.normalize = torch.tensor([1.0 / w, 1.0 / h, 1.0 / w, 1.0 / h]) # broadcast (slower, smaller)
+
+ def forward(self, x):
+ xywh, cls = self.model(x)[0].transpose(0, 1).split((4, self.nc), 1)
+ return cls, xywh * self.normalize # confidence (3780, 80), coordinates (3780, 4)
+
+
class Exporter:
"""
- Exporter
-
A class for exporting a model.
Attributes:
@@ -136,6 +152,7 @@ class Exporter:
Args:
cfg (str, optional): Path to a configuration file. Defaults to DEFAULT_CFG.
overrides (dict, optional): Configuration overrides. Defaults to None.
+ _callbacks (list, optional): List of callback functions. Defaults to None.
"""
self.args = get_cfg(cfg, overrides)
self.callbacks = _callbacks or callbacks.get_default_callbacks()
@@ -385,22 +402,6 @@ class Exporter:
check_requirements('coremltools>=6.0')
import coremltools as ct # noqa
- class iOSDetectModel(torch.nn.Module):
- # Wrap an Ultralytics YOLO model for iOS export
- def __init__(self, model, im):
- super().__init__()
- b, c, h, w = im.shape # batch, channel, height, width
- self.model = model
- self.nc = len(model.names) # number of classes
- if w == h:
- self.normalize = 1.0 / w # scalar
- else:
- self.normalize = torch.tensor([1.0 / w, 1.0 / h, 1.0 / w, 1.0 / h]) # broadcast (slower, smaller)
-
- def forward(self, x):
- xywh, cls = self.model(x)[0].transpose(0, 1).split((4, self.nc), 1)
- return cls, xywh * self.normalize # confidence (3780, 80), coordinates (3780, 4)
-
LOGGER.info(f'\n{prefix} starting export with coremltools {ct.__version__}...')
f = self.file.with_suffix('.mlmodel')
diff --git a/ultralytics/yolo/engine/model.py b/ultralytics/yolo/engine/model.py
index d9b17be..329075e 100644
--- a/ultralytics/yolo/engine/model.py
+++ b/ultralytics/yolo/engine/model.py
@@ -400,7 +400,7 @@ class YOLO:
train_args (dict, optional): Additional arguments to pass to the `train()` method. Defaults to {}.
Returns:
- A dictionary containing the results of the hyperparameter search.
+ (dict): A dictionary containing the results of the hyperparameter search.
Raises:
ModuleNotFoundError: If Ray Tune is not installed.
diff --git a/ultralytics/yolo/engine/predictor.py b/ultralytics/yolo/engine/predictor.py
index f7f01c1..75eb7d9 100644
--- a/ultralytics/yolo/engine/predictor.py
+++ b/ultralytics/yolo/engine/predictor.py
@@ -127,7 +127,10 @@ class BasePredictor:
log_string += result.verbose()
if self.args.save or self.args.show: # Add bbox to image
- plot_args = dict(line_width=self.args.line_thickness, boxes=self.args.boxes)
+ plot_args = dict(line_width=self.args.line_thickness,
+ boxes=self.args.boxes,
+ conf=self.args.show_conf,
+ labels=self.args.show_labels)
if not self.args.retina_masks:
plot_args['im_gpu'] = im[idx]
self.plotted_img = result.plot(**plot_args)
diff --git a/ultralytics/yolo/engine/trainer.py b/ultralytics/yolo/engine/trainer.py
index bb30419..576c06c 100644
--- a/ultralytics/yolo/engine/trainer.py
+++ b/ultralytics/yolo/engine/trainer.py
@@ -621,7 +621,7 @@ def check_amp(model):
model (nn.Module): A YOLOv8 model instance.
Returns:
- bool: Returns True if the AMP functionality works correctly with YOLOv8 model, else False.
+ (bool): Returns True if the AMP functionality works correctly with YOLOv8 model, else False.
Raises:
AssertionError: If the AMP checks fail, indicating anomalies with the AMP functionality on the system.
diff --git a/ultralytics/yolo/utils/autobatch.py b/ultralytics/yolo/utils/autobatch.py
index e4c4150..e845579 100644
--- a/ultralytics/yolo/utils/autobatch.py
+++ b/ultralytics/yolo/utils/autobatch.py
@@ -22,7 +22,7 @@ def check_train_batch_size(model, imgsz=640, amp=True):
amp (bool): If True, use automatic mixed precision (AMP) for training.
Returns:
- int: Optimal batch size computed using the autobatch() function.
+ (int): Optimal batch size computed using the autobatch() function.
"""
with torch.cuda.amp.autocast(amp):
@@ -34,13 +34,13 @@ def autobatch(model, imgsz=640, fraction=0.67, batch_size=16):
Automatically estimate the best YOLO batch size to use a fraction of the available CUDA memory.
Args:
- model: YOLO model to compute batch size for.
+ model (torch.nn.module): YOLO model to compute batch size for.
imgsz (int, optional): The image size used as input for the YOLO model. Defaults to 640.
fraction (float, optional): The fraction of available CUDA memory to use. Defaults to 0.67.
batch_size (int, optional): The default batch size to use if an error is detected. Defaults to 16.
Returns:
- int: The optimal batch size.
+ (int): The optimal batch size.
"""
# Check device
diff --git a/ultralytics/yolo/utils/callbacks/clearml.py b/ultralytics/yolo/utils/callbacks/clearml.py
index 777a464..dd0ad6d 100644
--- a/ultralytics/yolo/utils/callbacks/clearml.py
+++ b/ultralytics/yolo/utils/callbacks/clearml.py
@@ -19,14 +19,14 @@ except (ImportError, AssertionError):
clearml = None
-def _log_debug_samples(files, title='Debug Samples'):
+def _log_debug_samples(files, title='Debug Samples') -> None:
"""
- Log files (images) as debug samples in the ClearML task.
+ Log files (images) as debug samples in the ClearML task.
- arguments:
- files (List(PosixPath)) a list of file paths in PosixPath format
- title (str) A title that groups together images with the same values
- """
+ Args:
+ files (list): A list of file paths in PosixPath format.
+ title (str): A title that groups together images with the same values.
+ """
task = Task.current_task()
if task:
for f in files:
@@ -39,20 +39,23 @@ def _log_debug_samples(files, title='Debug Samples'):
iteration=iteration)
-def _log_plot(title, plot_path):
+def _log_plot(title, plot_path) -> None:
"""
- Log image as plot in the plot section of ClearML
+ Log an image as a plot in the plot section of ClearML.
- arguments:
- title (str) Title of the plot
- plot_path (PosixPath or str) Path to the saved image file
- """
+ Args:
+ title (str): The title of the plot.
+ plot_path (str): The path to the saved image file.
+ """
img = mpimg.imread(plot_path)
fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1], frameon=False, aspect='auto', xticks=[], yticks=[]) # no ticks
ax.imshow(img)
- Task.current_task().get_logger().report_matplotlib_figure(title, '', figure=fig, report_interactive=False)
+ Task.current_task().get_logger().report_matplotlib_figure(title=title,
+ series='',
+ figure=fig,
+ report_interactive=False)
def on_pretrain_routine_start(trainer):
diff --git a/ultralytics/yolo/utils/checks.py b/ultralytics/yolo/utils/checks.py
index 5f67d2f..ba2f0d9 100644
--- a/ultralytics/yolo/utils/checks.py
+++ b/ultralytics/yolo/utils/checks.py
@@ -47,13 +47,13 @@ def check_imgsz(imgsz, stride=32, min_dim=1, max_dim=2, floor=0):
stride, update it to the nearest multiple of the stride that is greater than or equal to the given floor value.
Args:
- imgsz (int or List[int]): Image size.
+ imgsz (int) or (cList[int]): Image size.
stride (int): Stride value.
min_dim (int): Minimum number of dimensions.
floor (int): Minimum allowed value for image size.
Returns:
- List[int]: Updated image size.
+ (List[int]): Updated image size.
"""
# Convert stride to integer if it is a tensor
stride = int(stride.max() if isinstance(stride, torch.Tensor) else stride)
@@ -106,7 +106,7 @@ def check_version(current: str = '0.0.0',
verbose (bool): If True, print warning message if minimum version is not met.
Returns:
- bool: True if minimum version is met, False otherwise.
+ (bool): True if minimum version is met, False otherwise.
"""
current, minimum = (pkg.parse_version(x) for x in (current, minimum))
result = (current == minimum) if pinned else (current >= minimum) # bool
@@ -126,7 +126,7 @@ def check_latest_pypi_version(package_name='ultralytics'):
package_name (str): The name of the package to find the latest version for.
Returns:
- str: The latest version of the package.
+ (str): The latest version of the package.
"""
requests.packages.urllib3.disable_warnings() # Disable the InsecureRequestWarning
response = requests.get(f'https://pypi.org/pypi/{package_name}/json', verify=False)
@@ -140,7 +140,7 @@ def check_pip_update_available():
Checks if a new version of the ultralytics package is available on PyPI.
Returns:
- bool: True if an update is available, False otherwise.
+ (bool): True if an update is available, False otherwise.
"""
if ONLINE and is_pip_package():
with contextlib.suppress(Exception):
@@ -206,9 +206,6 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=()
exclude (Tuple[str]): Tuple of package names to exclude from checking.
install (bool): If True, attempt to auto-update packages that don't meet requirements.
cmds (str): Additional commands to pass to the pip install command when auto-updating.
-
- Returns:
- None
"""
prefix = colorstr('red', 'bold', 'requirements:')
check_python() # check python version
diff --git a/ultralytics/yolo/utils/downloads.py b/ultralytics/yolo/utils/downloads.py
index a076629..baab806 100644
--- a/ultralytics/yolo/utils/downloads.py
+++ b/ultralytics/yolo/utils/downloads.py
@@ -67,21 +67,21 @@ def safe_download(url,
min_bytes=1E0,
progress=True):
"""
- Function for downloading files from a URL, with options for retrying, unzipping, and deleting the downloaded file.
+ Downloads files from a URL, with options for retrying, unzipping, and deleting the downloaded file.
Args:
- url: str: The URL of the file to be downloaded.
- file: str, optional: The filename of the downloaded file.
+ url (str): The URL of the file to be downloaded.
+ file (str, optional): The filename of the downloaded file.
If not provided, the file will be saved with the same name as the URL.
- dir: str, optional: The directory to save the downloaded file.
+ dir (str, optional): The directory to save the downloaded file.
If not provided, the file will be saved in the current working directory.
- unzip: bool, optional: Whether to unzip the downloaded file. Default: True.
- delete: bool, optional: Whether to delete the downloaded file after unzipping. Default: False.
- curl: bool, optional: Whether to use curl command line tool for downloading. Default: False.
- retry: int, optional: The number of times to retry the download in case of failure. Default: 3.
- min_bytes: float, optional: The minimum number of bytes that the downloaded file should have, to be considered
+ unzip (bool, optional): Whether to unzip the downloaded file. Default: True.
+ delete (bool, optional): Whether to delete the downloaded file after unzipping. Default: False.
+ curl (bool, optional): Whether to use curl command line tool for downloading. Default: False.
+ retry (int, optional): The number of times to retry the download in case of failure. Default: 3.
+ min_bytes (float, optional): The minimum number of bytes that the downloaded file should have, to be considered
a successful download. Default: 1E0.
- progress: bool, optional: Whether to display a progress bar during the download. Default: True.
+ progress (bool, optional): Whether to display a progress bar during the download. Default: True.
"""
if '://' not in str(url) and Path(url).is_file(): # exists ('://' check required in Windows Python<3.10)
f = Path(url) # filename
diff --git a/ultralytics/yolo/utils/files.py b/ultralytics/yolo/utils/files.py
index 8b38af9..6add24b 100644
--- a/ultralytics/yolo/utils/files.py
+++ b/ultralytics/yolo/utils/files.py
@@ -30,13 +30,13 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
directory if it does not already exist.
Args:
- path (str or pathlib.Path): Path to increment.
- exist_ok (bool, optional): If True, the path will not be incremented and will be returned as-is. Defaults to False.
- sep (str, optional): Separator to use between the path and the incrementation number. Defaults to an empty string.
- mkdir (bool, optional): If True, the path will be created as a directory if it does not exist. Defaults to False.
+ path (str, pathlib.Path): Path to increment.
+ exist_ok (bool, optional): If True, the path will not be incremented and returned as-is. Defaults to False.
+ sep (str, optional): Separator to use between the path and the incrementation number. Defaults to ''.
+ mkdir (bool, optional): Create a directory if it does not exist. Defaults to False.
Returns:
- pathlib.Path: Incremented path.
+ (pathlib.Path): Incremented path.
"""
path = Path(path) # os-agnostic
if path.exists() and not exist_ok:
diff --git a/ultralytics/yolo/utils/instance.py b/ultralytics/yolo/utils/instance.py
index e675ce2..f0c6a2e 100644
--- a/ultralytics/yolo/utils/instance.py
+++ b/ultralytics/yolo/utils/instance.py
@@ -98,7 +98,7 @@ class Bboxes:
def mul(self, scale):
"""
Args:
- scale (tuple | List | int): the scale for four coords.
+ scale (tuple) or (list) or (int): the scale for four coords.
"""
if isinstance(scale, Number):
scale = to_4tuple(scale)
@@ -112,7 +112,7 @@ class Bboxes:
def add(self, offset):
"""
Args:
- offset (tuple | List | int): the offset for four coords.
+ offset (tuple) or (list) or (int): the offset for four coords.
"""
if isinstance(offset, Number):
offset = to_4tuple(offset)
@@ -129,13 +129,18 @@ class Bboxes:
@classmethod
def concatenate(cls, boxes_list: List['Bboxes'], axis=0) -> 'Bboxes':
"""
- Concatenates a list of Boxes into a single Bboxes
+ Concatenate a list of Bboxes objects into a single Bboxes object.
- Arguments:
- boxes_list (list[Bboxes])
+ Args:
+ boxes_list (List[Bboxes]): A list of Bboxes objects to concatenate.
+ axis (int, optional): The axis along which to concatenate the bounding boxes.
+ Defaults to 0.
Returns:
- Bboxes: the concatenated Boxes
+ Bboxes: A new Bboxes object containing the concatenated bounding boxes.
+
+ Note:
+ The input should be a list or tuple of Bboxes objects.
"""
assert isinstance(boxes_list, (list, tuple))
if not boxes_list:
@@ -148,11 +153,21 @@ class Bboxes:
def __getitem__(self, index) -> 'Bboxes':
"""
+ Retrieve a specific bounding box or a set of bounding boxes using indexing.
+
Args:
- index: int, slice, or a BoolArray
+ index (int, slice, or np.ndarray): The index, slice, or boolean array to select
+ the desired bounding boxes.
Returns:
- Bboxes: Create a new :class:`Bboxes` by indexing.
+ Bboxes: A new Bboxes object containing the selected bounding boxes.
+
+ Raises:
+ AssertionError: If the indexed bounding boxes do not form a 2-dimensional matrix.
+
+ Note:
+ When using boolean indexing, make sure to provide a boolean array with the same
+ length as the number of bounding boxes.
"""
if isinstance(index, int):
return Bboxes(self.bboxes[index].view(1, -1))
@@ -236,11 +251,19 @@ class Instances:
def __getitem__(self, index) -> 'Instances':
"""
+ Retrieve a specific instance or a set of instances using indexing.
+
Args:
- index: int, slice, or a BoolArray
+ index (int, slice, or np.ndarray): The index, slice, or boolean array to select
+ the desired instances.
Returns:
- Instances: Create a new :class:`Instances` by indexing.
+ Instances: A new Instances object containing the selected bounding boxes,
+ segments, and keypoints if present.
+
+ Note:
+ When using boolean indexing, make sure to provide a boolean array with the same
+ length as the number of instances.
"""
segments = self.segments[index] if len(self.segments) else self.segments
keypoints = self.keypoints[index] if self.keypoints is not None else None
@@ -305,14 +328,20 @@ class Instances:
@classmethod
def concatenate(cls, instances_list: List['Instances'], axis=0) -> 'Instances':
"""
- Concatenates a list of Boxes into a single Bboxes
+ Concatenates a list of Instances objects into a single Instances object.
- Arguments:
- instances_list (list[Bboxes])
- axis
+ Args:
+ instances_list (List[Instances]): A list of Instances objects to concatenate.
+ axis (int, optional): The axis along which the arrays will be concatenated. Defaults to 0.
Returns:
- Boxes: the concatenated Boxes
+ Instances: A new Instances object containing the concatenated bounding boxes,
+ segments, and keypoints if present.
+
+ Note:
+ The `Instances` objects in the list should have the same properties, such as
+ the format of the bounding boxes, whether keypoints are present, and if the
+ coordinates are normalized.
"""
assert isinstance(instances_list, (list, tuple))
if not instances_list:
diff --git a/ultralytics/yolo/utils/metrics.py b/ultralytics/yolo/utils/metrics.py
index 24c5c88..88ce45f 100644
--- a/ultralytics/yolo/utils/metrics.py
+++ b/ultralytics/yolo/utils/metrics.py
@@ -23,10 +23,16 @@ def box_area(box):
def bbox_ioa(box1, box2, eps=1e-7):
- """Returns the intersection over box2 area given box1, box2. Boxes are x1y1x2y2
- box1: np.array of shape(nx4)
- box2: np.array of shape(mx4)
- returns: np.array of shape(nxm)
+ """
+ Calculate the intersection over box2 area given box1 and box2. Boxes are in x1y1x2y2 format.
+
+ Args:
+ box1 (np.array): A numpy array of shape (n, 4) representing n bounding boxes.
+ box2 (np.array): A numpy array of shape (m, 4) representing m bounding boxes.
+ eps (float, optional): A small value to avoid division by zero. Defaults to 1e-7.
+
+ Returns:
+ (np.array): A numpy array of shape (n, m) representing the intersection over box2 area.
"""
# Get the coordinates of bounding boxes
@@ -46,17 +52,17 @@ def bbox_ioa(box1, box2, eps=1e-7):
def box_iou(box1, box2, eps=1e-7):
"""
- Return intersection-over-union (Jaccard index) of boxes.
+ Calculate intersection-over-union (IoU) of boxes.
Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
Based on https://github.com/pytorch/vision/blob/master/torchvision/ops/boxes.py
- Arguments:
- box1 (Tensor[N, 4])
- box2 (Tensor[M, 4])
- eps
+ Args:
+ box1 (torch.Tensor): A tensor of shape (N, 4) representing N bounding boxes.
+ box2 (torch.Tensor): A tensor of shape (M, 4) representing M bounding boxes.
+ eps (float, optional): A small value to avoid division by zero. Defaults to 1e-7.
Returns:
- iou (Tensor[N, M]): the NxM matrix containing the pairwise IoU values for every element in boxes1 and boxes2
+ (torch.Tensor): An NxM tensor containing the pairwise IoU values for every element in box1 and box2.
"""
# inter(N,M) = (rb(N,M,2) - lt(N,M,2)).clamp(0).prod(2)
@@ -68,7 +74,22 @@ def box_iou(box1, box2, eps=1e-7):
def bbox_iou(box1, box2, xywh=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-7):
- # Returns Intersection over Union (IoU) of box1(1,4) to box2(n,4)
+ """
+ Calculate Intersection over Union (IoU) of box1(1, 4) to box2(n, 4).
+
+ Args:
+ box1 (torch.Tensor): A tensor representing a single bounding box with shape (1, 4).
+ box2 (torch.Tensor): A tensor representing n bounding boxes with shape (n, 4).
+ xywh (bool, optional): If True, input boxes are in (x, y, w, h) format. If False, input boxes are in
+ (x1, y1, x2, y2) format. Defaults to True.
+ GIoU (bool, optional): If True, calculate Generalized IoU. Defaults to False.
+ DIoU (bool, optional): If True, calculate Distance IoU. Defaults to False.
+ CIoU (bool, optional): If True, calculate Complete IoU. Defaults to False.
+ eps (float, optional): A small value to avoid division by zero. Defaults to 1e-7.
+
+ Returns:
+ (torch.Tensor): IoU, GIoU, DIoU, or CIoU values depending on the specified flags.
+ """
# Get the coordinates of bounding boxes
if xywh: # transform from xywh to xyxy
@@ -110,10 +131,17 @@ def bbox_iou(box1, box2, xywh=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-7
def mask_iou(mask1, mask2, eps=1e-7):
"""
- mask1: [N, n] m1 means number of gt objects
- mask2: [M, n] m2 means number of predicted objects
- Note: n means image_w x image_h
- Returns: masks iou, [N, M]
+ Calculate masks IoU.
+
+ Args:
+ mask1 (torch.Tensor): A tensor of shape (N, n) where N is the number of ground truth objects and n is the
+ product of image width and height.
+ mask2 (torch.Tensor): A tensor of shape (M, n) where M is the number of predicted objects and n is the
+ product of image width and height.
+ eps (float, optional): A small value to avoid division by zero. Defaults to 1e-7.
+
+ Returns:
+ (torch.Tensor): A tensor of shape (N, M) representing masks IoU.
"""
intersection = torch.matmul(mask1, mask2.t()).clamp(0)
union = (mask1.sum(1)[:, None] + mask2.sum(1)[None]) - intersection # (area1 + area2) - intersection
@@ -121,10 +149,18 @@ def mask_iou(mask1, mask2, eps=1e-7):
def kpt_iou(kpt1, kpt2, area, sigma, eps=1e-7):
- """OKS
- kpt1: [N, 17, 3], gt
- kpt2: [M, 17, 3], pred
- area: [N], areas from gt
+ """
+ Calculate Object Keypoint Similarity (OKS).
+
+ Args:
+ kpt1 (torch.Tensor): A tensor of shape (N, 17, 3) representing ground truth keypoints.
+ kpt2 (torch.Tensor): A tensor of shape (M, 17, 3) representing predicted keypoints.
+ area (torch.Tensor): A tensor of shape (N,) representing areas from ground truth.
+ sigma (list): A list containing 17 values representing keypoint scales.
+ eps (float, optional): A small value to avoid division by zero. Defaults to 1e-7.
+
+ Returns:
+ (torch.Tensor): A tensor of shape (N, M) representing keypoint similarities.
"""
d = (kpt1[:, None, :, 0] - kpt2[..., 0]) ** 2 + (kpt1[:, None, :, 1] - kpt2[..., 1]) ** 2 # (N, M, 17)
sigma = torch.tensor(sigma, device=kpt1.device, dtype=kpt1.dtype) # (17, )
@@ -171,7 +207,17 @@ class FocalLoss(nn.Module):
class ConfusionMatrix:
- # Updated version of https://github.com/kaanakan/object_detection_confusion_matrix
+ """
+ A class for calculating and updating a confusion matrix for object detection and classification tasks.
+
+ Attributes:
+ task (str): The type of task, either 'detect' or 'classify'.
+ matrix (np.array): The confusion matrix, with dimensions depending on the task.
+ nc (int): The number of classes.
+ conf (float): The confidence threshold for detections.
+ iou_thres (float): The Intersection over Union threshold.
+ """
+
def __init__(self, nc, conf=0.25, iou_thres=0.45, task='detect'):
self.task = task
self.matrix = np.zeros((nc + 1, nc + 1)) if self.task == 'detect' else np.zeros((nc, nc))
@@ -183,12 +229,9 @@ class ConfusionMatrix:
"""
Update confusion matrix for classification task
- Arguments:
- preds (Array[N, min(nc,5)])
- targets (Array[N, 1])
-
- Returns:
- None, updates confusion matrix accordingly
+ Args:
+ preds (Array[N, min(nc,5)]): Predicted class labels.
+ targets (Array[N, 1]): Ground truth class labels.
"""
preds, targets = torch.cat(preds)[:, 0], torch.cat(targets)
for p, t in zip(preds.cpu().numpy(), targets.cpu().numpy()):
@@ -196,15 +239,13 @@ class ConfusionMatrix:
def process_batch(self, detections, labels):
"""
- Return intersection-over-union (Jaccard index) of boxes.
- Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
+ Update confusion matrix for object detection task.
- Arguments:
- detections (Array[N, 6]), x1, y1, x2, y2, conf, class
- labels (Array[M, 5]), class, x1, y1, x2, y2
-
- Returns:
- None, updates confusion matrix accordingly
+ Args:
+ detections (Array[N, 6]): Detected bounding boxes and their associated information.
+ Each row should contain (x1, y1, x2, y2, conf, class).
+ labels (Array[M, 5]): Ground truth bounding boxes and their associated class labels.
+ Each row should contain (class, x1, y1, x2, y2).
"""
if detections is None:
gt_classes = labels.int()
@@ -254,6 +295,14 @@ class ConfusionMatrix:
@TryExcept('WARNING ⚠️ ConfusionMatrix plot failure')
@plt_settings()
def plot(self, normalize=True, save_dir='', names=()):
+ """
+ Plot the confusion matrix using seaborn and save it to a file.
+
+ Args:
+ normalize (bool): Whether to normalize the confusion matrix.
+ save_dir (str): Directory where the plot will be saved.
+ names (tuple): Names of classes, used as labels on the plot.
+ """
import seaborn as sn
array = self.matrix / ((self.matrix.sum(0).reshape(1, -1) + 1E-9) if normalize else 1) # normalize columns
@@ -284,6 +333,9 @@ class ConfusionMatrix:
plt.close(fig)
def print(self):
+ """
+ Print the confusion matrix to the console.
+ """
for i in range(self.nc + 1):
LOGGER.info(' '.join(map(str, self.matrix[i])))
@@ -343,12 +395,17 @@ def plot_mc_curve(px, py, save_dir=Path('mc_curve.png'), names=(), xlabel='Confi
def compute_ap(recall, precision):
- """ Compute the average precision, given the recall and precision curves
+ """
+ Compute the average precision (AP) given the recall and precision curves.
+
Arguments:
- recall: The recall curve (list)
- precision: The precision curve (list)
+ recall (list): The recall curve.
+ precision (list): The precision curve.
+
Returns:
- Average precision, precision curve, recall curve
+ (float): Average precision.
+ (np.ndarray): Precision envelope curve.
+ (np.ndarray): Modified recall curve with sentinel values added at the beginning and end.
"""
# Append sentinel values to beginning and end
@@ -488,57 +545,71 @@ class Metric(SimpleClass):
@property
def ap50(self):
- """AP@0.5 of all classes.
+ """
+ Returns the Average Precision (AP) at an IoU threshold of 0.5 for all classes.
+
Returns:
- (nc, ) or [].
+ (np.ndarray, list): Array of shape (nc,) with AP50 values per class, or an empty list if not available.
"""
return self.all_ap[:, 0] if len(self.all_ap) else []
@property
def ap(self):
- """AP@0.5:0.95
+ """
+ Returns the Average Precision (AP) at an IoU threshold of 0.5-0.95 for all classes.
+
Returns:
- (nc, ) or [].
+ (np.ndarray, list): Array of shape (nc,) with AP50-95 values per class, or an empty list if not available.
"""
return self.all_ap.mean(1) if len(self.all_ap) else []
@property
def mp(self):
- """mean precision of all classes.
+ """
+ Returns the Mean Precision of all classes.
+
Returns:
- float.
+ (float): The mean precision of all classes.
"""
return self.p.mean() if len(self.p) else 0.0
@property
def mr(self):
- """mean recall of all classes.
+ """
+ Returns the Mean Recall of all classes.
+
Returns:
- float.
+ (float): The mean recall of all classes.
"""
return self.r.mean() if len(self.r) else 0.0
@property
def map50(self):
- """Mean AP@0.5 of all classes.
+ """
+ Returns the mean Average Precision (mAP) at an IoU threshold of 0.5.
+
Returns:
- float.
+ (float): The mAP50 at an IoU threshold of 0.5.
"""
return self.all_ap[:, 0].mean() if len(self.all_ap) else 0.0
@property
def map75(self):
- """Mean AP@0.75 of all classes.
+ """
+ Returns the mean Average Precision (mAP) at an IoU threshold of 0.75.
+
Returns:
- float.
+ (float): The mAP50 at an IoU threshold of 0.75.
"""
return self.all_ap[:, 5].mean() if len(self.all_ap) else 0.0
@property
def map(self):
- """Mean AP@0.5:0.95 of all classes.
+ """
+ Returns the mean Average Precision (mAP) over IoU thresholds of 0.5 - 0.95 in steps of 0.05.
+
Returns:
- float.
+ (float): The mAP over IoU thresholds of 0.5 - 0.95 in steps of 0.05.
"""
return self.all_ap.mean() if len(self.all_ap) else 0.0
@@ -566,7 +637,7 @@ class Metric(SimpleClass):
def update(self, results):
"""
Args:
- results: tuple(p, r, ap, f1, ap_class)
+ results (tuple): A tuple of (p, r, ap, f1, ap_class)
"""
self.p, self.r, self.f1, self.all_ap, self.ap_class_index = results
diff --git a/ultralytics/yolo/utils/ops.py b/ultralytics/yolo/utils/ops.py
index 04fb883..a65043b 100644
--- a/ultralytics/yolo/utils/ops.py
+++ b/ultralytics/yolo/utils/ops.py
@@ -120,10 +120,10 @@ def make_divisible(x, divisor):
Args:
x (int): The number to make divisible.
- divisor (int or torch.Tensor): The divisor.
+ divisor (int) or (torch.Tensor): The divisor.
Returns:
- int: The nearest number divisible by the divisor.
+ (int): The nearest number divisible by the divisor.
"""
if isinstance(divisor, torch.Tensor):
divisor = int(divisor.max()) # to int
diff --git a/ultralytics/yolo/utils/plotting.py b/ultralytics/yolo/utils/plotting.py
index 062f01d..054ffd0 100644
--- a/ultralytics/yolo/utils/plotting.py
+++ b/ultralytics/yolo/utils/plotting.py
@@ -127,7 +127,7 @@ class Annotator:
masks_color = masks * (colors * alpha) # shape(n,h,w,3)
inv_alph_masks = (1 - masks * alpha).cumprod(0) # shape(n,h,w,1)
- mcs = (masks_color * inv_alph_masks).sum(0) * 2 # mask color summand shape(n,h,w,3)
+ mcs = masks_color.max(dim=0).values # shape(n,h,w,3)
im_gpu = im_gpu.flip(dims=[0]) # flip channel
im_gpu = im_gpu.permute(1, 2, 0).contiguous() # shape(h,w,3)
@@ -140,12 +140,16 @@ class Annotator:
self.fromarray(self.im)
def kpts(self, kpts, shape=(640, 640), radius=5, kpt_line=True):
- """Plot keypoints.
+ """Plot keypoints on the image.
+
Args:
- kpts (tensor): predicted kpts, shape: [17, 3]
- shape (tuple): image shape, (h, w)
- steps (int): keypoints step
- radius (int): size of drawing points
+ kpts (tensor): Predicted keypoints with shape [17, 3]. Each keypoint has (x, y, confidence).
+ shape (tuple): Image shape as a tuple (h, w), where h is the height and w is the width.
+ radius (int, optional): Radius of the drawn keypoints. Default is 5.
+ kpt_line (bool, optional): If True, the function will draw lines connecting keypoints
+ for human pose. Default is True.
+
+ Note: `kpt_line=True` currently only supports human pose plotting.
"""
if self.pil:
# convert to numpy first
diff --git a/ultralytics/yolo/utils/tal.py b/ultralytics/yolo/utils/tal.py
index 69cd881..3d020d3 100644
--- a/ultralytics/yolo/utils/tal.py
+++ b/ultralytics/yolo/utils/tal.py
@@ -54,6 +54,19 @@ def select_highest_overlaps(mask_pos, overlaps, n_max_boxes):
class TaskAlignedAssigner(nn.Module):
+ """
+ A task-aligned assigner for object detection.
+
+ This class assigns ground-truth (gt) objects to anchors based on the task-aligned metric,
+ which combines both classification and localization information.
+
+ Attributes:
+ topk (int): The number of top candidates to consider.
+ num_classes (int): The number of object classes.
+ alpha (float): The alpha parameter for the classification component of the task-aligned metric.
+ beta (float): The beta parameter for the localization component of the task-aligned metric.
+ eps (float): A small value to prevent division by zero.
+ """
def __init__(self, topk=13, num_classes=80, alpha=1.0, beta=6.0, eps=1e-9):
super().__init__()
@@ -66,8 +79,9 @@ class TaskAlignedAssigner(nn.Module):
@torch.no_grad()
def forward(self, pd_scores, pd_bboxes, anc_points, gt_labels, gt_bboxes, mask_gt):
- """This code referenced to
- https://github.com/Nioolek/PPYOLOE_pytorch/blob/master/ppyoloe/assigner/tal_assigner.py
+ """
+ Compute the task-aligned assignment.
+ Reference https://github.com/Nioolek/PPYOLOE_pytorch/blob/master/ppyoloe/assigner/tal_assigner.py
Args:
pd_scores (Tensor): shape(bs, num_total_anchors, num_classes)
@@ -76,11 +90,13 @@ class TaskAlignedAssigner(nn.Module):
gt_labels (Tensor): shape(bs, n_max_boxes, 1)
gt_bboxes (Tensor): shape(bs, n_max_boxes, 4)
mask_gt (Tensor): shape(bs, n_max_boxes, 1)
+
Returns:
target_labels (Tensor): shape(bs, num_total_anchors)
target_bboxes (Tensor): shape(bs, num_total_anchors, 4)
target_scores (Tensor): shape(bs, num_total_anchors, num_classes)
fg_mask (Tensor): shape(bs, num_total_anchors)
+ target_gt_idx (Tensor): shape(bs, num_total_anchors)
"""
self.bs = pd_scores.size(0)
self.n_max_boxes = gt_bboxes.size(1)
@@ -142,9 +158,19 @@ class TaskAlignedAssigner(nn.Module):
def select_topk_candidates(self, metrics, largest=True, topk_mask=None):
"""
+ Select the top-k candidates based on the given metrics.
+
Args:
- metrics: (b, max_num_obj, h*w).
- topk_mask: (b, max_num_obj, topk) or None
+ metrics (Tensor): A tensor of shape (b, max_num_obj, h*w), where b is the batch size,
+ max_num_obj is the maximum number of objects, and h*w represents the
+ total number of anchor points.
+ largest (bool): If True, select the largest values; otherwise, select the smallest values.
+ topk_mask (Tensor): An optional boolean tensor of shape (b, max_num_obj, topk), where
+ topk is the number of top candidates to consider. If not provided,
+ the top-k values are automatically computed based on the given metrics.
+
+ Returns:
+ (Tensor): A tensor of shape (b, max_num_obj, h*w) containing the selected top-k candidates.
"""
num_anchors = metrics.shape[-1] # h*w
@@ -165,22 +191,38 @@ class TaskAlignedAssigner(nn.Module):
def get_targets(self, gt_labels, gt_bboxes, target_gt_idx, fg_mask):
"""
+ Compute target labels, target bounding boxes, and target scores for the positive anchor points.
+
Args:
- gt_labels: (b, max_num_obj, 1)
- gt_bboxes: (b, max_num_obj, 4)
- target_gt_idx: (b, h*w)
- fg_mask: (b, h*w)
+ gt_labels (Tensor): Ground truth labels of shape (b, max_num_obj, 1), where b is the
+ batch size and max_num_obj is the maximum number of objects.
+ gt_bboxes (Tensor): Ground truth bounding boxes of shape (b, max_num_obj, 4).
+ target_gt_idx (Tensor): Indices of the assigned ground truth objects for positive
+ anchor points, with shape (b, h*w), where h*w is the total
+ number of anchor points.
+ fg_mask (Tensor): A boolean tensor of shape (b, h*w) indicating the positive
+ (foreground) anchor points.
+
+ Returns:
+ (Tuple[Tensor, Tensor, Tensor]): A tuple containing the following tensors:
+ - target_labels (Tensor): Shape (b, h*w), containing the target labels for
+ positive anchor points.
+ - target_bboxes (Tensor): Shape (b, h*w, 4), containing the target bounding boxes
+ for positive anchor points.
+ - target_scores (Tensor): Shape (b, h*w, num_classes), containing the target scores
+ for positive anchor points, where num_classes is the number
+ of object classes.
"""
- # assigned target labels, (b, 1)
+ # Assigned target labels, (b, 1)
batch_ind = torch.arange(end=self.bs, dtype=torch.int64, device=gt_labels.device)[..., None]
target_gt_idx = target_gt_idx + batch_ind * self.n_max_boxes # (b, h*w)
target_labels = gt_labels.long().flatten()[target_gt_idx] # (b, h*w)
- # assigned target boxes, (b, max_num_obj, 4) -> (b, h*w)
+ # Assigned target boxes, (b, max_num_obj, 4) -> (b, h*w)
target_bboxes = gt_bboxes.view(-1, 4)[target_gt_idx]
- # assigned target scores
+ # Assigned target scores
target_labels.clamp(0)
target_scores = F.one_hot(target_labels, self.num_classes) # (b, h*w, 80)
fg_scores_mask = fg_mask[:, :, None].repeat(1, 1, self.num_classes) # (b, h*w, 80)
diff --git a/ultralytics/yolo/utils/torch_utils.py b/ultralytics/yolo/utils/torch_utils.py
index 6e3da96..137aeb2 100644
--- a/ultralytics/yolo/utils/torch_utils.py
+++ b/ultralytics/yolo/utils/torch_utils.py
@@ -427,7 +427,7 @@ class EarlyStopping:
fitness (float): Fitness value of current epoch
Returns:
- bool: True if training should stop, False otherwise
+ (bool): True if training should stop, False otherwise
"""
if fitness is None: # check if fitness=None (happens when val=False)
return False
diff --git a/ultralytics/yolo/v8/classify/train.py b/ultralytics/yolo/v8/classify/train.py
index 8af9fce..ee20cc1 100644
--- a/ultralytics/yolo/v8/classify/train.py
+++ b/ultralytics/yolo/v8/classify/train.py
@@ -101,18 +101,6 @@ class ClassificationTrainer(BaseTrainer):
loss_items = loss.detach()
return loss, loss_items
- # def label_loss_items(self, loss_items=None, prefix="train"):
- # """
- # Returns a loss dict with labelled training loss items tensor
- # """
- # # Not needed for classification but necessary for segmentation & detection
- # keys = [f"{prefix}/{x}" for x in self.loss_names]
- # if loss_items is not None:
- # loss_items = [round(float(x), 5) for x in loss_items] # convert tensors to 5 decimal place floats
- # return dict(zip(keys, loss_items))
- # else:
- # return keys
-
def label_loss_items(self, loss_items=None, prefix='train'):
"""
Returns a loss dict with labelled training loss items tensor