# SMT Assembly Inspection Using Dual-Stream Convolutional Networks and Two Solder Regions
## 6 Convolutional Neural Network (CNN) Structure
### Single-Stream CNN  
Figure 9 shows the structure of a single-stream CNN. Most CNNs, such as AlexNet [28] and VGGNet [29], have a single-stream structure. The input data of the single-stream CNN consists of the \({}^{I}R\), \({}^{I}G\) and \({}^{I}B\) channel image of the chip component image. Each color channel of the input data has a size of 64 x 64 pixels. In Figure 9, C#, P#, and R# represent a convolutional layer, max pooling layer, and ResBlock layer of Figure 10, respectively. The convolution layer C# has a kernel size of \(3\times 3\), padding = 1, and stride = 1. Figure 9: Structure of a single-stream CNN. The max pooling layer P# has a kernel size of \(2\times 2\), padding = 0, and stride = 2. The ReLu function was used as the activation function of the convolution layer and the fully connected layer. Unless otherwise noted, the convolution layer and max pooling layer will have the same configuration. First, for local feature extraction, the input data are converted into a feature map \(64\times 64\times 64\) in size through C1. After the initial conversion, the feature map is again converted into a \(64\times 64\times 384\) feature map through two convolution layers C2 and C3. The output feature map of C3 passes through C4, and then for global feature extraction scales down to \(32\times 32\times 512\) through the max pooling layer P1. It is converted into a feature map \(16\times 16\times 512\) in size through C5 and P2. To avoid the gradient-vanishing problem, ResBlock layers [30] R1 and R2, are attached at the rear of the network. R1 and R2 in Figure 10 show the structure of the ResBlock layers used in this paper. The feature map is converted into \(8\times 8\times 512\) size through R1 and P3, and \(4\times 4\times 512\) through R2 and P4. For the fully connected layer input, the feature map output of C6 passes through a \(4\times 4\) convolution layer C7 with padding = 0 and is converted to \(1\times 1\times 512\). A probability value for six types of defect is finally output through a fully connected layer having a size of \(1\times 1\times 1024\). Table 1 shows the detailed structure of the ResBlock layers R1 and R2 used in this paper. The reason that our proposed method uses a \(3\times 3\) kernel size for the convolution layer is because the computational efficiency per receptive field is highest for this the kernel size. Since the computational \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{LayerConfig} & \multirow{2}{*}{**Inner Layer**} & \multirow{2}{*}{**Window Size (W \(\times\) H)**} & \multirow{2}{*}{**Channel Size**} & \multirow{2}{*}{**Padding**} & \multirow{2}{*}{**Stride**} \\ \hline \multirow{2}{*}{\(R1,R2\)} & Conv-1 & \(3\times 3\) & 512 & 1 & 1 \\  & Conv-2 & \(3\times 3\) & 512 & 1 & 1 \\ \hline \multirow{3}{*}{\(IM_{A}\)} & Conv-A1 & \(3\times 3\) & 16 & 1 & 1 \\  & Conv-B1 & \(3\times 1\) & 32 & 1 & 1 \\  & Conv-B2 & \(1\times 3\) & 32 & 1 & 1 \\ \hline \multirow{3}{*}{\(IM_{B}\)} & Conv-C1 & \(1\times 1\) & 16 & 1 & 1 \\  & Conv-C2 & \(3\times 3\) & 16 & 0 & 2 \\ \cline{1-1}  & Conv-D1 & \(3\times 1\) & 48 & 1 & 1 \\ \cline{1-1}  & Conv-D2 & \(1\times 3\) & 48 & 1 & 1 \\ \cline{1-1}  & Conv-D3 & \(3\times 3\) & 48 & 0 & 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Layer configuration of CNN. Figure 10: ResBlock structure. ResBlock consists of two convolution layers: the output of the ResBlock is the sum of the input feature and the output of the last convolution layer. power of the convolution layer is the sum of the product of the kernel weight and the input value, the computational power of the convolution layer is the square of the kernel size. For example, when the computation power of a \(3\times 3\) convolution layer is \(3^{2}=9\); similarly, the computational power of a \(5\times 5\) convolution layer is \(5^{2}=25\). Two \(3\times 3\) convolution layers are required to have the same receptive field as a \(5\times 5\) convolution layer only using the \(3\times 3\) convolution layer.