code: def build_trainer(self, cfg):
      # build trainer
      trainer = Trainer(cfg, mode="test")
      # load weights
      trainer.load_weights(cfg.weights)
  
      # set for get extra_data before nms
      trainer.model.use_extra_data = True
      # set for record the bbox index before nms
      if cfg.architecture in ["FasterRCNN", "MaskRCNN"]:
          trainer.model.bbox_post_process.nms.return_index = True
      elif cfg.architecture in [
          "YOLOv3",
          "PPYOLOE",
          "PPYOLOEWithAuxHead",
      ]:
          if trainer.model.post_process is not None:
              # anchor based YOLOs: YOLOv3,PP-YOLO
              trainer.model.post_process.nms.return_index = True
          else:
              # anchor free YOLOs: PP-YOLOE, PP-YOLOE+
              trainer.model.yolo_head.nms.return_index = True
      elif cfg.architecture == "BlazeFace" or cfg.architecture == "SSD":
          trainer.model.post_process.nms.return_index = True
      elif cfg.architecture == "RetinaNet":
          trainer.model.head.nms.return_index = True
      else:
          print(
              cfg.architecture
              + " is not supported for cam temporarily!"
          )
          sys.exit()
      # Todo: Unify the head/post_process name in each model
  
      return trainer
  
file_path: PaddleDetection/ppdet/utils/cam_utils.py
imports: import numpy
  import cv2
  import os
  import sys
  import glob
  from ppdet.utils.logger import setup_logger
  import copy
  import paddle
  from ppdet.engine import Trainer
label_desc: Use image node_id 2 for calling the BBoxCAM obj's underlying member method code with example usage: obj.build_trainer(cfg) and returns: trainer