import tensorflow as tf

    if ckpt and tf.train.checkpoint_exists(ckpt.model_checkpoint_path):
        print("loading checkpoint...")
        saver.restore(sess, ckpt.model_checkpoint_path)
    else:
        sess.run(tf.global_variables_initializer())

    summary_writer = tf.summary.FileWriter('./logs_pretrain', sess.graph)
    
    _x = x[:, :, :, ::-1]
    tf.summary.image('x', _x, 4)
    
    summary_op = tf.summary.merge_all()

    epoch_learning_rate = init_learning_rate
    for epoch in range(1, total_epochs + 1):
        if epoch % 10 == 0 :
            epoch_learning_rate = epoch_learning_rate / 10

