docstr: Create model cfg for feature extraction
  SG expects a yacs config (CfgNode)
  which is effectively a dictionary merged from
  their cfg defaults, their sg_cfg defaults, and
  scene_graph_benchmark/sgg_configs/vgattr/vinvl_x152c4.yaml
  the last needs to be modified for vinvl feature extraction
  we will modify that cfg obj here to output box_features
  used by oscar (vinvl model) as image feature input
docstr_tok: ["Create","model","cfg","for","feature","extraction","SG","expects","a","yacs","config","(","CfgNode",")","which","is","effectively","a","dictionary","merged","from","their","cfg","defaults",",","their","sg_cfg","defaults",",","and","scene_graph_benchmark\/sgg_configs\/vgattr\/vinvl_x152c4.yaml","the","last","needs","to","be","modified","for","vinvl","feature","extraction","we","will","modify","that","cfg","obj","here","to","output","box_features","used","by","oscar","(","vinvl","model",")","as","image","feature","input"]
code: def _build_detection_model(self):
      """Create model cfg for feature extraction
      SG expects a yacs config (CfgNode)
      which is effectively a dictionary merged from
      their cfg defaults, their sg_cfg defaults, and
      scene_graph_benchmark/sgg_configs/vgattr/vinvl_x152c4.yaml
      the last needs to be modified for vinvl feature extraction
      we will modify that cfg obj here to output box_features
      used by oscar (vinvl model) as image feature input
      """
      cfg.set_new_allowed(True)
      cfg.merge_from_other_cfg(sg_cfg)
      cfg.set_new_allowed(False)
      # Configuring VinVl
      cfg.merge_from_file(self.args.config_file)
      model_args = [
          "MODEL.WEIGHT",
          self.args.model_file,
          "MODEL.ROI_HEADS.NMS_FILTER",
          1,
          "MODEL.ROI_HEADS.SCORE_THRESH",
          0.2,
          "TEST.IGNORE_BOX_REGRESSION",
          False,
          "MODEL.ATTRIBUTE_ON",
          True,
          "TEST.OUTPUT_FEATURE",
          True,
          "TEST.OUTPUT_RELATION_FEATURE",
          True,
          "TEST.TSV_SAVE_SUBSET",
          ["rect", "class", "conf", "feature", "relation_feature"],
          "TEST.GATHER_ON_CPU",
          True,
      ]
      cfg.merge_from_list(model_args)
      cfg.freeze()
  
      model = AttrRCNN(cfg)
      model.to(DEVICE)
      model.eval()
      output_dir = cfg.OUTPUT_DIR
      checkpointer = DetectronCheckpointer(
          cfg, model, save_dir=output_dir
      )
      checkpointer.load(cfg.MODEL.WEIGHT)
      return model
  
imports: import argparse
  import os
  import cv2
  import numpy
  import torch
  from maskrcnn_benchmark.config import cfg
  from maskrcnn_benchmark.data.transforms import build_transforms
  from maskrcnn_benchmark.structures.image_list import to_image_list
  from maskrcnn_benchmark.utils.checkpoint import DetectronCheckpointer
  from mmf.utils.download import download
  from PIL import Image
  from scene_graph_benchmark.AttrRCNN import AttrRCNN
  from scene_graph_benchmark.config import sg_cfg
  from tools.scripts.features.extraction_utils import chunks, get_image_files
label_desc: Use image node_id 4 for calling the FeatureExtractor obj's underlying member method code with example usage: obj._build_detection_model() and returns: model