From 5f6dc08df803d8de0796e14fdb89729913ffe557 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 04:30:07 +0000 Subject: [PATCH 1/2] Bump actions/setup-python from 5 to 6 in /.github/workflows Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci-testing.yml | 4 ++-- .github/workflows/merge-main-into-prs.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 2ffdd68f..b8e16d16 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -27,7 +27,7 @@ jobs: model: [yolov5n] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - uses: astral-sh/setup-uv@v6 @@ -65,7 +65,7 @@ jobs: torch: "1.8.0" # min torch version CI https://pypi.org/project/torchvision/ steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - uses: astral-sh/setup-uv@v6 diff --git a/.github/workflows/merge-main-into-prs.yml b/.github/workflows/merge-main-into-prs.yml index 034c6c14..3fe22363 100644 --- a/.github/workflows/merge-main-into-prs.yml +++ b/.github/workflows/merge-main-into-prs.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: "3.x" cache: "pip" From 5bc84303bc6ecc6a00b9fa22c1e7a03f75350d9b Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Mon, 8 Sep 2025 04:30:40 +0000 Subject: [PATCH 2/2] Auto-format by https://ultralytics.com/actions --- testcode.py | 13 ++++++++----- utils/triton.py | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/testcode.py b/testcode.py index e191e8f3..0d3bbec6 100644 --- a/testcode.py +++ b/testcode.py @@ -1,12 +1,12 @@ -import time -import cv2 -import torch -import numpy as np import sys +import cv2 +import numpy as np +import torch from unitree_sdk2py.core.channel import ChannelFactoryInitialize from unitree_sdk2py.go2.video.video_client import VideoClient + # ---------------------------- # Preprocess and detect # ---------------------------- @@ -17,6 +17,7 @@ def preprocess(frame): img = np.ascontiguousarray(img) / 255.0 return torch.tensor(img).float().unsqueeze(0) + def detect_person(model, frame, conf_thresh=0.5): img = preprocess(frame) with torch.no_grad(): @@ -28,6 +29,7 @@ def detect_person(model, frame, conf_thresh=0.5): boxes.append((x1, y1, x2 - x1, y2 - y1)) return boxes + # ---------------------------- # Main Camera Loop # ---------------------------- @@ -50,7 +52,7 @@ def camera_loop(model): boxes = detect_person(model, frame) - for (x, y, w, h) in boxes: + for x, y, w, h in boxes: cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.putText(frame, "Person", (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2) @@ -61,6 +63,7 @@ def camera_loop(model): cv2.destroyAllWindows() + # ---------------------------- # Main # ---------------------------- diff --git a/utils/triton.py b/utils/triton.py index 88c0bd7b..01564acc 100644 --- a/utils/triton.py +++ b/utils/triton.py @@ -29,7 +29,7 @@ def __init__(self, url: str): self.model_name = model_repository.models[0].name self.metadata = self.client.get_model_metadata(self.model_name, as_json=True) - def create_input_placeholders() -> typing.List[InferInput]: + def create_input_placeholders() -> list[InferInput]: return [ InferInput(i["name"], [int(s) for s in i["shape"]], i["datatype"]) for i in self.metadata["inputs"] ] @@ -42,7 +42,7 @@ def create_input_placeholders() -> typing.List[InferInput]: self.model_name = model_repository[0]["name"] self.metadata = self.client.get_model_metadata(self.model_name) - def create_input_placeholders() -> typing.List[InferInput]: + def create_input_placeholders() -> list[InferInput]: return [ InferInput(i["name"], [int(s) for s in i["shape"]], i["datatype"]) for i in self.metadata["inputs"] ] @@ -54,7 +54,7 @@ def runtime(self): """Returns the model runtime.""" return self.metadata.get("backend", self.metadata.get("platform")) - def __call__(self, *args, **kwargs) -> typing.Union[torch.Tensor, typing.Tuple[torch.Tensor, ...]]: + def __call__(self, *args, **kwargs) -> typing.Union[torch.Tensor, tuple[torch.Tensor, ...]]: """ Invokes the model.