# Focused and TSOM Images Two-Input Deep-Learning Method for Through-Focus Scanning Measuring
## 2 Materials and Methods
### The Structure of the Two-Input CNN  
The structure of the two-input CNN proposed in this paper (the following is named Focus & TSOM-CNN) for TSOM measurement is shown in Figure 10. Focus & TSOM-CNN, from left to right, includes an input part, processing of TSOM images and focused images part and the feature merging and output part. The left area of the network mainly contains the input layer, which is used to input the TSOM images and the focused images into the network. The two kinds of images are 89 \(\times\) 89 pixels in size. Figure 8: Generation of TSOM image. (**a**) The transverse sectional view in the middle of the cube; (**b**) Spliced sectional view; and (**c**) TSOM image obtained after smoothing, interpolation and pseudo-color processing. Figure 9: Each TSOM image with a size of 89 \(\times\) 89 pixels. The middle area of the network as Figure 10 shows is the processing part of the two types of input images, and the upper part is the processing network of TSOM images. Since TSOM images contain relatively more effective information, the TSOM image processing network is constructed by referring to MCNN [28] which integrates features of different scales in order to fully extract the features of the input image. After the TSOM image is input, three columns of convolution channels are set for processing and three sizes of convolution kernels of 3 \(\times\) 3, 5 \(\times\) 5 and 7 \(\times\) 7 pixels are used to extract features of different scales in the three channels, respectively. Considering the small pixel size of TSOM images, 3 convolution layers are set in the first 3 \(\times\) 3 convolutional channel and the convolutional stride is set to 1, two convolution layers are set in the other two channels and the convolutional strides are set to 2. Both of three channels use the zero padding in the convolutional process. In both three channels, in order to retain the original characteristics, the pooling layer in the network is maximum pooling and the activation function is ReLU function: f(x)\(=\) max(0, x). After feature extraction of the three convolution channels, the first 3 \(\times\) 3 size convolutional channel obtains features with the size of 23 \(\times\) 23 \(\times\) 96, others obtain features with the size of 6 \(\times\) 6 \(\times\) 96, respectively. The features with the size 6 \(\times\) 6 \(\times\) 96 are increased to 23 \(\times\) 23 \(\times\) 96 by zero padding. Then, all the features are merged as the TSOM image features with the size of 23 \(\times\) 23 \(\times\) 288 pixels. The lower part of the middle area of the network is the processing of the focused image. Considering the texture of the focused image is relatively simple and effective information is concentrated in the middle area of the image, this part of the network refers to AlexNet [29] using single column convolution channel. The focused image features are extracted through three convolution layers and two pooling layers after input. The size of the convolution kernel is set to 3 \(\times\) 3 pixels. The pooling method adopts maximum pooling and the activation function is ReLU function. After the process, the size of the obtained features of the focused image is 23 \(\times\) 23 \(\times\) 96 pixels. The right area of the network is the feature merging and result output part. After feature extraction of the TSOM images and the focus images is completed, the extracted  
Figure 10: The structure of the two-input CNN for TSOM measurement (Focus & TSOM-CNN). features of the two types of images are merged, and the size of the merged features is \(23\times 23\times 384\) pixels. Then, the merged features are resized and mapped to the measuring target (linewidths) through the two fully connected layers for output. The activation function of the fully connected layers is ReLU function. The adaptive moment estimation (Adam) is used as the optimizer with a beginning learning rate of 0.0001. Drop-out is used to avoid overfitting.