Package FastVisionOps for Git installs and organize modules #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install package | |
| run: python -m pip install --upgrade pip && python -m pip install . | |
| - name: Verify installed native package | |
| working-directory: ${{ runner.temp }} | |
| run: | | |
| python - <<'PY' | |
| import numpy as np | |
| from fastvisionops import NativeBackend | |
| backend = NativeBackend() | |
| assert backend.library_path.name.startswith("_native") | |
| np.testing.assert_array_equal( | |
| backend.nms( | |
| [[0, 0, 10, 10], [1, 1, 9, 9], [20, 20, 30, 30]], | |
| [0.9, 0.8, 0.7], | |
| ), | |
| [0, 2], | |
| ) | |
| output = backend.hwc_to_chw_normalize( | |
| np.zeros((4, 5, 3), dtype=np.uint8), | |
| [0, 0, 0], | |
| [1, 1, 1], | |
| threads=2, | |
| ) | |
| assert output.shape == (3, 4, 5) | |
| PY | |
| - name: Build native backend | |
| run: python -m fastvisionops.build | |
| - name: Verify portable native build | |
| run: | | |
| python -m fastvisionops.build \ | |
| --no-openmp \ | |
| --output "${RUNNER_TEMP}/libfastvisionops-portable.so" | |
| python - <<'PY' | |
| import os | |
| import numpy as np | |
| from fastvisionops import NativeBackend | |
| backend = NativeBackend( | |
| os.path.join( | |
| os.environ["RUNNER_TEMP"], | |
| "libfastvisionops-portable.so", | |
| ) | |
| ) | |
| np.testing.assert_array_equal( | |
| backend.nms( | |
| [[0, 0, 10, 10], [1, 1, 9, 9], [20, 20, 30, 30]], | |
| [0.9, 0.8, 0.7], | |
| ), | |
| [0, 2], | |
| ) | |
| PY | |
| - name: Run test suite | |
| run: python -m unittest discover -s tests -v | |
| - name: Smoke-test benchmark runners | |
| run: | | |
| python -m benchmarks.benchmark_bbox --sizes 16 64 --warmup 0 --repeats 1 --batch-size 2 --batch-boxes 32 --workers 2 --format json | |
| python -m benchmarks.benchmark_preprocess --batches 1 2 --height 32 --width 32 --warmup 0 --repeats 1 --threads 2 --format json |