utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:GestureRecognition 作者: gkchai 项目源码 文件源码
def create_init_fn_to_restore(master_checkpoint, train_dir):
    """Creates an init operations to restore weights from various checkpoints.
    master_checkpoint is path to a checkpoint which contains all weights for
    the whole model.
    """
    if master_checkpoint is None:
        return None

    # Warn the user if a checkpoint exists in the train_dir. Then we'll be
    # ignoring the checkpoint path anyway.
    if tf.train.latest_checkpoint(train_dir):
        tf.logging.info(
            'Ignoring --checkpoint_path because a checkpoint already exists in %s'
            % train_dir)
        return None

    if tf.gfile.IsDirectory(master_checkpoint):
        checkpoint_path = tf.train.latest_checkpoint(master_checkpoint)
    else:
        checkpoint_path = master_checkpoint

    tf.logging.info('Fine-tuning from %s' % checkpoint_path)
    return slim.assign_from_checkpoint_fn(checkpoint_path, slim.get_model_variables())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号