Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 10, No. 2, 2024 18 Experimental Design of Face Image Restoration Teaching Yang Zhao, Jianwei Ding People's Public Security University of China, Beijing 100038, China Abstract: Taking face image restoration in digital image processing course as an example, a comprehensive experiment is designed. Through practical operation, the students' enthusiasm for research in the field of image restoration is cultivated. In the experimental part, the damaged image was repaired by using the image repair technique based on structure and texture. First, the basic principle and experimental procedure of this technique are introduced. The technique is then applied and improved to repair multiple damaged types of images. At the same time, the corresponding Python code is provided, so that students can carry out restoration operations for a variety of occluded images, so as to obtain reconstructed images. Students can explore different repair effects by adjusting the size and position of the occlusive area, and further deepen their understanding of repair techniques by analyzing these results. Keywords: Face Image Repair; Image Processing; Comprehensive Experiment; Diffusion Model; Digital Image Processing. 1. Introduction Image restoration is based on the existing content of the image, through the reconstruction of the lost or damaged part of the information, so that it is visually consistent and natural with the unblocked area. From the renovation of old photos to the sharpening processing of surveillance videos, face repair technology has become a key technology in many application scenarios with its unique charm. Recently, researchers have proposed DiffBFR [1], a new method for blind face image restoration based on the diffusion probability model. The core of DiffBFR [1] is that it innovatively adopts the diffusion probability model as the basic framework of the solution, thus effectively avoiding the problems of over smoothing and detail disappearance in GAN method. In the course of digital image processing, face image restoration, as a typical case, has strong practical characteristics, which can enhance students' understanding of image restoration technology and stimulate their interest in in- depth research in this field. In order to help students deeply understand the key links of face image repair technology and its implementation process. In this paper, this experiment was designed with reference to Liu [2] 's algorithm. Through practical operation of pycharm software, functions such as image reading, evaluation of restoration results and visualization of results were realized, which stimulated students' interest in image restoration, improved their scientific research quality and practical ability, and laid a solid foundation for future scientific research and practical work. 2. Based on the Principle of Structure and Texture Algorithm The existing DDPMs [3] faces the problem of semantic difference between obscured and unobscured areas in image restoration, because the semantic information of the unobscured area is not completely degraded in the process of diffusion, and the obscured area becomes pure noise. For structural complexity, priority extraction and repair of major structures can reduce the computational burden. After the main structure is repaired, the texture is repaired to avoid manual traces and save computing resources. The model adds noise to the image in the forward process and restores the blocked area in the reverse de-noising process. The experimental theoretical algorithm mainly includes two modules: structure denoising and texture repairing. 2.1. Structure Denoising Module The structure guidance network is responsible for extracting the key sparse structure information from the original image to capture the basic framework of the image. In the process of de-noising, the network gradually increases the sparsity of the structural information to reduce the semantic difference between the blocked and unblocked regions. The generated structural information provides time- dependent guidance throughout the denoising process, helping to maintain semantic coherence between different areas of the image and ensuring that the repaired image is structurally consistent with the original image. The formula of the structure guide module can be expressed as: ∗ 1 1 1 1 1 where , ̅ . 2.2. Texture Repair Module The texture network focuses on recovering the texture details of the image, and it receives sparse structural information from the structure guidance network and noisy images as input. The texture network uses this structural information as a guide to recover clear and semantically consistent textures from noise. The network can maintain the consistency of the image structure while de-noising, and 19 finally output a high-quality restoration result that matches the original image in texture and structure. The stochastic differential equation of the denoising process can be expressed as: The formula of texture denoising process can be expressed as: 2 where is the inverse time Wiener process and is the marginal probability density function of texture at time t. 3. Teaching Experiment Design In this experiment, pycharm software was used to implement code programming, and 500 celeba data sets were randomly selected as data sets. Image restoration experiment as an extension and deepening of the content of the image processing course, students should build on the basic knowledge of python programming and digital image processing and computer processing skills. Computer language: python. Experimental environment: Windows operating system xp or above or Unbuntu system; Pycharm software; Source code [2] and weight. 3.1. Teaching Experiment Procedure Step 1: Set up the basic environment and explain the code function. The teacher uses PyCharm as the development environment and takes the Strdiffusion[2] model as an example to explore the theoretical basis of the model. Students are then instructed to install and configure the required software and libraries on their computers, including installing Python, the PyTorch framework, and downloading pre-trained models and necessary dependency libraries. On this basis, the architecture of the StrDiffusion model is analyzed in detail, explaining how the structure-guided network and the texture network work together and the functions of each component in the model to help students understand the principle of the model. Finally, the tunable parameters in the model are discussed and their effect on performance, and students are instructed how to adjust these parameters to observe changes in the model's performance. Step 2: Motivate students to optimize existing algorithms. ○1In order to enhance students' innovative thinking, students are guided to make improvements from the following dimensions according to their current knowledge. ○2Replace the original module with a better module; ○3 Improvement of noise prediction network. Figure 1. Structure-directed network For ○1 , students can be guided to introduce feature extraction techniques or attention mechanisms at the decoder stage. By combining multi-modal data sources, such as texture features and color information. The introduction of the self-attention mechanism model can capture and utilize the global and local context information more flexibly, so that the details of the occluded area can be reconstructed more accurately in the process of image restoration. For ○2, students are encouraged to research and compare different neural network modules, such as convolutional layers, residual blocks, etc. Students can explore the advantages of these modules in feature extraction and representation learning, and how they can improve the performance of image restoration. For example, try integrating Transformer or some component of the Generative Adversarial Network (GAN) into the StrDiffusion model and see how these changes affect the quality of the repair results and the training efficiency of the model. After the module is replaced, the model is thoroughly evaluated for performance, including visual inspection and quantitative analysis of the repair effect. Students need to learn how to adjust hyperparameters based on the evaluation results, and how to balance the complexity of the model with the repair effect. For ○3, firstly, the weight distribution of the noise prediction network is optimized to solve the problem caused by the multiplication of confidence and data items, and enhance the sensitivity of the model to different features. Secondly, the parameter configuration of the network is adjusted, and the optimal parameter combination is found by comparing the influence of different Settings on the performance. Then, the robustness of feature extraction is enhanced to improve the stability and accuracy of the model under different conditions by introducing invariant features in deep learning. Finally, we improve the sample block search strategy to explore and implement a more efficient search algorithm. ○3is relatively simple and requires all students to complete, and○1 ○2 is optional. Figure 2. Texture network 20 Teachers provide guidance for the direction of the experiment, while the specific optimization plan and operational details need to be completed by students independently. This arrangement is designed to promote students' self-directed learning, thereby enhancing their innovative and practical skills. Step 3: Write the experiment report, evaluate and evaluate. After the completion of the above experimental steps, students are required to write experimental reports according to the standard format of scientific research papers, in order to develop their research writing ability. This task requires students to complete independently after class. Students' learning outcomes will be assessed through group defense, and teachers and other members of the group will participate in asking questions to assess students' knowledge. In the improvement of the prototype algorithm, students are allowed to experience failure, and the focus is on their improvement ideas and problem-solving methods. 3.2. Algorithm Implementation Download the model weights to the test folder, set up T = 100, through the test folder of ir-sde.yml file, modify data and mask path, By running the python3. / test/texture/ config/ inpainting/ test. The py to see results, In the test/results/ inpainting/ ir - sde/Val_Dataset folder to automatically generate the original 000000 _r. PNG, mask cover figure 000000 _m. PNG, algorithm repair figure 000000 _f. PNG (as shown in figure 3). Figure 3. Algorithm repair effect It shows that the original algorithm adds low-level and high-level features before adding noise to the structure- guided network. The same is true for the structure-de-noising network. The repair results are shown in Figure 4. Figure 4. Improved algorithm to repair renderings Three indicators were used to evaluate the image restoration effect, including Frechet initial distance MAE, peak signal-to-noise ratio PSNR, and structural similarity SSIM. It is also necessary to judge subjective factors such as whether the repaired image looks natural based on human vision. This evaluation method is closer to the visual experience of the human eye, and can comprehensively measure the real quality of the repair effect. Students are asked to compare the original algorithm repair result with the modified one according to objective evaluation index and subjective evaluation. 4. Conclusion By exploring the practical application of the StrDiffusion model in depth, students gain a more intuitive understanding of image restoration techniques in the field of digital image processing. Through detailed explanation of the model and demonstration of actual code, students not only master the basic concepts of image restoration, but also learn how to apply this knowledge to solve practical problems. We hope that this experiment will enhance students' understanding of image restoration techniques and inspire them to explore and innovate more deeply in this field." Acknowledgments People's Public Security University of China security engineering double first-class special(2023SYL08). References [1] Qiu X, Han C, Zhang Z, et al. DiffBFR: Bootstrapping Diffusion Model for Blind Face Restoration[C]//Proceedings of the 31st ACM International Conference on Multimedia. 2023: 7785-7795. [2] Liu H, Wang Y, Qian B, et al. Structure Matters: Tackling the Semantic Discrepancy in Diffusion Models for Image Inpainting[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2024: 8038-8047. [3] Ho J, Jain A, Abbeel P. Denoising diffusion probabilistic models[J]. Advances in neural information processing systems, 2020, 33: 6840-6851. 21 [4] Jianwei Ding, Qi Zhang. Experimental design of intelligent video surveillance system [J]. Experimental Technology & Management, 2021, 38(6). [5] Xiaoxue Fu, Hongtao Cheng. Study on the Teaching Mode of Python Language Programming Course in Medical Colleges based on Case drive [J]. Journal of Medical Informatics, 2024, 45(9): 102-106. [6] Junhong Zhao. Comprehensive Experimental Teaching Design of Digital image Processing Course -- Taking Image Restoration as an example [J]. Heilongjiang Science, 2021. [7] Wenjing Yu, Fuqin Yang, FENG Weiguo. Design of image restoration experiment [J]. Laboratory Research and Exploration, 2012 (6): 40-43. [8] Zanhao Wang. Research on Intelligent Image Recognition System Based on Deep Learning [J]. Modern Engineering Project Management,2024, 3(13): 217-219. [9] Xi Chen, Xianlong Cai. Dynamic Facial Occlusion Recognition Algorithm based on Deep Learning [J]. Journal of Jilin University (Information Science Edition),2024, 42(3): 503-508.