python - 为什么 colab 会抛出此错误,但不会在 kaggle 中抛出此错误,ValueError: Failed to find data adapter that can handle input
问题描述
错误:
ValueError: Failed to find data adapter that can handle input: <class 'NoneType'>, <class 'NoneType'>
我正在尝试做的事情- 嗯,我正在尝试建立一个模型来检测导管位置。起初,我在 kaggle 中编写了相同的代码,然后代码很好,没有任何错误,但相同的代码在 colab 中给出了错误。
代码:请在此处找到完整的Colab Notebook
这是 model.fit 代码
history = model.fit(dtrain,epochs=2,
verbose=1,
callbacks=[checkpoint, lr_reducer, early_stop],
steps_per_epoch=steps_per_epoch,
validation_data=dvalid)
Colab 在validation_data =dvalid这一行显示错误。dvalid 代码如下。
size = 384
BATCH_SIZE=32
decoder = build_decoder(with_labels=True, target_size=(size, size))
test_decoder = build_decoder(with_labels=False, target_size=(size, size))
dtrain = build_dataset(train_paths, train_labels, bsize=BATCH_SIZE,
cache_dir='tf_cache', decode_fn=decoder)
dvalid = build_dataset(
valid_paths, valid_labels, bsize=BATCH_SIZE,
repeat=False, shuffle=False, augment=False,
cache_dir='tf_cache', decode_fn=decoder)
dtest = build_dataset(
test_paths, bsize=BATCH_SIZE, repeat=False,
shuffle=False, augment=False, cache=False,
decode_fn=test_decoder)
我试过的
我尝试将数据转换为 numpy 数组,但仍然抛出相同的错误。
train_paths = np.asarray(train_paths)
train_labels = np.asarray(train_labels)
valid_paths = np.asarray(valid_paths)
valid_labels = np.asarray(valid_labels)
请查看代码并帮助我解决此错误。提前致谢
解决方案
推荐阅读
- java - 如何获取 imageView Android 数组中元素的 id
- floating-point - 为什么存在 NaN?
- c# - 在 applicationhost.config 中更改站点名称
- sql - 创建存储过程首先在 SQL server 中检查并插入 XML 数据
- node.js - 未处理的拒绝 SequelizeConnectionError:用户“ankitj”的密码验证失败
- html - 可调整大小的 DIV 向错误的方向扩展
- javascript - 如何将新数据合并到旧数组?
- apache-kafka - 卡夫卡,重新分区,位置和排序
- angular - DXpopup 位置偏移顶部相对于变量
- java - Java NIO 搜索目录中的文件