我想知道特定数据集中有哪些可用标签。在代码中我知道标签,但是我希望从数据集中打印出来,前提是我不知道所有标签。有办法吗?
我在网络上找不到解决方案。
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))
答案 0 :(得分:0)
class_names = np.array(dataset_info.features ['label']。names)