code: def get_list(
      path, key_func=lambda x: x[-11:], rgb_prefix="img_", level=1
  ):
      if level == 1:
          frame_folders = glob.glob(os.path.join(path, "*"))
      elif level == 2:
          frame_folders = glob.glob(os.path.join(path, "*", "*"))
      else:
          raise ValueError("level can be only 1 or 2")
  
      def count_files(directory):
          lst = os.listdir(directory)
          cnt = len(fnmatch.filter(lst, rgb_prefix + "*"))
          return cnt
  
      # check RGB
      video_dict = {}
      for f in frame_folders:
          cnt = count_files(f)
          k = key_func(f)
          if level == 2:
              k = k.split("/")[0]
  
          video_dict[f] = str(cnt) + " " + str(class_id[k])
  
      return video_dict
  
file_path: PaddleDetection/deploy/pipeline/tools/split_fight_train_test_dataset.py
imports: import os
  import glob
  import random
  import fnmatch
  import re
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: get_list(path, key_func, rgb_prefix, level) and returns: video_dict, cnt