首页 > 解决方案 > 提前停止 TensorFlow 对象检测 API

问题描述

正如标题所暗示的那样,无论如何要在 TF 对象检测 API 上实现提前停止?

我在对象检测的 github 上的这个线程https://github.com/tensorflow/models/issues/5887中读到有一个回购https://github.com/hongym7/early_stopping用于提前停止。但这是 TF1 的旧版本,我使用 TF2

有什么办法可以提前停止model_main_tf2.py?我花了几个小时阅读代码,但我没有看到任何地方可以实现提前停止。

这是训练模型的脚本链接 https://github.com/tensorflow/models/blob/master/research/object_detection/model_main_tf2.py

标签: pythontensorflowtensorflow2.0object-detectionobject-detection-api

解决方案


重写它tf.keras并使用tf.keras.callbacks.EarlyStopping. 阅读https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/EarlyStopping了解更多详情


推荐阅读