I prepared tfrecords using builder=tfds.builder(my_dataset, data_dir=data_dir) and builder.download_and_prepare(download_dir=data_dir).
The features underlying this dataset are defined in the DatasetInfo as follows
tfds.core.DatasetInfo(
builder=self,
description=_DESCRIPTION,
features=tfds.features.FeaturesDict({
# These are the features of your dataset like images, labels ...
# 'image': tfds.features.Image(shape=(None, None, 3)),
'image': tfds.features.Image(shape=(None,None,3)),
'label': tfds.features.ClassLabel(num_classes=2),
}),
# If there's a common (input, target) tuple from the
# features, specify them here. They'll be used if
# `as_supervised=True` in `builder.as_dataset`.
supervised_keys=('image', 'label'), # Set to `None` to disable
homepage='https://dataset-homepage/',
citation=_CITATION,
)
I want to read a single tfrecord file generated through the builder.
I tried the following:
ds=tf.data.RecordDataset(tfrecord_files)
features=tfds.features.FeaturesDict({
# These are the features of your dataset like images, labels ...
# 'image': tfds.features.Image(shape=(None, None, 3)),
'image': tfds.features.Image(shape=(None,None,3)),
'label': tfds.features.ClassLabel(num_classes=2),
})
for record in ds.take(1):
parsed_record=tf.io.parse_single_example(record,features)
However, this throws the following error: ValueError: Unsupported Image Image(shape=(None, None, 3), dtype=tf.uint8)
How can I read a tfrecord file where the features are generated using tfds.features?
Thanks.