code: def extract_val(tar_fname, target_dir, with_rec=False, num_thread=1):
      os.makedirs(target_dir)
      print("Extracting " + tar_fname)
      with tarfile.open(tar_fname) as tar:
          tar.extractall(target_dir)
      # build rec file before images are moved into subfolders
      if with_rec:
          build_rec_process(target_dir, False, num_thread)
      # move images to proper subfolders
      val_maps_file = os.path.join(
          os.path.dirname(__file__), "imagenet_val_maps.pklz"
      )
      with gzip.open(val_maps_file, "rb") as f:
          dirs, mappings = pickle.load(f)
      for d in dirs:
          os.makedirs(os.path.join(target_dir, d))
      for m in mappings:
          os.rename(
              os.path.join(target_dir, m[0]),
              os.path.join(target_dir, m[1], m[0]),
          )
  
file_path: gluon-cv/scripts/datasets/imagenet.py
imports: import os
  import argparse
  import tarfile
  import pickle
  import gzip
  import subprocess
  from tqdm import tqdm
  from mxnet.gluon.utils import check_sha1
  from gluoncv.utils import download, makedirs
label_desc: Use image node_id 5 for calling a global function with example usage: extract_val(tar_fname, target_dir, with_rec, num_thread) without return types