This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saver = tf.train.Saver() #Create saver | |
num_steps = 1000 | |
batch_size = 100 | |
for step in range(num_steps): | |
offset = (step * batch_size) % (train_labels.shape[0] - batch_size) | |
batch_images = train_images[offset:(offset + batch_size), :] | |
batch_labels = train_labels[offset:(offset + batch_size), :] | |
feed_dict = {input: batch_images, labels: batch_labels} | |
_, c, acc = session.run([optimizer, cost, accuracy], feed_dict=feed_dict) | |
if step % 100 == 0: | |
print("Cost: ", c) | |
print("Accuracy: ", acc * 100.0, "%") | |
saver.save(session, "/tmp/vggnet/vgg_net.ckpt", global_step=step) #Save session every 100 mini-batches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment