Now that we've enhanced the classifier to load random images, we'll start with choosing these random images with the exact size and shape of our training/testing images. We'll need to add placeholders for these user-provided images, so we'll add the following lines in the appropriate locations:
tf_random_dataset = tf.placeholder(tf.float32, shape=(1,
image_size, image_size, num_channels),
name='RANDOM_DATA')random_prediction =
tf.nn.softmax(nn_model(tf_random_dataset,
weights, biases))
Next, we will grab the image provided by the user via the following command-line parameter and run our session on the image:
![](https://static.packt-cdn.com/products/9781786462961/graphics/assets/b4fc549e-b9c3-40af-b06d-ddae4ffbc4f9.png)
We will follow almost the exact sequence as we did earlier. Running a test file through the script using the -e switch will yield an extra output, as follows:
The prediction is: 2
Voila! We just classified an...