(split_name, dataset_dir=None, config=None)
return slim.dataset.Dataset(
      data_sources=file_pattern,
      reader=tf.TFRecordReader,
      decoder=decoder,
      num_samples=config['splits'][split_name]['size'],
      items_to_descriptions=config['items_to_descriptions'],
      #  additional parameters for convenience.
      charset=charset,
      num_char_classes=len(charset),
      num_of_views=config['num_of_views'],
      max_sequence_length=config['max_sequence_length'],
      null_code=config['null_code'])
Returns a dataset tuple for FSNS dataset.

  Args:
    split_name: A train/test split name.
    dataset_dir: The base directory of the dataset sources, by default it uses
      a predefined CNS path (see DEFAULT_DATASET_DIR).
    config: A dictionary with dataset configuration. If None - will use the
      DEFAULT_CONFIG.

  Returns:
    A `Dataset` namedtuple.

  Raises:
    ValueError: if `split_name` is not a valid train/test split.
Returns a dataset tuple for FSNS dataset.
Returns a dataset tuple for FSNS dataset .
def get_split(split_name, dataset_dir=None, config=None):
  """Returns a dataset tuple for FSNS dataset.

  Args:
    split_name: A train/test split name.
    dataset_dir: The base directory of the dataset sources, by default it uses
      a predefined CNS path (see DEFAULT_DATASET_DIR).
    config: A dictionary with dataset configuration. If None - will use the
      DEFAULT_CONFIG.

  Returns:
    A `Dataset` namedtuple.

  Raises:
    ValueError: if `split_name` is not a valid train/test split.
  """
  if not dataset_dir:
    dataset_dir = DEFAULT_DATASET_DIR

  if not config:
    config = DEFAULT_CONFIG

  if split_name not in config['splits']:
    raise ValueError('split name %s was not recognized.' % split_name)

  logging.info('Using %s dataset split_name=%s dataset_dir=%s', config['name'],
               split_name, dataset_dir)

  # Ignores the 'image/height' feature.
  zero = tf.zeros([1], dtype=tf.int64)
  keys_to_features = {
      'image/encoded':
      tf.FixedLenFeature((), tf.string, default_value=''),
      'image/format':
      tf.FixedLenFeature((), tf.string, default_value='png'),
      'image/width':
      tf.FixedLenFeature([1], tf.int64, default_value=zero),
      'image/orig_width':
      tf.FixedLenFeature([1], tf.int64, default_value=zero),
      'image/class':
      tf.FixedLenFeature([config['max_sequence_length']], tf.int64),
      'image/unpadded_class':
      tf.VarLenFeature(tf.int64),
      'image/text':
      tf.FixedLenFeature([1], tf.string, default_value=''),
  }
  items_to_handlers = {
      'image':
      slim.tfexample_decoder.Image(
          shape=config['image_shape'],
          image_key='image/encoded',
          format_key='image/format'),
      'label':
      slim.tfexample_decoder.Tensor(tensor_key='image/class'),
      'text':
      slim.tfexample_decoder.Tensor(tensor_key='image/text'),
      'num_of_views':
      _NumOfViewsHandler(
          width_key='image/width',
          original_width_key='image/orig_width',
          num_of_views=config['num_of_views'])
  }
  decoder = slim.tfexample_decoder.TFExampleDecoder(keys_to_features,
                                                    items_to_handlers)
  charset_file = os.path.join(dataset_dir, config['charset_filename'])
  charset = read_charset(charset_file)

  print(charset)
  file_pattern = os.path.join(dataset_dir,
                              config['splits'][split_name]['pattern'])
  return slim.dataset.Dataset(
      data_sources=file_pattern,
      reader=tf.TFRecordReader,
      decoder=decoder,
      num_samples=config['splits'][split_name]['size'],
      items_to_descriptions=config['items_to_descriptions'],
      #  additional parameters for convenience.
      charset=charset,
      num_char_classes=len(charset),
      num_of_views=config['num_of_views'],
      max_sequence_length=config['max_sequence_length'],
      null_code=config['null_code'])
def get_split ( split_name , dataset_dir = None , config = None ) : if not dataset_dir : dataset_dir = DEFAULT_DATASET_DIR if not config : config = DEFAULT_CONFIG if split_name not in config [ 'splits' ] : raise ValueError ( 'split name %s was not recognized.' % split_name ) logging . info ( 'Using %s dataset split_name=%s dataset_dir=%s' , config [ 'name' ] , split_name , dataset_dir ) # Ignores the 'image/height' feature. zero = tf . zeros ( [ 1 ] , dtype = tf . int64 ) keys_to_features = { 'image/encoded' : tf . FixedLenFeature ( ( ) , tf . string , default_value = '' ) , 'image/format' : tf . FixedLenFeature ( ( ) , tf . string , default_value = 'png' ) , 'image/width' : tf . FixedLenFeature ( [ 1 ] , tf . int64 , default_value = zero ) , 'image/orig_width' : tf . FixedLenFeature ( [ 1 ] , tf . int64 , default_value = zero ) , 'image/class' : tf . FixedLenFeature ( [ config [ 'max_sequence_length' ] ] , tf . int64 ) , 'image/unpadded_class' : tf . VarLenFeature ( tf . int64 ) , 'image/text' : tf . FixedLenFeature ( [ 1 ] , tf . string , default_value = '' ) , } items_to_handlers = { 'image' : slim . tfexample_decoder . Image ( shape = config [ 'image_shape' ] , image_key = 'image/encoded' , format_key = 'image/format' ) , 'label' : slim . tfexample_decoder . Tensor ( tensor_key = 'image/class' ) , 'text' : slim . tfexample_decoder . Tensor ( tensor_key = 'image/text' ) , 'num_of_views' : _NumOfViewsHandler ( width_key = 'image/width' , original_width_key = 'image/orig_width' , num_of_views = config [ 'num_of_views' ] ) } decoder = slim . tfexample_decoder . TFExampleDecoder ( keys_to_features , items_to_handlers ) charset_file = os . path . join ( dataset_dir , config [ 'charset_filename' ] ) charset = read_charset ( charset_file ) print ( charset ) file_pattern = os . path . join ( dataset_dir , config [ 'splits' ] [ split_name ] [ 'pattern' ] ) return slim . dataset . Dataset ( data_sources = file_pattern , reader = tf . TFRecordReader , decoder = decoder , num_samples = config [ 'splits' ] [ split_name ] [ 'size' ] , items_to_descriptions = config [ 'items_to_descriptions' ] , #  additional parameters for convenience. charset = charset , num_char_classes = len ( charset ) , num_of_views = config [ 'num_of_views' ] , max_sequence_length = config [ 'max_sequence_length' ] , null_code = config [ 'null_code' ] )