Training day
It will be more fulfilling, however, to see our training in action and how we will improve upon what we did earlier.
We will prepare the training dataset and labels as follows:
tf_train_dataset = tf.placeholder(tf.float32, shape=(batch_size, image_size, image_size, num_channels), name='TRAIN_DATASET') tf_train_labels = tf.placeholder(tf.float32, shape=(batch_size, num_of_classes), name='TRAIN_LABEL') tf_valid_dataset = tf.constant(dataset.valid_dataset, name='VALID_DATASET') tf_test_dataset = tf.constant(dataset.test_dataset, name='TEST_DATASET')
Then, we will run the trainer, as follows:
# Training computation. logits = nn_model(tf_train_dataset, weights, biases, True) loss = tf.reduce_mean( tf.nn.softmax_cross_entropy_with_logits(logits, tf_train_labels)) # L2 regularization for the fully connected parameters. regularizers = (tf.nn.l2_loss(weights['fc1']) + ...