def evaluate():
    '\n        Test one image against the saved models and parameters\n    '
    train_dir = './data/train/'
    (train, train_label) = train_test_split.get_files(train_dir)
    image_array = get_image(train)
    with tf.Graph().as_default():
        batch_size = 1
        n_classes = 2
        image = tf.cast(image_array, tf.float32)
        image = tf.image.per_image_standardization(image)
        image = tf.reshape(image, [1, 208, 208, 3])
        logits = cnn.inference(image, batch_size, n_classes)
        logits = tf.nn.softmax(logits)
        X = tf.placeholder(tf.float32, shape=[208, 208, 3])
        logs_train_dir = './logs/train/'
        saver = tf.train.Saver()
        with tf.Session() as sess:
            print('Reading checkpoints...')
            ckpt = tf.train.get_checkpoint_state(logs_train_dir)
            if (ckpt and ckpt.model_checkpoint_path):
                global_step = ckpt.model_checkpoint_path.split('/')[(- 1)].split('-')[(- 1)]
                saver.restore(sess, ckpt.model_checkpoint_path)
                print('Loading success, global_step is %s'.format(global_step))
            else:
                print('No checkpoint file found')
            prediction = sess.run(logits, feed_dict={X: image_array})
            max_index = np.argmax(prediction)
            if (max_index == 0):
                print('This is a cat with possibility {:.6f}'.format(prediction[:, 0]))
            else:
                print('This is a dog with possibility {:.6f}'.format(prediction[:, 1]))
Test one image against the saved models and parameters
def evaluate():
    '\n        \n    '
    train_dir = './data/train/'
    (train, train_label) = train_test_split.get_files(train_dir)
    image_array = get_image(train)
    with tf.Graph().as_default():
        batch_size = 1
        n_classes = 2
        image = tf.cast(image_array, tf.float32)
        image = tf.image.per_image_standardization(image)
        image = tf.reshape(image, [1, 208, 208, 3])
        logits = cnn.inference(image, batch_size, n_classes)
        logits = tf.nn.softmax(logits)
        X = tf.placeholder(tf.float32, shape=[208, 208, 3])
        logs_train_dir = './logs/train/'
        saver = tf.train.Saver()
        with tf.Session() as sess:
            print('Reading checkpoints...')
            ckpt = tf.train.get_checkpoint_state(logs_train_dir)
            if (ckpt and ckpt.model_checkpoint_path):
                global_step = ckpt.model_checkpoint_path.split('/')[(- 1)].split('-')[(- 1)]
                saver.restore(sess, ckpt.model_checkpoint_path)
                print('Loading success, global_step is %s'.format(global_step))
            else:
                print('No checkpoint file found')
            prediction = sess.run(logits, feed_dict={X: image_array})
            max_index = np.argmax(prediction)
            if (max_index == 0):
                print('This is a cat with possibility {:.6f}'.format(prediction[:, 0]))
            else:
                print('This is a dog with possibility {:.6f}'.format(prediction[:, 1]))