code: def get_annpaths(
      root_dir: str,
      annpaths_list_path: str = None,
      train_ratio=0.6,
      val_ratio=0.2,
  ) -> Dict:
      if annpaths_list_path is not None:
          with open(annpaths_list_path, "r") as f:
              ann_paths = f.read().split()
          random.shuffle(ann_paths)
          N = len(ann_paths)
          num_train = int(N * train_ratio)
          num_val = int(N * val_ratio)
          return {
              "usersplit_train": ann_paths[:num_train],
              "usersplit_val": ann_paths[
                  num_train : num_train + num_val
              ],
              "usersplit_test": ann_paths[num_train + num_val :],
          }
      else:
          ann_ids_folder = os.path.join(root_dir, "ImageSets", "Main")
          ann_dir_path = os.path.join(root_dir, "Annotations")
          ann_paths = {}
          for ann_ids_filename in os.listdir(ann_ids_folder):
              ann_ids_path = os.path.join(
                  ann_ids_folder, ann_ids_filename
              )
              if (
                  os.path.isfile(ann_ids_path)
                  and ann_ids_filename[-4:] == ".txt"
              ):
                  ann_ids_name = ann_ids_filename[:-4]
  
                  with open(ann_ids_path, "r") as f:
                      rows = f.readlines()
                      if not rows:
                          print(
                              f"Skipping {ann_ids_path}: file is empty"
                          )
                      else:
                          ann_ids = []
                          for r in rows:
                              data = r.strip().split()
                              if (
                                  len(data) == 1
                              ):  # Each row is an annotation id
                                  ann_ids.append(data[0])
                              elif (
                                  len(data) == 2
                              ):  # Each row contains an annotation id and a flag (0 if we do not use this annotation in this split, and 1 if we use it)
                                  ann_id, used = data
                                  if int(used) == 1:
                                      ann_ids.append(ann_id)
                              else:
                                  print(
                                      f"Skipping {ann_ids_path}: file format not recognized. Make sure your annotation follows "
                                      f"VOC format!"
                                  )
                                  break
  
                          ann_paths[ann_ids_name] = [
                              os.path.join(ann_dir_path, aid + ".xml")
                              for aid in ann_ids
                          ]
          return ann_paths
  
file_path: autogluon/multimodal/src/autogluon/multimodal/cli/voc2coco.py
imports: import argparse
  import json
  import os
  import random
  import re
  import subprocess
  from typing import Dict, List
  import defusedxml.ElementTree
  from tqdm import tqdm
  from autogluon.multimodal.utils.object_detection import dump_voc_classes, dump_voc_xml_files, process_voc_annotations
label_desc: Use image node_id 2 for calling a global function with example usage: get_annpaths(root_dir, annpaths_list_path, train_ratio, val_ratio) and returns: dict, ann_paths