Inception-v3

The Inception micro-architecture was first introduced by Szegedy and others in their 2014 paper, Going Deeper with Convolutions:

Inception-v3

Figure 15: Original Inception module used in GoogLeNet

The goal of the inception module is to act as a multi-level feature extractor by computing 1×1, 3×3, and 5×5 convolutions within the same module of the network—the output of these filters is then stacked along the channel dimension before being fed into the next layer in the network. The original incarnation of this architecture was called GoogLeNet, but subsequent manifestations have simply been called Inception vN, where N refers to the version number put out by Google.

You might wonder why we are using different types of convolution on the same input. The answer is that it is not always possible to obtain enough useful features to perform an accurate classification with a single convolution, as far as its parameters have been carefully studied. In fact, with some input it works better with convolutions small kernels, while others get better results with other types of kernels. It is probably for this reason that the GoogLeNet team wants to consider some alternatives within their own network. As mentioned earlier, GoogLeNet uses three types of convolutional layer at the same network level (that is, they are in parallel) for this purpose: a 1×1 layer, a 3×3 layer, and a 5×5 layer.

The result of this 3-layer parallel local architecture is the combination of all their output values, chained into a single vector output, that will be the input of the next layer. This is done by using a layer concat. In addition to the three parallel convolutional layers, in the same local structure a pooling layer has been added, because pooling operations are essential to the success of a CNN.

Exploring Inception with TensorFlow

From the following link, https://github.com/tensorflow/models, you should be able to download the corresponding models repository.

Then type the following command:

cd models/tutorials/image/imagenet python classify_image.py

classify_image.py downloads the trained model from tensorflow.org when the program is run for the first time. You'll need about 200 MB of free space available on your hard disk.

The preceding command will classify the supplied image of a panda. If the model runs correctly, the script will produce the following output:

giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.88493)
indri, indris, Indri indri, Indri brevicaudatus (score = 0.00878)
lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00317)
custard apple (score = 0.00149)
earthstar (score = 0.00127)

If you wish to supply other JPEG images, you may do so by editing:

image_file argument:
python classify_image.py --image=image.jpg

You can have fun testing Inception by downloading images from the internet and seeing what results it produces.

For example, you can try the following image (we renamed it inception_image.jpg), taken from https://pixabay.com/it/:

Exploring Inception with TensorFlow

Figure 16: Input image to classify with Inception-v3

The result is as follows:

python classify_image.py --image=inception_example.jpg
strawberry (score = 0.91541)
crayfish, crawfish, crawdad, crawdaddy (score = 0.01208)
chocolate sauce, chocolate syrup (score = 0.00628)
cockroach, roach (score = 0.00572)
grocery store, grocery, food market, market (score = 0.00264)

That sounds about right!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.160.43