# Conveyor Belt Damage Detection with the Use of a Two-Layer Neural Network
## 1 Introduction
### Selection of the Size of the Neural Network  
In order to best illustrate the ability of the neural network to recognize certain types of tasks set before it, it is worth considering the problem of divining the belonging of a given pair of points to a certain area by the neural network on the basis of the values given at its input. Due to the fact that it is easy to visualize the described issues in an accessible way for the human eye (on the chart), we will consider the problem with two variables, thanks to which it will be possible to plot 2D plots. While considering the operation of neural networks, there are three types of problems [17; 19]:  
* an almost linearly separable problem,
* nonlinearly separable problem. Each of the problems named above has an appropriate interpretation used in the following considerations. In each of these problems, a certain area is designated where the points belonging to a given class are located (in the analyzed case, this area is limited by straight lines; in the case of larger problems, this area is limited by hyperplanes). Thus, in the case of a linearly separable problem, points above a certain line belong to a given class, below the same line they do not belong; in the almost linearly separable problem, the segment of a circle with the center at point \(O=(0,1)\), and radius \(r=0.5\) was determined, while, in the nonlinearly separable problem, the area is determined by two segments of a circle with centers at points \(O_{1}=(0,1),O_{2}=(1,0)\) and radius \(r_{1}=0.7,r_{2}=0.5\). There are randomly selected 1000 points in the training set, the excitation values of which were given as input from the uniform distribution \(U(0,1)\). Then, the process of teaching the neural network was carried out, followed by testing the network, in which pairs of points \((x,y)\) with values from the uniform distribution \(U(0,1)\) were generated, and then the network response to the input of these two was checked. Figure 6 shows the points distinguished by the network response--green points mean values considered by the network to belong to a given area, red points mean values not belonging to this area. The black line shows the expected course of the network decision boundary. A single-layer network can separate the decision area only with a straight line (or a hyperplane in more dimensions). Problems of a similar type given on a two-layer network with a hidden layer with five neurons generate the same results presented in Figure 7.  
Figure 6: Single-layer network. It can be noticed that the single-layer neural network is able to solve only the simplest problems, and, therefore, it has little practical significance. This is used only when the existence of one layer is sufficient to solve a specific problem, and the selection of the architecture of such a network is simple--the number of neurons in the input layer it clearly defined by the dimension of the input vector, and the number of output neurons is determined by the dimension of the expected output vector [16,17]. Choosing the architecture of a two-layer network is a bit more complicated. The number of neurons in the input and output layers is naturally determined, as in the case of a single-layer network, by the size of the input and output vector, but the number of neurons in the hidden layer leaves a lot of room for maneuvering to ensure matching with the training data and maintaining good generalization capabilities. Such a theoretical solution to the problem of matching to learning data has been the subject of many studies by mathematicians dealing with the approximation of functions of many variables. It can be noticed that the neural network is a kind of universal approximator of the learning data--during training, appropriate coefficients are selected (represented by the weight vectors of individual neurons), and in the reproductive process of determining the value based on the given input and the learned weight matrix, the value of the approximating function is calculated [16].