Add YOLO26 monocular depth estimation #1162
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
| # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license | |
| name: CI | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 0 * * *" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # CI builds don't need debuginfo; dropping it cuts crate compile+link | |
| CARGO_PROFILE_DEV_DEBUG: "0" | |
| CARGO_PROFILE_TEST_DEBUG: "0" | |
| # Incremental compilation adds overhead and never hits on cold CI runners. | |
| CARGO_INCREMENTAL: "0" | |
| jobs: | |
| # Cross-platform tests (default features only - no video/ffmpeg required) | |
| test: | |
| name: test / ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| # macos-latest's default Xcode 16.4 toolchain dangles libclang_rt.osx.a | |
| # (ld: library 'clang_rt.osx' not found). Select a present, known-good | |
| # Xcode and export its version so the Rust cache key is scoped to it - | |
| # otherwise a cache built under one image's Xcode dangles on another. | |
| - name: Select Xcode (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| sudo xcode-select -s "$(ls -d /Applications/Xcode_*.app | grep -vE 'beta|16\.4' | sort -V | tail -1)" | |
| xcodebuild -version | |
| echo "XCODE_VER=$(xcodebuild -version | head -1 | awk '{print $2}')" >> "$GITHUB_ENV" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| # Formatting is platform-independent; check it once instead of on every OS. | |
| - name: Format | |
| if: matrix.os == 'ubuntu-latest' | |
| run: cargo fmt --all -- --check | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| key: xcode-${{ env.XCODE_VER }} | |
| - name: Ensure toolchain | |
| run: rustup show | |
| - name: Clippy (annotate feature) | |
| if: matrix.os != 'macos-latest' | |
| run: cargo clippy --all-targets --no-default-features --features annotate -- -D warnings | |
| - name: Tests (annotate feature) | |
| if: matrix.os != 'macos-latest' | |
| run: cargo test --no-default-features --features annotate | |
| # CoreML is macOS-only — covers issue #148 (GatherElements warmup) and graph_input_cast_0 fix | |
| - name: Clippy (coreml + annotate) | |
| if: matrix.os == 'macos-latest' | |
| run: cargo clippy --all-targets --no-default-features --features "coreml,annotate" -- -D warnings | |
| - name: Tests (coreml + annotate) | |
| if: matrix.os == 'macos-latest' | |
| run: cargo test --no-default-features --features "coreml,annotate" | |
| - name: Integration tests (CoreML regression, including ignored) | |
| if: matrix.os == 'macos-latest' | |
| run: cargo test --no-default-features --features "coreml,annotate" --test integration_test test_coreml_model_loads_and_warms_up -- --ignored --exact | |
| # Video feature tests for Linux - FFmpeg 7 and 8 | |
| test-video: | |
| name: test / linux / ffmpeg ${{ matrix.ffmpeg_version }} | |
| runs-on: ubuntu-latest | |
| container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu | |
| strategy: | |
| matrix: | |
| ffmpeg_version: ["8.0", "7.1"] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Install dependencies | |
| run: | | |
| DEBIAN_FRONTEND=noninteractive apt-get update | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ca-certificates clang curl pkg-config libssl-dev | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| # Key on ffmpeg version so each container gets its own cache | |
| key: ffmpeg-${{ matrix.ffmpeg_version }} | |
| - name: Ensure toolchain | |
| run: rustup show | |
| - name: Clippy (annotate + video) | |
| run: cargo clippy --all --features annotate,video -- -D warnings | |
| - name: Tests (annotate + video) | |
| run: cargo test --all --features annotate,video | |
| # macOS FFmpeg 8 video build test | |
| build-macos-video: | |
| name: build / macos / ffmpeg 8 / video | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| # macos-latest's default Xcode 16.4 toolchain dangles libclang_rt.osx.a | |
| # (ld: library 'clang_rt.osx' not found). Select a present, known-good | |
| # Xcode and export its version so the Rust cache key is scoped to it - | |
| # otherwise a cache built under one image's Xcode dangles on another. | |
| - name: Select Xcode (macOS) | |
| run: | | |
| sudo xcode-select -s "$(ls -d /Applications/Xcode_*.app | grep -vE 'beta|16\.4' | sort -V | tail -1)" | |
| xcodebuild -version | |
| echo "XCODE_VER=$(xcodebuild -version | head -1 | awk '{print $2}')" >> "$GITHUB_ENV" | |
| - name: Install dependencies | |
| run: brew install ffmpeg | |
| - name: Capture FFmpeg version for cache key | |
| run: echo "FFMPEG_VERSION=$(brew list --versions ffmpeg | awk '{print $2}')" >> "$GITHUB_ENV" | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| key: ffmpeg-${{ env.FFMPEG_VERSION }}-xcode-${{ env.XCODE_VER }} | |
| - name: Ensure toolchain | |
| run: rustup show | |
| - name: Build (annotate + video features) | |
| run: cargo build --release --features "annotate,video,visualize" --bin ultralytics-inference | |
| # Windows FFmpeg 8 video build test | |
| build-windows-video: | |
| name: build / windows / ffmpeg 8 / video | |
| runs-on: windows-latest | |
| env: | |
| FFMPEG_VERSION: "8.1.1" | |
| FFMPEG_DOWNLOAD_URL: https://github.com/GyanD/codexffmpeg/releases/download/8.1.1/ffmpeg-8.1.1-full_build-shared.7z | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Cache FFmpeg | |
| id: cache-ffmpeg | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ffmpeg | |
| key: windows-ffmpeg-${{ env.FFMPEG_VERSION }} | |
| - name: Download FFmpeg | |
| if: steps.cache-ffmpeg.outputs.cache-hit != 'true' | |
| run: | | |
| Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-shared.7z | |
| 7z x ffmpeg-shared.7z | |
| mkdir ffmpeg | |
| mv ffmpeg-*/* ffmpeg/ | |
| - name: Set FFmpeg environment variables | |
| run: | | |
| $VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
| Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin" | |
| Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg" | |
| Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin" | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Ensure toolchain | |
| run: rustup show | |
| - name: Build (annotate + video features) | |
| run: cargo build --features annotate,video | |
| # Browser/WebAssembly build: guards that the core library stays wasm-compatible | |
| # and that the WebGPU (ort-web) bindings + npm wrapper build end to end. | |
| wasm: | |
| name: wasm / browser | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: clippy | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| key: wasm | |
| - name: Ensure toolchain | |
| run: rustup show | |
| # The core crate must keep compiling for wasm without the native backend. | |
| - name: Build core lib for wasm32 | |
| run: cargo build -p ultralytics-inference --lib --no-default-features --target wasm32-unknown-unknown | |
| - name: Clippy WebGPU bindings (wasm32) | |
| run: cargo clippy -p ultralytics-inference-web --target wasm32-unknown-unknown -- -D warnings | |
| - name: Install wasm-pack | |
| uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10 | |
| with: | |
| tool: wasm-pack | |
| - name: Set up Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 20 | |
| # Builds the wasm (wasm-pack) and the TypeScript wrapper. | |
| - name: Build npm package | |
| working-directory: web | |
| run: | | |
| npm ci | |
| npm run build | |
| # Code coverage (runs on Ubuntu with FFmpeg dev libs for full feature coverage) | |
| coverage: | |
| name: coverage | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y pkg-config libavutil-dev libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev libswscale-dev libswresample-dev libpostproc-dev clang | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| # Nightly toolchain version in rustc -V already gives this job a unique cache key | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Ensure toolchain | |
| run: rustup show | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Coverage | |
| # Exclude code that host-side unit tests cannot exercise: the CUDA kernel | |
| # (needs an NVIDIA GPU), the minifb viewer window (GUI), the thin CLI | |
| # entry point, and the wasm32-only web crate. | |
| run: cargo llvm-cov --features annotate,video,visualize --workspace --lcov --output-path lcov.info --ignore-filename-regex '(src/cuda_inference\.rs|src/visualizer/viewer\.rs|src/main\.rs|crates/web/)' | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| files: ./lcov.info | |
| disable_search: true | |
| fail_ci_if_error: true | |
| plugins: noop | |
| flags: template_coverage | |
| use_oidc: true |