[英]'BatchDataset' object has no attribute 'shape'
Here is my code:这是我的代码:
train_images = tf.keras.utils.image_dataset_from_directory(
'/content/drive/MyDrive/ArabicHandwritten2/train')
train_labels = tf.keras.utils.image_dataset_from_directory(
'/content/drive/MyDrive/ArabicHandwritten2/test')
train_images = tf.reshape(train_images.shape[0], 256, 256, 3).astype('float32')
train_images = (train_images - 127.5) / 127.5 # Normalize the images to [-1, 1]
BUFFER_SIZE = 16765
BATCH_SIZE = 32
train_dataset = tf.data.Dataset.from_tensor_slices(train_images).shuffle(BUFFER_SIZE).batch(BATCH_SIZE)
The error is:错误是:
AttributeError: 'BatchDataset' object has no attribute 'shape'
How can I solve the error?我该如何解决错误?
Thanks.谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.