Registry / ai-ml / rfdetr

rfdetr

JSON →
library1.8.0pypypi✓ verified 89d ago

RF-DETR is a PyTorch-based library for object detection and instance segmentation, implementing the DETR architecture with enhancements. It provides tools for training, inference, and deployment, integrating with PyTorch Lightning for composable training workflows. The library is actively maintained, with version 1.6.4 released recently, and receives frequent updates.

pip install rfdetr
INSTALL
IMPORT
SIG · RFDETR
R
rfdetr
ai-mlpythonv1.8.0
Install
80.3s avg
Import
20490ms
Disk
1138MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✕ timeout
py 3.11
✓ —
✕ timeout
py 3.12
✓ —
1/4 runs
py 3.13
✓ —
✓ 80.33s
py 3.9
2/4 runs
✕ timeout
1138MB installed
● package 1138MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RFDETRSmall
✓ from rfdetr import RFDETRSmall
RFDETRBase
✓ from rfdetr import RFDETRBase
RFDETRLarge
✓ from rfdetr import RFDETRLarge
DetectionDataset
✓ from rfdetr.data import DetectionDataset
✗ from rfdetr.datasets import DetectionDataset
Dataset classes were refactored into the `rfdetr.data` module.

This quickstart demonstrates how to load a pre-trained RF-DETR model, perform inference on an image URL, and inspect the returned detections object. It highlights recently added data fields like class names and source image/shape, which are useful for post-processing and visualization with libraries like `supervision`.

import supervision as sv from rfdetr import RFDETRSmall # Initialize model with pre-trained weights. Use "rfdetr-small" for the default. # For a custom fine-tuned model: pretrain_weights="path/to/your/model.pth" model = RFDETRSmall(pretrain_weights="rfdetr-small") # Example image URL for prediction image_url = "https://media.roboflow.com/dog.jpg" # Perform inference with a confidence threshold detections = model.predict(image_url, threshold=0.5) print(f"Detected {len(detections)} objects.") # Access new data points introduced in recent versions: if "class_name" in detections.data: print(f"Class names: {detections.data['class_name']}") if "source_image" in detections.data: print(f"Source image shape: {detections.data['source_shape']}") # Visualize results (requires 'supervision' to be installed) # image_bgr = detections.data.get("source_image") # if image_bgr is not None: # box_annotator = sv.BoxAnnotator() # annotated_image = box_annotator.annotate(scene=image_bgr.copy(), detections=detections) # sv.plot_image(annotated_image, size=(8, 8))
Debug
Known issues
deprecatedArguments `simplify` and `force` in `RFDETR.export()` are deprecated and no-ops, and will be removed in v1.8.
fix
Remove `simplify` and `force` arguments from your `RFDETR.export()` calls.
affects: >=1.6.1
gotchaTraining features require the `rfdetr[train]` optional dependencies to be installed.
fix
Install with `pip install "rfdetr[train]"` to enable training functionality and avoid `ImportError`s.
affects: >=1.6.1
gotcha`RFDETR.predict(shape=...)` requires both `height` and `width` dimensions to be positive integers divisible by 14.
fix
Ensure the `shape` tuple (e.g., `(480, 640)`) contains dimensions that are multiples of 14 to prevent incorrect processing.
affects: >=1.6.2
gotchaThe `detections.data` dictionary returned by `predict()` now includes additional keys like `class_name` (v1.6.4) and `source_image`/`source_shape` (v1.6.3).
fix
If your code assumes a fixed set of keys or iterates through `detections.data` without checking for key existence, adapt it to account for these new additions, e.g., `detections.data.get('class_name')`.
affects: >=1.6.3
Errors
Common errors & fixes
ImportError: rfdetr[train] is not installed. Please install with 'pip install "rfdetr[train]"'
Attempting to use training-specific modules or functions without installing the optional training dependencies.
fix
Install `rfdetr` with its training dependencies: `pip install "rfdetr[train]"`
KeyError: 'class_name'
Attempting to access `detections.data['class_name']` using an `rfdetr` version older than 1.6.4, where this key was not present.
fix
Upgrade `rfdetr` to `v1.6.4` or later, or use `detections.data.get('class_name')` and handle `None` for backward compatibility.
ValueError: Input shape dimensions must be divisible by 14. Got (500, 500)
The `shape` argument passed to `RFDETR.predict()` had dimensions (height, width) that were not perfectly divisible by 14.
fix
Provide a `shape` where both height and width are positive integers divisible by 14, e.g., `model.predict(..., shape=(480, 640))`.
TypeError: RFDETR.export() got an unexpected keyword argument 'simplify'
Using the deprecated `simplify` or `force` arguments in `RFDETR.export()`, which are no longer supported since v1.6.1.
fix
Remove the `simplify` and `force` arguments from your `RFDETR.export()` method calls.
Upgrade
Version history
1.8.0latest on PyPI · released Jun 16, 2026
Audit
Dependencies
torchrequiredUnderlying deep learning framework.
torchvisionrequiredStandard computer vision library for PyTorch.
supervisionoptionalRecommended for easy visualization and annotation of results.
lightningoptionalRequired for training functionality (included in `rfdetr[train]`).
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
rfdetr — pip install rfdetr · libregistry