【发布时间】:2020-04-15 07:15:18
【问题描述】:
我想在我的数据集上实现堆叠胶囊自动编码器(请参阅 here)。在实施时,我面临以下问题:
MNIST 数据集加载如下:
tfds.load(name='mnist', split=subset, **kwargs).repeat().batch(batch_size)
<DatasetV1Adapter shapes: {label: (?,), image: (?, 28, 28, 1)}, types: {label: tf.int64, image: tf.uint8}>
我正在通过替换上面的代码来加载我的数据集,如下所示:
img_list = []
for img in glob.glob("update_207/*.png"):
n= cv2.imread(img,0)
img_1 = tf.convert_to_tensor(np.array(n.resize((2000, 1200, 1))))
img_list.append(img_1)
tf.data.Dataset.from_tensor_slices(img_list).repeat().batch(batch_size)
<DatasetV1Adapter shapes: (?,), types: tf.float32>
我是 Tensorflow 的新手,因此请建议对我的代码进行更改,以便我的数据集具有与 MNIST 相似的形状和类型。
【问题讨论】:
标签: python tensorflow tensorflow-datasets