Google colaboratory Google Colabs中的TensorFlow 2在模型测试中预处理错误失败

Google colaboratory Google Colabs中的TensorFlow 2在模型测试中预处理错误失败,google-colaboratory,tensorflow2.0,Google Colaboratory,Tensorflow2.0,我试图对我的完整模型调用predict(),并将测试数据批传递给它。该模型适用于我的培训和验证数据,但当我尝试在测试数据上运行它时,会出现此错误 我已经查看了堆栈溢出链接上的答案,但我无法确定为什么会不断出现错误 以下是我运行的函数: # Make predictions on test data batch using the loaded full model test_predictions = loaded_full_model.predict(test_data,

我试图对我的完整模型调用predict(),并将测试数据批传递给它。该模型适用于我的培训和验证数据,但当我尝试在测试数据上运行它时,会出现此错误

我已经查看了堆栈溢出链接上的答案,但我无法确定为什么会不断出现错误

以下是我运行的函数:

# Make predictions on test data batch using the loaded full model
test_predictions = loaded_full_model.predict(test_data,
                                             verbose=1)
下面是返回的错误:

 14/324 [>.............................] - ETA: 39s
---------------------------------------------------------------------------
FailedPreconditionError                   Traceback (most recent call last)
<ipython-input-98-1081792ff13f> in <module>()
      1 # Make predictions on test data batch using the loaded full model
      2 test_predictions = loaded_full_model.predict(test_data,
----> 3                                              verbose=1)

8 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, 
num_outputs, inputs, attrs, ctx, name)
     58     ctx.ensure_initialized()
     59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:
     62     if name is not None:

FailedPreconditionError: 2 root error(s) found.
  (0) Failed precondition:  /content/drive/My Drive/Colab Notebooks/test/.ipynb_checkpoints; Is a 
directory
     [[{{node ReadFile}}]]
     [[IteratorGetNext]]
     [[IteratorGetNext/_2]]
  (1) Failed precondition:  /content/drive/My Drive/Colab Notebooks/test/.ipynb_checkpoints; Is a 
directory
     [[{{node ReadFile}}]]
     [[IteratorGetNext]]
0 successful operations.
0 derived errors ignored. [Op:__inference_predict_function_189545]

Function call stack:
predict_function -> predict_function
14/324[>....…]-预计到达时间:39s
---------------------------------------------------------------------------
FailedPremissionError回溯(最近一次调用上次)
在()
1#使用加载的完整模型对测试数据批次进行预测
2测试预测=满载模型。预测(测试数据,
---->3详细=1)
8帧
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py在quick_execute(op_name,
数量(输出、输入、属性、ctx、名称)
58 ctx.确保_已初始化()
59张量=pywrap\u tfe.tfe\u Py\u Execute(ctx.\u句柄、设备名称、操作名称、,
--->60个输入、属性、数量输出)
61除堆芯外,其他状态除外,如e:
62如果名称不是无:
FailedPremissionError:发现2个根错误。
(0)前置条件失败:/content/drive/My drive/Colab Notebooks/test/.ipynb_checkpoints;是一个
目录
[{{node ReadFile}}]]
[[IteratorGetNext]]
[[IteratorGetNext/_2]]
(1) 失败的前提条件:/content/drive/My drive/Colab Notebooks/test/.ipynb_检查点;是一个
目录
[{{node ReadFile}}]]
[[IteratorGetNext]]
0成功的操作。
忽略0个派生错误。[Op:uu推理u预测u函数189545]
函数调用堆栈:
预测函数->预测函数

似乎无法定位测试数据,是否可以通过打印来确保正确加载测试数据?我可以访问数据。代码如下:#加载测试映像文件名test_path=“/content/drive/My drive/Colab Notebooks/test/”test_文件名=[test_path+fname for fname for fname in os.listdir(test_path)]test_文件名[:10]以下是缩写输出:['/content/drive/My drive/Colab Notebooks/test/f6bb9fedf0b41301d3c6016a25c51608.jpg']