10.11.2016 Views

Learning Data Mining with Python

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Classifying Objects in Images Using Deep <strong>Learning</strong><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 <strong>with</strong> standard alterations such as dealing <strong>with</strong><br />

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

alteration dealt <strong>with</strong> 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.com/Lasagne/Lasagne.git<br />

From <strong>with</strong>in 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 <strong>with</strong> 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!