code: def extract_spatial_feats(feat_dir, out_dir):
      info_json_path = os.path.join(feat_dir, "gqa_spatial_info.json")
      info_dict = json.load(open(info_json_path))
  
      file_mapping = {k: [] for k in range(16)}
  
      for k, v in info_dict.items():
          file_mapping[v["file"]] += [(k, v)]
  
      for i in range(16):
          file_path = os.path.join(feat_dir, f"gqa_spatial_{i}.h5")
          print(f"Processing file {file_path}")
  
          feat_db = h5py.File(file_path, "r")
          for entry in tqdm.tqdm(file_mapping[i]):
              image_id = entry[0]
              meta = entry[1]
              to_save = feat_db["features"][meta["idx"]]
              to_save = to_save.reshape(1, 7, 7, 2048)
              save_path = os.path.join(out_dir, str(image_id) + ".npy")
              np.save(save_path, to_save)
  
file_path: mmf/tools/scripts/gqa/convert_gqa_to_vqa.py
imports: import argparse
  import json
  import os
  import re
  from collections import Counter
  import h5py
  import numpy
  import tqdm
  from mmf.utils.process_answers import preprocess_answer
  from mmf.utils.text_processing import text_tokenize
label_desc: Use image node_id 5 for calling a global function with example usage: extract_spatial_feats(feat_dir, out_dir) without return types