code: def load_and_process_features(cfg, input_dir, split, pca=None):
      # Choose only the first layer.
      layer = (
          cfg.MODEL.FEATURE_EVAL_SETTINGS.LINEAR_EVAL_FEAT_POOL_OPS_MAP[
              0
          ][0]
      )
      shard_file_names = ExtractedFeaturesLoader.get_shard_file_names(
          input_dir, split, layer
      )
  
      all_inds = []
      all_feats = []
  
      for shard in shard_file_names:
          # Load the feature shard.
          feature_shard = ExtractedFeaturesLoader.load_feature_shard(
              shard, verbose=False, allow_pickle=True
          )
          features = feature_shard.features
          inds = feature_shard.indices
  
          # Post-process (rmac | gem | l2) each image from the the feature shard .
          for i, feat in enumerate(features):
              ind = inds[i]
  
              if ind in all_inds:
                  # TODO: Sometimes load_feature_shard returns duplicate features.
                  # Feature already processed.
                  continue
  
              processed_feat = post_process_image(
                  cfg,
                  feat,
                  pca=pca,
              )
              all_feats.append(processed_feat)
              all_inds.append(ind)
  
      # Sort features by index.
      all_feats_sorted = [
          feat
          for _, feat in sorted(
              zip(all_inds, all_feats), key=lambda tup: tup[0]
          )
      ]
  
      return all_feats_sorted
  
imports: import logging
  import os
  import sys
  from argparse import Namespace
  from typing import Any, List
  import numpy
  import torch
  import torchvision
  from classy_vision.generic.util import copy_model_to_gpu, load_checkpoint
  from iopath.common.file_io import g_pathmgr
  from vissl.config import AttrDict
  from vissl.hooks import default_hook_generator
  from vissl.models import build_model
  from vissl.utils.checkpoint import get_checkpoint_folder, init_model_from_consolidated_weights
  from vissl.utils.distributed_launcher import launch_distributed
  from vissl.utils.env import set_env_vars, setup_path_manager
  from vissl.utils.extract_features_utils import ExtractedFeaturesLoader
  from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict, print_cfg
  from vissl.utils.instance_retrieval_utils.data_util import CopyDaysDataset, GenericInstanceRetrievalDataset, get_average_gem, InstanceRetrievalDataset, InstanceRetrievalImageLoader, InstreDataset, is_copdays_dataset, is_instre_dataset, is_oxford_paris_dataset, is_revisited_dataset, is_whiten_dataset, l2n, MultigrainResize, RevisitedInstanceRetrievalDataset, WhiteningTrainingImageDataset
  from vissl.utils.instance_retrieval_utils.rmac import get_rmac_descriptors
  from vissl.utils.io import load_file, makedir, save_file
  from vissl.utils.logger import setup_logging, shutdown_logging
  from vissl.utils.pca import load_pca, train_and_save_pca
  from vissl.utils.perf_stats import PerfStats, PerfTimer
label_desc: Use image node_id 12 for calling a global function with example usage: load_and_process_features(cfg, input_dir, split, pca) and returns: all_feats_sorted