如何打印张量流数据集的标签?

时间:2019-10-19 15:21:37

标签: tensorflow deep-learning python-3.7.4

我想知道特定数据集中有哪些可用标签。在代码中我知道标签,但是我希望从数据集中打印出来,前提是我不知道所有标签。有办法吗?

我在网络上找不到解决方案。

splits = tfds.Split.ALL.subsplit(weighted=(70,30))

(training_set, validation_set),dataset_info = tfds.load('tf_flowers', with_info = True , as_supervised = True,split = splits)

num_classes = dataset_info.features['label'].num_classes

num_training_examples = 0
num_validation_examples = 0

for example in training_set:
  num_training_examples += 1

for example in validation_set:
  num_validation_examples += 1

print('Total Number of Classes: {}'.format(num_classes))
print('Total Number of Training Images: {}'.format(num_training_examples))
print('Total Number of Validation Images: {} \n'.format(num_validation_examples))

1 个答案:

答案 0 :(得分:0)

class_names = np.array(dataset_info.features ['label']。names)