Reference for ultralytics/models/rtdetr/val.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/rtdetr/val.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.rtdetr.val.RTDETRDataset
Bases: YOLODataset
Real-Time DEtection and TRacking (RT-DETR) dataset class extending the base YOLODataset class.
This specialized dataset class is designed for use with the RT-DETR object detection model and is optimized for real-time detection and tracking tasks.
Source code in ultralytics/models/rtdetr/val.py
build_transforms
Build transformation pipeline for the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hyp
|
dict
|
Hyperparameters for transformations. |
None
|
Returns:
Type | Description |
---|---|
Compose
|
Composition of transformation functions. |
Source code in ultralytics/models/rtdetr/val.py
load_image
ultralytics.models.rtdetr.val.RTDETRValidator
Bases: DetectionValidator
RTDETRValidator extends the DetectionValidator class to provide validation capabilities specifically tailored for the RT-DETR (Real-Time DETR) object detection model.
The class allows building of an RTDETR-specific dataset for validation, applies Non-maximum suppression for post-processing, and updates evaluation metrics accordingly.
Examples:
>>> from ultralytics.models.rtdetr import RTDETRValidator
>>> args = dict(model="rtdetr-l.pt", data="coco8.yaml")
>>> validator = RTDETRValidator(args=args)
>>> validator()
Note
For further details on the attributes and methods, refer to the parent DetectionValidator class.
Source code in ultralytics/models/yolo/detect/val.py
build_dataset
Build an RTDETR Dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img_path
|
str
|
Path to the folder containing images. |
required |
mode
|
str
|
|
'val'
|
batch
|
int
|
Size of batches, this is for |
None
|
Returns:
Type | Description |
---|---|
RTDETRDataset
|
Dataset configured for RT-DETR validation. |
Source code in ultralytics/models/rtdetr/val.py
postprocess
Apply Non-maximum suppression to prediction outputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
preds
|
List | Tuple | Tensor
|
Raw predictions from the model. |
required |
Returns:
Type | Description |
---|---|
List[Tensor]
|
List of processed predictions for each image in batch. |