欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

在tensorflow中设置保存checkpoint的最大数量实例

程序员文章站 2022-10-11 20:15:11
1、我就废话不多说了,直接上代码吧! # set up a runconfig to only save checkpoints once per training cyc...

1、我就废话不多说了,直接上代码吧!

 # set up a runconfig to only save checkpoints once per training cycle.
 run_config = tf.estimator.runconfig(save_checkpoints_secs=1e9,keep_checkpoint_max = 10)
 model = tf.estimator.estimator(
   model_fn=deeplab_model_focal_class_imbalance_loss_adaptive.deeplabv3_plus_model_fn,
   model_dir=flags.model_dir,
   config=run_config,
   params={
     'output_stride': flags.output_stride,
     'batch_size': flags.batch_size,
     'base_architecture': flags.base_architecture,
     'pre_trained_model': flags.pre_trained_model,
     'batch_norm_decay': _batch_norm_decay,
     'num_classes': _num_classes,
     'tensorboard_images_max_outputs': flags.tensorboard_images_max_outputs,
     'weight_decay': flags.weight_decay,
     'learning_rate_policy': flags.learning_rate_policy,
     'num_train': _num_images['train'],
     'initial_learning_rate': flags.initial_learning_rate,
     'max_iter': flags.max_iter,
     'end_learning_rate': flags.end_learning_rate,
     'power': _power,
     'momentum': _momentum,
     'freeze_batch_norm': flags.freeze_batch_norm,
     'initial_global_step': flags.initial_global_step
   })

以上这篇在tensorflow中设置保存checkpoint的最大数量实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。