class_docstr: Wrapper around Detectron2 to return the required predicted bounding boxes
  as a ndarray.
class_docstr_tok: ["Wrapper","around","Detectron2","to","return","the","required","predicted","bounding","boxes","as","a","ndarray","."]
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.
      """
  
      self.cfg = get_cfg()
      self.cfg.merge_from_file(
          model_zoo.get_config_file(cfg.DEMO.DETECTRON2_CFG)
      )
      self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = (
          cfg.DEMO.DETECTRON2_THRESH
      )
      self.cfg.MODEL.WEIGHTS = cfg.DEMO.DETECTRON2_WEIGHTS
      self.cfg.INPUT.FORMAT = cfg.DEMO.INPUT_FORMAT
      if cfg.NUM_GPUS and gpu_id is None:
          gpu_id = torch.cuda.current_device()
      self.cfg.MODEL.DEVICE = (
          "cuda:{}".format(gpu_id) if cfg.NUM_GPUS > 0 else "cpu"
      )
  
      logger.info("Initialized Detectron2 Object Detection Model.")
  
      self.predictor = DefaultPredictor(self.cfg)
  
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 Detectron2Predictor object  with example: obj = Detectron2Predictor(cfg, gpu_id)