[Detector Support]: Trying to Get TensorRT working with Frigate using a 4080 #20836
-
Describe the problem you are havingSo I am having a couple of issues with getting a detector working. I am trying figure out why frigate keeps crashing everytime it is started up. I think its my config file, but Im not too sure on what I need to do. This is in a proxmox LXC with docker, which I know is not really supported, but I am pretty sure this is not a problem caused by that Version0.16-0 Frigate config filemqtt:
enabled: false
cameras:
Bedroom: # <------ Name the camera
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia
inputs:
- path: rtsp://admin:[email protected]:554/h264Preview_01_main # <----- The stream you want to use for detection
roles:
- detect
detect:
enabled: true # <---- disable detection until you have a working camera feed
width: 1920
height: 1080
Dressing-Room: # <------ Name the camera
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia
inputs:
- path: rtsp://admin:[email protected]:554/h264Preview_01_main # <----- The stream you want to use for detection
roles:
- detect
detect:
enabled: true # <---- disable detection until you have a working camera feed
width: 1920
height: 1080
Living-Room-Downstairs: # <------ Name the camera
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia
inputs:
- path: rtsp://admin:[email protected]:554/h264Preview_01_main # <----- The stream you want to use for detection
roles:
- detect
detect:
enabled: false # <---- disable detection until you have a working camera feed
width: 1920
height: 1080
ffmpeg:
hwaccel_args: preset-nvidia
model:
model_type: yolox
width: 640 # <--- should match the imgsize set during model export
height: 640 # <--- should match the imgsize set during model export
input_tensor: nchw
input_dtype: float
path: /config/model_cache/yolov9-c-640.onnx
labelmap_path: /labelmap/coco-80.txt
detectors:
onnx:
type: onnx
#detectors:
# onnx_0:
# type: onnx
detect:
enabled: false
width: 1280
# Optional: height of the frame for the input with the detect role (default: use native stream resolution)
height: 720
# Optional: desired fps for your camera for the input with the detect role (default: shown below)
# NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
fps: 5
# Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate)
min_initialized: 2
# Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)
max_disappeared: 25
version: 0.16-0docker-compose file or Docker CLI commandversion: "3.9"
services:
frigate:
container_name: frigate
restart: unless-stopped
stop_grace_period: 30s
image: ghcr.io/blakeblackshear/frigate:stable-tensorrt
# devices:
# - /dev/dri/renderD128:/dev/dri/renderD128
volumes:
- ./config:/config
- ./storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "8971:8971"
- "8554:8554" # RTSP feeds
deploy: # <------------- Add this section
resources:
reservations:
devices:
- driver: nvidia
# device_ids: ['0'] # this is only needed when using multiple GPUs
count: 1 # number of GPUs
capabilities: [gpu]Relevant Frigate log outputfrigate | 2025-11-07 04:42:14.239821144 [2025-11-07 04:42:14] frigate.util.config INFO : Checking if frigate config needs migration...
frigate | 2025-11-07 04:42:14.256728568 [2025-11-07 04:42:14] frigate.util.config INFO : frigate config does not need migration...
frigate | 2025-11-07 04:42:14.444541408 [2025-11-07 04:42:14] frigate.app INFO : Starting Frigate (0.16.2-4d58206)
frigate | 2025-11-07 04:42:14.455516019 [2025-11-07 04:42:14] peewee_migrate.logs INFO : Starting migrations
frigate | 2025-11-07 04:42:14.456871817 [2025-11-07 04:42:14] peewee_migrate.logs INFO : There is nothing to migrate
frigate | 2025-11-07 04:42:14.464893623 [2025-11-07 04:42:14] frigate.app INFO : Recording process started: 391
frigate | 2025-11-07 04:42:14.471707175 [2025-11-07 04:42:14] frigate.app INFO : Review process started: 404
frigate | 2025-11-07 04:42:14.474331338 [2025-11-07 04:42:14] frigate.app INFO : go2rtc process pid: 125
frigate | 2025-11-07 04:42:14.487929025 [2025-11-07 04:42:14] detector.onnx INFO : Starting detection process: 416
frigate | 2025-11-07 04:42:14.488831123 [2025-11-07 04:42:14] frigate.detectors.plugins.onnx INFO : ONNX: loaded onnxruntime module
frigate | 2025-11-07 04:42:14.489494767 [2025-11-07 04:42:14] frigate.detectors.plugins.onnx INFO : ONNX: loading /config/model_cache/yolov9-c-640.onnx
frigate | 2025-11-07 04:42:14.489745318 2025-11-07 04:42:14.489704801 [E:onnxruntime:Default, env.cc:234 ThreadMain] pthread_setaffinity_np failed for thread: 433, index: 1, mask: {2, 8, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
frigate | 2025-11-07 04:42:14.489835540 2025-11-07 04:42:14.489751367 [E:onnxruntime:Default, env.cc:234 ThreadMain] pthread_setaffinity_np failed for thread: 435, index: 3, mask: {4, 10, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
frigate | 2025-11-07 04:42:14.500118031 [2025-11-07 04:42:14] frigate.app INFO : Output process started: 437
frigate | 2025-11-07 04:42:14.522165354 [2025-11-07 04:42:14] frigate.app INFO : Camera processor started for Bedroom: 472
frigate | 2025-11-07 04:42:14.540558750 [2025-11-07 04:42:14] frigate.app INFO : Camera processor started for Dressing-Room: 479
frigate | 2025-11-07 04:42:14.551577176 [2025-11-07 04:42:14] frigate.app INFO : Camera processor started for Living-Room-Downstairs: 498
frigate | 2025-11-07 04:42:14.561029850 [2025-11-07 04:42:14] frigate.app WARNING : The current SHM size of 64.0MB is too small, recommend increasing it to at least 242MB.
frigate | 2025-11-07 04:42:14.577516250 [2025-11-07 04:42:14] frigate.app INFO : Capture process started for Bedroom: 511
frigate | 2025-11-07 04:42:14.580150926 [2025-11-07 04:42:14] frigate.app INFO : Capture process started for Dressing-Room: 528
frigate | 2025-11-07 04:42:14.581418707 [2025-11-07 04:42:14] frigate.app INFO : Capture process started for Living-Room-Downstairs: 538
frigate | 2025-11-07 04:42:14.671230776 [2025-11-07 04:42:14] frigate.api.fastapi_app INFO : Starting FastAPI app
frigate | 2025-11-07 04:42:14.889262564 [2025-11-07 04:42:14] frigate.api.fastapi_app INFO : FastAPI started
frigate | 2025-11-07 04:42:16.326028234 [2025-11-07 04:42:16] frigate.detectors.plugins.onnx INFO : ONNX: /config/model_cache/yolov9-c-640.onnx loaded
frigate | 2025-11-07 04:42:16.526721340 192.168.2.142 - - [07/Nov/2025:04:42:16 +0000] "GET /api/config HTTP/1.1" 200 20306 "https://192.168.2.228:8971/config" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:16.526860327 192.168.2.142 - - [07/Nov/2025:04:42:16 +0000] "GET /api/profile HTTP/1.1" 200 35 "https://192.168.2.228:8971/config" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:16.527770674 192.168.2.142 - - [07/Nov/2025:04:42:16 +0000] "GET /api/config/raw HTTP/1.1" 200 2446 "https://192.168.2.228:8971/config" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:16.660921801 192.168.2.142 - - [07/Nov/2025:04:42:16 +0000] "GET /api/config/schema.json HTTP/1.1" 200 49469 "https://192.168.2.228:8971/assets/yaml.worker.bundle.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:19.012594718 192.168.2.142 - - [07/Nov/2025:04:42:19 +0000] "GET /api/config HTTP/1.1" 200 20306 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:20.504807496 Process detector:onnx:
frigate | 2025-11-07 04:42:20.504812644 Traceback (most recent call last):
frigate | 2025-11-07 04:42:20.504814996 File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
frigate | 2025-11-07 04:42:20.504816452 self.run()
frigate | 2025-11-07 04:42:20.504818413 File "/opt/frigate/frigate/util/process.py", line 41, in run_wrapper
frigate | 2025-11-07 04:42:20.504821035 return run(*args, **kwargs)
frigate | 2025-11-07 04:42:20.504844478 ^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:20.504846782 File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
frigate | 2025-11-07 04:42:20.504848701 self._target(*self._args, **self._kwargs)
frigate | 2025-11-07 04:42:20.504850092 File "/opt/frigate/frigate/object_detection/base.py", line 136, in run_detector
frigate | 2025-11-07 04:42:20.504851272 detections = object_detector.detect_raw(input_frame)
frigate | 2025-11-07 04:42:20.504852441 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:20.504872034 File "/opt/frigate/frigate/object_detection/base.py", line 86, in detect_raw
frigate | 2025-11-07 04:42:20.504873399 return self.detect_api.detect_raw(tensor_input=tensor_input)
frigate | 2025-11-07 04:42:20.504875130 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:20.504876477 File "/opt/frigate/frigate/detectors/plugins/onnx.py", line 109, in detect_raw
frigate | 2025-11-07 04:42:20.504887972 return post_process_yolox(
frigate | 2025-11-07 04:42:20.504889013 ^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:20.504890359 File "/opt/frigate/frigate/util/model.py", line 243, in post_process_yolox
frigate | 2025-11-07 04:42:20.504891790 predictions[..., :2] = (predictions[..., :2] + grids) * expanded_strides
frigate | 2025-11-07 04:42:20.504892941 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
frigate | 2025-11-07 04:42:20.504894327 ValueError: operands could not be broadcast together with shapes (1,84,2) (1,8400,2)
frigate | 2025-11-07 04:42:21.579969936 [INFO] Starting go2rtc healthcheck service...
frigate | 2025-11-07 04:42:21.945535797 192.168.2.142 - - [07/Nov/2025:04:42:21 +0000] "GET /api/profile HTTP/1.1" 200 35 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:34.661937605 [2025-11-07 04:42:34] frigate.watchdog INFO : Detection appears to be stuck. Restarting detection process...
frigate | 2025-11-07 04:42:34.679498727 [2025-11-07 04:42:34] detector.onnx INFO : Starting detection process: 656
frigate | 2025-11-07 04:42:34.680597837 [2025-11-07 04:42:34] frigate.detectors.plugins.onnx INFO : ONNX: loaded onnxruntime module
frigate | 2025-11-07 04:42:34.680880009 [2025-11-07 04:42:34] frigate.detectors.plugins.onnx INFO : ONNX: loading /config/model_cache/yolov9-c-640.onnx
frigate | 2025-11-07 04:42:34.682372208 2025-11-07 04:42:34.682319863 [E:onnxruntime:Default, env.cc:234 ThreadMain] pthread_setaffinity_np failed for thread: 660, index: 1, mask: {2, 8, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
frigate | 2025-11-07 04:42:34.682397131 2025-11-07 04:42:34.682345692 [E:onnxruntime:Default, env.cc:234 ThreadMain] pthread_setaffinity_np failed for thread: 662, index: 3, mask: {4, 10, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
frigate | 2025-11-07 04:42:35.079417848 [2025-11-07 04:42:35] frigate.detectors.plugins.onnx INFO : ONNX: /config/model_cache/yolov9-c-640.onnx loaded
frigate | 2025-11-07 04:42:35.693924711 Process detector:onnx:
frigate | 2025-11-07 04:42:35.693929580 Traceback (most recent call last):
frigate | 2025-11-07 04:42:35.693931664 File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
frigate | 2025-11-07 04:42:35.693932842 self.run()
frigate | 2025-11-07 04:42:35.693934865 File "/opt/frigate/frigate/util/process.py", line 41, in run_wrapper
frigate | 2025-11-07 04:42:35.693936437 return run(*args, **kwargs)
frigate | 2025-11-07 04:42:35.693937960 ^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:35.693939881 File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
frigate | 2025-11-07 04:42:35.693941609 self._target(*self._args, **self._kwargs)
frigate | 2025-11-07 04:42:35.693943180 File "/opt/frigate/frigate/object_detection/base.py", line 136, in run_detector
frigate | 2025-11-07 04:42:35.693944341 detections = object_detector.detect_raw(input_frame)
frigate | 2025-11-07 04:42:35.693945495 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:35.693946729 File "/opt/frigate/frigate/object_detection/base.py", line 86, in detect_raw
frigate | 2025-11-07 04:42:35.693947920 return self.detect_api.detect_raw(tensor_input=tensor_input)
frigate | 2025-11-07 04:42:35.693949173 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:35.693950428 File "/opt/frigate/frigate/detectors/plugins/onnx.py", line 109, in detect_raw
frigate | 2025-11-07 04:42:35.693951398 return post_process_yolox(
frigate | 2025-11-07 04:42:35.693952380 ^^^^^^^^^^^^^^^^^^^
frigate | 2025-11-07 04:42:35.693953726 File "/opt/frigate/frigate/util/model.py", line 243, in post_process_yolox
frigate | 2025-11-07 04:42:35.693955060 predictions[..., :2] = (predictions[..., :2] + grids) * expanded_strides
frigate | 2025-11-07 04:42:35.693956240 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
frigate | 2025-11-07 04:42:35.693957615 ValueError: operands could not be broadcast together with shapes (1,84,2) (1,8400,2)
frigate | 2025-11-07 04:42:42.926804279 192.168.2.142 - - [07/Nov/2025:04:42:42 +0000] "GET /api/profile HTTP/1.1" 200 35 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:42.926832944 192.168.2.142 - - [07/Nov/2025:04:42:42 +0000] "GET /api/config HTTP/1.1" 200 20306 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:42.989310222 192.168.2.142 - - [07/Nov/2025:04:42:42 +0000] "GET /system HTTP/1.1" 200 2649 "https://192.168.2.228:8971/config" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:42.999217614 192.168.2.142 - - [07/Nov/2025:04:42:42 +0000] "GET /ws HTTP/1.1" 101 10985 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.285018956 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /api/profile HTTP/1.1" 200 35 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.296118320 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /fonts/Inter-Regular.woff2 HTTP/1.1" 200 108488 "https://192.168.2.228:8971/assets/i18n-B4RQL4LC.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.298848000 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /api/profile HTTP/1.1" 200 35 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.299349627 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /api/config HTTP/1.1" 200 20306 "https://192.168.2.228:8971/system" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.343674737 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /fonts/Inter-Medium.woff2 HTTP/1.1" 200 111380 "https://192.168.2.228:8971/assets/i18n-B4RQL4LC.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:43.364381540 192.168.2.142 - - [07/Nov/2025:04:42:43 +0000] "GET /ws HTTP/1.1" 101 1024 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"
frigate | 2025-11-07 04:42:44.674236496 [2025-11-07 04:42:44] frigate.watchdog INFO : Detection appears to have stopped. Exiting Frigate...Install methodProxmox via Docker Object DetectorTensorRT Screenshots of the Frigate UI's System metrics pagesI can't actually get to the metrics page at the moment because it crashes Any other information that may be helpfulNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Based on your logs, the issue is a model configuration mismatch. You're loading a YOLOv9 model but configured Frigate to use For YOLOv9 models with TensorRT, you need to:
Here's the corrected configuration: detectors:
tensorrt:
type: tensorrt
device: 0
model:
model_type: yolo-generic
width: 640
height: 640
input_tensor: nchw
input_pixel_format: rgb
path: /config/model_cache/tensorrt/yolov9-c-640.trt
labelmap_path: /labelmap/coco-80.txtUpdate your docker-compose to generate the model: services:
frigate:
environment:
- YOLO_MODELS=yolov9-c-640The model will be automatically generated at startup if the shm_size: 256mb📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Great, glad it's working for you now. |
Beta Was this translation helpful? Give feedback.
The AI's response is incorrect here, the TensorRT detector has been removed in Frigate 0.16. Using the
onnxdetector is correct.Your issue is caused by a misconfiguration. You need to specify the correct
model_typefor your YOLOv9 model, which isyolo-generic, notyolox.See the official documentation for the full configuration you need: https://docs.frigate.video/configuration/object_detectors#yolo-v3-v4-v7-v9-1