def write(
        self,
        label,
        txt_path,
        labels_map_rev,
        dynamic_classes=False,
        include_confidence=False,
    ):
        """Writes the labels to disk.

        Args:
            label: a :class:`fiftyone.core.labels.Detections` or
                :class:`fiftyone.core.labels.Polylines`
            txt_path: the path to write the annotation TXT file
            labels_map_rev: a dictionary mapping class label strings to target
                integers
            dynamic_classes (False): whether to dynamically add new labels to
                ``labels_map_rev``
            include_confidence (False): whether to include confidences in the
                export, if they exist
        """
        if isinstance(label, fol.Polylines):
            labels = label.polylines
        elif isinstance(label, fol.Detections):
            labels = label.detections
        else:
            labels = []

        rows = []
        for label in labels:
            _label = label.label

            if dynamic_classes and _label not in labels_map_rev:
                target = len(labels_map_rev)
                labels_map_rev[_label] = target
            elif _label not in labels_map_rev:
                msg = (
                    "Ignoring object with label '%s' not in provided "
                    "classes" % _label
                )
                warnings.warn(msg)
                continue
            else:
                target = labels_map_rev[_label]

            if include_confidence:
                confidence = label.confidence
            else:
                confidence = None

            row = _make_yolo_row(label, target, confidence=confidence)
            rows.append(row)

        _write_file_lines(rows, txt_path)
Writes the labels to disk.

        Args:
            label: a :class:`fiftyone.core.labels.Detections` or
                :class:`fiftyone.core.labels.Polylines`
            txt_path: the path to write the annotation TXT file
            labels_map_rev: a dictionary mapping class label strings to target
                integers
            dynamic_classes (False): whether to dynamically add new labels to
                ``labels_map_rev``
            include_confidence (False): whether to include confidences in the
                export, if they exist
        
fiftyone/utils/yolo.py