Training the network with images

Now that we have the structure of the convolutional neural network, let's explore how to train it. Training a neural network that works with images requires more memory than most computers have available. This is where the minibatch sources from Chapter 3, Getting Data into Your Neural Network, come into play. We're going to set up a set of two minibatch sources to train and evaluate the neural network we've just created. Let's first take a look at how to construct a minibatch source for images:

import osfrom cntk.io import MinibatchSource, StreamDef, StreamDefs, ImageDeserializer, INFINITELY_REPEATimport cntk.io.transforms as xformsdef create_datasource(folder, max_sweeps=INFINITELY_REPEAT): mapping_file ...

Get Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide 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.