code: def _to_scale_video_playback_labels(
      frames, frame_size, make_events=False
  ):
      in_progress_events = {}
      events = []
  
      traj_uuids = {}
      annotations = {}
      for frame_number, frame in frames.items():
          # Ingst new labels
          for label in frame.values():
              if make_events and isinstance(
                  label, (fol.Classification, fol.Classifications)
              ):
                  _ingest_event_label(
                      label, frame_number, in_progress_events
                  )
              elif isinstance(label, (fol.Detection, fol.Detections)):
                  if isinstance(label, fol.Detection):
                      detections = [label]
                  else:
                      detections = label.detections
  
                  for detection in detections:
                      if detection.index is None:
                          key = None
                      else:
                          key = (detection.label, detection.index)
  
                      uuid = traj_uuids.get(key, None)
                      if uuid is None:
                          uuid = str(uuid4())
                          annotations[uuid] = _init_video_box(
                              detection.label
                          )
  
                          if key is not None:
                              traj_uuids[key] = uuid
  
                      annotations[uuid]["frames"].append(
                          _make_video_box_frame(
                              detection, frame_number, frame_size
                          )
                      )
  
              elif label is not None:
                  msg = (
                      "Ignoring unsupported label type '%s'"
                      % label.__class__
                  )
                  warnings.warn(msg)
  
          # Finalize in-progress events
          _finalize_events(events, frame_number, in_progress_events)
  
      # Finalize all remaining events
      _finalize_events(events, None, in_progress_events)
  
      return {"annotations": annotations}, {"events": events}
  
imports: from collections import defaultdict
  from copy import deepcopy
  import logging
  import os
  from uuid import uuid4
  import warnings
  import numpy
  import eta.core.image
  import eta.core.serial
  import eta.core.utils
  import eta.core.web
  import fiftyone.core.labels
  import fiftyone.core.media
  import fiftyone.core.metadata
  import fiftyone.core.utils
  import fiftyone.core.validation
  import fiftyone.utils.image
label_desc: Use image node_id 11 for calling a global function with example usage: _to_scale_video_playback_labels(frames, frame_size, make_events) and returns: dict,  dict