Exemple #1
0
def main():
    # Show info when training
    log = logging.getLogger('tensorflow')
    log.setLevel(logging.INFO)

    classifier = get_classifier(8)

    train_spec = tf.estimator.TrainSpec(input_fn=lambda: input.batch_dataset(
        "dataset/reflected-train.tfrecords", tf.estimator.ModeKeys.TRAIN, 8),
                                        max_steps=2000)

    eval_spec = tf.estimator.EvalSpec(input_fn=lambda: input.batch_dataset(
        "dataset/reflected-eval.tfrecords", tf.estimator.ModeKeys.EVAL, 8))

    tf.estimator.train_and_evaluate(classifier, train_spec, eval_spec)
def main():
    # Show info when training
    log = logging.getLogger('tensorflow')
    log.setLevel(logging.INFO)

    classifier = get_classifier(8)

    for i in range(1,51):
        train_spec = tf.estimator.TrainSpec(
            input_fn=lambda:input.batch_dataset("dataset/shape-train-???.tfrecords", tf.estimator.ModeKeys.TRAIN, 8),
            max_steps= 10000 * i
        )

        eval_spec = tf.estimator.EvalSpec(
            input_fn=lambda:input.batch_dataset("dataset/shape-eval-???.tfrecords", tf.estimator.ModeKeys.EVAL, 8)
        )
        tf.estimator.train_and_evaluate(classifier, train_spec, eval_spec)