def get_split(split_name, dataset_dir, file_pattern=None): if split_name not in NUM_SAMPLE: raise ValueError('split name %s was not recognized.' % split_name) if not file_pattern: file_pattern = FILE_PATTERN file_pattern = dataset_dir + file_pattern % split_name source = glob.glob(file_pattern) decoder = tf.image.decode_png label = dataset.read_label_file(dataset_dir + FILE_LABEL) feature = { 'image/encoded': tf.FixedLenFeature((), tf.string, default_value=''), 'image/class/label': tf.FixedLenFeature([], tf.int64, default_value=tf.zeros([], dtype=tf.int64)), } return dataset.Dataset(source=source, feature=feature, decoder=decoder, num_sample=NUM_SAMPLE[split_name], num_class=NUM_CLASSE, label=label, description=DESCRIPTION)
def get_dataset(dataset_filepath): return dataset.Dataset(dataset_filepath)