(split_name, dataset_dir, file_pattern, reader, split_to_sizes,
              items_to_descriptions, num_classes)
return slim.dataset.Dataset(
    data_sources=file_pattern,
    reader=reader,
    decoder=decoder,
    num_samples=split_to_sizes[split_name],
    items_to_descriptions=items_to_descriptions,
    num_classes=num_classes,
    labels_to_names=labels_to_names)
Gets a dataset tuple with instructions for reading KITTI dataset.

  Args:
    split_name: A train/val split name.
    dataset_dir: The base directory of the dataset sources.
    file_pattern: The file pattern to use when matching the dataset sources.
      It is assumed that the pattern contains a '%s' string so that the split
      name can be inserted.
    reader: The TensorFlow reader type.

  Returns:
    A `Dataset` namedtuple.

  Raises:
      ValueError: if `split_name` is not a valid train/val split.
Gets a dataset tuple with instructions for reading KITTI dataset.
Gets a dataset tuple with instructions for reading KITTI dataset .
def get_split(split_name, dataset_dir, file_pattern, reader, split_to_sizes,
              items_to_descriptions, num_classes):
  """Gets a dataset tuple with instructions for reading KITTI dataset.

  Args:
    split_name: A train/val split name.
    dataset_dir: The base directory of the dataset sources.
    file_pattern: The file pattern to use when matching the dataset sources.
      It is assumed that the pattern contains a '%s' string so that the split
      name can be inserted.
    reader: The TensorFlow reader type.

  Returns:
    A `Dataset` namedtuple.

  Raises:
      ValueError: if `split_name` is not a valid train/val split.
  """
  if split_name not in ['train', 'val']:
    raise ValueError('split name %s was not recognized.' % split_name)
  file_pattern = os.path.join(dataset_dir, file_pattern % split_name)

  # Allowing None in the signature so that dataset_factory can use the default.
  if reader is None:
    reader = tf.TFRecordReader

  keys_to_features = {
    'image/encoded': tf.FixedLenFeature((), tf.string, default_value=''),
    'image/format': tf.FixedLenFeature((), tf.string, default_value='png'),
    'image/height': tf.FixedLenFeature([1], tf.int64),
    'image/width': tf.FixedLenFeature([1], tf.int64),
    'image/channels': tf.FixedLenFeature([1], tf.int64),
    'image/shape': tf.FixedLenFeature([3], tf.int64),
    'image/object/bbox/xmin': tf.VarLenFeature(dtype=tf.float32),
    'image/object/bbox/ymin': tf.VarLenFeature(dtype=tf.float32),
    'image/object/bbox/xmax': tf.VarLenFeature(dtype=tf.float32),
    'image/object/bbox/ymax': tf.VarLenFeature(dtype=tf.float32),
    'image/object/bbox/label': tf.VarLenFeature(dtype=tf.int64),
  }
  items_to_handlers = {
    'image': slim.tfexample_decoder.Image('image/encoded', 'image/format'),
    'shape': slim.tfexample_decoder.Tensor('image/shape'),
    'object/bbox': slim.tfexample_decoder.BoundingBox(
      ['ymin', 'xmin', 'ymax', 'xmax'], 'image/object/bbox/'),
    'object/label': slim.tfexample_decoder.Tensor('image/object/bbox/label'),
  }
  decoder = slim.tfexample_decoder.TFExampleDecoder(
    keys_to_features, items_to_handlers)

  labels_to_names = {0: "Pedestrian",
                     1: "Cyclist",
                     2: "Car"}

  return slim.dataset.Dataset(
    data_sources=file_pattern,
    reader=reader,
    decoder=decoder,
    num_samples=split_to_sizes[split_name],
    items_to_descriptions=items_to_descriptions,
    num_classes=num_classes,
    labels_to_names=labels_to_names)
def get_split ( split_name , dataset_dir , file_pattern , reader , split_to_sizes , items_to_descriptions , num_classes ) : if split_name not in [ 'train' , 'val' ] : raise ValueError ( 'split name %s was not recognized.' % split_name ) file_pattern = os . path . join ( dataset_dir , file_pattern % split_name ) # Allowing None in the signature so that dataset_factory can use the default. if reader is None : reader = tf . TFRecordReader keys_to_features = { 'image/encoded' : tf . FixedLenFeature ( ( ) , tf . string , default_value = '' ) , 'image/format' : tf . FixedLenFeature ( ( ) , tf . string , default_value = 'png' ) , 'image/height' : tf . FixedLenFeature ( [ 1 ] , tf . int64 ) , 'image/width' : tf . FixedLenFeature ( [ 1 ] , tf . int64 ) , 'image/channels' : tf . FixedLenFeature ( [ 1 ] , tf . int64 ) , 'image/shape' : tf . FixedLenFeature ( [ 3 ] , tf . int64 ) , 'image/object/bbox/xmin' : tf . VarLenFeature ( dtype = tf . float32 ) , 'image/object/bbox/ymin' : tf . VarLenFeature ( dtype = tf . float32 ) , 'image/object/bbox/xmax' : tf . VarLenFeature ( dtype = tf . float32 ) , 'image/object/bbox/ymax' : tf . VarLenFeature ( dtype = tf . float32 ) , 'image/object/bbox/label' : tf . VarLenFeature ( dtype = tf . int64 ) , } items_to_handlers = { 'image' : slim . tfexample_decoder . Image ( 'image/encoded' , 'image/format' ) , 'shape' : slim . tfexample_decoder . Tensor ( 'image/shape' ) , 'object/bbox' : slim . tfexample_decoder . BoundingBox ( [ 'ymin' , 'xmin' , 'ymax' , 'xmax' ] , 'image/object/bbox/' ) , 'object/label' : slim . tfexample_decoder . Tensor ( 'image/object/bbox/label' ) , } decoder = slim . tfexample_decoder . TFExampleDecoder ( keys_to_features , items_to_handlers ) labels_to_names = { 0 : "Pedestrian" , 1 : "Cyclist" , 2 : "Car" } return slim . dataset . Dataset ( data_sources = file_pattern , reader = reader , decoder = decoder , num_samples = split_to_sizes [ split_name ] , items_to_descriptions = items_to_descriptions , num_classes = num_classes , labels_to_names = labels_to_names )