def load_yolo_predictions(txt_path, classes=None):
    """Return a list of records from YOLO prediction file.

    Each record is a list `[label, box, score]`, where the box contains
    coordinates in YOLOv5 format. `score` can be None if text file does
    not contain scores, and `label` is either integer, or string if the
    mapping `classes` is provided.
    """

    result = []

    for line in open(txt_path, "r"):
        label, x_c, y_c, w, h, *rest = line.split()
        label = int(label)
        if classes:
            label = classes[label]
        box = [float(x_c), float(y_c), float(w), float(h)]
        score = float(rest[0]) if rest else None

        result.append([label, box, score])

    return result