## 2 Materials and Methods
### Photoacoustic Imaging Experimentation and Machine Learning-Based Crack Detection
#### 2.1.2 PAI Dataset  
The PAM setup described above is utilized to generate an A-line scan at a designated point on the sample surface. An A-line scan constitutes of 1024 amplitude values of the reflected acoustic wave. A B-line scan is generated by repeating the A-line measurements for 1024 points in the x-axis. Finally, a C-scan image is obtained by repeating the B-scan image acquisition process for 256 points in the y-axis, resulting in the final output with dimensions of 1024 \(\times\) 1024 \(\times\) 256 for a single-crack image. Such single C-scan images take more than 16 min for acquisition, which will result in huge acquisition time if there is a large number of samples to be inspected.  
This study proposes a machine learning approach to use a low-resolution image (1024 \(\times\) 1024 \(\times\) 16, which takes only 1 min of acquisition time) to produce reliable results comparable to those of high-resolution images. After acquiring the raw acoustic response data, PA images are reconstructed. Further, the reconstructed images are downsampled to generate low-resolution images, and the images are resized from 1024 \(\times\) 1024 to a smaller size (224 \(\times\) 224) to boost the performance of the machine learning crack detection scheme. The number of images uniquely generated by the PAM setup and finally constructed after data augmentation techniques are listed in Table 2.  
Data augmentation (image rotation, reflection, and scaling) techniques presented in Table 3 are applied on the low-resolution images to generate an ample amount of data for the machine learning models. Figure 3 presents the actual steel samples with surface cracks used for PAI experimentation and a few examples PA images before and after data augmentation. The overall scheme starting from performing actual experiments on the steel samples, image preprocessing, and dataset construction is presented in Figure 4.  
\begin{table}
\begin{tabular}{c c c c} \hline
**Crack \#** & **Length (mm)** & **Width (\(\mu\)m)** & **Sample Information** \\ \hline
1 & 6 & 300 & \\
2 & 8 & 300 & \\
3 & 7 & 1000 & Sample 1 \\
4 & 8 & 1000 & \\
5 & 5 & 500 & \\ \hline
6 & 1 & 400 & \\
7 & 8 & 300 & \\
8 & 1 & 350 & Sample 2 \\
9 & 1 & 1000 & \\
10 & 4 & 400 & \\ \hline
11 & 2 & 300 & \\
12 & 4 & 300 & \\
13 & 4 & 500 & Sample 3 \\
14 & 1 & 500 & \\
15 & 1 & 300 & \\ \hline \end{tabular}
\end{table}
Table 1: Surface crack dimensions utilized for actual experimentation using the PAM setup to generate raw acoustic response data.  
\begin{table}
\begin{tabular}{c c} \hline
**Attribute** & **Crack Images** \\ \hline
**\#** of cracks & 15 \\ PAM setup’s unique laser excitation angles per crack & 4 \\ Total original images & 15 \(\times\) 4 = 60 \\ Total Images after applying Data augmentation techniques & 4050 \\ \hline \end{tabular}
\end{table}
Table 2: Total unique images generated by the PAM setup and final images constructed after data augmentation techniques.  
Figure 4: Overall scheme showing the steps involved in the construction of the final PAI dataset starting from PAI experimentation, image preprocessing, image resizing, and data augmentation.  
Figure 3: Steel samples used for actual PAI experimentation are presented in the first column; the second column provides a few example PA images reconstructed from the acoustic responses received after experimentation. Finally, the third column shows a few images after application of data augmentation techniques.