python - KERAS: AttributeError: 'BatchDataset' object has no attribute 'ndim' ,Tensorflow 图像分割演示不适用于我的 anaconda
问题描述
我知道这条线有问题:
history = model.fit(train_ds,
steps_per_epoch=int(np.ceil(num_train_examples / float(batch_size))),
epochs=epochs,
validation_data=val_ds,
validation_steps=int(np.ceil(num_val_examples / float(batch_size))),
callbacks=[cp])
我得到错误:
AttributeError:“BatchDataset”对象没有属性“ndim”
并且正在使用 tensorflow 的演示:图像分割。我认为这与输入尺寸有关,但找不到解决问题的方法。
数据库信息:
train_ds = get_baseline_dataset(x_train_filenames,
y_train_filenames,
preproc_fn=tr_preprocessing_fn,
batch_size=batch_size)
val_ds = get_baseline_dataset(x_val_filenames,
y_val_filenames,
preproc_fn=val_preprocessing_fn,
batch_size=batch_size)
def get_baseline_dataset(filenames,
labels,
preproc_fn=functools.partial(_augment),
threads=5,
batch_size=batch_size,
shuffle=True):
(ps。它在 Google colab 中有效,但在 anaconda/spyder 上无效)
解决方案
推荐阅读
- r - 如何使用 sparklyr 获取跟踪作业 URL?
- reactjs - s3cmd 用错误的 MIME 类型标记 CSS
- java - 如何在 Ant 构建任务中将捆绑的 jar 添加到我的类路径中?
- vba - 从访问附件中获取文件名
- swift - 新的 FMDB 不使用 SqlCipher 加密?
- python - 具有部分字符串匹配的列表理解
- macos - Homebrew 安装出现错误
- tsql - UPDATE SQL 命令不保存结果
- java - 包含对对象的引用的 Java 数组
- amazon-web-services - 使用 Chalice 向 AWS API Gateway 响应添加标头