code: def _walk_voc_dir(devkit_dir, year, output_dir):
      filelist_dir = _get_voc_dir(devkit_dir, year, "ImageSets/Main")
      annotation_dir = _get_voc_dir(devkit_dir, year, "Annotations")
      img_dir = _get_voc_dir(devkit_dir, year, "JPEGImages")
      trainval_list = []
      test_list = []
      added = set()
  
      for _, _, files in os.walk(filelist_dir):
          for fname in files:
              img_ann_list = []
              if re.match(r"[a-z]+_trainval\.txt", fname):
                  img_ann_list = trainval_list
              elif re.match(r"[a-z]+_test\.txt", fname):
                  img_ann_list = test_list
              else:
                  continue
              fpath = osp.join(filelist_dir, fname)
              for line in open(fpath):
                  name_prefix = line.strip().split()[0]
                  if name_prefix in added:
                      continue
                  added.add(name_prefix)
                  ann_path = osp.join(
                      osp.relpath(annotation_dir, output_dir),
                      name_prefix + ".xml",
                  )
                  img_path = osp.join(
                      osp.relpath(img_dir, output_dir),
                      name_prefix + ".jpg",
                  )
                  img_ann_list.append((img_path, ann_path))
  
      return trainval_list, test_list
  
file_path: PaddleDetection/ppdet/utils/voc_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import os.path
  import re
  import random
label_desc: Use image node_id 3 for calling a global function with example usage: _walk_voc_dir(devkit_dir, year, output_dir) and returns: trainval_list,  test_list