[Detector Support]: couldn't get yolov9 obj detector working on frigate #23454
-
Describe the problem you are havingi am running frigate in proxmox vm with docker compose, Versionfrigate:stable-tensorrt Frigate config filemqtt:
host: mqtt
topic_prefix: frigate
version: 0.17-0
objects:
track:
- person
filters:
person:
min_score: 0.8
detectors:
onnx:
type: onnx
model:
model_type: yolo-generic
width: 640
height: 640
input_tensor: nchw
input_dtype: float
path: /config/model_cache/yolov9-m.onnx
labelmap_path: /labelmap/coco-80.txt
detect:
enabled: true
fps: 5
cameras:
west-road-view-D1:
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia-h264
output_args:
record: preset-record-generic-audio-aac
inputs:
- path:
rtsp://admin:pass@192.168.1.201:554/cam/realmonitor?channel=1&subtype=0
input_args: preset-rtsp-restream
roles: [record]
- path:
rtsp://admin:pass@192.168.1.201:554/cam/realmonitor?channel=1&subtype=1
roles: [detect]
detect:
enabled: true
width: 640
height: 380
record:
enabled: true
alerts:
retain:
days: 30
mode: motion
detections:
retain:
days: 30
mode: motion
continuous:
days: 30
motion:
days: 30
semantic_search:
enabled: false
model_size: large
face_recognition:
enabled: true
model_size: large
lpr:
enabled: false
classification:
bird:
enabled: false
notifications:
enabled: true
email: myemaildocker-compose file or Docker CLI commandservices:
frigate:
deploy:
resources:
reservations:
devices:
- driver: nvidia
# device_ids: ['0']
count: 1 # number of GPUs
capabilities: [gpu]
container_name: frigate
privileged: true # this may not be necessary for all setups
restart: unless-stopped
stop_grace_period: 30s # allow enough time to shut down the various services
image: ghcr.io/blakeblackshear/frigate:stable-tensorrt
shm_size: "512mb" # update for your cameras based on calculation above
volumes:
- /etc/localtime:/etc/localtime:ro
- /home/docker/data/frigate/config:/config
- /home/docker/hdd/wd-video/storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "8971:8971"
- "5000:5000" # Internal unauthenticated access. Expose carefully.
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "pass"Relevant Frigate log outputfrigate | s6-rc: info: service frigate: starting
frigate | s6-rc: info: service go2rtc-healthcheck successfully started
frigate | s6-rc: info: service frigate successfully started
frigate | s6-rc: info: service nginx: starting
frigate | 2026-06-11 13:43:03.912668255 [INFO] Starting NGINX...
frigate | 2026-06-11 13:43:03.964343700 [INFO] Preparing Frigate...
frigate | 2026-06-11 13:43:04.170554039 [INFO] Preparing new go2rtc config...
frigate | 2026-06-11 13:43:04.191693710 [INFO] Starting Frigate...
frigate | 2026-06-11 13:43:04.404572003 [INFO] Starting go2rtc...
frigate | 2026-06-11 13:43:04.647562054 13:43:04.645 INF go2rtc platform=linux/amd64 revision=df95ce3 version=1.9.10
frigate | 2026-06-11 13:43:04.647565911 13:43:04.645 INF config path=/config/go2rtc_homekit.yml
frigate | 2026-06-11 13:43:04.647568055 13:43:04.646 INF [rtsp] listen addr=:8554
frigate | 2026-06-11 13:43:04.647569568 13:43:04.646 INF [webrtc] listen addr=:8555
frigate | 2026-06-11 13:43:04.647570901 13:43:04.647 INF [api] listen addr=:1984
frigate | s6-rc: info: service nginx successfully started
frigate | s6-rc: info: service certsync: starting
frigate | s6-rc: info: service certsync successfully started
frigate | s6-rc: info: service legacy-services: starting
frigate | 2026-06-11 13:43:05.220451297 [INFO] Starting certsync...
frigate | s6-rc: info: service legacy-services successfully started
frigate | 2026-06-11 13:43:05.511968505 127.0.0.1 - - [11/Jun/2026:13:43:05 +0000] "" 400 0 "-" "-" "-" request_time="0.000" upstream_response_time="-"
frigate | 2026-06-11 13:43:06.905223994 [2026-06-11 13:43:06] frigate.util.config INFO : Checking if frigate config needs migration...
frigate | 2026-06-11 13:43:06.931734809 [2026-06-11 13:43:06] frigate.util.config INFO : frigate config does not need migration...
frigate | 2026-06-11 13:43:07.971628256 [2026-06-11 13:43:07] frigate.util.services INFO : Automatically detected nvidia hwaccel for video decoding
frigate | 2026-06-11 13:43:08.162079775 [2026-06-11 13:43:08] frigate.app INFO : Starting Frigate (0.17.0-f0d69f7)
frigate | 2026-06-11 13:43:08.279380890 [2026-06-11 13:43:08] peewee_migrate.logs INFO : Starting migrations
frigate | 2026-06-11 13:43:08.279870652 [2026-06-11 13:43:08] peewee_migrate.logs INFO : There is nothing to migrate
frigate | 2026-06-11 13:43:08.306506988 [2026-06-11 13:43:08] frigate.app INFO : Recording process started: 1023
frigate | 2026-06-11 13:43:08.320712085 [2026-06-11 13:43:08] frigate.app INFO : Review process started: 1036
frigate | 2026-06-11 13:43:08.322820262 [2026-06-11 13:43:08] frigate.app INFO : go2rtc process pid: 165
frigate | 2026-06-11 13:43:08.522149549 [2026-06-11 13:43:08] frigate.app INFO : Embedding process started: 1046
frigate | 2026-06-11 13:43:08.543900444 [2026-06-11 13:43:08] frigate.detectors.plugins.onnx INFO : ONNX: loading /config/model_cache/yolov9-m.onnx
frigate | 2026-06-11 13:43:08.570803638 [2026-06-11 13:43:08] frigate.app INFO : Output process started: 1117
frigate | 2026-06-11 13:43:08.606869690 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Camera processor started for west-road-view-D1: 1177
frigate | 2026-06-11 13:43:08.638231619 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Capture process started for west-road-view-D1: 1260
frigate | 2026-06-11 13:43:08.663494908 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Camera processor started for east-side-D2: 1326
frigate | 2026-06-11 13:43:08.685607363 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Capture process started for east-side-D2: 1383
frigate | 2026-06-11 13:43:08.709586825 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Camera processor started for porch-to-door-D3: 1449
frigate | 2026-06-11 13:43:08.752033886 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Capture process started for porch-to-door-D3: 1506
frigate | 2026-06-11 13:43:08.794680748 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Camera processor started for porch-to-north-road-D4: 1583
frigate | 2026-06-11 13:43:08.818728741 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Capture process started for porch-to-north-road-D4: 1640
frigate | 2026-06-11 13:43:08.844136795 [2026-06-11 13:43:08] frigate.api.fastapi_app INFO : Starting FastAPI app
frigate | 2026-06-11 13:43:08.872991057 2026/06/11 13:43:08 [error] 255#255: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", subrequest: "/auth", upstream: "http://127.0.0.1:5001/auth", host: "127.0.0.1:5000"
frigate | 2026-06-11 13:43:08.872996587 2026/06/11 13:43:08 [error] 255#255: *2 auth request unexpected status: 502 while sending to client, client: 127.0.0.1, server: , request: "GET /api/version HTTP/1.1", host: "127.0.0.1:5000"
frigate | 2026-06-11 13:43:08.972593877 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Camera processor started for porch-to-gateD5: 1706
frigate | 2026-06-11 13:43:08.973055086 [2026-06-11 13:43:08] frigate.api.fastapi_app INFO : FastAPI started
frigate | 2026-06-11 13:43:08.996784562 [2026-06-11 13:43:08] frigate.camera.maintainer INFO : Capture process started for porch-to-gateD5: 1790
frigate | 2026-06-11 13:43:09.035432203 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Camera processor started for west-side-road-D6: 1867
frigate | 2026-06-11 13:43:09.059153624 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Capture process started for west-side-road-D6: 1924
frigate | 2026-06-11 13:43:09.081054245 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Camera processor started for terris-D7: 1990
frigate | 2026-06-11 13:43:09.119009628 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Capture process started for terris-D7: 2047
frigate | 2026-06-11 13:43:09.147372472 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Camera processor started for east-side-D8: 2113
frigate | 2026-06-11 13:43:09.174579595 [2026-06-11 13:43:09] frigate.camera.maintainer INFO : Capture process started for east-side-D8: 2170
frigate | 2026-06-11 13:43:09.175381833 [2026-06-11 13:43:09] frigate.detectors.plugins.onnx INFO : ONNX: /config/model_cache/yolov9-m.onnx loaded
frigate | 2026-06-11 13:43:10.906048679 Process frigate.detector:onnx:
frigate | 2026-06-11 13:43:10.906051845 Traceback (most recent call last):
frigate | 2026-06-11 13:43:10.906053087 File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
frigate | 2026-06-11 13:43:10.906056884 self.run()
frigate | 2026-06-11 13:43:10.906058407 File "/opt/frigate/frigate/object_detection/base.py", line 170, in run
frigate | 2026-06-11 13:43:10.906059399 detections = object_detector.detect_raw(input_frame)
frigate | 2026-06-11 13:43:10.906084417 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2026-06-11 13:43:10.906086421 File "/opt/frigate/frigate/object_detection/base.py", line 101, in detect_raw
frigate | 2026-06-11 13:43:10.906087713 return self.detect_api.detect_raw(tensor_input=tensor_input)
frigate | 2026-06-11 13:43:10.906088655 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2026-06-11 13:43:10.906089637 File "/opt/frigate/frigate/detectors/plugins/onnx.py", line 93, in detect_raw
frigate | 2026-06-11 13:43:10.906105848 return post_process_yolo(tensor_output, self.width, self.height)
frigate | 2026-06-11 13:43:10.906106940 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2026-06-11 13:43:10.906108143 File "/opt/frigate/frigate/util/model.py", line 231, in post_process_yolo
frigate | 2026-06-11 13:43:10.906108984 return __post_process_multipart_yolo(output, width, height)
frigate | 2026-06-11 13:43:10.906121608 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2026-06-11 13:43:10.906122800 File "/opt/frigate/frigate/util/model.py", line 121, in __post_process_multipart_yolo
frigate | 2026-06-11 13:43:10.906123562 bs, _, ny, nx = output.shape
frigate | 2026-06-11 13:43:10.906124082 ^^^^^^^^^^^^^
frigate | 2026-06-11 13:43:10.906124934 ValueError: not enough values to unpack (expected 4, got 3)Install methodDocker Compose Object DetectorTensorRT Screenshots of the Frigate UI's System metrics pages. Any other information that may be helpfuli also tried this #20836 but it didn't work either, it seems to be something wrong with the model parameters or something ;c |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
The error you're seeing ( You need to export the YOLOv9 model using Frigate's specific export process. Run this command to build a properly formatted model: (1) docker build . --build-arg MODEL_SIZE=m --build-arg IMG_SIZE=640 --output . -f- <<'EOF'
FROM python:3.11 AS build
RUN apt-get update && apt-get install --no-install-recommends -y cmake libgl1 && rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:0.10.4 /uv /bin/
WORKDIR /yolov9
ADD https://github.com/WongKinYiu/yolov9.git .
RUN uv pip install --system -r requirements.txt
RUN uv pip install --system onnx==1.18.0 onnxruntime onnx-simplifier==0.4.* onnxscript
ARG MODEL_SIZE
ARG IMG_SIZE
ADD https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-${MODEL_SIZE}-converted.pt yolov9-${MODEL_SIZE}.pt
RUN sed -i "s/ckpt = torch.load(attempt_download(w), map_location='cpu')/ckpt = torch.load(attempt_download(w), map_location='cpu', weights_only=False)/g" models/experimental.py
RUN python3 export.py --weights ./yolov9-${MODEL_SIZE}.pt --imgsz ${IMG_SIZE} --simplify --include onnx
FROM scratch
ARG MODEL_SIZE
ARG IMG_SIZE
COPY --from=build /yolov9/yolov9-${MODEL_SIZE}.onnx /yolov9-${MODEL_SIZE}-${IMG_SIZE}.onnx
EOFThis will output detectors:
onnx:
type: onnx
model:
model_type: yolo-generic
width: 640
height: 640
input_tensor: nchw
input_dtype: float
path: /config/model_cache/yolov9-m-640.onnx
labelmap_path: /labelmap/coco-80.txtYour RTX 3060 should be automatically detected and used with the For reference, an RTX 3050 achieves approximately 28ms inference time with YOLOv9 s-640, so your 3060 should perform similarly or better. (2) 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.




The error you're seeing (
ValueError: not enough values to unpack (expected 4, got 3)) indicates your YOLOv9 model wasn't exported correctly for Frigate's expected format. (1)You need to export the YOLOv9 model using Frigate's specific export process. Run this command to build a properly formatted model: (1)