code: def extract_features(self):
      image_dir = self.args.image_dir
  
      if os.path.isfile(image_dir):
          features = self.get_frcnn_features([image_dir])
          full_features, feat_list, info_list = self._process_features(
              features, 0
          )
          self._save_feature(
              image_dir, full_features, feat_list, info_list
          )
      else:
          files = get_image_files(
              self.args.image_dir,
              exclude_list=self.args.exclude_list,
              partition=self.args.partition,
              max_partition=self.args.max_partition,
              start_index=self.args.start_index,
              end_index=self.args.end_index,
          )
  
          finished = 0
          total = len(files)
          failed = 0
          failedNames = []
  
          file_names = copy.deepcopy(files)
  
          for chunk, begin_idx in chunks(files, self.args.batch_size):
              try:
                  features = self.get_frcnn_features(chunk)
                  for idx, file_name in enumerate(chunk):
                      (
                          full_features,
                          feat_list,
                          info_list,
                      ) = self._process_features(features, idx)
                      self._save_feature(
                          file_names[begin_idx + idx],
                          full_features,
                          feat_list,
                          info_list,
                      )
                  finished += len(chunk)
  
                  if finished % 200 == 0:
                      print(f"Processed {finished}/{total}")
              except Exception:
                  failed += len(chunk)
                  for idx, file_name in enumerate(chunk):
                      failedNames.append(file_names[begin_idx + idx])
                  logging.exception("message")
          if self.args.partition is not None:
              print("Partition " + str(self.args.partition) + " done.")
          print("Failed: " + str(failed))
          print("Failed Names: " + str(failedNames))
  
file_path: mmf/tools/scripts/features/frcnn/extract_features_frcnn.py
imports: import argparse
  import copy
  import logging
  import os
  import numpy
  import torch
  from tools.scripts.features.extraction_utils import chunks, get_image_files
  from tools.scripts.features.frcnn.frcnn_utils import Config
  from tools.scripts.features.frcnn.modeling_frcnn import GeneralizedRCNN
  from tools.scripts.features.frcnn.processing_image import Preprocess
label_desc: Use image node_id 7 for calling the FeatureExtractor obj's underlying member method code with example usage: obj.extract_features() without return types