code: def _prepare_kitti_split(
      split_dir, overwrite=False, num_workers=None
  ):
      samples_path = os.path.join(split_dir, "samples.json")
      if not overwrite and os.path.isfile(samples_path):
          return
  
      group_field = "group"
      label_field = "ground_truth"
  
      dataset = fo.Dataset()
      dataset.add_group_field(group_field, default="left")
  
      dataset.app_config.plugins["3d"] = {
          "defaultCameraPosition": {"x": 0, "y": 0, "z": 100}
      }
      dataset.save()
  
      calib_dir = os.path.join(split_dir, "calib")
      velodyne_dir = os.path.join(split_dir, "velodyne")
      labels_dir = os.path.join(split_dir, "labels")
      left_images_dir = os.path.join(split_dir, "left")
      right_images_dir = os.path.join(split_dir, "right")
      pcd_dir = os.path.join(split_dir, "pcd")
  
      make_map = lambda d: {
          os.path.splitext(os.path.basename(p))[0]: p
          for p in etau.list_files(d, abs_paths=True)
      }
  
      calib_map = make_map(calib_dir)
      velodyne_map = make_map(velodyne_dir)
  
      uuids = sorted(velodyne_map.keys())
  
      _convert_velodyne_to_pcd(
          velodyne_map,
          calib_map,
          pcd_dir,
          uuids,
          overwrite=overwrite,
          num_workers=num_workers,
      )
  
      left_map = make_map(left_images_dir)
      right_map = make_map(right_images_dir)
      pcd_map = make_map(pcd_dir)
  
      is_labeled = os.path.isdir(labels_dir)
      if is_labeled:
          labels_map = make_map(labels_dir)
  
      samples = []
  
      logger.info("Parsing samples...")
      with fou.ProgressBar() as pb:
          for uuid in pb(uuids):
              group = fo.Group()
  
              left_filepath = left_map[uuid]
              right_filepath = right_map[uuid]
              pcd_filepath = pcd_map[uuid]
  
              left_sample = fo.Sample(filepath=left_filepath)
              left_sample[group_field] = group.element("left")
  
              right_sample = fo.Sample(filepath=right_filepath)
              right_sample[group_field] = group.element("right")
  
              pcd_sample = fo.Sample(filepath=pcd_filepath)
              pcd_sample[group_field] = group.element("pcd")
  
              if is_labeled:
                  labels_path = labels_map[uuid]
                  calib_path = calib_map[uuid]
  
                  left_metadata = fom.ImageMetadata.build_for(
                      left_filepath
                  )
                  left_frame_size = (
                      left_metadata.width,
                      left_metadata.height,
                  )
                  gt_left, gt_3d = _load_kitti_annotations(
                      labels_path, left_frame_size
                  )
  
                  right_metadata = fom.ImageMetadata.build_for(
                      right_filepath
                  )
                  right_frame_size = (
                      right_metadata.width,
                      right_metadata.height,
                  )
  
                  calib = _load_calibration_matrices(calib_path)
                  gt_right = _proj_3d_to_right_camera(
                      gt_3d, calib, right_frame_size
                  )
  
                  left_sample["metadata"] = left_metadata
                  left_sample[label_field] = gt_left
  
                  right_sample["metadata"] = right_metadata
                  right_sample[label_field] = gt_right
  
                  pcd_sample[label_field] = _normalize_3d_detections(
                      gt_3d
                  )
  
              samples.extend([left_sample, right_sample, pcd_sample])
  
      dataset.add_samples(samples)
  
      if is_labeled:
          dataset.compute_metadata()
  
      dataset.export(
          export_dir=split_dir,
          dataset_type=fo.types.FiftyOneDataset,
          export_media=False,
          rel_dir=split_dir,
      )
  
      dataset.delete()
  
imports: import csv
  import logging
  import struct
  import os
  import numpy
  import eta.core.utils
  import eta.core.web
  import fiftyone
  import fiftyone.core.labels
  import fiftyone.core.metadata
  import fiftyone.core.storage
  import fiftyone.core.utils
  import fiftyone.utils.data
label_desc: Use image node_id 7 for calling a global function with example usage: _prepare_kitti_split(split_dir, overwrite, num_workers) without return types