docstr: Models and config files are downloaded if not
  specified in args.
  Then gets a list of images to extract features from.
  Will exclude images already in the output dir,
  and images in the exclude list.
  Images are loaded and transformed based on config.
  Will then do feature extraction in batches
  using AttrRCNN with weights from scene graph benchmark
  for VinVL (Oscar+) image features.
  Output of a list of BoxList objects that contain
  fields and bbox which are processes to create
  image features and image info objects for MMF.
  
  By default this will generate npy files containing
  the image features expected by VinVL checkpoints,
  and work with MMF out of the box.
docstr_tok: ["Models","and","config","files","are","downloaded","if","not","specified","in","args",".","Then","gets","a","list","of","images","to","extract","features","from",".","Will","exclude","images","already","in","the","output","dir",",","and","images","in","the","exclude","list",".","Images","are","loaded","and","transformed","based","on","config",".","Will","then","do","feature","extraction","in","batches","using","AttrRCNN","with","weights","from","scene","graph","benchmark","for","VinVL","(","Oscar+",")","image","features",".","Output","of","a","list","of","BoxList","objects","that","contain","fields","and","bbox","which","are","processes","to","create","image","features","and","image","info","objects","for","MMF",".","By","default","this","will","generate","npy","files","containing","the","image","features","expected","by","VinVL","checkpoints",",","and","work","with","MMF","out","of","the","box","."]
code: def extract_features(self):
      """Models and config files are downloaded if not
      specified in args.
      Then gets a list of images to extract features from.
      Will exclude images already in the output dir,
      and images in the exclude list.
      Images are loaded and transformed based on config.
      Will then do feature extraction in batches
      using AttrRCNN with weights from scene graph benchmark
      for VinVL (Oscar+) image features.
      Output of a list of BoxList objects that contain
      fields and bbox which are processes to create
      image features and image info objects for MMF.
  
      By default this will generate npy files containing
      the image features expected by VinVL checkpoints,
      and work with MMF out of the box.
      """
      image_dir = self.args.image_dir
      if os.path.isfile(image_dir):
          features, infos = self.get_vinvl_features([image_dir])
          self._save_feature(image_dir, features[0], infos[0])
      else:
          files = get_image_files(
              self.args.image_dir,
              exclude_list=self.args.exclude_list,
              start_index=self.args.start_index,
              end_index=self.args.end_index,
              output_folder=self.args.output_folder,
          )
  
          finished = 0
          total = len(files)
  
          for chunk, _ in chunks(files, self.args.batch_size):
              features, infos = self.get_vinvl_features(chunk)
              for idx, file_name in enumerate(chunk):
                  self._save_feature(
                      file_name, features[idx], infos[idx]
                  )
              finished += len(chunk)
  
              if finished % 200 == 0:
                  print(f"Processed {finished}/{total}")
  
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 10 for calling the FeatureExtractor obj's underlying member method code with example usage: obj.extract_features() without return types