Reference for ultralytics/models/yolo/segment/val.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/yolo/segment/val.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.yolo.segment.val.SegmentationValidator
Bases: DetectionValidator
A class extending the DetectionValidator class for validation based on a segmentation model.
Example
Source code in ultralytics/models/yolo/segment/val.py
eval_json
Return COCO-style object detection evaluation metrics.
Source code in ultralytics/models/yolo/segment/val.py
finalize_metrics
Sets speed and confusion matrix for evaluation metrics.
get_desc
Return a formatted description of evaluation metrics.
Source code in ultralytics/models/yolo/segment/val.py
init_metrics
Initialize metrics and select mask processing function based on save_json flag.
Source code in ultralytics/models/yolo/segment/val.py
plot_predictions
Plots batch predictions with masks and bounding boxes.
Source code in ultralytics/models/yolo/segment/val.py
plot_val_samples
Plots validation samples with bounding box labels.
Source code in ultralytics/models/yolo/segment/val.py
postprocess
Post-processes YOLO predictions and returns output detections with proto.
Source code in ultralytics/models/yolo/segment/val.py
pred_to_json
Save one JSON result.
Examples:
>>> result = {"image_id": 42, "category_id": 18, "bbox": [258.15, 41.29, 348.26, 243.78], "score": 0.236}
Source code in ultralytics/models/yolo/segment/val.py
preprocess
Preprocesses batch by converting masks to float and sending to device.
save_one_txt
Save YOLO detections to a txt file in normalized coordinates in a specific format.
Source code in ultralytics/models/yolo/segment/val.py
update_metrics
Metrics.