Implementation:Obss Sahi Download Rtdetr Model
| Knowledge Sources | |
|---|---|
| Domains | Object_Detection, Model_Setup |
| Last Updated | 2026-02-08 12:00 GMT |
Overview
Utility functions for downloading RT-DETR model weights (Large and X variants) from Ultralytics releases.
Description
The sahi.utils.rtdetr module provides convenience functions for downloading RT-DETR (Real-Time Detection Transformer) model weights. RTDETRTestConstants defines the download URLs and default local paths for RT-DETR-L and RT-DETR-X model variants. Each download function checks if the file already exists before downloading, and creates parent directories as needed.
Usage
Use these functions to obtain RT-DETR model weights before initializing the RT-DETR detection model in SAHI, particularly in test environments or first-time setup.
Code Reference
Source Location
- Repository: Obss_Sahi
- File: sahi/utils/rtdetr.py
- Lines: 1-39
Signature
class RTDETRTestConstants:
RTDETRL_MODEL_URL: str
RTDETRL_MODEL_PATH: str
RTDETRX_MODEL_URL: str
RTDETRX_MODEL_PATH: str
def download_rtdetrl_model(destination_path: str | None = None) -> None: ...
def download_rtdetrx_model(destination_path: str | None = None) -> None: ...
Import
from sahi.utils.rtdetr import download_rtdetrl_model, download_rtdetrx_model, RTDETRTestConstants
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| destination_path | str or None | No | Custom download path; defaults to tests/data/models/rtdetr/ |
Outputs
| Name | Type | Description |
|---|---|---|
| Model file | .pt file | RT-DETR model weights at destination path |
Usage Examples
Download RT-DETR Models
from sahi.utils.rtdetr import download_rtdetrl_model, download_rtdetrx_model
# Download RT-DETR-L to default test path
download_rtdetrl_model()
# Download RT-DETR-X to custom path
download_rtdetrx_model(destination_path="/models/rtdetr-x.pt")