Revamp RF-DETR Export Docs (#19341)

* Revamp RFDETR docs

* Clarify model size

* Specify model size
This commit is contained in:
Nicolas Mowen 2025-07-31 08:11:46 -06:00 committed by GitHub
parent d18f2282c8
commit c3410cd13e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 25 deletions

View File

@ -365,8 +365,8 @@ detectors:
model: model:
model_type: rfdetr model_type: rfdetr
width: 560 width: 320
height: 560 height: 320
input_tensor: nchw input_tensor: nchw
input_dtype: float input_dtype: float
path: /config/model_cache/rfdetr.onnx path: /config/model_cache/rfdetr.onnx
@ -616,8 +616,8 @@ detectors:
model: model:
model_type: rfdetr model_type: rfdetr
width: 560 width: 320
height: 560 height: 320
input_tensor: nchw input_tensor: nchw
input_dtype: float input_dtype: float
path: /config/model_cache/rfdetr.onnx 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 ### Download RF-DETR Model
To export as ONNX: 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.
1. `pip3 install rfdetr` ```sh
2. `python3` docker build . --build-arg MODEL_SIZE=Nano --output . -f- <<'EOF'
3. `from rfdetr import RFDETRBase` FROM python:3.11 AS build
4. `x = RFDETRBase()` RUN apt-get update && apt-get install --no-install-recommends -y libgl1 && rm -rf /var/lib/apt/lists/*
5. `x.export()` COPY --from=ghcr.io/astral-sh/uv:0.8.0 /uv /bin/
WORKDIR /rfdetr
#### Additional Configuration RUN uv pip install --system rfdetr onnx onnxruntime onnxsim onnx-graphsurgeon
ARG MODEL_SIZE
The input tensor resolution can be customized: RUN python3 -c "from rfdetr import RFDETR${MODEL_SIZE}; x = RFDETR${MODEL_SIZE}(resolution=320); x.export()"
FROM scratch
```python ARG MODEL_SIZE
from rfdetr import RFDETRBase COPY --from=build /rfdetr/output/inference_model.onnx /rfdetr-${MODEL_SIZE}.onnx
x = RFDETRBase(resolution=560) # resolution must be a multiple of 56 EOF
x.export()
``` ```
### Downloading YOLO-NAS Model ### Downloading YOLO-NAS Model

View File

@ -167,9 +167,9 @@ 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: `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 | | 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 3050 | t-320: 15 ms | 320: ~ 10 ms 640: ~ 16 ms | Nano-320: ~ 12 ms |
| RTX 3070 | 320: 11 ms | 320: ~ 8 ms 640: ~ 14 ms | 336: ~ 14 ms 560: ~ 36 ms | | RTX 3070 | t-320: 11 ms | 320: ~ 8 ms 640: ~ 14 ms | Nano-320: ~ 9 ms |
| RTX A4000 | | 320: ~ 15 ms | | | RTX A4000 | | 320: ~ 15 ms | |
| Tesla P40 | | 320: ~ 105 ms | | | Tesla P40 | | 320: ~ 105 ms | |