docstr: Draw predicted labels or ground truth classes to clip. Draw bouding boxes to clip
  if bboxes is provided. Boxes will gradually fade in and out the clip, centered around
  the clip's central frame, within the provided `draw_range`.
  Args:
      frames (array-like): video data in the shape (T, H, W, C).
      preds (tensor): a tensor of shape (num_boxes, num_classes) that contains all of the confidence scores
          of the model. For recognition task or for ground_truth labels, input shape can be (num_classes,).
      bboxes (Optional[tensor]): shape (num_boxes, 4) that contains the coordinates of the bounding boxes.
      text_alpha (float): transparency label of the box wrapped around text labels.
      ground_truth (bool): whether the prodived bounding boxes are ground-truth.
      keyframe_idx (int): the index of keyframe in the clip.
      draw_range (Optional[list[ints]): only draw frames in range [start_idx, end_idx] inclusively in the clip.
          If None, draw on the entire clip.
      repeat_frame (int): repeat each frame in draw_range for `repeat_frame` time for slow-motion effect.
docstr_tok: ["Draw","predicted","labels","or","ground","truth","classes","to","clip",".","Draw","bouding","boxes","to","clip","if","bboxes","is","provided",".","Boxes","will","gradually","fade","in","and","out","the","clip",",","centered","around","the","clip","'s","central","frame",",","within","the","provided","`","draw_range","`",".","Args",":","frames","(","array-like",")",":","video","data","in","the","shape","(","T",",","H",",","W",",","C",")",".","preds","(","tensor",")",":","a","tensor","of","shape","(","num_boxes",",","num_classes",")","that","contains","all","of","the","confidence","scores","of","the","model",".","For","recognition","task","or","for","ground_truth","labels",",","input","shape","can","be","(","num_classes",",",")",".","bboxes","(","Optional","[","tensor","]",")",":","shape","(","num_boxes",",","4",")","that","contains","the","coordinates","of","the","bounding","boxes",".","text_alpha","(","float",")",":","transparency","label","of","the","box","wrapped","around","text","labels",".","ground_truth","(","bool",")",":","whether","the","prodived","bounding","boxes","are","ground-truth",".","keyframe_idx","(","int",")",":","the","index","of","keyframe","in","the","clip",".","draw_range","(","Optional","[","list","[","ints","]",")",":","only","draw","frames","in","range","[","start_idx",",","end_idx","]","inclusively","in","the","clip",".","If","None",",","draw","on","the","entire","clip",".","repeat_frame","(","int",")",":","repeat","each","frame","in","draw_range","for","`","repeat_frame","`","time","for","slow-motion","effect","."]
code: def draw_clip_range(
      self,
      frames,
      preds,
      bboxes=None,
      text_alpha=0.5,
      ground_truth=False,
      keyframe_idx=None,
      draw_range=None,
      repeat_frame=1,
  ):
      """
      Draw predicted labels or ground truth classes to clip. Draw bouding boxes to clip
      if bboxes is provided. Boxes will gradually fade in and out the clip, centered around
      the clip's central frame, within the provided `draw_range`.
      Args:
          frames (array-like): video data in the shape (T, H, W, C).
          preds (tensor): a tensor of shape (num_boxes, num_classes) that contains all of the confidence scores
              of the model. For recognition task or for ground_truth labels, input shape can be (num_classes,).
          bboxes (Optional[tensor]): shape (num_boxes, 4) that contains the coordinates of the bounding boxes.
          text_alpha (float): transparency label of the box wrapped around text labels.
          ground_truth (bool): whether the prodived bounding boxes are ground-truth.
          keyframe_idx (int): the index of keyframe in the clip.
          draw_range (Optional[list[ints]): only draw frames in range [start_idx, end_idx] inclusively in the clip.
              If None, draw on the entire clip.
          repeat_frame (int): repeat each frame in draw_range for `repeat_frame` time for slow-motion effect.
      """
      if draw_range is None:
          draw_range = [0, len(frames) - 1]
      if draw_range is not None:
          draw_range[0] = max(0, draw_range[0])
          left_frames = frames[: draw_range[0]]
          right_frames = frames[draw_range[1] + 1 :]
  
      draw_frames = frames[draw_range[0] : draw_range[1] + 1]
      if keyframe_idx is None:
          keyframe_idx = len(frames) // 2
  
      img_ls = (
          list(left_frames)
          + self.draw_clip(
              draw_frames,
              preds,
              bboxes=bboxes,
              text_alpha=text_alpha,
              ground_truth=ground_truth,
              keyframe_idx=keyframe_idx - draw_range[0],
              repeat_frame=repeat_frame,
          )
          + list(right_frames)
      )
  
      return img_ls
  
imports: import itertools
  import logging
  import numpy
  import matplotlib.pyplot
  import torch
  from detectron2.utils.visualizer import Visualizer
  import slowfast.utils.logging
  from slowfast.utils.misc import get_class_names
label_desc: Use image node_id 4 for calling the VideoVisualizer obj's underlying member method code with example usage: obj.draw_clip_range(frames, preds, bboxes, text_alpha, ground_truth, keyframe_idx, draw_range, repeat_frame) and returns: img_ls