예제 #1
0
def view_neurons(load_model_name='models/chap_15_3_3.ckpt'):
    restore_saver = tf.train.Saver()
    with tf.Session() as sess:
        restore_saver.restore(sess, load_model_name)
        weights1_val = weights1.eval()
        weights1_imgs = weights1_val.T[:6].reshape(6, 28, 28)
        show_multi_image(2, 3, weights1_imgs)
예제 #2
0
def show_reconstructed_images(images_for_view):
    # show
    n_rows = len(images_for_view)
    n_cols = images_for_view[0].shape[0]
    concated_images = np.concatenate(images_for_view,
                                     axis=0).reshape(n_rows * n_cols, 28, 28)
    show_multi_image(n_rows, n_cols, concated_images)
예제 #3
0
def predict(images,
            load_model_name='models/chap_15_3_3.ckpt'):
    restore_saver = tf.train.Saver()
    with tf.Session() as sess:
        restore_saver.restore(sess, load_model_name)
        reconstructed_images = outputs.eval(feed_dict={x: images})

    # show
    concated_images = np.concatenate([images, reconstructed_images], axis=0).reshape(images.shape[0] * 2, 28, 28)
    show_multi_image(2, images.shape[0], concated_images)