ultralytics 8.4.39 Use dashed incremented run paths (#24193)
Some checks failed
CI / Benchmarks (yolo26n, macos-26, 3.12) (push) Has been cancelled
CI / Benchmarks (yolo26n, ubuntu-24.04-arm, 3.12) (push) Has been cancelled
CI / Benchmarks (yolo26n, ubuntu-latest, 3.12) (push) Has been cancelled
CI / Tests (macos-26, 3.12, latest) (push) Has been cancelled
CI / Tests (ubuntu-24.04-arm, 3.12, latest) (push) Has been cancelled
CI / Tests (ubuntu-latest, 3.12, latest) (push) Has been cancelled
CI / Tests (ubuntu-latest, 3.8, 1.8.0, 0.9.0) (push) Has been cancelled
CI / Tests (windows-latest, 3.12, latest) (push) Has been cancelled
CI / SlowTests (macos-26, 3.12, latest) (push) Has been cancelled
CI / SlowTests (ubuntu-24.04-arm, 3.12, latest) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.10, 1.11.0, 0.12.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.10, 1.12.0, 0.13.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.10, 1.13.0, 0.14.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.11, 2.0.0, 0.15.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.11, 2.1.0, 0.16.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.10.0, 0.25.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.11.0, 0.26.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.2.0, 0.17.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.3.0, 0.18.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.4.0, 0.19.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.5.0, 0.20.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.6.0, 0.21.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.7.0, 0.22.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.8.0, 0.23.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.9.0, 0.24.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, latest) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.8, 1.8.0, 0.9.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.9, 1.10.0, 0.11.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.9, 1.9.0, 0.10.0) (push) Has been cancelled
CI / SlowTests (windows-latest, 3.12, latest) (push) Has been cancelled
CI / GPU (push) Has been cancelled
CI / RaspberryPi (push) Has been cancelled
CI / NVIDIA_Jetson (JetPack5.1.2, 1.23.5, https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.16.3-cp38-cp38-linux_aarch64.whl, 3.8, jetson-jp512, https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.2.0-cp38-c… (push) Has been cancelled
CI / NVIDIA_Jetson (JetPack6.2, 1.26.4, https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.20.0-cp310-cp310-linux_aarch64.whl, 3.10, jetson-jp62, https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.5.0a0+872d… (push) Has been cancelled
CI / Conda (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Summary (push) Has been cancelled
Publish Docker Images / Build (push) Has been cancelled
Publish Docker Images / trigger-actions (push) Has been cancelled
Publish Docker Images / notify (push) Has been cancelled
Publish Docs / Docs (push) Has been cancelled
Publish to PyPI / check (push) Has been cancelled
Publish to PyPI / build (push) Has been cancelled
Publish to PyPI / publish (push) Has been cancelled
Publish to PyPI / sbom (push) Has been cancelled
Publish to PyPI / notify (push) Has been cancelled

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2026-04-18 21:10:21 +02:00 committed by GitHub
parent b50af592b7
commit d86cb96689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 22 additions and 14 deletions

View file

@ -168,7 +168,7 @@ Effective management of these aspects helps track progress and makes debugging a
| Argument | Default | Description | | Argument | Default | Description |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project` | `'runs'` | Specifies the root directory for saving training runs. Each run is saved in a separate subdirectory. | | `project` | `'runs'` | Specifies the root directory for saving training runs. Each run is saved in a separate subdirectory. |
| `name` | `'exp'` | Defines the experiment name. If unspecified, YOLO increments this name for each run (e.g., `exp`, `exp2`) to avoid overwriting. | | `name` | `'exp'` | Defines the experiment name. If unspecified, YOLO increments this name for each run (e.g., `exp`, `exp-2`) to avoid overwriting. |
| `exist_ok` | `False` | Determines whether to overwrite an existing experiment directory. `True` allows overwriting; `False` prevents it. | | `exist_ok` | `False` | Determines whether to overwrite an existing experiment directory. `True` allows overwriting; `False` prevents it. |
| `plots` | `True` | Controls the generation and saving of training and validation plots. Set to `True` to create plots like loss curves, [precision](https://www.ultralytics.com/glossary/precision)-[recall](https://www.ultralytics.com/glossary/recall) curves, and sample predictions for visual tracking of performance. | | `plots` | `True` | Controls the generation and saving of training and validation plots. Set to `True` to create plots like loss curves, [precision](https://www.ultralytics.com/glossary/precision)-[recall](https://www.ultralytics.com/glossary/recall) curves, and sample predictions for visual tracking of performance. |
| `save` | `True` | Enables saving training checkpoints and final model weights. Set to `True` to save model states periodically, allowing training resumption or model deployment. | | `save` | `True` | Enables saving training checkpoints and final model weights. Set to `True` to save model states periodically, allowing training resumption or model deployment. |

View file

@ -72,7 +72,7 @@ Multiple pretrained models can be ensembled together at test and inference time
python val.py --weights yolov5x.pt yolov5l6.pt --data coco.yaml --img 640 --half python val.py --weights yolov5x.pt yolov5l6.pt --data coco.yaml --img 640 --half
``` ```
You can list as many checkpoints as you would like, including custom weights such as `runs/train/exp5/weights/best.pt`. YOLOv5 will automatically run each model, align the predictions on a per-image basis, and average the outputs before performing NMS. You can list as many checkpoints as you would like, including custom weights such as `runs/train/exp-5/weights/best.pt`. YOLOv5 will automatically run each model, align the predictions on a per-image basis, and average the outputs before performing NMS.
Output: Output:
@ -91,7 +91,7 @@ val: Scanning '../datasets/coco/val2017.cache' images and labels... 4952 found,
all 5000 36335 0.747 0.637 0.692 0.502 all 5000 36335 0.747 0.637 0.692 0.502
Speed: 0.1ms pre-process, 39.5ms inference, 2.0ms NMS per image at shape (32, 3, 640, 640) # <--- ensemble speed Speed: 0.1ms pre-process, 39.5ms inference, 2.0ms NMS per image at shape (32, 3, 640, 640) # <--- ensemble speed
Evaluating pycocotools mAP... saving runs/val/exp3/yolov5x_predictions.json... Evaluating pycocotools mAP... saving runs/val/exp-3/yolov5x_predictions.json...
... ...
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.515 # <--- ensemble mAP Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.515 # <--- ensemble mAP
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.699 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.699
@ -128,7 +128,7 @@ Ensemble created with ['yolov5x.pt', 'yolov5l6.pt']
image 1/2 /content/yolov5/data/images/bus.jpg: 640x512 4 persons, 1 bus, 1 tie, Done. (0.063s) image 1/2 /content/yolov5/data/images/bus.jpg: 640x512 4 persons, 1 bus, 1 tie, Done. (0.063s)
image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 3 persons, 2 ties, Done. (0.056s) image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 3 persons, 2 ties, Done. (0.056s)
Results saved to runs/detect/exp2 Results saved to runs/detect/exp-2
Done. (0.223s) Done. (0.223s)
``` ```

View file

@ -50,7 +50,7 @@ val: Scanning '/content/datasets/coco/val2017.cache' images and labels... 4952 f
all 5000 36335 0.732 0.628 0.683 0.496 all 5000 36335 0.732 0.628 0.683 0.496
Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640) # <--- base speed Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640) # <--- base speed
Evaluating pycocotools mAP... saving runs/val/exp2/yolov5x_predictions.json... Evaluating pycocotools mAP... saving runs/val/exp-2/yolov5x_predictions.json...
... ...
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.507 # <--- base mAP Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.507 # <--- base mAP
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.689 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.689
@ -87,7 +87,7 @@ val: Scanning '/content/datasets/coco/val2017.cache' images and labels... 4952 f
all 5000 36335 0.724 0.614 0.671 0.478 all 5000 36335 0.724 0.614 0.671 0.478
Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640) # <--- prune speed Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640) # <--- prune speed
Evaluating pycocotools mAP... saving runs/val/exp3/yolov5x_predictions.json... Evaluating pycocotools mAP... saving runs/val/exp-3/yolov5x_predictions.json...
... ...
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.489 # <--- prune mAP Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.489 # <--- prune mAP
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.677 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.677
@ -101,7 +101,7 @@ Evaluating pycocotools mAP... saving runs/val/exp3/yolov5x_predictions.json...
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.496 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.496
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.722 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.722
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.803 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.803
Results saved to runs/val/exp3 Results saved to runs/val/exp-3
``` ```
## Results Analysis ## Results Analysis

View file

@ -81,7 +81,7 @@ val: New cache created: ../datasets/coco/val2017.cache
all 5000 36335 0.718 0.656 0.695 0.503 all 5000 36335 0.718 0.656 0.695 0.503
Speed: 0.2ms pre-process, 80.6ms inference, 2.7ms NMS per image at shape (32, 3, 832, 832) # <--- TTA speed Speed: 0.2ms pre-process, 80.6ms inference, 2.7ms NMS per image at shape (32, 3, 832, 832) # <--- TTA speed
Evaluating pycocotools mAP... saving runs/val/exp2/yolov5x_predictions.json... Evaluating pycocotools mAP... saving runs/val/exp-2/yolov5x_predictions.json...
... ...
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.516 # <--- TTA mAP Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.516 # <--- TTA mAP
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.701 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.701

View file

@ -170,7 +170,7 @@ python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yo
💡 Always train using datasets stored locally. Accessing data from network drives (like Google Drive) or remote storage can be significantly slower and impede training performance. Copying your dataset to a local SSD is often the best practice. 💡 Always train using datasets stored locally. Accessing data from network drives (like Google Drive) or remote storage can be significantly slower and impede training performance. Copying your dataset to a local SSD is often the best practice.
All training outputs, including weights and logs, are saved in the `runs/train/` directory. Each training session creates a new subdirectory (e.g., `runs/train/exp`, `runs/train/exp2`, etc.). For an interactive, hands-on experience, explore the training section in our official tutorial notebooks: <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> <a href="https://www.kaggle.com/models/ultralytics/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a> All training outputs, including weights and logs, are saved in the `runs/train/` directory. Each training session creates a new subdirectory (e.g., `runs/train/exp`, `runs/train/exp-2`, etc.). For an interactive, hands-on experience, explore the training section in our official tutorial notebooks: <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> <a href="https://www.kaggle.com/models/ultralytics/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
## 4. Visualize ## 4. Visualize

View file

@ -549,7 +549,7 @@ def test_utils_ops():
def test_utils_files(tmp_path): def test_utils_files(tmp_path):
"""Test file handling utilities including file age, date, and paths with spaces.""" """Test file handling utilities including file age, date, and paths with spaces."""
from ultralytics.utils.files import file_age, file_date, get_latest_run, spaces_in_path from ultralytics.utils.files import file_age, file_date, get_latest_run, increment_path, spaces_in_path
file_age(SOURCE) file_age(SOURCE)
file_date(SOURCE) file_date(SOURCE)
@ -560,6 +560,14 @@ def test_utils_files(tmp_path):
with spaces_in_path(path) as new_path: with spaces_in_path(path) as new_path:
print(new_path) print(new_path)
exp_dir = tmp_path / "runs" / "exp"
exp_dir.mkdir(parents=True)
assert increment_path(exp_dir) == tmp_path / "runs" / "exp-2"
results_file = exp_dir / "results.txt"
results_file.touch()
assert increment_path(results_file) == exp_dir / "results-2.txt"
@pytest.mark.slow @pytest.mark.slow
def test_utils_patches_torch_save(tmp_path): def test_utils_patches_torch_save(tmp_path):

View file

@ -1,6 +1,6 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
__version__ = "8.4.38" __version__ = "8.4.39"
import importlib import importlib
import os import os

View file

@ -103,7 +103,7 @@ def spaces_in_path(path: str | Path):
yield path yield path
def increment_path(path: str | Path, exist_ok: bool = False, sep: str = "", mkdir: bool = False) -> Path: def increment_path(path: str | Path, exist_ok: bool = False, sep: str = "-", mkdir: bool = False) -> Path:
"""Increment a file or directory path, i.e., runs/exp --> runs/exp{sep}2, runs/exp{sep}3, ... etc. """Increment a file or directory path, i.e., runs/exp --> runs/exp{sep}2, runs/exp{sep}3, ... etc.
If the path exists and `exist_ok` is not True, the path will be incremented by appending a number and `sep` to the If the path exists and `exist_ok` is not True, the path will be incremented by appending a number and `sep` to the
@ -125,13 +125,13 @@ def increment_path(path: str | Path, exist_ok: bool = False, sep: str = "", mkdi
>>> path = Path("runs/exp") >>> path = Path("runs/exp")
>>> new_path = increment_path(path) >>> new_path = increment_path(path)
>>> print(new_path) >>> print(new_path)
runs/exp2 runs/exp-2
Increment a file path: Increment a file path:
>>> path = Path("runs/exp/results.txt") >>> path = Path("runs/exp/results.txt")
>>> new_path = increment_path(path) >>> new_path = increment_path(path)
>>> print(new_path) >>> print(new_path)
runs/exp/results2.txt runs/exp/results-2.txt
""" """
path = Path(path) # os-agnostic path = Path(path) # os-agnostic
if path.exists() and not exist_ok: if path.exists() and not exist_ok: