## 3 Methodology
### Training Dataset Synthesis  
The deep learning mechanism relies on a large amount of training data. However, owing to the privacy issues associated with collecting personal ID card images, the availability of real data remains limited. Hence, the construction of large-scale synthetic data for neural network training was necessary in this study. Furthermore, the appearance of text on ID cards may vary owing to different backgrounds and lighting. Therefore, we created the synthetic Chinese characters training dataset through the following steps. First, (1) generate a font image with a white background. Then, (2) produce a simulated background, and (3) combine the font and background images. The detailed data synthesis process is presented below.  
**Font Generation.** First, we used the Pillow [37] package in the Python programming languo to create a 100 \(\times\) 100-pixel white image as the background and then pasted the character text on the background to generate a character sample image. Big5 is a common Chinese character encoding method used for traditional Chinese characters, which contains a large set of 13,060 characters used in daily life. This study uses it as the classification target and adds the digits 0-9 that often appear on the ID cards. There were a total of 13,070 characters. Since the most commonly used Chinese fonts are Microsoft JhengHei and MingLiU, we chose these two fonts and added their boldface versions to increase the diversity of the dataset, with a total of four different fonts for each character. In addition, the Times News Roman font was adopted for the digits 0 to 9. Therefore, a total of 52,290 character images were generated.  
**Background Simulation.** Second, to simulate the factors of the background stripes patterns on ID cards, we added noise and merged them into the aforementioned generated character images. In this study, we introduce three background simulation methods, including a random gray-level background, a random noise background, and a patch stitching background, as described below. The three proposed background simulation methods can effectively convey the background pattern of real ID cards and facilitate the learning capability of the CNN model to achieve better OCR performance.  
1. To simulate various environmental lighting changes, we overlaid the generated character images with a different gray-level background, as depicted in Figure 3. The gray level was randomly selected. Additionally, the resultant character image was blurred with a Gaussian filter to smooth the appearance of the generated character image.  
2. The second type of background was random noise. First, a pure gray-level background was generated. Next, a positive or negative random number was added to the gray-level background. Then, the character image was merged with the noisy background, as shown in Figure 4. Finally, Gaussian blur was applied to smoothen the appearance.
3. To improve the instability caused by random noise, we further propose a patch stitching method to simulate the ID card background. First, we randomly selected 50 patches of 2 \(\times\) 2 images from the surrounding areas of a real ID card image, as shown in the red boxes in Figure 5a. Next, these patches were stitched in order from left to right and from top to bottom into a 100 \(\times\) 100-pixel background image, as shown in Figure 5b. After obtaining the stitching background, it was combined with the character image, and Gaussian blurring was performed. Figure 6 illustrates the process.  
Figure 4: Background simulation method 2: Character “[PERSON]” image with random noise background.  
Figure 5: Stitching background method: (**a**) Random selection of patches and (**b**) stitching background result.  
Figure 3: Background simulation method 1: Character “[PERSON]” image with a gray-level background.  
Figure 6: Background simulation method 3: Character “[PERSON]” image with patch-stitching background.