Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPU object detection in Frigate on old NVIDIA Maxwell cards

Make Frigate use your old NVIDIA card (Quadro K2200, GTX 750/900 series, and other Maxwell GPUs) for object detection — the thing that officially doesn't work and fails with:

CUDA error cudaErrorNoKernelImageForDevice: no kernel image is available for execution on the device

If you've seen that error, or Frigate ignores your GPU and warns CPU detectors are not recommended, this repo is for you. No coding skills needed — just the ability to copy-paste commands into a terminal.

Verified working: Quadro K2200 running Frigate 0.17.2, YOLO-NAS-S 320 at ~33 ms per inference (≈30 detections/second) plus the large face recognition model. A 2014 card doing modern NVR duty.


Why this happens (short version)

Frigate's -tensorrt Docker image contains everything your Maxwell card needs — the driver works, CUDA 12 works, cuDNN works — except one file: the onnxruntime-gpu library ships prebuilt GPU code only for newer card generations. Your card's generation (called "compute capability 5.0/5.2", codename Maxwell) was dropped from the official builds.

The fix is simply that same library rebuilt with your card's generation included. That's what this repo provides.

Is my card a Maxwell?

Run on the machine with the GPU:

nvidia-smi --query-gpu=name,compute_cap --format=csv

If compute_cap says 5.0 or 5.2, you're in the right place. Common cards: GTX 750/750 Ti, GTX 950/960/970/980 (Ti), GTX 960M and other 900M laptop chips, Quadro K620/K1200/K2200, Quadro M2000/M4000/M5000, Tesla M40/M60.

(Compute 6.x Pascal cards like the GTX 1060/1080 do not need this — they work with the stock image.)

What you need

  • Frigate running in Docker with the -tensorrt image tag (e.g. ghcr.io/blakeblackshear/frigate:stable-tensorrt)
  • The NVIDIA driver + container toolkit already working — nvidia-smi must show your card inside the container: docker exec frigate nvidia-smi
  • Frigate 0.16/0.17 era image (Python 3.11, CUDA 12.x, onnxruntime 1.22.0). Check yours matches (three commands, compare the numbers):
    docker exec frigate python3 --version                       # want: 3.11.x
    docker exec frigate pip list | grep onnxruntime-gpu         # want: 1.22.0
    docker exec frigate pip list | grep nvidia-cuda-runtime     # want: 12.x
    
    All match → use the prebuilt file (Step 1). Different → build your own (see "Building it yourself" below), it's one command and ~25 minutes.

Everywhere below, frigate is the container name. If yours is called something else, swap it in.

Step 1 — Download the patched library

Grab onnxruntime_gpu-1.22.0-cp311-cp311-linux_x86_64.whl from the Releases page and put it in your Frigate config folder (the folder on your server that Frigate sees as /config — the same place your config.yml lives).

Step 2 — Install it into the container

Run on your Docker host:

docker exec frigate pip install --break-system-packages --force-reinstall --no-deps /config/onnxruntime_gpu-1.22.0-cp311-cp311-linux_x86_64.whl

Step 3 — Test it (before touching your config)

docker exec -i frigate python3 - <<'EOF'
import onnxruntime as ort, numpy as np
print("providers:", ort.get_available_providers())
EOF

You should see CUDAExecutionProvider in the list and no error. (If you already have an ONNX model in /config, the real proof comes after the restart in Step 4 — watch for the error being gone from the logs.)

Step 4 — Point Frigate at your GPU

Add this to your Frigate config (this example uses YOLO-NAS — download it via Frigate's official docs, which have a ready-made notebook that produces yolo_nas_s.onnx):

detectors:
  onnx:
    type: onnx
    device: "0"

model:
  model_type: yolonas
  width: 320
  height: 320
  input_pixel_format: bgr
  input_tensor: nchw
  path: /config/yolo_nas_s.onnx
  labelmap_path: /labelmap/coco-80.txt

Restart Frigate. In the logs you want to see ONNX: <your model> loaded, and no CPU detectors are not recommended warning. nvidia-smi on the host should show a frigate.detector:onnx process holding GPU memory. In the Frigate UI, System metrics should show inference around 30–40 ms.

Bonus: face recognition's large model now also runs on your GPU.

⚠️ Step 5 — Make it survive updates (important!)

Every time you update the Frigate image, the patch is silently wiped and detection falls back to CPU. The tell-tale sign: the CPU detectors are not recommended warning is back in the logs.

Copy reapply.sh from this repo next to the .whl file in your config folder, then after every Frigate update run:

sh /path/to/your/frigate/config/reapply.sh

(It just re-runs the install command and restarts the container.)

Building it yourself

If your Frigate image has different versions (a newer release bumped onnxruntime, Python, or CUDA), build a matching wheel with build-onnxruntime-maxwell.sh. On the Docker host (any machine with Docker — the GPU is not needed for building):

mkdir -p ~/ort-out
docker run --rm --name ort-maxwell-build \
  -v $(pwd)/build-onnxruntime-maxwell.sh:/build.sh:ro \
  -v ~/ort-out:/out \
  nvidia/cuda:12.5.1-cudnn-devel-ubuntu22.04 bash /build.sh

Takes ~25 minutes on a decent CPU (needs ~16 GB RAM and ~30 GB free disk for the build container). The finished .whl appears in ~/ort-out. Before running, open the script and match the three versions at the top comments to your container (onnxruntime git tag, Python version, and the CUDA base image in the command above).

The script already works around two build landmines: CMake 4 breaking old dependencies, and a stale download checksum for the eigen library.

FAQ

Is this safe? The script builds the official, unmodified microsoft/onnxruntime source code — the only change is a build flag (CMAKE_CUDA_ARCHITECTURES=50) telling it to include GPU code for Maxwell cards. Don't trust random binaries from the internet? Good instinct — build it yourself with the script and you get the identical result.

How fast is it? Quadro K2200 (640 CUDA cores): ~33 ms per YOLO-NAS-S 320 inference ≈ 30 detections/sec. Rule of thumb: comfortable for 3–4 cameras of person detection, workable for 5–6 with well-tuned motion masks. Decode is a separate dedicated chip on the card and is never the bottleneck.

What about TensorRT? Gone forever for Maxwell (TensorRT 10 dropped it). This patch uses the CUDA execution provider instead, which is why the wheel is built without TensorRT. For Frigate-sized models the difference is minor.

Will this work forever? No — and you should know the expiry condition: CUDA 13 removed Maxwell support entirely (the compiler can no longer produce code for these cards). This patch works as long as your Frigate image ships CUDA 12.x. When Frigate moves to CUDA 13, Maxwell's road genuinely ends — plan for a cheap used Turing card (Quadro T400, GTX 1650) at that point.

Rollback? docker exec frigate pip install --break-system-packages --force-reinstall onnxruntime-gpu==1.22.0 puts the stock library back (CPU detection).

My card is Kepler (compute 3.x)? Sorry — CUDA 12 itself already dropped Kepler. This trick can't help; the toolchain can't target your card at all.

Background

The failure is well documented but was never solved in the Frigate discussions (#21006, #20016) — the answer is simply that nobody had published a Maxwell build of onnxruntime. Now one exists. Not affiliated with the Frigate or ONNX Runtime projects.

About

Run Frigate NVR object detection on old NVIDIA Maxwell GPUs (Quadro K2200, GTX 750/900 series) — patched onnxruntime-gpu wheel + build script. Fixes cudaErrorNoKernelImageForDevice.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages