Files
HSAP/algorithms/dms_yolo/code.embedded.bak/ultralytics/models/rtdetr/model.py
Chengfang Lu e72bc061c5 feat: HSAP platform v2 — modular navigation, quality review, audit log, world model simulation
Major changes:
- New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind
- 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理
- Data catalog with charts (DMS/ADAS/Lane 3-tab view)
- Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance
- Audit enhancements: batch operations, rejection categories, Feishu notifications
- Operation audit log (操作日志)
- World model simulation studio (仿真工坊)
- Dataset version management with snapshots and diff
- ADAS 7-class dataset integration (138K images organized + compressed)
- User management with Feishu integration and pagination
- CRUD/search/filter on all pages, card layout redesign
- PIL-optimized image overlay rendering
- Auto-snapshot on build, in_review workflow stage
- Removed embedded algorithm code (now in workspace)
2026-06-03 11:40:21 +08:00

64 lines
2.2 KiB
Python

# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""
Interface for Baidu's RT-DETR, a Vision Transformer-based real-time object detector.
RT-DETR offers real-time performance and high accuracy, excelling in accelerated backends like CUDA with TensorRT.
It features an efficient hybrid encoder and IoU-aware query selection for enhanced detection accuracy.
References:
https://arxiv.org/pdf/2304.08069.pdf
"""
from ultralytics.engine.model import Model
from ultralytics.nn.tasks import RTDETRDetectionModel
from ultralytics.utils.torch_utils import TORCH_1_11
from .predict import RTDETRPredictor
from .train import RTDETRTrainer
from .val import RTDETRValidator
class RTDETR(Model):
"""Interface for Baidu's RT-DETR model, a Vision Transformer-based real-time object detector.
This model provides real-time performance with high accuracy. It supports efficient hybrid encoding, IoU-aware query
selection, and adaptable inference speed.
Attributes:
model (str): Path to the pre-trained model.
Methods:
task_map: Return a task map for RT-DETR, associating tasks with corresponding Ultralytics classes.
Examples:
Initialize RT-DETR with a pre-trained model
>>> from ultralytics import RTDETR
>>> model = RTDETR("rtdetr-l.pt")
>>> results = model("image.jpg")
"""
def __init__(self, model: str = "rtdetr-l.pt") -> None:
"""Initialize the RT-DETR model with the given pre-trained model file.
Args:
model (str): Path to the pre-trained model. Supports .pt, .yaml, and .yml formats.
"""
assert TORCH_1_11, "RTDETR requires torch>=1.11"
super().__init__(model=model, task="detect")
@property
def task_map(self) -> dict:
"""Return a task map for RT-DETR, associating tasks with corresponding Ultralytics classes.
Returns:
(dict): A dictionary mapping task names to Ultralytics task classes for the RT-DETR model.
"""
return {
"detect": {
"predictor": RTDETRPredictor,
"validator": RTDETRValidator,
"trainer": RTDETRTrainer,
"model": RTDETRDetectionModel,
}
}