See our collection for all versions of RF-DETR.

Run RF-DETR with Keras 3: JAX, PyTorch, or TensorFlow

GitHub Docs Collection

kerasformers/rfdetr-small

Paper: RF-DETR: Neural Architecture Search for Real-Time Detection Transformers (arXiv:2511.09554) · HF Papers

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.

Pure-Keras 3 conversion of Roboflow/rf-detr-small for 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

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-small")
processor = RFDETRImageProcessor.from_weights("kerasformers/rfdetr-small")

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 object detection
rfdetr-small kerasformers/rfdetr-small object detection
rfdetr-medium kerasformers/rfdetr-medium object detection
rfdetr-base kerasformers/rfdetr-base object detection
rfdetr-large kerasformers/rfdetr-large object detection
rfdetr-seg-preview kerasformers/rfdetr-seg-preview instance segmentation
rfdetr-seg-nano kerasformers/rfdetr-seg-nano instance segmentation
rfdetr-seg-small kerasformers/rfdetr-seg-small instance segmentation
rfdetr-seg-medium kerasformers/rfdetr-seg-medium instance segmentation
rfdetr-seg-large kerasformers/rfdetr-seg-large instance segmentation
rfdetr-seg-xlarge kerasformers/rfdetr-seg-xlarge instance segmentation
rfdetr-seg-xxlarge 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 and Loading Weights.
  • Community / upstream safetensors still work via the hf: prefix, e.g. RFDETRDetect.from_weights("hf:Roboflow/rf-detr-small").

Special Thanks

A huge thank you to the Roboflow RF-DETR authors for creating and releasing these models.

License: Apache 2.0.

Downloads last month
33
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kerasformers/rfdetr-small

Finetuned
(3)
this model

Collection including kerasformers/rfdetr-small

Paper for kerasformers/rfdetr-small