Building an image classifier using a Convolutional Neural Network
The image classifier in the previous section didn't perform well. Getting 92.1% on MNIST dataset is relatively easy. Let's see how we can use Convolutional Neural Networks (CNNs) to achieve a much higher accuracy. We will build an image classifier using the same dataset, but with a CNN instead of a single layer neural network.
Create a new python and import the following packages:
import argparse import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data
Define a function to parse the input arguments:
def build_arg_parser(): parser = argparse.ArgumentParser(description='Build a CNN classifier \ using MNIST data') parser.add_argument('--input-dir', dest='input_dir', ...
Get Artificial Intelligence with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.