We start by create a session to run the graph we created. Note that for faster training, we should use a GPU. However, if you do not have a GPU, just set log_device_placement=False:
session = tf.Session(graph=graph, config=tf.ConfigProto(log_device_placement=True))session.run(init_op)for i in range(300): _, loss_value = session.run([train, loss_op], feed_dict={images_X: images_array, labels_X: labels_array}) if i % 10 == 0: print("Loss: ", loss_value)
>>>Loss: 4.7910895Loss: 4.3410876Loss: 4.0275432...Loss: 0.523456
Once the training is completed, let us pick 10 random images and see the predictive power of our model:
random_indexes = random.sample(range(len(images32)), 10)random_images = [images32[i] ...