PYTHON 版本:3.12.4PIP 版本:24.1.1KERAS 版本:3.4.1TENSORFLOW 版本:2.16.1我一直尝试在 jupyter notebook 上运行代码来训练模型:这实际上引发了一个……
PYTHON版本:3.12.4
PIP 版本:24.1.1
KERAS 版本:3.4.1
TENSORFLOW 版本:2.16.1
我一直尝试在 jupyter notebook 上运行代码来训练模型:
这实际上会引发一个错误:
ValueError Traceback (most recent call last)
Cell In[10], line 2
1 # Model chekpoint Callback
----> 2 cp_callback = tf.keras.callbacks.ModelCheckpoint(
3 model_save_path, verbose=1, save_weights_only=False)
4 # Callback for early Termination
5 es_callback = tf.keras.callbacks.EarlyStopping(patience=20, verbose=1)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\keras\src\callbacks\model_checkpoint.py:191, in ModelCheckpoint.__init__(self, filepath, monitor, verbose, save_best_only, save_weights_only, mode, save_freq, initial_value_threshold)
189 else:
190 if not self.filepath.endswith(".keras"):
--> 191 raise ValueError(
192 "The filepath provided must end in `.keras` "
193 "(Keras model format). Received: "
194 f"filepath={self.filepath}"
195 )
ValueError: The filepath provided must end in `.keras` (Keras model format). Received: filepath=model/keypoint_classifier/keypoint_classifier.hdf5
代码:
# Model chekpoint Callback
cp_callback = tf.keras.callbacks.ModelCheckpoint(
model_save_path, verbose=1, save_weights_only=False)
# Callback for early Termination
es_callback = tf.keras.callbacks.EarlyStopping(patience=20, verbose=1)
ValueError:提供的文件路径必须以 `.keras` 结尾(Keras 模型格式)。收到:filepath=model/keypoint_classifier/keypoint_classifier.hdf5
下载声明:
本站所有软件和资料均为软件作者提供或网友推荐发布而来,仅供学习和研究使用,不得用于任何商业用途。如本站不慎侵犯你的版权请联系我,我将及时处理,并撤下相关内容!