class_docstr: Visualize action predictions for videos or folder of images with precomputed
  and ground-truth boxes in AVA format.
class_docstr_tok: ["Visualize","action","predictions","for","videos","or","folder","of","images","with","precomputed","and","ground-truth","boxes","in","AVA","format","."]
docstr: Predict and append prediction results to each box in each keyframe in
  `self.pred_boxes` dictionary.
docstr_tok: ["Predict","and","append","prediction","results","to","each","box","in","each","keyframe","in","`","self.pred_boxes","`","dictionary","."]
code: def get_predictions(self):
      """
      Predict and append prediction results to each box in each keyframe in
      `self.pred_boxes` dictionary.
      """
      # Set random seed from configs.
      np.random.seed(self.cfg.RNG_SEED)
      torch.manual_seed(self.cfg.RNG_SEED)
  
      # Setup logging format.
      logging.setup_logging(self.cfg.OUTPUT_DIR)
  
      # Print config.
      logger.info("Run demo with config:")
      logger.info(self.cfg)
      assert (
          self.cfg.NUM_GPUS <= 1
      ), "Cannot run demo visualization on multiple GPUs."
  
      # Build the video model and print model statistics.
      model = build_model(self.cfg)
      model.eval()
      logger.info("Start loading model info")
      misc.log_model_info(model, self.cfg, use_train_input=False)
      logger.info("Start loading model weights")
      cu.load_test_checkpoint(self.cfg, model)
      logger.info("Finish loading model weights")
      logger.info("Start making predictions for precomputed boxes.")
      for keyframe_idx, boxes_and_labels in tqdm.tqdm(
          self.pred_boxes.items()
      ):
          inputs = self.get_input_clip(keyframe_idx)
          boxes = boxes_and_labels[0]
          boxes = torch.from_numpy(np.array(boxes)).float()
  
          box_transformed = scale_boxes(
              self.cfg.DATA.TEST_CROP_SIZE,
              boxes,
              self.display_height,
              self.display_width,
          )
  
          # Pad frame index for each box.
          box_inputs = torch.cat(
              [
                  torch.full((box_transformed.shape[0], 1), float(0)),
                  box_transformed,
              ],
              axis=1,
          )
          if self.cfg.NUM_GPUS:
              # Transfer the data to the current GPU device.
              if isinstance(inputs, (list,)):
                  for i in range(len(inputs)):
                      inputs[i] = inputs[i].cuda(non_blocking=True)
              else:
                  inputs = inputs.cuda(non_blocking=True)
  
              box_inputs = box_inputs.cuda()
  
          preds = model(inputs, box_inputs)
  
          preds = preds.detach()
  
          if self.cfg.NUM_GPUS:
              preds = preds.cpu()
  
          boxes_and_labels[1] = preds
  
imports: import numpy
  import os
  import cv2
  import torch
  import tqdm
  import slowfast.utils.checkpoint
  import slowfast.utils.logging
  from slowfast.datasets.ava_helper import parse_bboxes_file
  from slowfast.datasets.cv2_transform import scale, scale_boxes
  from slowfast.datasets.utils import get_sequence
  from slowfast.models import build_model
  from slowfast.utils import misc
  from slowfast.utils.env import pathmgr
  from slowfast.visualization.utils import process_cv2_inputs
  from slowfast.visualization.video_visualizer import VideoVisualizer
label_desc: Use image node_id 4 for calling the AVAVisualizerWithPrecomputedBox obj's underlying member method code with example usage: obj.get_predictions() without return types