How roboflow/rf-detr works
RF-DETR is a transformer-based computer-vision package for object detection, instance segmentation, and keypoint detection. A user supplies a model and images to the inference facade, which prepares batches, runs the model, and decodes predictions; users can also train models from annotated datasets and export models for supported runtimes. The graph preserves training, evaluation, and deployment as distinct capabilities. Relationships are limited to README statements and references in the supplied SOURCE INDEX; unsampled backend details are represented at their enclosing directory.
Main entry points: inference.py Inference facade · lwdetr.py LW-DETR model · module_model.py Training module · detr.py Model API
Components 20
Data preparation
- Dataset formats
src/rfdetr/datasets - COCO dataset
src/rfdetr/datasets/coco.py
Model and inference
- Model configuration
src/rfdetr/config.py - Model API
src/rfdetr/detr.py - Inference facade
src/rfdetr/inference.py - Prediction pipeline
src/rfdetr/_prediction/core.py - Batch scheduling
src/rfdetr/_prediction/pipelines.py - LW-DETR model
src/rfdetr/models/lwdetr.py - DINOv2 backbone
src/rfdetr/models/backbone/dinov2_with_windowed_attn.py - Transformer
src/rfdetr/models/transformer.py - Prediction postprocess
src/rfdetr/models/postprocess.py - Model weights
src/rfdetr/models/weights.py
Training and evaluation
- Training module
src/rfdetr/training/module_model.py - Training orchestration
src/rfdetr/training/trainer.py - COCO evaluation
src/rfdetr/training/callbacks/coco_eval.py
Export and runtimes
- Model export
src/rfdetr/export - Export metadata
src/rfdetr/export/_runtime/metadata.py - Runtime adapters
src/rfdetr/export/_runtime/adapters.py - Backend inference
src/rfdetr/export
Other components
- User
Connections 22
- User → Model API: uses model API
README.md - Model API → Model configuration: configures model
src/rfdetr/detr.py - Model API → Inference facade: creates inference
src/rfdetr/detr.py - Inference facade → Prediction pipeline: runs prediction
src/rfdetr/inference.py - Prediction pipeline → Batch scheduling: schedules batches
src/rfdetr/_prediction/pipelines.py - Inference facade → LW-DETR model: loads native model
src/rfdetr/inference.py - LW-DETR model → DINOv2 backbone: uses backbone
src/rfdetr/models/lwdetr.py - LW-DETR model → Transformer: uses transformer
src/rfdetr/models/lwdetr.py - LW-DETR model → Prediction postprocess: configures postprocess
src/rfdetr/models/lwdetr.py - Inference facade → Model weights: loads weights
src/rfdetr/inference.py - User → Dataset formats: provides data
README.md - Dataset formats → COCO dataset: supports COCO
src/rfdetr/datasets/coco.py - User → Training orchestration: starts training
- Training orchestration → Training module: orchestrates training
- Training module → COCO dataset: loads dataset
src/rfdetr/training/module_model.py - Training module → LW-DETR model: trains model
src/rfdetr/training/module_model.py - Training module → COCO evaluation: registers evaluation
src/rfdetr/training/module_model.py - User → Model export: exports model
- Model export → Export metadata: writes metadata
src/rfdetr/export/_runtime/metadata.py - Inference facade → Runtime adapters: loads exported runtime
src/rfdetr/inference.py - Runtime adapters → Backend inference: dispatches backend
src/rfdetr/export/_runtime/adapters.py - Backend inference → Export metadata: reads metadata
src/rfdetr/export/_runtime/adapters.py