Skip to content

NVR with realtime local object detection for IP cameras

Revamp RF-DETR Export Docs (#19341)

Nicolas Mowenc3410cd13eef
diff --git a/docs/docs/configuration/object_detectors.md b/docs/docs/configuration/object_detectors.md
index 2811827522..e048e0ec56 100644
--- a/docs/docs/configuration/object_detectors.md
+++ b/docs/docs/configuration/object_detectors.md
@@ -365,8 +365,8 @@ detectors:
model:
model_type: rfdetr
- width: 560
- height: 560
+ width: 320
+ height: 320
input_tensor: nchw
input_dtype: float
path: /config/model_cache/rfdetr.onnx
@@ -616,8 +616,8 @@ detectors:
model:
model_type: rfdetr
- width: 560
- height: 560
+ width: 320
+ height: 320
input_tensor: nchw
input_dtype: float
path: /config/model_cache/rfdetr.onnx
@@ -983,22 +983,21 @@ Make sure you change the batch size to 1 before exporting.
### Download RF-DETR Model
-To export as ONNX:
-
-1. `pip3 install rfdetr`
-2. `python3`
-3. `from rfdetr import RFDETRBase`
-4. `x = RFDETRBase()`
-5. `x.export()`
-
-#### Additional Configuration
-
-The input tensor resolution can be customized:
+RF-DETR can be exported as ONNX by running the command below. You can copy and paste the whole thing to your terminal and execute, altering `MODEL_SIZE=Nano` in the first line to `Nano`, `Small`, or `Medium` size.
-```python
-from rfdetr import RFDETRBase
-x = RFDETRBase(resolution=560) # resolution must be a multiple of 56
-x.export()
+```sh
+docker build . --build-arg MODEL_SIZE=Nano --output . -f- <<'EOF'
+FROM python:3.11 AS build
+RUN apt-get update && apt-get install --no-install-recommends -y libgl1 && rm -rf /var/lib/apt/lists/*
+COPY --from=ghcr.io/astral-sh/uv:0.8.0 /uv /bin/
+WORKDIR /rfdetr
+RUN uv pip install --system rfdetr onnx onnxruntime onnxsim onnx-graphsurgeon
+ARG MODEL_SIZE
+RUN python3 -c "from rfdetr import RFDETR${MODEL_SIZE}; x = RFDETR${MODEL_SIZE}(resolution=320); x.export()"
+FROM scratch
+ARG MODEL_SIZE
+COPY --from=build /rfdetr/output/inference_model.onnx /rfdetr-${MODEL_SIZE}.onnx
+EOF
```
### Downloading YOLO-NAS Model
diff --git a/docs/docs/frigate/hardware.md b/docs/docs/frigate/hardware.md
index 650151a359..8a9454e2c1 100644
--- a/docs/docs/frigate/hardware.md
+++ b/docs/docs/frigate/hardware.md
@@ -166,12 +166,12 @@ There are improved capabilities in newer GPU architectures that TensorRT can ben
Inference speeds will vary greatly depending on the GPU and the model used.
`tiny` variants are faster than the equivalent non-tiny model, some known examples are below:
-| Name | YOLOv9 Inference Time | YOLO-NAS Inference Time | RF-DETR Inference Time |
-| --------------- | --------------------- | ------------------------- | ------------------------- |
-| RTX 3050 | 320: 15 ms | 320: ~ 10 ms 640: ~ 16 ms | 336: ~ 16 ms 560: ~ 40 ms |
-| RTX 3070 | 320: 11 ms | 320: ~ 8 ms 640: ~ 14 ms | 336: ~ 14 ms 560: ~ 36 ms |
-| RTX A4000 | | 320: ~ 15 ms | |
-| Tesla P40 | | 320: ~ 105 ms | |
+| Name | YOLOv9 Inference Time | YOLO-NAS Inference Time | RF-DETR Inference Time |
+| --------------- | --------------------- | ------------------------- | ---------------------- |
+| RTX 3050 | t-320: 15 ms | 320: ~ 10 ms 640: ~ 16 ms | Nano-320: ~ 12 ms |
+| RTX 3070 | t-320: 11 ms | 320: ~ 8 ms 640: ~ 14 ms | Nano-320: ~ 9 ms |
+| RTX A4000 | | 320: ~ 15 ms | |
+| Tesla P40 | | 320: ~ 105 ms | |
### ROCm - AMD GPU