# Detecting and Localizing Dents on Vehicle Bodies Using Region-Based Convolutional Neural Network
## 2 Proposed R-CNN Model
### R-CNN Topology  
The R-CNN structure in this study consisted of an input layer, two hidden layers, and an output layer as illustrated in Figure 2. The input layer accepted a preprocessed grayscale image and its number of nodes was one. The preprocessed image was represented by a matrix of pixel values ranged from 0 to 255 (0: black, 255: white). The region images (mini-patches) inputted to the network were 32 \(\times\) 32 pixels, which were determined by sliding the preprocessed image from the top-left corner to the bottom-right corner with stride 5.  
The hidden layer consisted of two pairs of convolution and pooling layers. The first hidden layer convoluted \(6\times 6\) 58 filters with stride 3 and padding 2. A rectified linear unit (Relu) was used as an activation function, and a \(3\times 3\) max pooling was employed with stride 3 and padding 2. The second  
Figure 1: Light device used to create Mach bands on a vehicle exterior, (**a**) Lighting device (**b**) Mach bands projected by the lighting device (**c**) Examples of light diffusion around normal (left) and abnormal (right) surfaces.  
Figure 2: The region-based convolutional neural network (R-CNN) structure used in this study.  
hidden layer convoluted \(6\times 6\) 58 filters with stride 3 and padding 2. Likewise, Relu was employed as an activation function, and a \(3\times 3\) max pooling was used with stride 3 and padding 2.  
The output layer consisted of a fully connected layer and an output layer. The fully connected layer included 91 neurons, which were connected to the last output layer. The output layer included two final neurons, which were connected from the fully connected neurons. The two final neurons were activated by softmax function to determine normal or abnormal (dent) at the end.  
Six parameters (kernel number, kernel size, padding size, pooling size, stride size, and number of fully connected nodes) for the R-CNN were determined with an adaptive genetic algorithm (AGA) by referring to [22]. The AGA searched a set of satisficing parameters by evolutionally changing the parameters of the R-CNN. The gene for the AGA consisted of 20 binary digits (6 digits for kernel number, 3 digits for kernel size, 2 digits for padding size, 2 digits for pooling size, 2 digits for stride size, and 5 digits for number of fully connected nodes) for the six parameters. The Roulette wheel selection from the population (population size = 20) and the one-point crossover were applied for generating the next offspring [23; 24]. Mutations were performed in the offspring with a probability of mutation (initial value = 5%), which adaptively adjusted its value depending on the homogeneity of the offspring [25; 26; 27]. The AGA efficiently explored incumbent solutions for the parameters, as can be seen in Figure 3, and the incumbent optimum was improved rapidly within 50 generations. The satisficing parameters for the R-CNN were 58 for the kernel number, 6 for the kernel size, 2 for the pad number, 3 for the pooling size, 3 for the stride, and 91 for the number of fully connected nodes, as listed in Table 1.