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
__init__(*args, data=None, **kwargs)
Initialize the RTDETRDataset class by inheriting from the YOLODataset class.
build_transforms(hyp=None)
Temporary, only for evaluation.
Source code in ultralytics/models/rtdetr/val.py
load_image(i, rect_mode=False)
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.
Example
Note
For further details on the attributes and methods, refer to the parent DetectionValidator class.
Source code in ultralytics/models/rtdetr/val.py
build_dataset(img_path, mode='val', batch=None)
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
|
Source code in ultralytics/models/rtdetr/val.py
postprocess(preds)
Apply Non-maximum suppression to prediction outputs.