code: def extract_low_shot_features(
      args: Namespace, cfg: AttrDict, output_dir: str
  ):
      dataset_name = cfg["SVM"]["low_shot"]["dataset_name"]
      k_values = cfg["SVM"]["low_shot"]["k_values"]
      sample_inds = cfg["SVM"]["low_shot"]["sample_inds"]
      if "voc" in dataset_name:
          # extract the features. In case of voc07 low-shot, we extract the
          # features on full train and test sets. Both sets have about 5K images
          # we extract
          launch_distributed(
              cfg,
              args.node_id,
              engine_name="extract_features",
              hook_generator=default_hook_generator,
          )
      elif "places" in dataset_name:
          # in case of places, since the features size could become large, we need
          # to extract features at smaller subsamples
          data_paths, label_paths = dataset_catalog.get_data_files(
              split="TRAIN", dataset_config=cfg["DATA"]
          )
          targets = load_file(label_paths[0])
          logging.info("Generating low-shot samples for Places205...")
          generate_places_low_shot_samples(
              targets, k_values, sample_inds, output_dir, data_paths[0]
          )
  
          test_features_extracted = False
          for idx in sample_inds:
              for k in k_values:
                  out_img_file = (
                      f"{output_dir}/train_images_sample{idx}_k{k}.npy"
                  )
                  out_lbls_file = (
                      f"{output_dir}/train_labels_sample{idx}_k{k}.npy"
                  )
                  cfg.DATA.TRAIN.DATA_PATHS = [out_img_file]
                  cfg.DATA.TRAIN.LABEL_PATHS = [out_lbls_file]
                  cfg.CHECKPOINT.DIR = f"{output_dir}/sample{idx}_k{k}"
                  logging.info(
                      f"Extracting features for places low shot: sample{idx}_k{k}"
                  )
                  # we want to extract the test features only once since the test
                  # features are commonly used for testing for all low-shot setup.
                  if test_features_extracted:
                      cfg.TEST_MODEL = False
                  launch_distributed(
                      cfg,
                      args.node_id,
                      engine_name="extract_features",
                      hook_generator=default_hook_generator,
                  )
                  test_features_extracted = True
          # set the test model to true again after feature extraction is done
          cfg.TEST_MODEL = True
      else:
          raise RuntimeError(f"Dataset not recognised: {dataset_name}")
  
imports: import logging
  import multiprocessing
  import sys
  from argparse import Namespace
  from typing import Any, List
  from extra_scripts.create_low_shot_samples import generate_low_shot_samples, generate_places_low_shot_samples
  from vissl.config import AttrDict
  from vissl.data import dataset_catalog
  from vissl.hooks import default_hook_generator
  from vissl.models.model_helpers import get_trunk_output_feature_names
  from vissl.utils.checkpoint import get_checkpoint_folder
  from vissl.utils.distributed_launcher import launch_distributed
  from vissl.utils.env import set_env_vars
  from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict, print_cfg
  from vissl.utils.io import load_file
  from vissl.utils.logger import setup_logging, shutdown_logging
  from vissl.utils.misc import merge_features
  from vissl.utils.svm_utils.svm_low_shot_trainer import SVMLowShotTrainer
label_desc: Use image node_id 5 for calling a global function with example usage: extract_low_shot_features(args, cfg, output_dir) without return types