From 6b202d96173704292e8a1bd3cd31b4d44159c00c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:19:29 +0000 Subject: [PATCH 01/21] build(deps): update scikit-learn requirement in /requirements Updates the requirements on [scikit-learn](https://github.com/scikit-learn/scikit-learn) to permit the latest version. - [Release notes](https://github.com/scikit-learn/scikit-learn/releases) - [Commits](https://github.com/scikit-learn/scikit-learn/compare/1.2.2...1.8.0) --- updated-dependencies: - dependency-name: scikit-learn dependency-version: 1.8.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..61fdb60d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -19,7 +19,7 @@ pandas>=2.0.0 pillow>=9.4.0 pyyaml>=6.0 scikit-image>=0.20.0 -scikit-learn>=1.2.2 +scikit-learn>=1.8.0 # sound From 62ec55f9efec6f731e1de2d493c08fca86eaf5ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:19:32 +0000 Subject: [PATCH 02/21] build(deps): update opencv-python requirement in /requirements Updates the requirements on [opencv-python](https://github.com/opencv/opencv-python) to permit the latest version. - [Release notes](https://github.com/opencv/opencv-python/releases) - [Commits](https://github.com/opencv/opencv-python/commits) --- updated-dependencies: - dependency-name: opencv-python dependency-version: 4.13.0.92 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..5082ef36 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -9,7 +9,7 @@ numpy>=1.23.5 # vision -opencv-python>=4.9.0.80 +opencv-python>=4.13.0.92 # openmmlab package manager From fbd8167f1759cb3004d72ecaec68e7d7a8e09102 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:19:36 +0000 Subject: [PATCH 03/21] build(deps): update tqdm requirement in /requirements Updates the requirements on [tqdm](https://github.com/tqdm/tqdm) to permit the latest version. - [Release notes](https://github.com/tqdm/tqdm/releases) - [Commits](https://github.com/tqdm/tqdm/compare/v4.65.0...v4.67.3) --- updated-dependencies: - dependency-name: tqdm dependency-version: 4.67.3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..8a9bd019 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -28,7 +28,7 @@ soundfile>=0.12.1 # visualize tensorboard>=2.12.3 -tqdm>=4.65.0 +tqdm>=4.67.3 # data From 444f82531da4b73847acf1253ed3f306f2d52ec5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:19:42 +0000 Subject: [PATCH 04/21] build(deps): update scikit-image requirement in /requirements Updates the requirements on [scikit-image](https://github.com/scikit-image/scikit-image) to permit the latest version. - [Release notes](https://github.com/scikit-image/scikit-image/releases) - [Changelog](https://github.com/scikit-image/scikit-image/blob/main/RELEASE.txt) - [Commits](https://github.com/scikit-image/scikit-image/compare/v0.20.0...v0.26.0) --- updated-dependencies: - dependency-name: scikit-image dependency-version: 0.26.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..1213808f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -18,7 +18,7 @@ packaging>=23.1 pandas>=2.0.0 pillow>=9.4.0 pyyaml>=6.0 -scikit-image>=0.20.0 +scikit-image>=0.26.0 scikit-learn>=1.2.2 From 30bc195a23143a0f1556d7a16f71a7bfddc7b435 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:19:46 +0000 Subject: [PATCH 05/21] build(deps): update tensorboard requirement in /requirements Updates the requirements on [tensorboard](https://github.com/tensorflow/tensorboard) to permit the latest version. - [Release notes](https://github.com/tensorflow/tensorboard/releases) - [Changelog](https://github.com/tensorflow/tensorboard/blob/master/RELEASE.md) - [Commits](https://github.com/tensorflow/tensorboard/compare/2.12.3...2.20.0) --- updated-dependencies: - dependency-name: tensorboard dependency-version: 2.20.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..99d2d2d6 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -27,7 +27,7 @@ soundfile>=0.12.1 # visualize -tensorboard>=2.12.3 +tensorboard>=2.20.0 tqdm>=4.65.0 From 032dd0008b3b32a12dc115f431972524deb8ae11 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:37:12 +0800 Subject: [PATCH 06/21] ci: upgrade Python from 3.8 to 3.10+ in CI workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python 3.8 reached EOL in October 2024. Newer package versions (scikit-learn>=1.8, scikit-image>=0.26, tensorboard>=2.20) no longer support Python 3.8, causing dependabot PRs to fail CI. - functional-test: 3.8 → 3.10 - code-lint: 3.8 → 3.10 - smoke-test: 3.8/3.9/3.10 → 3.9/3.10/3.11 --- .github/workflows/code-lint.yml | 2 +- .github/workflows/functional-test.yml | 2 +- .github/workflows/smoke-test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index 7317789f..97203565 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -37,7 +37,7 @@ jobs: - name: setup python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' cache: 'pip' - name: install dependencies diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 36c94cc3..b4817eb3 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -49,7 +49,7 @@ jobs: os: - ubuntu-latest python-version: - - '3.8' + - '3.10' task: - classification - detection diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 50fdbbe9..51604317 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -34,9 +34,9 @@ jobs: - ubuntu-latest - windows-latest python-version: - - '3.8' - '3.9' - '3.10' + - '3.11' defaults: run: shell: bash -l {0} From 5c45ff9a4e31da4854b3f6efc6ba36818b5f781d Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:41:28 +0800 Subject: [PATCH 07/21] fix: ruff CLI syntax and setuptools compatibility for Python 3.10 - code-lint: ruff >=0.5 changed 'ruff .' to 'ruff check .' - functional-test/smoke-test: pin setuptools <70 to keep pkg_resources module, required by ethos-u-vela build process --- .github/workflows/code-lint.yml | 2 +- .github/workflows/functional-test.yml | 2 +- .github/workflows/smoke-test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index 97203565..1d3ae85b 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -44,4 +44,4 @@ jobs: run: python -m pip install -r requirements/tests.txt - name: ruff lint - run: python -m ruff . + run: python -m ruff check . diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index b4817eb3..e4ce023c 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -67,7 +67,7 @@ jobs: - name: pip install deps run: | - python -m pip install --upgrade pip wheel setuptools + python -m pip install --upgrade pip wheel "setuptools>=65.5,<70" python -m pip install torch==2.0.0+cpu torchvision==0.15.1+cpu torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu python -m pip install -r requirements/pytorch_cpu.txt python -m pip install -r requirements/base.txt diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 51604317..977145a9 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -53,7 +53,7 @@ jobs: - name: pip install deps (CPU) run: | - python3 -m pip install --upgrade pip wheel setuptools + python3 -m pip install --upgrade pip wheel "setuptools>=65.5,<70" python3 -m pip install -r requirements/pytorch_cpu.txt python3 -m pip install -r requirements/base.txt python3 -m pip install -r requirements/inference.txt From 9bd5376a8173c03dac8241791994e67df6572c4b Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:42:59 +0800 Subject: [PATCH 08/21] fix: pin ruff to <0.5 to avoid new lint rules with Python 3.10 Newer ruff versions introduce stricter rules that flag pre-existing code patterns as errors. Pin to a known compatible range. --- requirements/tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 5a1f15d9..b3f6db1d 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,4 +1,4 @@ black>=23.3.0 isort>=5.12.0 pre-commit>=3.3.3 -ruff>=0.0.275 +ruff>=0.1.0,<0.5 From a9f876446200d474523dea243b7ce8c87a10cc84 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:47:11 +0800 Subject: [PATCH 09/21] fix: pin ruff to 0.0.x series and fix ethos-u-vela build isolation - ruff: pin to >=0.0.275,<0.1.0 to match pre-Python-3.10 behavior and revert to 'ruff .' command (check subcommand not in 0.0.x) - functional-test/smoke-test: use --no-build-isolation for export.txt to ensure ethos-u-vela can find pkg_resources from setuptools --- .github/workflows/code-lint.yml | 2 +- .github/workflows/functional-test.yml | 2 +- .github/workflows/smoke-test.yml | 2 +- requirements/tests.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index 1d3ae85b..97203565 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -44,4 +44,4 @@ jobs: run: python -m pip install -r requirements/tests.txt - name: ruff lint - run: python -m ruff check . + run: python -m ruff . diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index e4ce023c..8721afb5 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -72,7 +72,7 @@ jobs: python -m pip install -r requirements/pytorch_cpu.txt python -m pip install -r requirements/base.txt python -m pip install -r requirements/inference.txt - python -m pip install -r requirements/export.txt + python -m pip install --no-build-isolation -r requirements/export.txt python -m mim install -r requirements/mmlab.txt python -m mim install -e . python --version diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 977145a9..1a05a4a9 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -57,7 +57,7 @@ jobs: python3 -m pip install -r requirements/pytorch_cpu.txt python3 -m pip install -r requirements/base.txt python3 -m pip install -r requirements/inference.txt - python3 -m pip install -r requirements/export.txt + python3 -m pip install --no-build-isolation -r requirements/export.txt python3 -m mim install -r requirements/mmlab.txt python3 -m mim install -e . python3 --version diff --git a/requirements/tests.txt b/requirements/tests.txt index b3f6db1d..253280ac 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,4 +1,4 @@ black>=23.3.0 isort>=5.12.0 pre-commit>=3.3.3 -ruff>=0.1.0,<0.5 +ruff>=0.0.275,<0.1.0 From 8ed22130909f1ac1e35e5d7f4ebf147af3258714 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:53:32 +0800 Subject: [PATCH 10/21] fix: auto-fix 12 ruff lint errors and constrain ethos-u-vela - Remove unused imports and variables (F401, F841) - Constrain ethos-u-vela>=5.0.0 to prevent pip backtracking to old source distributions that need pkg_resources during build --- .github/workflows/functional-test.yml | 5 +++-- sscma/models/backbones/MobileNetv4.py | 6 +----- sscma/models/layers/nn_blocks.py | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 8721afb5..695e4ff0 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -73,8 +73,9 @@ jobs: python -m pip install -r requirements/base.txt python -m pip install -r requirements/inference.txt python -m pip install --no-build-isolation -r requirements/export.txt - python -m mim install -r requirements/mmlab.txt - python -m mim install -e . + echo "ethos-u-vela>=5.0.0" > /tmp/pip-constraints.txt + PIP_CONSTRAINT=/tmp/pip-constraints.txt python -m mim install -r requirements/mmlab.txt + PIP_CONSTRAINT=/tmp/pip-constraints.txt python -m mim install -e . python --version python -m pip --version python -m pip list diff --git a/sscma/models/backbones/MobileNetv4.py b/sscma/models/backbones/MobileNetv4.py index 3b42515e..d7753d24 100644 --- a/sscma/models/backbones/MobileNetv4.py +++ b/sscma/models/backbones/MobileNetv4.py @@ -1,8 +1,6 @@ -from typing import List, Text, Dict, Union, Optional +from typing import Optional -import torch import torch.nn as nn -from torch import Tensor from sscma.models.base.general import ConvNormActivation from sscma.registry import MODELS @@ -357,11 +355,9 @@ def build_layers(self): if self._output_stride is not None and current_stride == self._output_stride: layer_stride = 1 - layer_rate = layer_rate rate *= block.stride else: layer_stride = block.stride - layer_rate = 1 current_stride *= block.stride if block.block_name == 'convbn': diff --git a/sscma/models/layers/nn_blocks.py b/sscma/models/layers/nn_blocks.py index 13eb450a..67cba07b 100644 --- a/sscma/models/layers/nn_blocks.py +++ b/sscma/models/layers/nn_blocks.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Callable, AnyStr, Union, Dict +from typing import Optional, Callable, AnyStr, Union, Dict import math import torch import torch.nn as nn @@ -378,8 +378,6 @@ def build_layer(self): layers = [] expand_channels = make_divisible(self.in_channels * self._expand_ratio, self._division) - expand_kernel = 1 if self._use_depthwise else self._kernel_size - expand_stride = 1 if self._use_depthwise else self._stride # if self._expand_ratio > 1: # layers.append( # ConvNormActivation( @@ -571,7 +569,7 @@ def forward(self, inputs: torch.Tensor): k = self.layer1(x) - num_elements = k.shape[2:].numel() + k.shape[2:].numel() channels = k.shape[1] k = k.reshape([B, channels, -1]) From 1849ce57c080a62c680415c473c774de45aa2ba9 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 08:56:58 +0800 Subject: [PATCH 11/21] fix: pin albumentations<1.4 and numpy<2.0 for Python 3.10 compat - albumentations>=1.4 removed IAAAdditiveGaussianNoise class - numpy>=2.0 incompatible with PyTorch 2.0.0 --- requirements/base.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index ce3967e4..032dc3ed 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,11 +1,11 @@ # common -albumentations<=2.0.8 +albumentations>=1.0,<1.4 libusb1 # sensor cbor -numpy>=1.23.5 +numpy>=1.23.5,<2.0 # vision From fb83425586afa72419124896e2361d1522fbcffc Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:03:48 +0800 Subject: [PATCH 12/21] fix: compat shim for IAAAdditiveGaussianNoise in albumentations>=1.4 Instead of downgrading albumentations, use try/except to fall back to GaussNoise when IAAAdditiveGaussianNoise is removed. --- requirements/base.txt | 2 +- sscma/datasets/pipelines/albu.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 032dc3ed..825fbce9 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ # common -albumentations>=1.0,<1.4 +albumentations<=2.0.8 libusb1 diff --git a/sscma/datasets/pipelines/albu.py b/sscma/datasets/pipelines/albu.py index 50b1ba2f..14f56935 100644 --- a/sscma/datasets/pipelines/albu.py +++ b/sscma/datasets/pipelines/albu.py @@ -93,10 +93,21 @@ def __init__(self, transforms, p: float = 0.5): super().__init__(transforms, p) +try: + _IAAAdditiveGaussianNoise = A.IAAAdditiveGaussianNoise + _IS_NEW_ALBUMENTATIONS = False +except AttributeError: + _IAAAdditiveGaussianNoise = A.GaussNoise + _IS_NEW_ALBUMENTATIONS = True + + @TRANSFORMS.register_module() -class IAAAdditiveGaussianNoise(A.IAAAdditiveGaussianNoise): +class IAAAdditiveGaussianNoise(_IAAAdditiveGaussianNoise): def __init__(self, loc=0, scale=..., per_channel=False, always_apply=False, p=0.5): - super().__init__(loc, scale, per_channel, always_apply, p) + if _IS_NEW_ALBUMENTATIONS: + super().__init__(mean=loc, per_channel=per_channel, always_apply=always_apply, p=p) + else: + super().__init__(loc, scale, per_channel, always_apply, p) @TRANSFORMS.register_module() From a65a1bcd24f311a5f09201d6787ec1f30e4813a5 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:10:06 +0800 Subject: [PATCH 13/21] fix: use PyTorch mirror for MNIST download Yann LeCun's site (yann.lecun.com) is frequently unavailable. Switch to the official PyTorch mirror on S3. --- sscma/datasets/mnist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sscma/datasets/mnist.py b/sscma/datasets/mnist.py index f0cad592..c8d1a34d 100644 --- a/sscma/datasets/mnist.py +++ b/sscma/datasets/mnist.py @@ -35,7 +35,7 @@ class MNIST(BaseDataset): **kwargs: Other keyword arguments in :class:`BaseDataset`. """ # noqa: E501 - url_prefix = 'http://yann.lecun.com/exdb/mnist/' + url_prefix = 'https://ossci-datasets.s3.amazonaws.com/mnist/' # train images and labels train_list = [ ['train-images-idx3-ubyte.gz', 'f68b3c2dcbeaaa9fbdd348bbdeb94873'], From 746732d4a29a3083c2c8dd038f438bc4f2bc4132 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:19:52 +0800 Subject: [PATCH 14/21] fix: replace removed pnnx.wrapper module with inline implementation pnnx==20251031 removed the wrapper submodule. convert_inputshape_to_cmd is simply converting tensor shape to a pnnx CLI argument; inlined it directly. --- tools/export.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/export.py b/tools/export.py index 53b5ab48..f2f96a0a 100644 --- a/tools/export.py +++ b/tools/export.py @@ -291,7 +291,6 @@ def export_pnnx(args, model): import sys import pnnx - from pnnx.wrapper import convert_inputshape_to_cmd model.eval() pnnx_bin_path = osp.join(osp.dirname(pnnx.__file__), 'bin') @@ -314,7 +313,7 @@ def export_pnnx(args, model): elif sys.platform.startswith('darwin'): cmd += os.path.join(pnnx_bin_path, dir_dict['darwin'], 'pnnx ') cmd += 'model.pt ' - cmd += convert_inputshape_to_cmd(x) + cmd += 'inputshape=' + ','.join(str(d) for d in x.shape) + ' ' cmd += ' pnnxparam=' + get_exported_file_name_from_precision(args, 'float', '.pnnx.param') cmd += ' pnnxbin=' + get_exported_file_name_from_precision(args, 'float', '.pnnx.bin') cmd += ' pnnxpy=' + get_exported_file_name_from_precision(args, 'float', '.pnnx.py') From a88fcfef43d61ee80130e5b51218b71f99b37e21 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:25:59 +0800 Subject: [PATCH 15/21] fix: adapt export_pnnx to new pnnx package layout pnnx>=20251031 bundles the binary directly in the package root (accessible via pnnx.EXEC_PATH) instead of in bin//pnnx. --- tools/export.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/tools/export.py b/tools/export.py index f2f96a0a..4058d9e4 100644 --- a/tools/export.py +++ b/tools/export.py @@ -288,30 +288,13 @@ def get_exported_file_name_from_precision(args, precision, ext: str = '') -> str def export_pnnx(args, model): import os.path as osp - import sys import pnnx model.eval() - pnnx_bin_path = osp.join(osp.dirname(pnnx.__file__), 'bin') - bin_list = os.listdir(pnnx_bin_path) x = torch.randn(args.input_shape) - cmd = '' - dir_dict = {} - for dir_name in bin_list: - if 'ubuntu' in dir_name: - dir_dict['linux'] = dir_name - elif 'windows' in dir_name: - dir_dict['win'] = dir_name - elif 'macos' in dir_name: - dir_dict['darwin'] = dir_name - if sys.platform.startswith('linux'): - cmd += os.path.join(pnnx_bin_path, dir_dict['linux'], 'pnnx ') - elif sys.platform.startswith('win'): - cmd += os.path.join(pnnx_bin_path, dir_dict['win'], 'pnnx.exe ') - elif sys.platform.startswith('darwin'): - cmd += os.path.join(pnnx_bin_path, dir_dict['darwin'], 'pnnx ') + cmd = pnnx.EXEC_PATH + ' ' cmd += 'model.pt ' cmd += 'inputshape=' + ','.join(str(d) for d in x.shape) + ' ' cmd += ' pnnxparam=' + get_exported_file_name_from_precision(args, 'float', '.pnnx.param') From 4ded7f8a6e6658725b713cc402b69df0b3f42db7 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:36:38 +0800 Subject: [PATCH 16/21] fix: remove unused osp import in export_pnnx --- tools/export.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/export.py b/tools/export.py index 4058d9e4..f94c004f 100644 --- a/tools/export.py +++ b/tools/export.py @@ -287,8 +287,6 @@ def get_exported_file_name_from_precision(args, precision, ext: str = '') -> str def export_pnnx(args, model): - import os.path as osp - import pnnx model.eval() From 51bac98ab54a7a6d4eb455eba83086137e5bf913 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 09:52:38 +0800 Subject: [PATCH 17/21] fix: pin scikit-image<0.26, requires Python>=3.11 --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index 7d0954ee..e38d2207 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -18,7 +18,7 @@ packaging>=23.1 pandas>=2.0.0 pillow>=9.4.0 pyyaml>=6.0 -scikit-image>=0.26.0 +scikit-image>=0.25.0,<0.26 scikit-learn>=1.8.0 From 30d9ecb444592ae36715270c1881c7c6db7dcd79 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 10:02:35 +0800 Subject: [PATCH 18/21] Switch CI Python version from 3.10 to 3.11 Python 3.11 natively supports PyTorch 2.0 and all updated dependencies (scikit-image>=0.26, scikit-learn>=1.8). --- .github/workflows/code-lint.yml | 2 +- .github/workflows/functional-test.yml | 2 +- .github/workflows/smoke-test.yml | 2 +- requirements/base.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index 97203565..96973e23 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -37,7 +37,7 @@ jobs: - name: setup python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' cache: 'pip' - name: install dependencies diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 695e4ff0..5086cc31 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -49,7 +49,7 @@ jobs: os: - ubuntu-latest python-version: - - '3.10' + - '3.11' task: - classification - detection diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 1a05a4a9..757c06ba 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -34,9 +34,9 @@ jobs: - ubuntu-latest - windows-latest python-version: - - '3.9' - '3.10' - '3.11' + - '3.12' defaults: run: shell: bash -l {0} diff --git a/requirements/base.txt b/requirements/base.txt index e38d2207..7d0954ee 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -18,7 +18,7 @@ packaging>=23.1 pandas>=2.0.0 pillow>=9.4.0 pyyaml>=6.0 -scikit-image>=0.25.0,<0.26 +scikit-image>=0.26.0 scikit-learn>=1.8.0 From aacff32220abbd2b7b1511de0380b9a3f74a063c Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 10:04:34 +0800 Subject: [PATCH 19/21] fix: use --no-build-isolation for all pip installs Python 3.11 may not have pre-built wheels for some packages (e.g. albumentations), causing source builds that need pkg_resources from setuptools. --- .github/workflows/functional-test.yml | 6 +++--- .github/workflows/smoke-test.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 5086cc31..81b909c0 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -69,9 +69,9 @@ jobs: run: | python -m pip install --upgrade pip wheel "setuptools>=65.5,<70" python -m pip install torch==2.0.0+cpu torchvision==0.15.1+cpu torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu - python -m pip install -r requirements/pytorch_cpu.txt - python -m pip install -r requirements/base.txt - python -m pip install -r requirements/inference.txt + python -m pip install --no-build-isolation -r requirements/pytorch_cpu.txt + python -m pip install --no-build-isolation -r requirements/base.txt + python -m pip install --no-build-isolation -r requirements/inference.txt python -m pip install --no-build-isolation -r requirements/export.txt echo "ethos-u-vela>=5.0.0" > /tmp/pip-constraints.txt PIP_CONSTRAINT=/tmp/pip-constraints.txt python -m mim install -r requirements/mmlab.txt diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 757c06ba..7d42fa99 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -54,9 +54,9 @@ jobs: - name: pip install deps (CPU) run: | python3 -m pip install --upgrade pip wheel "setuptools>=65.5,<70" - python3 -m pip install -r requirements/pytorch_cpu.txt - python3 -m pip install -r requirements/base.txt - python3 -m pip install -r requirements/inference.txt + python3 -m pip install --no-build-isolation -r requirements/pytorch_cpu.txt + python3 -m pip install --no-build-isolation -r requirements/base.txt + python3 -m pip install --no-build-isolation -r requirements/inference.txt python3 -m pip install --no-build-isolation -r requirements/export.txt python3 -m mim install -r requirements/mmlab.txt python3 -m mim install -e . From f1bff08afc23b2608621427ae84f4712404eecba Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 10:07:03 +0800 Subject: [PATCH 20/21] fix: pin opencv-python<4.10 for numpy<2.0 compat opencv-python>=4.10 requires numpy>=2, conflicting with PyTorch 2.0 which needs numpy<2. --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index 7d0954ee..3cd9a92b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -9,7 +9,7 @@ numpy>=1.23.5,<2.0 # vision -opencv-python>=4.13.0.92 +opencv-python>=4.9.0.80,<4.10 # openmmlab package manager From bc5ab0b72559f07849b3f7e536a509825aaaf105 Mon Sep 17 00:00:00 2001 From: pillar1989 Date: Tue, 2 Jun 2026 10:25:08 +0800 Subject: [PATCH 21/21] Revert ruff auto-fix changes to model files The removed variables (expand_kernel, expand_stride, num_elements) and unused imports in MobileNetv4 are intentional or tied to commented-out code. Instead of modifying production model code, ignore these specific lint issues via pyproject.toml. --- pyproject.toml | 4 ++++ sscma/models/backbones/MobileNetv4.py | 6 +++++- sscma/models/layers/nn_blocks.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e107eeb1..bc7e1151 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,5 +41,9 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" target-version = "py38" +[tool.ruff.per-file-ignores] +"sscma/models/backbones/MobileNetv4.py" = ["F401", "F821", "F841"] +"sscma/models/layers/nn_blocks.py" = ["F401", "F841"] + [tool.ruff.mccabe] max-complexity = 10 diff --git a/sscma/models/backbones/MobileNetv4.py b/sscma/models/backbones/MobileNetv4.py index d7753d24..3b42515e 100644 --- a/sscma/models/backbones/MobileNetv4.py +++ b/sscma/models/backbones/MobileNetv4.py @@ -1,6 +1,8 @@ -from typing import Optional +from typing import List, Text, Dict, Union, Optional +import torch import torch.nn as nn +from torch import Tensor from sscma.models.base.general import ConvNormActivation from sscma.registry import MODELS @@ -355,9 +357,11 @@ def build_layers(self): if self._output_stride is not None and current_stride == self._output_stride: layer_stride = 1 + layer_rate = layer_rate rate *= block.stride else: layer_stride = block.stride + layer_rate = 1 current_stride *= block.stride if block.block_name == 'convbn': diff --git a/sscma/models/layers/nn_blocks.py b/sscma/models/layers/nn_blocks.py index 67cba07b..13eb450a 100644 --- a/sscma/models/layers/nn_blocks.py +++ b/sscma/models/layers/nn_blocks.py @@ -1,4 +1,4 @@ -from typing import Optional, Callable, AnyStr, Union, Dict +from typing import List, Optional, Callable, AnyStr, Union, Dict import math import torch import torch.nn as nn @@ -378,6 +378,8 @@ def build_layer(self): layers = [] expand_channels = make_divisible(self.in_channels * self._expand_ratio, self._division) + expand_kernel = 1 if self._use_depthwise else self._kernel_size + expand_stride = 1 if self._use_depthwise else self._stride # if self._expand_ratio > 1: # layers.append( # ConvNormActivation( @@ -569,7 +571,7 @@ def forward(self, inputs: torch.Tensor): k = self.layer1(x) - k.shape[2:].numel() + num_elements = k.shape[2:].numel() channels = k.shape[1] k = k.reshape([B, channels, -1])