2.28

可视化数据集注释

该功能可在训练前将YOLO 图像上的注释可视化,帮助识别和纠正可能导致错误检测结果的任何错误注释。它能绘制边界框,用类别名称标注对象,并根据背景亮度调整文本颜色,以提高可读性。

from ultralytics.data.utils import visualize_image_annotations

label_map = {  # Define the label map with all annotated class labels.
    0: "person",
    1: "car",
}

# Visualize
visualize_image_annotations(
    "path/to/image.jpg",  # Input image path.
    "path/to/annotations.txt",  # Annotation file path for the image.
    label_map,
)
posted @ 2025-03-03 08:30  kxzzow  阅读(11)  评论(0)    收藏  举报