Building Convolutional Neural Networks

In this chapter, we are going to develop a convolutional neural network (CNN) for an image classification example using DL4J. We will develop the components of our application step by step while we progress through the recipes. The chapter assumes that you have read Chapter 1Introduction to Deep Learning in Java, and Chapter 2Data Extraction, Transformation, and Loading, and that you have set up DL4J on your computer, as mentioned in Chapter 1, Introduction to Deep Learning in Java. Let's go ahead and discuss the specific changes required for this chapter.

For demonstration purposes, we will have classifications for four different species. CNNs convert complex images into an abstract format that can be used for prediction. Hence, a CNN would be an optimal choice for this image classification problem.

CNNs are just like any other deep neural network that abstracts the decision process and gives us an interface to transform input to output. The only difference is that they support other types of layers and different orderings of layers. Unlike other forms of input, such as text or CSV, images are complex. Considering the fact that each pixel is a source of information, training will become resource intensive and time consuming for large numbers of high-resolution images.

In this chapter, we will cover the following recipes:

  • Extracting images from disk
  • Creating image variations for training data
  • Image preprocessing and the design of input layers
  • Constructing hidden layers for a CNN
  • Constructing output layers for output classification
  • Training images and evaluating CNN output
  • Creating an API endpoint for the image classifier

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

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