DatasetV1Adapter返回意外的数据类型

问题描述 投票:0回答:1

我正在尝试将自己的数据库运行到基于MNIST的代码中

来自负载的MNIST值为

{'test': <DatasetV1Adapter shapes: {image: (28, 28, 1), label: ()}, types: {image: tf.uint8, label: tf.int64}>,
 'train': <DatasetV1Adapter shapes: {image: (28, 28, 1), label: ()}, types: {image: tf.uint8, label: tf.int64}>}

我得到的是:

<DatasetV1Adapter shapes: ((None, 224, 224, 3), (None, 10)), types: (tf.float32, tf.bool)>

我真的不知道如何解决此问题,因为它似乎阻止了我的模型训练,并返回以下错误:

 ValueError: Input 0 of layer dense_12 is incompatible with the layer: expected axis -1 of input shape to have value 150528 but received input with shape [32, 784]

使用张量流方法尝试加载数据库

python tensorflow tensorflow2.0 tensorflow-datasets
1个回答
0
投票

由于现在您的图像是彩色(RGB)图像,所以希望您已相应地更改了输入层。如果是这样,则问题出在其余的模型层上,它们没有收到预期的输入形状。您必须更改其参数值,例如步幅,内核大小等。

如果不确定,请使用已在RGB图像上实现的某些模型。

© www.soinside.com 2019 - 2024. All rights reserved.