Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Roboflow Rf detr RFDETR Deploy To Roboflow

From Leeroopedia


Knowledge Sources
Domains Deployment, MLOps
Last Updated 2026-02-08 15:00 GMT

Overview

Concrete tool for deploying trained RF-DETR models to the Roboflow platform.

Description

RFDETR.deploy_to_roboflow() packages the model's state dict and args into a temporary weights.pt file, authenticates with Roboflow using the provided API key (or ROBOFLOW_API_KEY env var), and uploads via the version.deploy() method. The model size string (e.g. "rfdetr-base") is included for Roboflow to configure the inference server correctly.

Usage

Call on a trained RFDETR model instance after fine-tuning to deploy to Roboflow.

Code Reference

Source Location

  • Repository: rf-detr
  • File: rfdetr/detr.py
  • Lines: L405-458

Signature

def deploy_to_roboflow(
    self,
    workspace: str,
    project_id: str,
    version: str,
    api_key: str = None,
    size: str = None,
) -> None:
    """
    Deploy the trained RF-DETR model to Roboflow.

    Args:
        workspace: Roboflow workspace name
        project_id: Target project ID
        version: Project version number
        api_key: API key (falls back to ROBOFLOW_API_KEY env var)
        size: Model size string (e.g. "rfdetr-base"); auto-detected from class
    """

Import

from rfdetr import RFDETRBase  # or any size variant

I/O Contract

Inputs

Name Type Required Description
workspace str Yes Roboflow workspace name
project_id str Yes Target project ID
version str Yes Project version number
api_key Optional[str] No API key (default: ROBOFLOW_API_KEY env var)
size Optional[str] No Model size string (auto-detected from model class)

Outputs

Name Type Description
Deployed model Remote Model available on Roboflow platform for inference

Usage Examples

Deploy After Training

from rfdetr import RFDETRBase

# Train model
model = RFDETRBase()
model.train(dataset_dir="/path/to/dataset", epochs=50)

# Deploy to Roboflow
model.deploy_to_roboflow(
    workspace="my-workspace",
    project_id="my-detection-project",
    version="1",
    api_key="your_api_key",
)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment