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 Platform Models

From Leeroopedia


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

Overview

Platform-licensed RF-DETR model variants (XLarge and 2XLarge) providing the highest-capacity detection configurations under the Roboflow Platform Model License.

Description

The platform models module defines two large-scale RF-DETR variants available under PML-1.0 licensing. RFDETRXLarge uses the DINOv2 windowed base encoder at 700px resolution with num_windows=1, hidden_dim 512, 5 decoder layers, and pretrained on Objects365 (365 classes). RFDETR2XLarge scales to 880px resolution with num_windows=2 for maximum accuracy. Both model classes extend RFDETR and enforce license acceptance via a mandatory accept_platform_model_license=True constructor parameter; omitting this flag raises a ValueError. Each class provides get_model_config() returning the appropriate config and get_train_config() returning a standard TrainConfig.

Usage

Use these models when maximum detection accuracy is required and the project has a Roboflow platform plan. RFDETRXLarge (700px) offers a good balance for high-accuracy scenarios, while RFDETR2XLarge (880px, 2-window attention) provides the absolute highest capacity at increased computational cost.

Code Reference

Source Location

Signature

class RFDETRXLargeConfig(ModelConfig):
    encoder: Literal["dinov2_windowed_base"] = "dinov2_windowed_base"
    hidden_dim: int = 512
    dec_layers: int = 5
    sa_nheads: int = 16
    ca_nheads: int = 32
    dec_n_points: int = 4
    num_windows: int = 1
    patch_size: int = 20
    resolution: int = 700
    pretrain_weights: str = "rf-detr-xlarge.pth"
    license: str = "PML-1.0"

class RFDETR2XLargeConfig(ModelConfig):
    # Same as XLarge but:
    num_windows: int = 2
    resolution: int = 880
    pretrain_weights: str = "rf-detr-xxlarge.pth"

class RFDETRXLarge(RFDETR):
    size: Literal["rfdetr-xlarge"] = "rfdetr-xlarge"

    def __init__(
        self,
        accept_platform_model_license: bool = False,
        **kwargs: Any,
    ) -> None:
        """
        Args:
            accept_platform_model_license: Must be True to acknowledge PML-1.0.
        Raises:
            ValueError: If license not accepted.
        """
        ...

    def get_model_config(self, **kwargs: Any) -> RFDETRXLargeConfig: ...
    def get_train_config(self, **kwargs: Any) -> TrainConfig: ...

class RFDETR2XLarge(RFDETR):
    size: Literal["rfdetr-2xlarge"] = "rfdetr-2xlarge"

    def __init__(
        self,
        accept_platform_model_license: bool = False,
        **kwargs: Any,
    ) -> None: ...

    def get_model_config(self, **kwargs: Any) -> RFDETR2XLargeConfig: ...
    def get_train_config(self, **kwargs: Any) -> TrainConfig: ...

Import

from rfdetr.platform.models import RFDETRXLarge, RFDETR2XLarge

I/O Contract

Inputs

Name Type Required Description
accept_platform_model_license bool Yes Must be True to use the model; raises ValueError if False
**kwargs Any No Passed to parent RFDETR.__init__ (e.g., pretrain_weights override)

Outputs

Name Type Description
model instance RFDETRXLarge or RFDETR2XLarge Fully initialized RF-DETR model with pretrained weights loaded
get_model_config() RFDETRXLargeConfig or RFDETR2XLargeConfig Architecture configuration Pydantic model
get_train_config() TrainConfig Training hyperparameter configuration

Usage Examples

XLarge Model Inference

from rfdetr.platform.models import RFDETRXLarge

# Initialize with license acceptance
model = RFDETRXLarge(accept_platform_model_license=True)

# Run inference on an image
detections = model.predict("image.jpg")
print(detections)

2XLarge Model with Custom Resolution

from rfdetr.platform.models import RFDETR2XLarge

# Initialize the largest variant
model = RFDETR2XLarge(accept_platform_model_license=True)

# Fine-tune on custom dataset
model.train(
    dataset_dir="data/custom",
    epochs=50,
    batch_size=2,
)

License Enforcement

from rfdetr.platform.models import RFDETRXLarge

# This will raise ValueError:
try:
    model = RFDETRXLarge()
except ValueError as e:
    print(e)
    # "You must accept the platform model license (LICENSE.platform)..."

# Correct usage:
model = RFDETRXLarge(accept_platform_model_license=True)

Related Pages

Page Connections

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