24.07.2016 Views

www.allitebooks.com

Learning%20Data%20Mining%20with%20Python

Learning%20Data%20Mining%20with%20Python

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Classifying Objects in Images Using Deep Learning<br />

These include the following:<br />

• Network-in-network layers: These are small neural networks that are easier<br />

to interpret than traditional neural network layers.<br />

• Dropout layers: These randomly drop units during training, preventing<br />

overfitting, which is a major problem in neural networks.<br />

• Noise layers: These introduce noise into the neurons; again, addressing the<br />

overfitting problem.<br />

In this chapter, we will use convolution layers (layers that are organized to mimic<br />

the way in which human vision works). They use small collections of connected<br />

neurons that analyze only a segment of the input values (in this case, an image).<br />

This allows the network to deal with standard alterations such as dealing with<br />

translations of images. In the case of vision-based experiments, an example of an<br />

alteration dealt with by convolution layers is translating the image.<br />

In contrast, a traditional neural network is often heavily connected—all neurons<br />

from one layer connect to all neurons in the next layer.<br />

Convolutional networks are implemented in the lasagne.layers.Conv1DLayer<br />

and lasagne.layers.Conv2DLayer classes.<br />

At the time of writing, Lasagne hasn't had a formal release and is not<br />

on pip. You can install it from github. In a new folder, download the<br />

source code repository using the following:<br />

git clone https://github.<strong>com</strong>/Lasagne/Lasagne.git<br />

From within the created Lasagne folder, you can then install the library<br />

using the following:<br />

sudo python3 setup.py install<br />

See http://lasagne.readthedocs.org/en/latest/user/<br />

installation.html for installation instructions.<br />

Neural networks use convolutional layers (generally, just Convolutional Neural<br />

Networks) and also the pooling layers, which take the maximum output for a<br />

certain region. This reduces noise caused by small variations in the image, and<br />

reduces (or down-samples) the amount of information. This has the added benefit<br />

of reducing the amount of work needed to be done in later layers.<br />

Lasagne also implements these pooling layers—for example in the lasagne.layers.<br />

MaxPool2DLayer class. Together with the convolution layers, we have all the tools<br />

needed to build a convolution neural network.<br />

[ 250 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!