这是我第一次尝试在 Keras 上的 ImageNet 上进行微调和使用预训练模型,并使用我自己的数据来测试它的性能。我对我得到的错误类型有点困惑。
基本上一切正常,直到这个 model.fit 单元格,但这并不意味着错误来自上面。这个错误让我觉得我需要在我的 CNN 中编辑一些参数
history2 = modelB.fit(train_data, validation_data = test_data, epochs = 60,callbacks = [best_model2, reduce_lr2, es2])
错误信息:
ValueError:在用户代码中:
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 264, in assert_input_compatibility
raise ValueError(f'Input {input_index} of layer "{layer_name}" is '
ValueError: Input 0 of layer "model_2" is incompatible with the layer: expected shape=(None, 224, 224, 3), found shape=(None, 64, 64, 3)
欢迎任何帮助