# A Method of Defect Depth Estimation for Simulated Infrared Thermography Data with Deep Learning
## 3 Proposed Strategy for Defect Depth Estimation
### Gated Recurrent Unit Model with Depth Estimator  
Due to the time continuity of the thermal sequence, each frame collected from the experiment is related to the recent historical frame, therefore the time series memory deep learning model can be applied to the thermography data based on this feature. The GRU model is originally from RNN which is a time series model that can handle the continuous information such as thermal sequences [15]. During the cooling period of the thermal data, the temperature evaluation curves over time are acquired from the given infrared frames. The learned GRU model is able to distinguish whether the pixel is from a defective region or a sound region due to the training period. Therefore, the multiple units of GRU could be applied to extract the features of the temperature evaluations from the samples based on physical properties.  
The GRU neural network in Figure 8 are structured as follows [16]. In Equations (6)-(9), \(R_{t}Z_{t}\) represent the update, reset gate units respectively. \(S^{(z)}\), \(S^{(r)}\), \(S\) are the weight factors for each gate unit. \(x_{t}\) is the current input. \(h_{t-1}\) is the input from the previous time step in the hidden state. \(h_{t}^{\prime}\) is the input of current memory from the hidden state. \(U^{(z)}\), \(U^{(r)}\), \(U_{o}\) are the weight factors for previous time information \(h_{t-1}.\sigma(.)\) represents the sigmoid function.\({}^{\circ}\) is denoted as the Hadamard product [17].  
\[Z_{t}=\sigma\big{(}S^{(z)}(x_{t})+U^{(z)}(h_{t-1})\big{)} \tag{6}\]  
Figure 7: GRU model-based defects depth estimation strategy.  
\[R_{t}=\sigma\big{(}S^{(r)}(x_{t})+U^{(r)}(h_{t-1})\big{)} \tag{7}\] \[h_{t}^{\prime}=\textit{tanh}(S(z_{t})+R_{t}\,^{\circ}U_{o}(h_{t-1}))\] (8) \[h_{t}=Z_{t}\,^{\circ}\textit{tanh}+(1-Z_{t})\,^{\circ}\,h_{t}^{\prime} \tag{9}\]  
As shown in Figure 9, in this work, the original thermal sequences were reshaped into vectors. The particular thermal contrast vectors are directly fed into the input of the GRU network structure. Each thermal contrast vector in the defect region is decoded with the depth value of corresponding defect at the output of GRU based on the thermal properties from the training sequences. In order to select the points for the simulated thermal sequences to extract temperature curves vectors, 5 different locations inside each defect surface in these defective areas were selected. Since the temperature of the defect region is not even, these selected points accounted for small temperature variations and change above each defect surface region. Each thermal contrast vector is vectorized with the same length in the time of the thermal sequence. Therefore, the input values of GRU are fed into the particular thermal contrast vectors. The output from the decode section (to be connected with the fully connected layer) are set with the corresponding defect depth of each vector. The estimated depth values in the defect region output from GRU are based on the thermal properties from the training sequences.  
Figure 8: Gated Recurrent Unit.  
Figure 9: The process of Gated Recurrent Unit (GRU) depth estimation.