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 \ 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/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 ------------------------------------------------------------------------------------------------------- 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/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. | 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/data/converter.py b/ultralytics/data/converter.py index fa5821418a..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" @@ -636,8 +637,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}") diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 85b6a70d27..e0ceee5002 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -605,8 +605,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: