code: def ingest_pascal(data_dir, out_dir, year="2007", overwrite=False):
      # define paths
      root_dir = os.path.join(out_dir, "VOCdevkit", "VOC" + year)
      manifest_train = os.path.join(root_dir, "trainval.csv")
      manifest_inference = os.path.join(root_dir, "val.csv")
  
      # write configuration file
      config_path = os.path.join(
          os.path.dirname(os.path.realpath(__file__)), "pascalvoc.cfg"
      )
      with open(config_path, "w") as f:
          f.write(
              "manifest = [train:{}, val:{}]\n".format(
                  manifest_train, manifest_inference
              )
          )
          f.write("manifest_root = {}\n".format(out_dir))
          f.write("epochs = 14\n")
          f.write("height = 1000\n")
          f.write("width = 1000\n")
          f.write("batch_size = 1\n")
          f.write("rng_seed = 0")
      print("Wrote config file to: {}".format(config_path))
  
      if (
          not overwrite
          and os.path.exists(manifest_train)
          and os.path.exists(manifest_inference)
      ):
          print(
              """Found existing manfiest files, skipping ingest,
                Use --overwrite to rerun ingest anyway."""
          )
          return (manifest_train, manifest_inference)
  
      # untar data to output directory
      tarfiles = [
          os.path.join(data_dir, tar)
          for tar in [
              "VOCtrainval_06-Nov-2007.tar",
              "VOCtest_06-Nov-2007.tar",
          ]
      ]
  
      for file in tarfiles:
          with tarfile.open(file, "r") as t:
              print("Extracting {} to {}".format(file, out_dir))
              t.extractall(out_dir)
  
      # convert the annotations to json, exclude difficult objects (used for training)
      input_path = os.path.join(root_dir, "Annotations")
      annot_path = os.path.join(root_dir, "Annotations-json")
      print("Reading PASCAL XML files from {}".format(input_path))
      print(
          "Converting XML files to json format, writing to: {}".format(
              annot_path
          )
      )
      convert_xml_to_json(input_path, annot_path, difficult=False)
  
      # convert the annotations to json, including difficult objects (used for inference)
      annot_path_difficult = os.path.join(
          root_dir, "Annotations-json-difficult"
      )
      print(
          "Converting XML files to json format (including objects with difficult flag),"
      )
      print("writing to: {}".format(annot_path_difficult))
      convert_xml_to_json(
          input_path, annot_path_difficult, difficult=True
      )
  
      img_dir = os.path.join(root_dir, "JPEGImages")
  
      # write manifest file for training
      index_path = os.path.join(
          root_dir, "ImageSets", "Main", "trainval.txt"
      )
      create_manifest(
          manifest_train, index_path, annot_path, img_dir, out_dir
      )
  
      # write manifest file for testing
      # for testing, we inlude the difficult objects, so use annot_path_difficult
      index_path = os.path.join(
          root_dir, "ImageSets", "Main", "test.txt"
      )
      create_manifest(
          manifest_inference,
          index_path,
          annot_path_difficult,
          img_dir,
          out_dir,
      )
  
imports: from configargparse import ArgumentParser
  from convert_xml_to_json import convert_xml_to_json
  import numpy
  import os
  import tarfile
label_desc: Use image node_id 1 for calling a global function with example usage: ingest_pascal(data_dir, out_dir, year, overwrite) and returns: manifest_train,  manifest_inference