code: def main_concatenate(
      audio_dir, visual_dir, store_dir, ji=None, nj=None
  ):
      audio_loader = scp2array_dic(
          scp_path=os.path.join(audio_dir, "feats.scp"),
          array_dic=None,
          ark_path=None,
          compression_method=None,
          append=False,
      )
      visual_npz_dic = {}
      with codecs.open(
          os.path.join(visual_dir, "embedding.scp"), "r"
      ) as handle:
          lines_content = handle.readlines()
      for line_content in [
          *map(
              lambda x: x[:-1] if x[-1] in ["\n"] else x, lines_content
          )
      ]:
          key, path = line_content.split(" ")
          visual_npz_dic[key] = path
  
      common_keys = [
          *(set(audio_loader.keys()) & set(visual_npz_dic.keys()))
      ]
      store_scp = os.path.abspath(
          os.path.join(store_dir, "raw_av_embedding.{}.scp".format(ji))
      )
      store_ark = os.path.abspath(
          os.path.join(store_dir, "raw_av_embedding.{}.ark".format(ji))
      )
  
      for key_idx in tqdm(
          range(len(common_keys)),
          leave=True,
          desc="0" if ji is None else str(ji),
      ):
          if ji is None:
              processing_token = True
          else:
              if key_idx % nj == ji:
                  processing_token = True
              else:
                  processing_token = False
          if processing_token:
              key = common_keys[key_idx]
              audio_array = audio_loader[key]
              visual_array = np.load(visual_npz_dic[key])["data"][0]
              expend_visual_array = np.stack(
                  [visual_array for _ in range(4)], axis=-1
              ).reshape(-1, visual_array.shape[-1])
              expend_visual_array = expend_visual_array[1:]
              expend_visual_array = expend_visual_array[
                  : audio_array.shape[0]
              ]
              audio_visual_array = np.concatenate(
                  [audio_array, expend_visual_array], axis=-1
              )
              kaldiio.save_ark(
                  ark=store_ark,
                  array_dict={key: audio_visual_array},
                  scp=store_scp,
                  append=True,
              )
      return None
  
file_path: espnet/egs2/misp2021/avsr1/local/concatenate_feature.py
imports: import argparse
  import codecs
  import os
  import kaldiio
  import numpy
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: main_concatenate(audio_dir, visual_dir, store_dir, ji, nj) and returns: None