From 2f6b91ee8c038a59ac51fe1151e3defd6cd0f907 Mon Sep 17 00:00:00 2001 From: inisis <46103969+inisis@users.noreply.github.com> Date: Sun, 12 May 2024 23:10:18 +0800 Subject: [PATCH 01/11] Set `TORCH_CPP_LOG_LEVEL=ERROR` for reduced verbosity (#12989) * modify torch cpp log level to Error to avoid annoying print * Auto-format by https://ultralytics.com/actions --------- Co-authored-by: UltralyticsAssistant --- export.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/export.py b/export.py index 214d903c2998..cd2202c9c072 100644 --- a/export.py +++ b/export.py @@ -48,6 +48,8 @@ import contextlib import json import os + +os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR" import platform import re import subprocess From 331c39e3c3b829519727d592358d0bb42433d3b5 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 12 May 2024 18:25:53 +0200 Subject: [PATCH 02/11] Add `pip install --retries 3` to CI to resolve transients (#13001) * Add `pip install --retries 3` to CI to resolve transients Signed-off-by: Glenn Jocher * Update ci-testing.yml Signed-off-by: Glenn Jocher --------- Signed-off-by: Glenn Jocher --- .github/workflows/ci-testing.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index b70e0eb89245..aa5f9e316ee6 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -29,7 +29,7 @@ jobs: - name: Install requirements run: | python -m pip install --upgrade pip wheel - pip install -r requirements.txt coremltools openvino-dev "tensorflow-cpu<2.15.1" --extra-index-url https://download.pytorch.org/whl/cpu + pip install --retries 3 -r requirements.txt coremltools openvino-dev "tensorflow-cpu<2.15.1" --extra-index-url https://download.pytorch.org/whl/cpu yolo checks pip list - name: Benchmark DetectionModel @@ -68,11 +68,11 @@ jobs: - name: Install requirements run: | python -m pip install --upgrade pip wheel + torch="" if [ "${{ matrix.torch }}" == "1.8.0" ]; then - pip install -r requirements.txt torch==1.8.0 torchvision==0.9.0 --extra-index-url https://download.pytorch.org/whl/cpu - else - pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu + torch="torch==1.8.0 torchvision==0.9.0" fi + pip install --retries 3 -r requirements.txt $torch --extra-index-url https://download.pytorch.org/whl/cpu shell: bash # for Windows compatibility - name: Check environment run: | From d1ea6b1efa3fe64f666205c4419b36af20780a86 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 12 May 2024 18:48:42 +0200 Subject: [PATCH 03/11] Revert CI `pip install` retries to default (#13002) Signed-off-by: Glenn Jocher --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index aa5f9e316ee6..c20a07e6c0b4 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -29,7 +29,7 @@ jobs: - name: Install requirements run: | python -m pip install --upgrade pip wheel - pip install --retries 3 -r requirements.txt coremltools openvino-dev "tensorflow-cpu<2.15.1" --extra-index-url https://download.pytorch.org/whl/cpu + pip install -r requirements.txt coremltools openvino-dev "tensorflow-cpu<2.15.1" --extra-index-url https://download.pytorch.org/whl/cpu yolo checks pip list - name: Benchmark DetectionModel @@ -72,7 +72,7 @@ jobs: if [ "${{ matrix.torch }}" == "1.8.0" ]; then torch="torch==1.8.0 torchvision==0.9.0" fi - pip install --retries 3 -r requirements.txt $torch --extra-index-url https://download.pytorch.org/whl/cpu + pip install -r requirements.txt $torch --extra-index-url https://download.pytorch.org/whl/cpu shell: bash # for Windows compatibility - name: Check environment run: | From 28e06aa3911ecf8bcfb9f13aa3be378e4ab62593 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 12 May 2024 22:16:54 +0200 Subject: [PATCH 04/11] Centralize ENV variable definition in utils/general.py (#13004) * Centralize ENV variable definition in utils/general.py Signed-off-by: Glenn Jocher * Update export.py Signed-off-by: Glenn Jocher * Auto-format by https://ultralytics.com/actions --------- Signed-off-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- export.py | 2 -- utils/general.py | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/export.py b/export.py index cd2202c9c072..214d903c2998 100644 --- a/export.py +++ b/export.py @@ -48,8 +48,6 @@ import contextlib import json import os - -os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR" import platform import re import subprocess diff --git a/utils/general.py b/utils/general.py index 5a9325eec757..64ae50626e14 100644 --- a/utils/general.py +++ b/utils/general.py @@ -68,6 +68,8 @@ os.environ["NUMEXPR_MAX_THREADS"] = str(NUM_THREADS) # NumExpr max threads os.environ["OMP_NUM_THREADS"] = "1" if platform.system() == "darwin" else str(NUM_THREADS) # OpenMP (PyTorch and SciPy) os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" # suppress verbose TF compiler warnings in Colab +os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR" # suppress "NNPACK.cpp could not initialize NNPACK" warnings +os.environ["KINETO_LOG_LEVEL"] = "5" # suppress verbose PyTorch profiler output when computing FLOPs def is_ascii(s=""): From 1bcd17ee6941f5e31e7a4939f6f1ab43b3815c7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 11:46:16 +0200 Subject: [PATCH 05/11] Bump contributor-assistant/github-action from 2.3.2 to 2.4.0 in /.github/workflows (#13006) Bump contributor-assistant/github-action in /.github/workflows Bumps [contributor-assistant/github-action](https://github.com/contributor-assistant/github-action) from 2.3.2 to 2.4.0. - [Release notes](https://github.com/contributor-assistant/github-action/releases) - [Commits](https://github.com/contributor-assistant/github-action/compare/v2.3.2...v2.4.0) --- updated-dependencies: - dependency-name: contributor-assistant/github-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 4f87c77701dd..df8d4fd51303 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -20,7 +20,7 @@ jobs: steps: - name: CLA Assistant if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I sign the CLA') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@v2.3.2 + uses: contributor-assistant/github-action@v2.4.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # must be repository secret token From 712de55a20cd584a12a4aebe96226c92f816dcf3 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 18 May 2024 15:52:21 +0200 Subject: [PATCH 06/11] Reformat Markdown code blocks (#13023) --- README.md | 4 +--- README.zh-CN.md | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 55f813747fe5..9eb712587c82 100644 --- a/README.md +++ b/README.md @@ -395,9 +395,7 @@ python classify/predict.py --weights yolov5s-cls.pt --source data/images/bus.jpg ``` ```python -model = torch.hub.load( - "ultralytics/yolov5", "custom", "yolov5s-cls.pt" -) # load from PyTorch Hub +model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5s-cls.pt") # load from PyTorch Hub ``` ### Export diff --git a/README.zh-CN.md b/README.zh-CN.md index 69ce9b72d332..36b9e6a0a773 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -394,9 +394,7 @@ python classify/predict.py --weights yolov5s-cls.pt --source data/images/bus.jpg ``` ```python -model = torch.hub.load( - "ultralytics/yolov5", "custom", "yolov5s-cls.pt" -) # load from PyTorch Hub +model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5s-cls.pt") # load from PyTorch Hub ``` ### 模型导出 From 60dde7f18b9b102ea4462ec1ec5ab42bc8287811 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 24 May 2024 07:50:10 +0200 Subject: [PATCH 07/11] [Snyk] Security upgrade requests from 2.31.0 to 2.32.0 (#13039) fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-6928867 Co-authored-by: snyk-bot --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3892abe07308..7248b72086b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ opencv-python>=4.1.1 pillow>=10.3.0 psutil # system resources PyYAML>=5.3.1 -requests>=2.23.0 +requests>=2.32.0 scipy>=1.4.1 thop>=0.1.1 # FLOPs computation torch>=1.8.0 # see https://pytorch.org/get-started/locally (recommended) From 892e8a82633cf5348da9bab3e36315c4dcc8960e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 28 May 2024 16:56:27 +0200 Subject: [PATCH 08/11] Update Ultralytics YouTube URL (#13046) * Update Ultralytics YouTube URL * Update README.md Signed-off-by: Glenn Jocher * Auto-format by https://ultralytics.com/actions --------- Signed-off-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- README.md | 4 ++-- README.zh-CN.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9eb712587c82..fe9120be4832 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ To request an Enterprise License please complete the form at [Ultralytics Licens Ultralytics Twitter - Ultralytics YouTube + Ultralytics YouTube Ultralytics TikTok @@ -460,7 +460,7 @@ For YOLOv5 bug reports and feature requests please visit [GitHub Issues](https:/ Ultralytics Twitter - Ultralytics YouTube + Ultralytics YouTube Ultralytics TikTok diff --git a/README.zh-CN.md b/README.zh-CN.md index 36b9e6a0a773..2fb0bf9b3164 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -34,7 +34,7 @@ YOLOv5 🚀 是世界上最受欢迎的视觉 AI,代表 Ultralytics Twitter - Ultralytics YouTube + Ultralytics YouTube Ultralytics TikTok @@ -459,7 +459,7 @@ Ultralytics 提供两种许可证选项以适应各种使用场景: Ultralytics Twitter - Ultralytics YouTube + Ultralytics YouTube Ultralytics TikTok From 2b7bcf664b08eaf92fff2b1a9d3882e9c3bcb208 Mon Sep 17 00:00:00 2001 From: RainRat Date: Wed, 29 May 2024 13:09:30 -0700 Subject: [PATCH 09/11] Fix typos (#13049) * fix typos no functional change * Update hpo.py better fix for typo no functional change --- segment/train.py | 2 +- utils/augmentations.py | 2 +- utils/dataloaders.py | 2 +- utils/loggers/clearml/hpo.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/segment/train.py b/segment/train.py index 5a6e9afb8ec0..a0d0c5119639 100644 --- a/segment/train.py +++ b/segment/train.py @@ -746,7 +746,7 @@ def run(**kwargs): """ Executes YOLOv5 training with given parameters, altering options programmatically; returns updated options. - Example: mport train; train.run(data='coco128.yaml', imgsz=320, weights='yolov5m.pt') + Example: import train; train.run(data='coco128.yaml', imgsz=320, weights='yolov5m.pt') """ opt = parse_opt(True) for k, v in kwargs.items(): diff --git a/utils/augmentations.py b/utils/augmentations.py index 3025ebdb7092..3556bffeda18 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -353,7 +353,7 @@ def classify_albumentations( if vflip > 0: T += [A.VerticalFlip(p=vflip)] if jitter > 0: - color_jitter = (float(jitter),) * 3 # repeat value for brightness, contrast, satuaration, 0 hue + color_jitter = (float(jitter),) * 3 # repeat value for brightness, contrast, saturation, 0 hue T += [A.ColorJitter(*color_jitter, 0)] else: # Use fixed crop for eval set (reproducibility) T = [A.SmallestMaxSize(max_size=size), A.CenterCrop(height=size, width=size)] diff --git a/utils/dataloaders.py b/utils/dataloaders.py index 04420c77a673..7ca451aa0929 100644 --- a/utils/dataloaders.py +++ b/utils/dataloaders.py @@ -136,7 +136,7 @@ def __iter__(self): g = torch.Generator() g.manual_seed(self.seed + self.epoch) - # determine the the eventual size (n) of self.indices (DDP indices) + # determine the eventual size (n) of self.indices (DDP indices) n = int((len(self.dataset) - self.rank - 1) / self.num_replicas) + 1 # num_replicas == WORLD_SIZE idx = torch.randperm(n, generator=g) if not self.shuffle: diff --git a/utils/loggers/clearml/hpo.py b/utils/loggers/clearml/hpo.py index 4e314ea868df..aa1b7ab9494d 100644 --- a/utils/loggers/clearml/hpo.py +++ b/utils/loggers/clearml/hpo.py @@ -58,7 +58,7 @@ # now we decide if we want to maximize it or minimize it (accuracy we maximize) objective_metric_sign="max", # let us limit the number of concurrent experiments, - # this in turn will make sure we do dont bombard the scheduler with experiments. + # this in turn will make sure we don't bombard the scheduler with experiments. # if we have an auto-scaler connected, this, by proxy, will limit the number of machine max_number_of_concurrent_tasks=1, # this is the optimizer class (actually doing the optimization) From 004037947f7b302550fd409851590a76e90a07ab Mon Sep 17 00:00:00 2001 From: goksmisama <80083119+goksmisama@users.noreply.github.com> Date: Thu, 30 May 2024 04:12:17 +0800 Subject: [PATCH 10/11] Fix reshape_classifier_output function to correctly reshape the final output layer (#13052) * Fix reshape_classifier_output function to correctly reshape the final output layer * Update torch_utils.py Signed-off-by: Glenn Jocher --------- Signed-off-by: Glenn Jocher Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com> Co-authored-by: Glenn Jocher --- utils/torch_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/torch_utils.py b/utils/torch_utils.py index 4929d21cdf83..28893c71deef 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -79,11 +79,11 @@ def reshape_classifier_output(model, n=1000): elif isinstance(m, nn.Sequential): types = [type(x) for x in m] if nn.Linear in types: - i = types.index(nn.Linear) # nn.Linear index + i = len(types) - 1 - types[::-1].index(nn.Linear) # last nn.Linear index if m[i].out_features != n: m[i] = nn.Linear(m[i].in_features, n) elif nn.Conv2d in types: - i = types.index(nn.Conv2d) # nn.Conv2d index + i = len(types) - 1 - types[::-1].index(nn.Conv2d) # last nn.Conv2d index if m[i].out_channels != n: m[i] = nn.Conv2d(m[i].in_channels, n, m[i].kernel_size, m[i].stride, bias=m[i].bias is not None) From c0380fd85549c8b315bb1fb2f423f9297e9744ec Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 30 May 2024 12:37:30 +0200 Subject: [PATCH 11/11] Add Prettier for YAML formatting to Ultralytics Actions (#13053) * Add Prettier for YAML formatting to Ultralytics Actions Signed-off-by: Glenn Jocher * Update format.yml Signed-off-by: Glenn Jocher * Update format.yml Signed-off-by: Glenn Jocher --------- Signed-off-by: Glenn Jocher --- .github/workflows/format.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 4723d0f7dc70..da66ffe5e503 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -19,7 +19,8 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, do not modify python: true # format Python code and docstrings - markdown: true # format Markdown and YAML + markdown: true # format Markdown + prettier: true # format YAML spelling: true # check spelling links: false # check broken links summary: true # print PR summary with GPT4 (requires 'openai_api_key' or 'openai_azure_api_key' and 'openai_azure_endpoint')