Instructions to use zeromodels/rfdetr-medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/rfdetr-medium with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use zeromodels/rfdetr-medium with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/rfdetr-medium") - Notebooks
- Google Colab
- Kaggle
File size: 5,075 Bytes
32e5e49 b5c5031 32e5e49 b5c5031 32e5e49 b5c5031 32e5e49 b5c5031 32e5e49 b5c5031 32e5e49 b5c5031 32e5e49 b5c5031 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ---
pipeline_tag: object-detection
license: apache-2.0
base_model: Roboflow/rf-detr-medium
library_name: kerasformers
tags:
- keras
- kerasformers
- rf-detr
- detr
- object-detection
- arxiv:2511.09554
- pytorch
- jax
- tf
---
## ***See [our collection](https://huggingface.co/collections/kerasformers/rf-detr-6a69d4fc463069d0af85320b) for all versions of RF-DETR.***
# Run RF-DETR with Keras 3: JAX, PyTorch, or TensorFlow
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/rf_detr/) [](https://huggingface.co/collections/kerasformers/rf-detr-6a69d4fc463069d0af85320b)
# kerasformers/rfdetr-medium
Paper: [RF-DETR: Neural Architecture Search for Real-Time Detection Transformers (arXiv:2511.09554)](https://arxiv.org/abs/2511.09554) · [HF Papers](https://huggingface.co/papers/2511.09554)
RF-DETR is Roboflow's real-time DETR, built on a windowed DINOv2 backbone with a lightweight deformable decoder. Configurations came out of a neural architecture search, so variants differ in resolution, patch size, window count, and decoder depth. Instance-segmentation checkpoints add a mask head.
For more details on the model, please go to Roboflow's original [model card](https://huggingface.co/Roboflow/rf-detr-medium).
Pure-**Keras 3** conversion of [`Roboflow/rf-detr-medium`](https://huggingface.co/Roboflow/rf-detr-medium) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
This is an **object detection** checkpoint (`RFDETRDetect`): each query predicts a class and box.
## ✨ Quick start
```python
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from PIL import Image
from kerasformers.models.rf_detr import RFDETRDetect, RFDETRImageProcessor
model = RFDETRDetect.from_weights("kerasformers/rfdetr-medium")
processor = RFDETRImageProcessor.from_weights("kerasformers/rfdetr-medium")
image = Image.open("your_image.jpg").convert("RGB")
inputs = processor(image)
output = model(inputs["pixel_values"], training=False)
results = processor.post_process_object_detection(
output, threshold=0.5, target_sizes=[(image.height, image.width)]
)[0]
for score, name, box in zip(
results["scores"], results["label_names"], results["boxes"]
):
print(f"{name}: {float(score):.3f} {box}")
```
Load any RF-DETR variant the same way with `from_weights("kerasformers/<variant>")` (use `RFDETRDetect` for this repo):
| Variant | Hub | Task |
|---|---|---|
| `rfdetr-nano` | [`kerasformers/rfdetr-nano`](https://huggingface.co/kerasformers/rfdetr-nano) | object detection |
| `rfdetr-small` | [`kerasformers/rfdetr-small`](https://huggingface.co/kerasformers/rfdetr-small) | object detection |
| `rfdetr-medium` | [`kerasformers/rfdetr-medium`](https://huggingface.co/kerasformers/rfdetr-medium) | object detection |
| `rfdetr-base` | [`kerasformers/rfdetr-base`](https://huggingface.co/kerasformers/rfdetr-base) | object detection |
| `rfdetr-large` | [`kerasformers/rfdetr-large`](https://huggingface.co/kerasformers/rfdetr-large) | object detection |
| `rfdetr-seg-preview` | [`kerasformers/rfdetr-seg-preview`](https://huggingface.co/kerasformers/rfdetr-seg-preview) | instance segmentation |
| `rfdetr-seg-nano` | [`kerasformers/rfdetr-seg-nano`](https://huggingface.co/kerasformers/rfdetr-seg-nano) | instance segmentation |
| `rfdetr-seg-small` | [`kerasformers/rfdetr-seg-small`](https://huggingface.co/kerasformers/rfdetr-seg-small) | instance segmentation |
| `rfdetr-seg-medium` | [`kerasformers/rfdetr-seg-medium`](https://huggingface.co/kerasformers/rfdetr-seg-medium) | instance segmentation |
| `rfdetr-seg-large` | [`kerasformers/rfdetr-seg-large`](https://huggingface.co/kerasformers/rfdetr-seg-large) | instance segmentation |
| `rfdetr-seg-xlarge` | [`kerasformers/rfdetr-seg-xlarge`](https://huggingface.co/kerasformers/rfdetr-seg-xlarge) | instance segmentation |
| `rfdetr-seg-xxlarge` | [`kerasformers/rfdetr-seg-xxlarge`](https://huggingface.co/kerasformers/rfdetr-seg-xxlarge) | instance segmentation |
## Tips
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
- Prefer `RFDETRImageProcessor.from_weights(...)` so the processor resolution matches the variant (bare constructor defaults to base's 560).
- Detection: `RFDETRDetect` + `post_process_object_detection`.
- Segmentation: `RFDETRInstanceSegment` + `post_process_instance_segmentation`.
- See [RF-DETR docs](https://imvision12.github.io/KerasFormers/rf_detr/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
- Community / upstream safetensors still work via the `hf:` prefix, e.g. `RFDETRDetect.from_weights("hf:Roboflow/rf-detr-medium")`.
## Special Thanks
A huge thank you to the Roboflow RF-DETR authors for creating and releasing these models.
License: Apache 2.0.
|