Reference for ultralytics/models/yolo/detect/val.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/yolo/detect/val.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.yolo.detect.val.DetectionValidator
Bases: BaseValidator
A class extending the BaseValidator class for validation based on a detection model.
Example
Source code in ultralytics/models/yolo/detect/val.py
build_dataset
Build YOLO 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/yolo/detect/val.py
eval_json
Evaluates YOLO output in JSON format and returns performance statistics.
Source code in ultralytics/models/yolo/detect/val.py
finalize_metrics
Set final values for metrics speed and confusion matrix.
get_dataloader
Construct and return dataloader.
Source code in ultralytics/models/yolo/detect/val.py
get_desc
Return a formatted string summarizing class metrics of YOLO model.
get_stats
Returns metrics statistics and results dictionary.
Source code in ultralytics/models/yolo/detect/val.py
init_metrics
Initialize evaluation metrics for YOLO.
Source code in ultralytics/models/yolo/detect/val.py
plot_predictions
Plots predicted bounding boxes on input images and saves the result.
Source code in ultralytics/models/yolo/detect/val.py
plot_val_samples
Plot validation image samples.
Source code in ultralytics/models/yolo/detect/val.py
postprocess
Apply Non-maximum suppression to prediction outputs.
Source code in ultralytics/models/yolo/detect/val.py
pred_to_json
Serialize YOLO predictions to COCO json format.
Source code in ultralytics/models/yolo/detect/val.py
preprocess
Preprocesses batch of images for YOLO training.
Source code in ultralytics/models/yolo/detect/val.py
print_results
Prints training/validation set metrics per class.
Source code in ultralytics/models/yolo/detect/val.py
save_one_txt
Save YOLO detections to a txt file in normalized coordinates in a specific format.
Source code in ultralytics/models/yolo/detect/val.py
update_metrics
Metrics.