From 7373816b238064e4b69aad869d8bb63a9f97a358 Mon Sep 17 00:00:00 2001 From: Paula Derrenger <107626595+pderrenger@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:15:15 +0100 Subject: [PATCH 01/43] Fix PyPI downloads links (#17399) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher --- README.md | 4 ++-- README.zh-CN.md | 4 ++-- docs/README.md | 2 +- docs/en/index.md | 2 +- docs/en/models/yolo11.md | 2 +- docs/en/models/yolov5.md | 2 +- docs/en/models/yolov8.md | 2 +- docs/en/quickstart.md | 2 +- docs/overrides/javascript/extra.js | 12 +++++++++--- docs/overrides/javascript/giscus.js | 4 +++- examples/heatmaps.ipynb | 2 +- examples/hub.ipynb | 2 +- examples/object_counting.ipynb | 2 +- examples/object_tracking.ipynb | 2 +- examples/tutorial.ipynb | 2 +- ultralytics/engine/exporter.py | 3 +-- ultralytics/engine/trainer.py | 2 +- ultralytics/solutions/solutions.py | 15 +++++++-------- ultralytics/utils/callbacks/comet.py | 2 +- 19 files changed, 37 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 01277aff54..52ef10fcb8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
Ultralytics CI - Ultralytics Downloads + Ultralytics Downloads Ultralytics YOLO Citation Ultralytics Discord Ultralytics Forums @@ -55,7 +55,7 @@ See below for a quickstart install and usage examples, and see our [Docs](https: Pip install the ultralytics package including all [requirements](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) in a [**Python>=3.8**](https://www.python.org/) environment with [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). -[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) +[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) ```bash pip install ultralytics diff --git a/README.zh-CN.md b/README.zh-CN.md index caf5e6b470..418652edd5 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -8,7 +8,7 @@
Ultralytics CI - Ultralytics Downloads + Ultralytics Downloads Ultralytics YOLO Citation Ultralytics Discord Ultralytics Forums @@ -55,7 +55,7 @@ 在 [**Python>=3.8**](https://www.python.org/) 环境中使用 [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/) 通过 pip 安装包含所有[依赖项](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) 的 ultralytics 包。 -[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) +[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) ```bash pip install ultralytics diff --git a/docs/README.md b/docs/README.md index a3d3edb40e..802352b581 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,7 +15,7 @@ ## 🛠️ Installation [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) -[![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) +[![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) To install the ultralytics package in developer mode, ensure you have Git and Python 3 installed on your system. Then, follow these steps: diff --git a/docs/en/index.md b/docs/en/index.md index ef1245f891..3794403c50 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -20,7 +20,7 @@ keywords: Ultralytics, YOLO, YOLO11, object detection, image segmentation, deep

Ultralytics CI - Ultralytics Downloads + Ultralytics Downloads Ultralytics YOLO Citation Ultralytics Discord Ultralytics Forums diff --git a/docs/en/models/yolo11.md b/docs/en/models/yolo11.md index dee9344b46..872c7e1e0f 100644 --- a/docs/en/models/yolo11.md +++ b/docs/en/models/yolo11.md @@ -130,7 +130,7 @@ Note that the example below is for YOLO11 [Detect](../tasks/detect.md) models fo !!! tip "Ultralytics YOLO11 Publication" - Ultralytics has not published a formal research paper for YOLO11 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com). + Ultralytics has not published a formal research paper for YOLO11 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com/). If you use YOLO11 or any other software from this repository in your work, please cite it using the following format: diff --git a/docs/en/models/yolov5.md b/docs/en/models/yolov5.md index 4d261df5c4..c973bf050c 100644 --- a/docs/en/models/yolov5.md +++ b/docs/en/models/yolov5.md @@ -94,7 +94,7 @@ This example provides simple YOLOv5 training and inference examples. For full do !!! tip "Ultralytics YOLOv5 Publication" - Ultralytics has not published a formal research paper for YOLOv5 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com). + Ultralytics has not published a formal research paper for YOLOv5 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com/). If you use YOLOv5 or YOLOv5u in your research, please cite the Ultralytics YOLOv5 repository as follows: diff --git a/docs/en/models/yolov8.md b/docs/en/models/yolov8.md index bb4f287a98..7d3508481a 100644 --- a/docs/en/models/yolov8.md +++ b/docs/en/models/yolov8.md @@ -167,7 +167,7 @@ Note the below example is for YOLOv8 [Detect](../tasks/detect.md) models for obj !!! tip "Ultralytics YOLOv8 Publication" - Ultralytics has not published a formal research paper for YOLOv8 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com). + Ultralytics has not published a formal research paper for YOLOv8 due to the rapidly evolving nature of the models. We focus on advancing the technology and making it easier to use, rather than producing static documentation. For the most up-to-date information on YOLO architecture, features, and usage, please refer to our [GitHub repository](https://github.com/ultralytics/ultralytics) and [documentation](https://docs.ultralytics.com/). If you use the YOLOv8 model or any other software from this repository in your work, please cite it using the following format: diff --git a/docs/en/quickstart.md b/docs/en/quickstart.md index 204623cca4..da4d862419 100644 --- a/docs/en/quickstart.md +++ b/docs/en/quickstart.md @@ -28,7 +28,7 @@ Ultralytics provides various installation methods including pip, conda, and Dock Install the `ultralytics` package using pip, or update an existing installation by running `pip install -U ultralytics`. Visit the Python Package Index (PyPI) for more details on the `ultralytics` package: [https://pypi.org/project/ultralytics/](https://pypi.org/project/ultralytics/). [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) - [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) + [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) ```bash # Install the ultralytics package from PyPI diff --git a/docs/overrides/javascript/extra.js b/docs/overrides/javascript/extra.js index e2faf7986e..fa9d79b08e 100644 --- a/docs/overrides/javascript/extra.js +++ b/docs/overrides/javascript/extra.js @@ -47,7 +47,9 @@ checkAutoTheme(); document.addEventListener("DOMContentLoaded", () => { const autoThemeInput = document.getElementById("__palette_1"); autoThemeInput?.addEventListener("click", () => { - if (autoThemeInput.checked) setTimeout(checkAutoTheme); + if (autoThemeInput.checked) { + setTimeout(checkAutoTheme); + } }); }); @@ -165,7 +167,9 @@ let chart = null; // chart variable will hold the reference to the current char // This function is responsible for updating the benchmarks chart. function updateChart() { // If a chart instance already exists, destroy it. - if (chart) chart.destroy(); + if (chart) { + chart.destroy(); + } // Get the selected algorithms from the checkboxes. const selectedAlgorithms = [...document.querySelectorAll('input[name="algorithm"]:checked')].map(e => e.value); @@ -187,7 +191,9 @@ function updateChart() { })); // If there are no selected algorithms, return without creating a new chart. - if (datasets.length === 0) return; + if (datasets.length === 0) { + return; + } // Create a new chart instance. chart = new Chart(document.getElementById('chart').getContext('2d'), { diff --git a/docs/overrides/javascript/giscus.js b/docs/overrides/javascript/giscus.js index a64e297342..008ba294b5 100644 --- a/docs/overrides/javascript/giscus.js +++ b/docs/overrides/javascript/giscus.js @@ -1,7 +1,9 @@ // Giscus functionality function loadGiscus() { const giscusContainer = document.getElementById("giscus-container"); - if (!giscusContainer || giscusContainer.querySelector("script")) return; + if (!giscusContainer || giscusContainer.querySelector("script")) { + return; + } const script = document.createElement("script"); script.src = "https://giscus.app/client.js"; diff --git a/examples/heatmaps.ipynb b/examples/heatmaps.ipynb index d0124df894..b4c94c35ff 100644 --- a/examples/heatmaps.ipynb +++ b/examples/heatmaps.ipynb @@ -38,7 +38,7 @@ "\n", "Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) and check software and hardware.\n", "\n", - "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" + "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" ] }, { diff --git a/examples/hub.ipynb b/examples/hub.ipynb index 03382596ce..bf7e27f97d 100644 --- a/examples/hub.ipynb +++ b/examples/hub.ipynb @@ -36,7 +36,7 @@ "\n", "Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) and check software and hardware.\n", "\n", - "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" + "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" ] }, { diff --git a/examples/object_counting.ipynb b/examples/object_counting.ipynb index e742cff6a7..83f245d60f 100644 --- a/examples/object_counting.ipynb +++ b/examples/object_counting.ipynb @@ -38,7 +38,7 @@ "\n", "Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) and check software and hardware.\n", "\n", - "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" + "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" ] }, { diff --git a/examples/object_tracking.ipynb b/examples/object_tracking.ipynb index cc4d03add8..d7f4d42b82 100644 --- a/examples/object_tracking.ipynb +++ b/examples/object_tracking.ipynb @@ -38,7 +38,7 @@ "\n", "Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) and check software and hardware.\n", "\n", - "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" + "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" ] }, { diff --git a/examples/tutorial.ipynb b/examples/tutorial.ipynb index 75dd455e9a..5eadcf3e60 100644 --- a/examples/tutorial.ipynb +++ b/examples/tutorial.ipynb @@ -55,7 +55,7 @@ "\n", "Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) and check software and hardware.\n", "\n", - "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" + "[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/)" ] }, { diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 00a7b6c7a7..9fca6c28d9 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -568,8 +568,7 @@ class Exporter: f = str(self.file.with_suffix(".mnn")) # MNN model file args = ["", "-f", "ONNX", "--modelFile", f_onnx, "--MNNModel", f, "--bizCode", json.dumps(self.metadata)] if self.args.int8: - args.append("--weightQuantBits") - args.append("8") + args.extend(("--weightQuantBits", "8")) if self.args.half: args.append("--fp16") mnnconvert.convert(args) diff --git a/ultralytics/engine/trainer.py b/ultralytics/engine/trainer.py index 068274a429..a7e3922b4f 100644 --- a/ultralytics/engine/trainer.py +++ b/ultralytics/engine/trainer.py @@ -792,7 +792,7 @@ class BaseTrainer: g[0].append(param) optimizers = {"Adam", "Adamax", "AdamW", "NAdam", "RAdam", "RMSProp", "SGD", "auto"} - name = {x.lower(): x for x in optimizers}.get(name.lower(), None) + name = {x.lower(): x for x in optimizers}.get(name.lower()) if name in {"Adam", "Adamax", "AdamW", "NAdam", "RAdam"}: optimizer = getattr(optim, name, optim.Adam)(g[2], lr=lr, betas=(momentum, 0.999), weight_decay=0.0) elif name == "RMSProp": diff --git a/ultralytics/solutions/solutions.py b/ultralytics/solutions/solutions.py index 20c2ce90b7..ea94767033 100644 --- a/ultralytics/solutions/solutions.py +++ b/ultralytics/solutions/solutions.py @@ -72,14 +72,13 @@ class BaseSolution: self.model = YOLO(self.CFG["model"]) self.names = self.model.names - if IS_CLI: # for CLI, download the source and init video writer - if self.CFG["source"] is None: - d_s = "solutions_ci_demo.mp4" if "-pose" not in self.CFG["model"] else "solution_ci_pose_demo.mp4" - LOGGER.warning(f"⚠️ WARNING: source not provided. using default source {ASSETS_URL}/{d_s}") - from ultralytics.utils.downloads import safe_download - - safe_download(f"{ASSETS_URL}/{d_s}") # download source from ultralytics assets - self.CFG["source"] = d_s # set default source + if IS_CLI and self.CFG["source"] is None: + d_s = "solutions_ci_demo.mp4" if "-pose" not in self.CFG["model"] else "solution_ci_pose_demo.mp4" + LOGGER.warning(f"⚠️ WARNING: source not provided. using default source {ASSETS_URL}/{d_s}") + from ultralytics.utils.downloads import safe_download + + safe_download(f"{ASSETS_URL}/{d_s}") # download source from ultralytics assets + self.CFG["source"] = d_s # set default source # Initialize environment and region setup self.env_check = check_imshow(warn=True) diff --git a/ultralytics/utils/callbacks/comet.py b/ultralytics/utils/callbacks/comet.py index 3fae97f917..ef6e88c3f1 100644 --- a/ultralytics/utils/callbacks/comet.py +++ b/ultralytics/utils/callbacks/comet.py @@ -291,7 +291,7 @@ def _log_plots(experiment, trainer): for plots in EVALUATION_PLOT_NAMES for prefix in POSE_METRICS_PLOT_PREFIX ] - elif isinstance(trainer.validator.metrics, DetMetrics) or isinstance(trainer.validator.metrics, OBBMetrics): + elif isinstance(trainer.validator.metrics, (DetMetrics, OBBMetrics)): plot_filenames = [trainer.save_dir / f"{plots}.png" for plots in EVALUATION_PLOT_NAMES] if plot_filenames is not None: From 005a0b605b81370f9988f90b23750295e66e4f53 Mon Sep 17 00:00:00 2001 From: Francesco Mattioli Date: Thu, 7 Nov 2024 17:18:30 +0100 Subject: [PATCH 02/43] Jupyter Docker Image, allow connection (#17400) Co-authored-by: Glenn Jocher --- docker/Dockerfile-jupyter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile-jupyter b/docker/Dockerfile-jupyter index e42639b9b7..0a58bb35fd 100644 --- a/docker/Dockerfile-jupyter +++ b/docker/Dockerfile-jupyter @@ -17,7 +17,7 @@ RUN mkdir /data/weights && /usr/local/bin/yolo settings weights_dir="/data/weigh RUN mkdir /data/runs && /usr/local/bin/yolo settings runs_dir="/data/runs" # Start JupyterLab with tutorial notebook -ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "/ultralytics/examples/tutorial.ipynb"] +ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "--ip=*", "/ultralytics/examples/tutorial.ipynb"] # Usage Examples ------------------------------------------------------------------------------------------------------- From 9a7b344fd0f11a7aeccff5d93804eb32b7653c46 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Fri, 8 Nov 2024 02:02:29 +0800 Subject: [PATCH 03/43] Fix duplicated annotations by `yolo_bbox2segment` (#17401) Co-authored-by: Burhan <62214284+Burhan-Q@users.noreply.github.com> --- ultralytics/data/converter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/data/converter.py b/ultralytics/data/converter.py index fa5821418a..6b87f4e833 100644 --- a/ultralytics/data/converter.py +++ b/ultralytics/data/converter.py @@ -636,8 +636,8 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"): continue line = (int(cls[i]), *s.reshape(-1)) texts.append(("%g " * len(line)).rstrip() % line) - with open(txt_file, "a") as f: - f.writelines(text + "\n" for text in texts) + with open(txt_file, "a") as f: + f.writelines(text + "\n" for text in texts) LOGGER.info(f"Generated segment labels saved in {save_dir}") From b0aef79d367ed37d203728c9fc8752adbe9d8829 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:16:27 +0800 Subject: [PATCH 04/43] Add device selection for `yolo_bbox2segment` (#17409) --- ultralytics/data/converter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ultralytics/data/converter.py b/ultralytics/data/converter.py index 6b87f4e833..e854c60de9 100644 --- a/ultralytics/data/converter.py +++ b/ultralytics/data/converter.py @@ -577,7 +577,7 @@ def merge_multi_segment(segments): return s -def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"): +def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt", device=None): """ Converts existing object detection dataset (bounding boxes) to segmentation dataset or oriented bounding box (OBB) in YOLO format. Generates segmentation data using SAM auto-annotator as needed. @@ -587,6 +587,7 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"): save_dir (str | Path): Path to save the generated labels, labels will be saved into `labels-segment` in the same directory level of `im_dir` if save_dir is None. Default: None. sam_model (str): Segmentation model to use for intermediate segmentation data; optional. + device (int | str): The specific device to run SAM models. Default: None. Notes: The input directory structure assumed for dataset: @@ -621,7 +622,7 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"): boxes[:, [0, 2]] *= w boxes[:, [1, 3]] *= h im = cv2.imread(label["im_file"]) - sam_results = sam_model(im, bboxes=xywh2xyxy(boxes), verbose=False, save=False) + sam_results = sam_model(im, bboxes=xywh2xyxy(boxes), verbose=False, save=False, device=device) label["segments"] = sam_results[0].masks.xyn save_dir = Path(save_dir) if save_dir else Path(im_dir).parent / "labels-segment" From f2f81aa5e8bc41d8d43d233c9d79f3a922c5e0f0 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:19:17 +0800 Subject: [PATCH 05/43] Update validation-args.md (#17411) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher --- docs/en/macros/validation-args.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/macros/validation-args.md b/docs/en/macros/validation-args.md index 5eeea81f49..c28a8e473a 100644 --- a/docs/en/macros/validation-args.md +++ b/docs/en/macros/validation-args.md @@ -12,7 +12,7 @@ | `device` | `str` | `None` | Specifies the device for validation (`cpu`, `cuda:0`, etc.). Allows flexibility in utilizing CPU or GPU resources. | | `dnn` | `bool` | `False` | If `True`, uses the [OpenCV](https://www.ultralytics.com/glossary/opencv) DNN module for ONNX model inference, offering an alternative to [PyTorch](https://www.ultralytics.com/glossary/pytorch) inference methods. | | `plots` | `bool` | `False` | When set to `True`, generates and saves plots of predictions versus ground truth for visual evaluation of the model's performance. | -| `rect` | `bool` | `False` | If `True`, uses rectangular inference for batching, reducing padding and potentially increasing speed and efficiency. | +| `rect` | `bool` | `True` | If `True`, uses rectangular inference for batching, reducing padding and potentially increasing speed and efficiency. | | `split` | `str` | `val` | Determines the dataset split to use for validation (`val`, `test`, or `train`). Allows flexibility in choosing the data segment for performance evaluation. | | `project` | `str` | `None` | Name of the project directory where validation outputs are saved. | | `name` | `str` | `None` | Name of the validation run. Used for creating a subdirectory within the project folder, where valdiation logs and outputs are stored. | From 84bfe3c2e4fd5881c33d0f1264b94c6e62edeb43 Mon Sep 17 00:00:00 2001 From: Paula Derrenger <107626595+pderrenger@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:31:42 +0100 Subject: [PATCH 06/43] Use new Ultralytics Retry action (#17419) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher --- .github/workflows/docker.yaml | 8 ++++---- .github/workflows/links.yml | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 38f30bb1b6..8682340a33 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -134,12 +134,12 @@ jobs: - name: Build Image if: github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true' - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: timeout_minutes: 120 - retry_wait_seconds: 60 - max_attempts: 3 # retry twice - command: | + retry_delay_seconds: 60 + retries: 2 + run: | docker build \ --platform ${{ matrix.platforms }} \ -f docker/${{ matrix.dockerfile }} \ diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 4dd8aa38b0..1a0b3ca15c 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -29,12 +29,12 @@ jobs: sudo mv lychee /usr/local/bin - name: Test Markdown and HTML links with retry - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: - timeout_minutes: 5 - retry_wait_seconds: 60 - max_attempts: 3 - command: | + timeout_minutes: 60 + retry_delay_seconds: 300 + retries: 2 + run: | lychee \ --scheme https \ --timeout 60 \ @@ -59,12 +59,12 @@ jobs: - name: Test Markdown, HTML, YAML, Python and Notebook links with retry if: github.event_name == 'workflow_dispatch' - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: - timeout_minutes: 5 - retry_wait_seconds: 60 - max_attempts: 3 - command: | + timeout_minutes: 60 + retry_delay_seconds: 300 + retries: 2 + run: | lychee \ --scheme https \ --timeout 60 \ From 95368cbe54ba0767e7fd8504e417f5be8e87b544 Mon Sep 17 00:00:00 2001 From: Kilian Schnelle <57074573+KiSchnelle@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:19:46 +0100 Subject: [PATCH 07/43] Changed model.names return type hint from list to dict[int, str] (#17402) --- ultralytics/engine/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/engine/model.py b/ultralytics/engine/model.py index c5b63eed83..718176726f 100644 --- a/ultralytics/engine/model.py +++ b/ultralytics/engine/model.py @@ -2,7 +2,7 @@ import inspect from pathlib import Path -from typing import List, Union +from typing import Dict, List, Union import numpy as np import torch @@ -881,7 +881,7 @@ class Model(nn.Module): return self @property - def names(self) -> list: + def names(self) -> Dict[int, str]: """ Retrieves the class names associated with the loaded model. From cc81b0667993df97fee963bf6de4ce41318597ae Mon Sep 17 00:00:00 2001 From: Burhan <62214284+Burhan-Q@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:49:11 -0500 Subject: [PATCH 08/43] Match Docs caption to video thumbnail text (#17424) --- docs/en/guides/object-counting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/guides/object-counting.md b/docs/en/guides/object-counting.md index 144555793d..796d1533aa 100644 --- a/docs/en/guides/object-counting.md +++ b/docs/en/guides/object-counting.md @@ -19,7 +19,7 @@ Object counting with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly allowfullscreen>
- Watch: Object Counting using Ultralytics YOLO11 + Watch: Object Counting using Ultralytics YOLOv8