code: def ingest_kitti(
      input_dir, out_dir, train_percent=90, overwrite=False
  ):
      """
      Ingests the KITTI dataset. Peforms the following ops:
      0. Unzips the files into output directory.
      1. Convert annotations to json format
      2. Split the training data into train and validation sets
      3. Write manifest file
      4. Write configuration file
  
      Arguments:
          input_dir (string): path to folder with KITTI zip files.
          out_dir (string): path to unzip KITTI data
          train_percent (float): percent of data to use for training.
          overwrite (bool): overwrite existing files
      """
  
      # define paths
      data_dir = ensure_dirs_exist(os.path.join(out_dir, "kitti"))
      train_manifest = os.path.join(data_dir, "train.csv")
      val_manifest = os.path.join(data_dir, "val.csv")
  
      if (
          not overwrite
          and os.path.exists(train_manifest)
          and os.path.exists(val_manifest)
      ):
          print(
              """Found existing manfiest files, skipping ingest,
                Use --overwrite to rerun ingest anyway."""
          )
          return (train_manifest, val_manifest)
  
      # unzip files to output directory
      zipfiles = [
          os.path.join(input_dir, zipfile)
          for zipfile in [
              "data_object_image_2.zip",
              "data_object_label_2.zip",
          ]
      ]
  
      for file in zipfiles:
          with ZipFile(file, "r") as zf:
              print("Extracting {} to {}".format(file, data_dir))
              zf.extractall(data_dir)
  
      # get list of images
      img_path = os.path.join(data_dir, "training", "image_2")
      annot_path = os.path.join(data_dir, "training", "label_2")
  
      images = [
          os.path.splitext(os.path.basename(im))[0]
          for im in glob.glob(os.path.join(img_path, "*.png"))
      ]
  
      print("Found {} images".format(len(images)))
      assert (
          len(images) > 0
      ), "Did not found any images. Check your input_dir."
  
      # for each image, convert the annotation to json
  
      # create folder names for annotations
      annot_save_dir = ensure_dirs_exist(
          os.path.join(data_dir, "training", "label_2-json/")
      )
      annot_save_dir_difficult = ensure_dirs_exist(
          os.path.join(data_dir, "training", "label_2-json-difficult/")
      )
  
      print(
          "Writing annotations to: {} and {}".format(
              annot_save_dir, annot_save_dir_difficult
          )
      )
      for im in tqdm(images):
          path = os.path.join(annot_path, im + ".txt")
          im_path = os.path.join(img_path, im + ".png")
  
          assert os.path.exists(im_path)
  
          out_path = os.path.join(annot_save_dir, im + ".json")
          convert_annot_to_json(
              path, im_path, out_path, difficult=False
          )
  
          out_path = os.path.join(
              annot_save_dir_difficult, im + ".json"
          )
          convert_annot_to_json(path, im_path, out_path, difficult=True)
  
      # shuffle files and split into training and validation set.
      np.random.seed(0)
      np.random.shuffle(images)
  
      train_count = (len(images) * train_percent) // 100
      train = images[:train_count]
      val = images[train_count:]
  
      # write manifest files
      create_manifest(
          train_manifest, train, annot_save_dir, img_path, data_dir
      )
      create_manifest(
          val_manifest,
          val,
          annot_save_dir_difficult,
          img_path,
          data_dir,
      )
  
      # write configuration file
      config_path = os.path.join(
          os.path.dirname(os.path.realpath(__file__)), "kitti.cfg"
      )
      with open(config_path, "w") as f:
          f.write(
              "manifest = [train:{}, val:{}]\n".format(
                  train_manifest, val_manifest
              )
          )
          f.write("manifest_root = {}\n".format(data_dir))
          f.write("epochs = 14\n")
          f.write("height = 375\n")
          f.write("width = 1242\n")
          f.write("batch_size = 1\n")
      print("Wrote config file to: {}".format(config_path))
  
file_path: neon/examples/faster-rcnn/ingest_kitti.py
imports: from __future__ import print_function
  import os
  import glob
  import json
  import numpy
  from PIL import Image
  from zipfile import ZipFile
  import math
  from neon.util.persist import ensure_dirs_exist
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: ingest_kitti(input_dir, out_dir, train_percent, overwrite) and returns: train_manifest,  val_manifest