code: def _process_feature_extraction(
      self,
      output,
      im_scales,
      im_infos,
      feature_name="fc6",
      conf_thresh=0,
  ):
      batch_size = len(output[0]["proposals"])
      n_boxes_per_image = [
          len(boxes) for boxes in output[0]["proposals"]
      ]
      score_list = output[0]["scores"].split(n_boxes_per_image)
      score_list = [
          torch.nn.functional.softmax(x, -1) for x in score_list
      ]
      feats = output[0][feature_name].split(n_boxes_per_image)
      cur_device = score_list[0].device
  
      feat_list = []
      info_list = []
  
      for i in range(batch_size):
          dets = output[0]["proposals"][i].bbox / im_scales[i]
          scores = score_list[i]
          max_conf = torch.zeros(scores.shape[0]).to(cur_device)
          conf_thresh_tensor = torch.full_like(max_conf, conf_thresh)
          start_index = 1
          # Column 0 of the scores matrix is for the background class
          if self.args.background:
              start_index = 0
          for cls_ind in range(start_index, scores.shape[1]):
              cls_scores = scores[:, cls_ind]
              keep = nms(dets, cls_scores, 0.5)
              max_conf[keep] = torch.where(
                  # Better than max one till now and minimally greater
                  # than conf_thresh
                  (cls_scores[keep] > max_conf[keep])
                  & (cls_scores[keep] > conf_thresh_tensor[keep]),
                  cls_scores[keep],
                  max_conf[keep],
              )
  
          sorted_scores, sorted_indices = torch.sort(
              max_conf, descending=True
          )
          num_boxes = (
              sorted_scores[: self.args.num_features] != 0
          ).sum()
          keep_boxes = sorted_indices[: self.args.num_features]
          feat_list.append(feats[i][keep_boxes])
          bbox = (
              output[0]["proposals"][i][keep_boxes].bbox / im_scales[i]
          )
          # Predict the class label using the scores
          objects = torch.argmax(
              scores[keep_boxes][:, start_index:], dim=1
          )
  
          info_list.append(
              {
                  "bbox": bbox.cpu().numpy(),
                  "num_boxes": num_boxes.item(),
                  "objects": objects.cpu().numpy(),
                  "cls_prob": scores[keep_boxes][:, start_index:]
                  .cpu()
                  .numpy(),
                  "image_width": im_infos[i]["width"],
                  "image_height": im_infos[i]["height"],
              }
          )
  
      return feat_list, info_list
  
imports: import argparse
  import os
  import cv2
  import numpy
  import torch
  from maskrcnn_benchmark.config import cfg
  from maskrcnn_benchmark.layers import nms
  from maskrcnn_benchmark.modeling.detector import build_detection_model
  from maskrcnn_benchmark.structures.image_list import to_image_list
  from maskrcnn_benchmark.utils.model_serialization import load_state_dict
  from mmf.utils.download import download
  from PIL import Image
  from tools.scripts.features.extraction_utils import chunks, get_image_files
label_desc: Use image node_id 6 for calling the FeatureExtractor obj's underlying member method code with example usage: obj._process_feature_extraction(output, im_scales, im_infos, feature_name, conf_thresh) and returns: feat_list,  info_list