Furkan Akkurt
Furkan Akkurt

Reputation: 9

Tensorflow 2.x giving me DatasetV1Adapter instead of Dataset

I am trying to load the 'voc' dataset from the tensorflow datasets. When I was able to successfully load the dataset using the below code:

ds = tfds.load('voc', split=['train','test'], shuffle_files=True)

I also printed out the ds, I got that:

[<DatasetV1Adapter shapes: {image: (None, None, 3), image/filename: (), labels: (None,), labels_no_difficult: (None,), objects: {bbox: (None, 4), is_difficult: (None,), is_truncated: (None,), label: (None,), pose: (None,)}}, types: {image: tf.uint8, image/filename: tf.string, labels: tf.int64, labels_no_difficult: tf.int64, objects: {bbox: tf.float32, is_difficult: tf.bool, is_truncated: tf.bool, label: tf.int64, pose: tf.int64}}>, <DatasetV1Adapter shapes: {image: (None, None, 3), image/filename: (), labels: (None,), labels_no_difficult: (None,), objects: {bbox: (None, 4), is_difficult: (None,), is_truncated: (None,), label: (None,), pose: (None,)}}, types: {image: tf.uint8, image/filename: tf.string, labels: tf.int64, labels_no_difficult: tf.int64, objects: {bbox: tf.float32, is_difficult: tf.bool, is_truncated: tf.bool, label: tf.int64, pose: tf.int64}}>]

and tried to be sure that the loaded is an instance of tf.data.Dataset, I got an assertion error.

assert isinstance(ds, tf.data.Dataset)

Instead, it says that it is an instance of DatasetV1Adapter. I am using tensorflow version 2.2.0 (I have printed out to see if I was mistaken, print(tf.version) printed out 2.2.0). I am also using 2.1.0 version of tensorflow.datasets library. Should not be the type of ds Dataset instead of DatasetV1Adapter since I'm using tf 2.x?

edit: After working on this specific problem for nearly 10 hours, I was able to solve it. The solution was fairly simple and straightforward, I reinstalled the packages tensorflow and tensorflow_datasets.

Upvotes: 1

Views: 311

Answers (1)

user11530462
user11530462

Reputation:

@Furkan Akkurt, thank you for your solution. For the benefit of community i am providing solution here (answer section)

Reinstall the tensorflow and tensorflow_datasets packages has resolved the issue.

Upvotes: 0

Related Questions