code: def _make_bdd_annotation(labels, metadata, filename, extra_attrs):
      frame_size = (metadata.width, metadata.height)
  
      # Convert labels to BDD format
      frame_attrs = {}
      objects = []
      polylines = []
      for name, _labels in labels.items():
          if isinstance(_labels, fol.Classification):
              frame_attrs[name] = _labels.label
          elif isinstance(_labels, fol.Classifications):
              frame_attrs[name] = [
                  l.label for l in _labels.classifications
              ]
          elif isinstance(_labels, fol.Detection):
              obj = _detection_to_bdd(_labels, frame_size, extra_attrs)
              objects.append(obj)
          elif isinstance(_labels, fol.Detections):
              for detection in _labels.detections:
                  obj = _detection_to_bdd(
                      detection, frame_size, extra_attrs
                  )
                  objects.append(obj)
          elif isinstance(_labels, fol.Polyline):
              obj = _polyline_to_bdd(_labels, frame_size, extra_attrs)
              polylines.append(obj)
          elif isinstance(_labels, fol.Polylines):
              for polyline in _labels.polylines:
                  obj = _polyline_to_bdd(
                      polyline, frame_size, extra_attrs
                  )
                  polylines.append(obj)
          elif _labels is not None:
              msg = (
                  "Ignoring unsupported label type '%s'"
                  % _labels.__class__
              )
              warnings.warn(msg)
  
      # Build labels list
      labels = []
      uuid = -1
  
      for obj in objects:
          uuid += 1
          obj["id"] = uuid
          labels.append(obj)
  
      for polyline in polylines:
          uuid += 1
          polyline["id"] = uuid
          labels.append(polyline)
  
      return {
          "name": filename,
          "attributes": frame_attrs,
          "labels": labels,
      }
  
imports: from copy import deepcopy
  import logging
  import os
  import warnings
  import eta.core.serial
  import eta.core.utils
  import fiftyone
  import fiftyone.core.labels
  import fiftyone.core.metadata
  import fiftyone.core.storage
  import fiftyone.utils.data
label_desc: Use image node_id 12 for calling a global function with example usage: _make_bdd_annotation(labels, metadata, filename, extra_attrs) and returns: dict