I am trying to understand how to work with tensorflow datasets, tfds.
The dataset is a directory of this kind
-dataset
-train
-class_name1
-files...
-class_name2
-files...
-val
-class_name1
-files...
-class_name2
-files...
-test
-class_name1
-files...
-class_name2
-files...
Here is some code:
import tensorflow_datasets as tfds
builder = tfds.ImageFolder('/content/dataset')
train_ds, val_ds, test_ds = builder.as_dataset(split=['train', 'val', 'test'], shuffle_files=True, as_supervised=True)
print(builder.info)
Output:
tfds.core.DatasetInfo(
name='image_folder',
version=1.0.0,
description='Generic image classification dataset.',
homepage='https://www.tensorflow.org/datasets/catalog/image_folder',
features=FeaturesDict({
'image': Image(shape=(None, None, 3), dtype=tf.uint8),
'image/filename': Text(shape=(), dtype=tf.string),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=243),
}),
total_num_examples=73090,
splits={
'test': 5849,
'train': 58469,
'val': 8772,
},
supervised_keys=('image', 'label'),
citation="""""",
redistribution_info=,
)
When i am plotting, doing classification reports, confusion matrix etc i want to be able to use the class_names not the integer labels.
Is there some easy command that give me access to the class_names? (There are 243 classes, not 2)