如何在每个训练步骤中保存训练模型,而不是根据时间间隔定期保存? -在TensorFlow-Slim中 [英] How to save training model at each training step instead of periodic save based on time interval.? - in TensorFlow-Slim

查看:521
本文介绍了如何在每个训练步骤中保存训练模型,而不是根据时间间隔定期保存? -在TensorFlow-Slim中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

slim.learning.train(...)接受两个与保存模型( save_interval_secs )或保存摘要( save_summaries_secs )有关的参数.该API的问题在于,它仅允许基于某个时间间隔"保存模型/摘要,但我需要根据训练的每一步"进行操作.

slim.learning.train(...) accepts two arguments pertaining to saving the model(save_interval_secs) or saving the summaries(save_summaries_secs). The problem with this API is, it only allows to save the model/summary based on some "time interval" but I need to do this based on "each step" of the training.

如何使用TF-slim api实现此目标?

how to achieve this using TF-slim api.?

这是slim.learning火车api-

Here is the slim.learning train api -

def train(train_op,
          logdir,
          train_step_fn=train_step,
          train_step_kwargs=_USE_DEFAULT,
          log_every_n_steps=1,
          graph=None,
          master='',
          is_chief=True,
          global_step=None,
          number_of_steps=None,
          init_op=_USE_DEFAULT,
          init_feed_dict=None,
          local_init_op=_USE_DEFAULT,
          init_fn=None,
          ready_op=_USE_DEFAULT,
          summary_op=_USE_DEFAULT,
          **save_summaries_secs=600,**
          summary_writer=_USE_DEFAULT,
          startup_delay_steps=0,
          saver=None,
          **save_interval_secs=600,**
          sync_optimizer=None,
          session_config=None,
          session_wrapper=None,
          trace_every_n_steps=None,
          ignore_live_threads=False):

推荐答案

不建议使用Slim,使用Estimator可以完全控制保存/汇总频率.

Slim is deprecated, and using Estimator you get full control over saving / summary frequency.

您还可以将秒数设置为非常小的数字,以便始终保存.

You can also set the seconds to a very small number so it always saves.

这篇关于如何在每个训练步骤中保存训练模型,而不是根据时间间隔定期保存? -在TensorFlow-Slim中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆