Identifying Rock Crack by Convolutional Neural Network


October 30, 2018

by Shihang Feng

PIC

Figure 1: (a) Input image, (b) classication results of all imaging points in the input image.

1 Objective

In this lab, we will go through convolutional neural network (CNN) to distinguish rock cracks in a image.

2 Prerequisties

3 How to use the CNN lab

Download the codes ./CNN_lab.zip and unzip it. Change your Matlab working directory under this file so you may able to use all necessary sub-functions. The main function is function test_example_CNN.m, open it in the matlab script and run.

test_example_CNN

4 Procedure of CNN

  1. Build training sets. Pick 200 crack image in the image and labeled as 1 and then pick 200 non-crack image in the image and labled as 0.
  2. Convert the image into image patches.
  3. Use CNN algorithms to estimate a optimal set of weights and bias.
  4. Input all the image patches into the trained CNN model to do classification.

5 Convolutional Neural Network

The misfit function of the convolutional neural network is:

J(w,b) = 1-∑  (y(x )- a)2
         2n  x

where w is the set of all weights and b the set of all biases, n is the number of training inputs, x is the set of all training inputs, y(x) is the expected output of the network for input x, and a is the actual output of the network for input x, with respect to w and b. The architecture of the convolutional neural network is shown in Figure 2.

PIC

Figure 2: The convolutional neural network architecture with two convolutional layer and a fully connected layer.

6 Questions

  1. Pick the training set manually by yourself. You can focus on big crack only or small crack only. See how the result will be looks like.
  2. Modify the structure of CNN. See how the CNN parameter will change the result.
  3. Increase the iteration number to 100. How the result will change? Why? Is there anyway to prevent this problem.
  4. Try to do multi-class classification using this code. Such as background, crack class 1 and crack class 2.

7 PS

The lab requires lots of memory, if you have memory problem, please contact me. And if there are any errors in this Lab, please contact: shihang.feng@kaust.edu.sa