class_docstr: Class for writing annotations in YOLO-style TXT format.
class_docstr_tok: ["Class","for","writing","annotations","in","YOLO-style","TXT","format","."]
docstr: Writes the detections to disk.
  
  Args:
      detections: a :class:`fiftyone.core.labels.Detections` instance
      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
docstr_tok: ["Writes","the","detections","to","disk",".","Args",":","detections",":","a",":","class",":","`","fiftyone.core.labels.Detections","`","instance","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"]
code: def write(
      self,
      detections,
      txt_path,
      labels_map_rev,
      dynamic_classes=False,
      include_confidence=False,
  ):
      """Writes the detections to disk.
  
      Args:
          detections: a :class:`fiftyone.core.labels.Detections` instance
          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
      """
      rows = []
      for detection in detections.detections:
          label = detection.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 detection with label '%s' not in provided "
                  "classes" % label
              )
              warnings.warn(msg)
              continue
          else:
              target = labels_map_rev[label]
  
          if include_confidence:
              confidence = detection.confidence
          else:
              confidence = None
  
          row = _make_yolo_row(
              detection.bounding_box, target, confidence=confidence
          )
          rows.append(row)
  
      _write_file_lines(rows, txt_path)
  
imports: import logging
  import os
  import warnings
  import yaml
  import eta.core.utils
  import fiftyone.core.labels
  import fiftyone.core.storage
  import fiftyone.utils.data
label_desc: Use image node_id 1 for calling the YOLOAnnotationWriter obj's underlying member method code with example usage: obj.write(detections, txt_path, labels_map_rev, dynamic_classes, include_confidence) without return types