code: def get_keyframe_data(boxes_and_labels):
      """
      Getting keyframe indices, boxes and labels in the dataset.
  
      Args:
          boxes_and_labels (list[dict]): a list which maps from video_idx to a dict.
              Each dict `frame_sec` to a list of boxes and corresponding labels.
  
      Returns:
          keyframe_indices (list): a list of indices of the keyframes.
          keyframe_boxes_and_labels (list[list[list]]): a list of list which maps from
              video_idx and sec_idx to a list of boxes and corresponding labels.
      """
  
      def sec_to_frame(sec):
          """
          Convert time index (in second) to frame index.
          0: 900
          30: 901
          """
          return (sec - 900) * FPS
  
      keyframe_indices = []
      keyframe_boxes_and_labels = []
      count = 0
      for video_idx in range(len(boxes_and_labels)):
          sec_idx = 0
          keyframe_boxes_and_labels.append([])
          for sec in boxes_and_labels[video_idx].keys():
              if sec not in AVA_VALID_FRAMES:
                  continue
  
              if len(boxes_and_labels[video_idx][sec]) > 0:
                  keyframe_indices.append(
                      (video_idx, sec_idx, sec, sec_to_frame(sec))
                  )
                  keyframe_boxes_and_labels[video_idx].append(
                      boxes_and_labels[video_idx][sec]
                  )
                  sec_idx += 1
                  count += 1
      logger.info("%d keyframes used." % count)
  
      return keyframe_indices, keyframe_boxes_and_labels
  
file_path: SlowFast/slowfast/datasets/ava_helper.py
imports: import logging
  import os
  from collections import defaultdict
  from slowfast.utils.env import pathmgr
label_desc: Use image node_id 3 for calling a global function with example usage: get_keyframe_data(boxes_and_labels) and returns: keyframe_indices,  keyframe_boxes_and_labels, unknown