main.py
def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, input_image, correct_label, keep_prob, learning_rate):
    """
    Train neural network and print out the loss during training.
    :param sess: TF Session
    :param epochs: Number of epochs
    :param batch_size: Batch size
    :param get_batches_fn: Function to get batches of training data.  Call using get_batches_fn(batch_size)
    :param train_op: TF Operation to train the neural network
    :param cross_entropy_loss: TF Tensor for the amount of loss
    :param input_image: TF Placeholder for input images
    :param correct_label: TF Placeholder for label images
    :param keep_prob: TF Placeholder for dropout keep probability
    :param learning_rate: TF Placeholder for learning rate
    """
    
    #init global variables
    sess.run(tf.global_variables_initializer())
    
    print("Training...\n")
    for i in range(epochs):
        print("EPOCH {} ...".format(i+1))
        for image, label in get_batches_fn(batch_size):
            _, loss = sess.run([train_op, cross_entropy_loss], \
                               feed_dict={input_image: image, correct_label: label, keep_prob: KEEP_PROB, learning_rate: LEARNING_RATE})            
            print("\tLoss: = {:.4f}".format(loss))
    pass

    Train neural network and print out the loss during training.
    :param sess: TF Session
    :param epochs: Number of epochs
    :param batch_size: Batch size
    :param get_batches_fn: Function to get batches of training data.  Call using get_batches_fn(batch_size)
    :param train_op: TF Operation to train the neural network
    :param cross_entropy_loss: TF Tensor for the amount of loss
    :param input_image: TF Placeholder for input images
    :param correct_label: TF Placeholder for label images
    :param keep_prob: TF Placeholder for dropout keep probability
    :param learning_rate: TF Placeholder for learning rate
    
Train neural network and print out the loss during training.
Train neural network and print out the loss during training .
def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, input_image, correct_label, keep_prob, learning_rate):
    sess.run(tf.global_variables_initializer())
    print("Training...\n")
    for i in range(epochs):
        print("EPOCH {} ...".format(i+1))
        for image, label in get_batches_fn(batch_size):
            _, loss = sess.run([train_op, cross_entropy_loss], \
                               feed_dict={input_image: image, correct_label: label, keep_prob: KEEP_PROB, learning_rate: LEARNING_RATE})            
            print("\tLoss: = {:.4f}".format(loss))
    pass
def train_nn ( sess , epochs , batch_size , get_batches_fn , train_op , cross_entropy_loss , input_image , correct_label , keep_prob , learning_rate ) : sess . run ( tf . global_variables_initializer ( ) ) print ( "Training...\n" ) for i in range ( epochs ) : print ( "EPOCH {} ..." . format ( i + 1 ) ) for image , label in get_batches_fn ( batch_size ) : _ , loss = sess . run ( [ train_op , cross_entropy_loss ] , feed_dict = { input_image : image , correct_label : label , keep_prob : KEEP_PROB , learning_rate : LEARNING_RATE } ) print ( "\tLoss: = {:.4f}" . format ( loss ) ) pass
Train neural network and print out the loss during training.
Train neural network and print out the loss during training .
"""
    Train neural network and print out the loss during training.
    :param sess: TF Session
    :param epochs: Number of epochs
    :param batch_size: Batch size
    :param get_batches_fn: Function to get batches of training data.  Call using get_batches_fn(batch_size)
    :param train_op: TF Operation to train the neural network
    :param cross_entropy_loss: TF Tensor for the amount of loss
    :param input_image: TF Placeholder for input images
    :param correct_label: TF Placeholder for label images
    :param keep_prob: TF Placeholder for dropout keep probability
    :param learning_rate: TF Placeholder for learning rate
    """ #init global variables
sess
None
epochs
Number of epochs
Number of epochs
batch_size
None
get_batches_fn
Function to get batches of training data.  Call using get_batches_fn(batch_size)
Function to get batches of training data . Call using get_batches_fn ( batch_size )
train_op
TF Operation to train the neural network
TF Operation to train the neural network
cross_entropy_loss
TF Tensor for the amount of loss
TF Tensor for the amount of loss
input_image
TF Placeholder for input images
TF Placeholder for input images
correct_label
TF Placeholder for label images
TF Placeholder for label images
keep_prob
TF Placeholder for dropout keep probability
TF Placeholder for dropout keep probability
learning_rate
TF Placeholder for learning rate
TF Placeholder for learning rate