在训练期间减少后,Tensorflow平均损失增加

时间:2019-05-18 12:05:49

标签: tensorflow image-processing neural-network deep-learning dataset

我正在测试github项目(CNN-facial-landmarks)

检测68个面部地标,我使用地标.py python脚本进行了训练(300WV,300V,Helen数据集) 我在训练期间平均损失增加。 我想知道这个问题的源头是什么?

Avg loss

def main(unused_argv):

# Create the Estimator
estimator = tf.estimator.Estimator(
    model_fn=cnn_model_fn, model_dir="./model")

# Choose mode between Train, Evaluate and Predict
mode_dict = {
    'train': tf.estimator.ModeKeys.TRAIN,
    'eval': tf.estimator.ModeKeys.EVAL,
    'predict': tf.estimator.ModeKeys.PREDICT
}

mode = mode_dict['train']


if mode == tf.estimator.ModeKeys.TRAIN:
    estimator.train(input_fn=_train_input_fn, steps=200000)

    # Export result as SavedModel.
    estimator.export_savedmodel('./saved_model', serving_input_receiver_fn)

elif mode == tf.estimator.ModeKeys.EVAL:
    evaluation = estimator.evaluate(input_fn=_eval_input_fn)
    print(evaluation)

else:
    predictions = estimator.predict(input_fn=_predict_input_fn)
    for _, result in enumerate(predictions):
        img = cv2.imread(result['name'].decode('ASCII') + '.jpg')
        marks = np.reshape(result['logits'], (-1, 2)) * IMG_WIDTH
        for mark in marks:
            cv2.circle(img, (int(mark[0]), int(
                mark[1])), 1, (0, 255, 0), -1, cv2.LINE_AA)
        img = cv2.resize(img, (512, 512))
        cv2.imshow('result', img)
        cv2.waitKey()


if __name__ == '__main__':
  tf.app.run()

0 个答案:

没有答案