class_docstr: Action Predictor for action recognition.
class_docstr_tok: ["Action","Predictor","for","action","recognition","."]
docstr: Args:
      cfg (CfgNode): configs. Details can be found in
          slowfast/config/defaults.py
      gpu_id (Optional[int]): GPU id.
docstr_tok: ["Args",":","cfg","(","CfgNode",")",":","configs",".","Details","can","be","found","in","slowfast\/config\/defaults.py","gpu_id","(","Optional","[","int","]",")",":","GPU","id","."]
code: def __init__(self, cfg, gpu_id=None):
      """
      Args:
          cfg (CfgNode): configs. Details can be found in
              slowfast/config/defaults.py
          gpu_id (Optional[int]): GPU id.
      """
      if cfg.NUM_GPUS:
          self.gpu_id = (
              torch.cuda.current_device() if gpu_id is None else gpu_id
          )
  
      # Build the video model and print model statistics.
      self.model = build_model(cfg, gpu_id=gpu_id)
      self.model.eval()
      self.cfg = cfg
  
      if cfg.DETECTION.ENABLE:
          self.object_detector = Detectron2Predictor(
              cfg, gpu_id=self.gpu_id
          )
  
      logger.info("Start loading model weights.")
      cu.load_test_checkpoint(cfg, self.model)
      logger.info("Finish loading model weights")
  
imports: import queue
  import cv2
  import torch
  from detectron2 import model_zoo
  from detectron2.config import get_cfg
  from detectron2.engine import DefaultPredictor
  import slowfast.utils.checkpoint
  from slowfast.datasets import cv2_transform
  from slowfast.models import build_model
  from slowfast.utils import logging
  from slowfast.visualization.utils import process_cv2_inputs
label_desc: Use image node_id 1 to create a new Predictor object  with example: obj = Predictor(cfg, gpu_id)