Method, system and device for restoring damaged murals in historical and cultural scenic spots by using AI
By constructing a network model of self-attention encoder and decoder, the problems of structural distortion and blurred details in the restoration of Dunhuang murals were solved, and high-quality mural restoration effects were achieved.
Patent Information
- Application Number
- CN202510006289.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-01-03
AI Technical Summary
Existing technologies have bottleneck problems such as structural distortion, blurred details and visual incoherence when restoring Dunhuang murals.
A network model based on self-attention encoder and self-attention decoder is constructed. Local feature maps are obtained through residual connected convolutional neural networks. The weights are calculated by combining the U-Net image segmentation algorithm and the k-nearest neighbor distance algorithm. The image features are optimized using Fourier transform, and gradient descent optimization training is performed to finally generate high-quality restored images.
It effectively solved the problems of structural distortion and blurred details, improved the visual coherence and detail expression of mural restoration, and improved the restoration quality.
Smart Images

Figure CN119904390B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data restoration, and in particular to a method, system and device for restoring damaged murals in historical and cultural scenic spots by using AI. BACKGROUND
[0002] Dunhuang has been immersed in the culture of the Han and Tang dynasties for thousands of years, and has many cultural relics such as grottoes and caves. Dunhuang grotto art, including Dunhuang murals, is a national Buddhist art that has absorbed the best of Chinese and foreign cultures. It is renowned worldwide for its long history, grand scale, exquisite artistry, and profound connotations, and is hailed as the "dawn of human civilization" and the "treasure trove of world Buddhist art".
[0003] Dunhuang murals have been affected by various types of diseases due to external factors such as the natural environment or human activities, as well as internal factors such as the materials and structure of the murals and the mineral composition of the rock on which the murals are painted. The most typical examples are discoloration and fading of the mural pigments, cracking and peeling of the mural pigment layer, and the deterioration of the mural ground layer, which is characterized by crumbling, powdering, hollowing, and peeling. In addition, the mural pigment layer is prone to mold growth and pollution, and past practices such as burning incense and living in the grotto have also caused smoke damage to the murals. Peeling and damage, also known as damage, refers to the complete peeling of the mural pigment layer. The internal structure of Dunhuang murals is relatively fragile, and over the centuries, they have been subjected to natural erosion and even human damage. Today, Dunhuang murals are generally damaged, and the extent of the damage is often severe. There has been a long history of research on the protection of cultural heritage such as Dunhuang murals and painted sculptures. Restoring damaged murals requires experienced professional artists, and the amount of work is enormous. Over the past 70 years, since the 1940s, researchers at the Dunhuang Research Institute have restored over 5000 square meters of murals in more than 280 caves.
[0004] However, there are still some problems in the restoration of damaged murals using AI, such as structural distortion, blurred details, and visual discontinuity. SUMMARY
[0005] The present application provides a method, system and device for restoring damaged murals in historical and cultural scenic spots using AI, to solve the problems of structural distortion, blurred details, and visual discontinuity in the restoration of damaged murals using AI.
[0006] In one aspect, the present application provides a method for restoring damaged murals in historical and cultural scenic spots using AI, comprising the following steps:
[0007] S1: Collecting the image of the damaged mural to be restored. Obtaining a historical image set based on the complete mural image and the damaged mural image. Normalizing the historical image set and dividing it into a training set and a test set according to a predetermined ratio.
[0008] S2: Construct a network model based on a self-attention encoder and a self-attention decoder. The self-attention encoder is used to obtain global dependency and calculate a weighted feature map based on distance dependency.
[0009] S3: Train the network model iteratively using the training set. Reserve the network model parameters that reach the preset accuracy on the test set to obtain an optimal restoration model.
[0010] S4: Input the damaged mural image into the optimal restoration model to output the restored mural.
[0011] According to the method for restoring damaged murals in historical and cultural scenic spots by using AI, in step S2, the operation steps of the self-attention encoder include:
[0012] S21: Obtain the local feature map of the damaged mural image using a residual connection convolutional neural network, the high level of the residual connection convolutional neural network is used as the skip feature of the self-attention encoder, and the residual connection convolutional neural network includes a down-sampling layer.
[0013] S22: Generate a mask region corresponding to the local feature map using a U-Net image segmentation algorithm.
[0014] S23: Use a k-nearest neighbor distance algorithm to calculate the weight of each feature point according to the distance relationship between the feature points in the local feature map, and multiply the calculated weight value with the corresponding pixel or feature point in the local feature map.
[0015] S24: Calculate the latent vector of the mask region, and pass the quantized latent vector to the self-attention decoder.
[0016] According to the method for restoring damaged murals in historical and cultural scenic spots by using AI, in step S2, the operation steps of the self-attention decoder include:
[0017] S25: Receive the quantized latent vector, generate a multi-scale representation of the damaged mural image, adjust the spatial resolution of the damaged mural image by upsampling technology until it matches the input size of the self-attention decoder layer, and generate a preliminary restoration image based on the latent vector, the preliminary restoration image is used as the coarse feature of the self-attention decoder.
[0018] S26: Combine the skip feature of the self-attention encoder with the coarse feature provided by the self-attention decoder to form a fusion feature map.
[0019] S27: The self-attention encoder gradually recovers the high-resolution features of the fusion feature map through transposed convolution, and finally generates a reconstructed image.
[0020] S28: Apply a Fourier transform to the generated reconstructed image to enhance high-frequency features in the reconstructed image and optimize the generation of repetitive textures. Then, convert the image back to the spatial domain by inverse Fourier transform to obtain the final restored image.
[0021] According to the present application, a method for restoring damaged murals in historical and cultural scenic spots by AI is provided. In step S3, the specific steps for training include:
[0022] S31: Normalize the non-zero values of the output of the convolutional layer of the network model.
[0023] S32: Regularize the gradient norm of the model network layer.
[0024] S33: Iteratively optimize the model architecture using the gradient descent method.
[0025] According to the present application, a method for restoring damaged murals in historical and cultural scenic spots by AI is provided. In step S33, the specific steps for iteratively optimizing the network model using the gradient descent method include:
[0026] S331: Initialize the network model parameters, and use the structural similarity loss as the loss function of the network model.
[0027] S332: Perform gradient calculation and update the network model parameters until the loss function reaches the preset threshold or the maximum number of iterations, then output the optimal parameters, and obtain the optimal restoration model according to the optimal parameters.
[0028] In another aspect, the present application also provides a system for restoring damaged murals in historical and cultural scenic spots by AI, comprising:
[0029] A private data acquisition and processing module is used to acquire and process damaged mural images to be repaired in historical and cultural scenic spots, as well as complete mural images and historical image sets of damaged mural images, and to normalize the historical image sets.
[0030] A self-attention encoder module is used to obtain the global dependency relationship of the feature vector in the damaged mural image and calculate the weighted feature map based on distance dependency, enhance the local texture information of the rough prior, and restore the lost or blurred rough texture and coherent visual structure.
[0031] A self-attention decoder module is used to generate a restored mural image and enhance the range of the restored image.
[0032] A model training and verification module is used to input the acquired complete mural images and damaged mural images as model input data, iteratively train the network composed of the self-attention encoder and the self-attention decoder multiple times, and finally save the optimal parameter model for restoring damaged murals.
[0033] The system for restoring damaged murals in historical and cultural scenic spots by using AI according to the present application comprises a self-attention encoder module.
[0034] A downsampling Resnet unit is used to obtain a local feature map of the damaged mural image.
[0035] A DWT module unit is used to encode the global dependency relationship and obtain a distance-based weighted feature map, and the latent vector label of the mask area is calculated and transmitted to the self-attention decoder.
[0036] The system for restoring damaged murals in historical and cultural scenic spots by using AI according to the present application comprises a self-attention decoder module.
[0037] An upsampling Resnet unit is used to increase the spatial resolution of the repaired damaged mural image to the input size of the self-attention decoder layer.
[0038] A DWT unit is used to integrate the features between the self-attention encoder and the self-attention decoder, receive the features from the upsampling ResNet module and the self-attention encoder, integrate them to reduce visual bias and improve the image restoration effect, gradually restore the high-resolution features of the image through transposed convolution, and finally generate a reconstructed image.
[0039] A Res-FFC unit is used to enhance the reuse of high-frequency features and optimize the repeated texture generation capability.
[0040] The model training and verification module of the system for restoring damaged murals in historical and cultural scenic spots by using AI according to the present application comprises:
[0041] A preprocessing unit is used to normalize the non-zero values output by the convolution layer of the network model, and fine-tune the network layer to regularize the gradient norm.
[0042] An optimization unit is used to optimize the network model by using the gradient descent method, obtain and save the optimal restoration model.
[0043] On the other hand, the present application also provides a device for restoring damaged murals in historical and cultural scenic spots by using AI, which comprises at least a memory, a processor and a display screen. The functions of the device are completed by deploying a system for restoring damaged murals in historical and cultural scenic spots by using AI. The high-definition camera of the electronic device is used to collect complete mural images and damaged mural images in historical and cultural scenic spots. The memory is used to store the collected mural image data and computer instructions. The processor is used to run the computer instructions to realize a method for restoring damaged murals in historical and cultural scenic spots by using AI. The touch display screen is used for real-time human-computer interaction, and the damaged mural image and the restored mural image are displayed visually.
[0044] The application provides a method, system and device for restoring a damaged mural in a historical and cultural scenic area by using AI. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0046] Figure 1 is one of the method flowcharts for restoring a damaged mural in a historical and cultural scenic area by using AI provided by the embodiments of the application;
[0047] Figure 2 is a system framework diagram for restoring a damaged mural in a historical and cultural scenic area by using AI provided by the embodiments of the application; DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of the application more clear, the technical solutions in the application will be described clearly and completely in the following by combining the drawings in the application. Obviously, the described embodiments are some of the embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0049] Embodiment 1: please refer to Figure 1 The embodiments of the application provide a method for restoring a damaged mural in a historical and cultural scenic area by using AI, which comprises the following steps.
[0050] S1: collecting a damaged mural image to be repaired. Obtain a historical image set based on a complete mural image and a damaged mural image. Normalize the historical image set and divide the historical image set into a training set and a test set according to a preset proportion.
[0051] In this embodiment, high-definition cameras can be used to collect the mural. High-definition cameras can capture the fine texture, color changes and detailed features of the mural, providing more accurate and detailed records than traditional photography or hand-drawing. This high-precision record helps to preserve the original appearance of the mural and provides reliable basis for subsequent research, repair and replication. Using high-definition cameras for collection can avoid physical damage to the mural, especially for those fragile or easily damaged murals. Non-contact collection is particularly important. Non-contact collection can also help reduce environmental changes and pollution caused by human intervention. High-resolution images of complete murals can also be collected from historical databases, museums or online documents.
[0052] S2: Construct a network model based on a self-attention encoder and a self-attention decoder. The self-attention encoder is used to obtain global dependencies and calculate weighted feature maps based on distance dependencies.
[0053] In this embodiment, the self-attention mechanism can be constructed by ready-to-use implementation, ensuring that the computational complexity is controlled without affecting the accuracy of feature extraction. By combining the self-attention mechanism, long-distance dependencies can be effectively captured, enhancing the model's understanding and recovery ability of image features, thereby improving the quality of restoration. The network model can incorporate the advantages of residual neural networks and convolutional neural networks to enhance the image restoration process. At the same time, the introduction of sparse attention can minimize computational complexity. The residual neural network expression formula is:
[0054] y = F(x, {W i}) + x
[0055] where x is the input, F(x, {W i}) is an operation composed of multiple convolutional layers and nonlinear activation functions, and y is the output.
[0056] The specific expression formula of the convolutional neural network is:
[0057]
[0058] where y[n] is the convolution result, x1[m] is the input, and ω[n] is the convolution kernel.
[0059] S21: Use a residual connection convolutional neural network to obtain a local feature map of the damaged mural image. The high-level of the residual connection convolutional neural network serves as a skip feature for the self-attention encoder. The residual connection convolutional neural network includes a down-sampling layer.
[0060] S22: Use a U-Net image segmentation algorithm to generate a mask region corresponding to the local feature map.
[0061] S23: Using the k-nearest neighbor distance algorithm, according to the distance relationship between the feature points in the local feature map, the weight of each feature point is calculated using the Gaussian function according to the distance value relationship, and the calculated weight value is multiplied with the corresponding pixel or feature point in the local feature map.
[0062] In this embodiment, the k-nearest neighbor distance algorithm expression formula is:
[0063]
[0064] where d(X i , X j ) is the distance between samples X i and X j , X ik is the value of sample X i on k features, and X jk is the value of sample X j on k features.
[0065] In this embodiment, the distance-dependent weight calculation can improve the accuracy of feature extraction, so that the model can more effectively learn the relationship between regions and improve the restoration ability of the complete image. The image segmentation algorithm is used to automatically identify and mark the damaged area, thereby generating a mask. The distance weight of each pixel is combined to perform weighted processing on the local feature map, ensuring that the surrounding effective pixels have the maximum contribution to the repair of the damaged part. For each pixel in the damaged area, the average distance between it and the surrounding effective pixels is calculated, and the following formula is used:
[0066]
[0067] where ω is a variable representing the result of the summation, and d(x1, x2) is the distance between x1 and x2.
[0068] S24: Calculate the latent vector of the mask area and pass the quantized latent vector to the self-attention decoder.
[0069] In this embodiment, the latent vector is generated in the damaged area to ensure that the self-attention encoder can learn the semantic information in the damaged area. The generated latent vector is compressed and quantized to meet the input requirements of the self-attention decoder. K-means clustering and other methods can be used for quantization processing.
[0070] S25: Receive the quantized latent vector, generate a multi-scale representation of the damaged mural image, adjust the spatial resolution of the damaged mural image through upsampling technology until it matches the input size of the self-attention decoder layer, and generate a preliminary restoration image based on the latent vector. The preliminary restoration image serves as the rough features of the self-attention decoder.
[0071] In this embodiment, multi-scale representation of output features can be achieved through different decoding layers, and methods such as deconvolution and bilinear interpolation are used to restore high-resolution features of the image. Each decoding layer should activate the generated features, for example, using the ReLU activation function to increase nonlinearity. The output layer is consistent with the size of the original input image, matching local and global context information to form a complete high-resolution image. Multi-scale representation improves the richness of image details, ensuring diversity and realism of the restoration.
[0072] S26: Combine the skip features of the self-attention encoder with the coarse features provided by the self-attention decoder to form a fused feature map.
[0073] In this embodiment, the encoder and decoder output feature maps can also be combined using splicing or weighted averaging. Additional convolution layers may be needed to adjust the number of channels in the fused feature map to remain consistent. Integration provides a more comprehensive context, allowing the entire model to utilize richer feature information and promote improved restoration quality.
[0074] S27: The self-attention encoder gradually restores the high-resolution features of the fused feature map through transposed convolution, ultimately generating a reconstructed image.
[0075] S28: Apply Fourier transform to the generated reconstructed image to enhance high-frequency features in the reconstructed image and optimize the generation of repetitive textures. Then, through inverse Fourier transform, the image is converted back to the spatial domain to obtain the final restored image.
[0076] In this embodiment, the image is converted from the spatial domain to the frequency domain for processing through the Fast Fourier Transform, increasing the high-frequency components of the image to improve detail performance. After Fourier transform, the low-frequency and high-frequency features of the image can be processed separately, and then the final image is formed through inverse transform. Through the Fourier transform method, the high-frequency features in the restoration process are improved, making the image more perfect in detail, especially in repairing small damage and patterns. The Fourier transform of the image can be represented as:
[0077]
[0078] where F(u, v) is the representation of the image in the frequency domain, u and v are variables in the frequency domain, corresponding to x and y in the spatial domain, e -j2π(ux+vy) is the function is the core part of the Fourier transform, which is used to convert signals in the spatial or temporal domain to the frequency domain, dxdy is the differential element of double integration, representing the small area when integrating the two variables x and y.
[0079] S3: Train the network model iteratively using the training set. Retain the network model parameters that achieve the preset accuracy on the test set to obtain the optimal restoration model.
[0080] In the data input stage, data augmentation techniques such as random rotation, cropping, etc. can be performed to enhance the generalization ability of the model. The training set, validation set and test set are divided in the ratio of 80%-10%-10%. During training, overfitting can be avoided by monitoring the validation loss and early stopping strategy, and a best model saving mechanism is formed. By optimizing the training process, the effectiveness and reliability of the model in practical application can be ensured, and the efficiency and quality of image restoration can be improved.
[0081] S31: Normalizing the non-zero values of the output of the convolutional layer of the network model.
[0082] In this embodiment, BatchNormalization can be used to normalize after each convolutional layer, which helps to speed up training and improve model stability. The popular library is used to simplify the implementation process. Normalization ensures the stability of the gradient and the speed of model training, so that the subsequent model training process can converge faster. The following expression formula can be used:
[0083]
[0084] where x is the original input feature map, μ is the mean of all feature maps, σ is the standard deviation of all feature maps, is a very small positive number to prevent division by zero, and x e is the normalized feature map.
[0085] S32: Regularizing the gradient norm of the model network layer.
[0086] In this embodiment, the L2 regularization method can be used, and the expression formula is:
[0087]
[0088] where Loss r is the total loss after adding the regularization term, Loss is the original loss function, which is usually calculated based on the difference between the model prediction and the actual label, λ is the regularization coefficient, is the L2 norm of the model parameter θ.
[0089] S33: Iterative optimization of the network model using gradient descent method.
[0090] S331: Initialize the network model parameters, and use the structural similarity loss as the loss function of the network model.
[0091] S332: Perform gradient calculation and update the network model parameters until the loss function reaches the preset threshold or the maximum number of iterations, then output the optimal parameters, and obtain the optimal restoration model according to the optimal parameters.
[0092] S4: input the incomplete mural image data into the optimal restoration model to form a complete mural.
[0093] In this embodiment, the generated complete mural can be further optimized by color correction or sharpening algorithm to improve the visual effect.
[0094] Based on the same overall inventive concept, the application also protects a system for restoring damaged murals in historical and cultural scenic spots using AI. The following describes a system for restoring damaged murals in historical and cultural scenic spots using AI provided by the application. The system described below corresponds to the method described above.
[0095] The private data acquisition and processing module is used to acquire and process the damaged mural images to be repaired in the historical and cultural scenic spot, as well as the historical image set of the complete mural image and the damaged mural image, and to normalize the historical image set.
[0096] In this embodiment, the image can be size-standardized, and grayscale standardization and brightness adjustment can be applied to make different images visually consistent and increase the training effectiveness of the model. Data augmentation such as random rotation, scaling and flipping can also be used to enhance the diversity of the data set and reduce overfitting.
[0097] The self-attention encoder module is used to obtain the global dependency relationship of the feature vector in the damaged mural image and calculate the weighted feature map based on the distance dependency, enhance the local texture information of the rough prior, and restore the lost or blurred rough texture and coherent visual structure.
[0098] The self-attention encoding module includes:
[0099] The down-sampling Resnet unit is used to obtain the local feature map of the damaged mural image.
[0100] In this embodiment, batch normalization and activation functions can be used to improve the stability and training efficiency of the model.
[0101] The DWT module unit is used to implement the encoding of global dependency and obtain the distance-based weighted feature map, and calculate the potential vector label of the mask area and pass it to the self-attention decoder.
[0102] The self-attention decoder module is used to generate the restored mural image and enhance the range of the restored image.
[0103] The self-attention decoding module includes:
[0104] The up-sampling Resnet unit is used to increase the spatial resolution of the repaired damaged mural image to the input size of the self-attention decoder layer.
[0105] The DWT unit is configured to integrate features between the self-attention encoder and the self-attention decoder, receive features from the up-sampling ResNet module and the self-attention encoder, integrate the features to reduce visual bias and improve image restoration effects, gradually restore high-resolution features of the image through transposed convolution, and finally generate a reconstructed image.
[0106] The Res-FFC unit is configured to enhance reuse of high-frequency features and optimize the ability of repeated texture generation.
[0107] The model training and verification module is configured to use complete mural images and damaged mural images as input data of the model, train the network composed of the self-attention encoder and the self-attention decoder through multiple iterations, and finally save an optimal parameter model for restoring damaged murals.
[0108] In this embodiment, a cross-entropy loss function or other suitable loss function for image reconstruction can be used for multiple iterations of training to optimize parameters of the self-attention encoder and the decoder.
[0109] To implement the above-mentioned method for restoring damaged murals in historical and cultural scenic spots by using AI, this embodiment further provides an apparatus for restoring damaged murals in historical and cultural scenic spots by using AI, which comprises a high-definition camera, a memory, a processor, and a touch display screen. The high-definition camera of the electronic apparatus is configured to collect complete mural images and damaged mural images in historical and cultural scenic spots. The memory is configured to store mural image data and computer instructions. The processor is configured to run computer instructions to implement the method for restoring damaged murals in historical and cultural scenic spots by using AI. The touch display screen is configured to realize real-time human-computer interaction, visually display damaged mural images and restored mural images.
[0110] In this embodiment, the apparatus can be a smartphone, a tablet computer, a notebook computer, a desktop computer, a rack-mounted server, a blade server, a tower server, or a cabinet server (including a standalone server or a server cluster composed of multiple servers). The apparatus of this embodiment at least includes but is not limited to a memory and a processor that can be connected to each other through a system bus.
[0111] The memory (i.e., a readable storage medium) in the embodiment includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Of course, the memory can also include both the internal storage unit and the external storage device of the computer device. In the embodiment, the memory is generally used to store an operating system and various application software installed on the computer device, etc. In addition, the memory can also be used to temporarily store various data that have been output or will be output.
[0112] The processor in some embodiments can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is generally used to control the overall operation of the computer device. In the embodiment, the processor is used to run the program code or process data stored in the memory, thereby implementing the steps of the motion control method of the four-wheel differential mobile robot described above, thereby implementing the optimized control of the existing mobile robot, and improving the accuracy and stability of the trajectory tracking of the mobile robot.
[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0114] Those skilled in the art can clearly understand the implementation of the various embodiments by means of software and necessary general hardware platforms through the description of the above embodiments, and of course, the embodiments can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0115] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. By using the gradient descent method, the model can learn how to recover the missing area from the context information of the missing wall painting by optimizing the loss function.
Claims
1. A method for restoring a missing mural in a historical and cultural scenic area by using an AI technology, characterized in that, The method comprises: S1: collecting a damaged mural image to be repaired; obtaining a historical image set based on a complete mural image and the damaged mural image; normalizing the historical image set and dividing the historical image set into a training set and a test set according to a preset proportion; S2: constructing a network model based on a self-attention encoder and a self-attention decoder; the self-attention encoder is used to obtain a global dependency relationship and calculate a weighted feature map based on distance dependency; The operation steps of the self-attention decoder include: S25: receiving a quantized latent vector, generating a multi-scale representation of the damaged mural image, adjusting the spatial resolution of the damaged mural image through an upsampling technique until it matches the input size of the self-attention decoder, generating a preliminary restoration image from the latent vector, and the preliminary restoration image as a coarse feature of the self-attention decoder; S26: combining the skip features of the self-attention encoder with the coarse features provided by the self-attention decoder to form a fusion feature map; S27: the self-attention encoder gradually recovers the high-resolution features of the fusion feature map through transposed convolution, and finally generates a reconstructed image; S28: applying Fourier transform to the generated reconstructed image to enhance the high-frequency features in the reconstructed image and optimize the generation of repeated textures; then, the image is converted back to the spatial domain through inverse Fourier transform to obtain the final restoration image; S3: training the network model using the training set; retaining the network model parameters that reach the preset accuracy on the test set to obtain an optimal restoration model; S4: inputting the damaged mural image into the optimal restoration model to output a restored mural. 2.The method for restoring a missing mural of a historical and cultural scenic area by using an AI technology according to claim 1, characterized in that, In step S2, the operation steps of the self-attention encoder include: S21: using a residual connection convolutional neural network to obtain a local feature map of the damaged mural image, the high-level of the residual connection convolutional neural network as the skip feature of the self-attention encoder, and the residual connection convolutional neural network including a down-sampling layer; S22: using a U-Net image segmentation algorithm to generate a mask region corresponding to the local feature map; S23: using a k-nearest neighbor distance algorithm, according to the distance relationship between the feature points in the local feature map, using a Gaussian function to calculate the weight of each feature point according to the distance relationship, and multiplying the calculated weight value with the corresponding pixel or feature point in the local feature map; S24: calculating the latent vector of the mask region and passing the quantized latent vector to the self-attention decoder. 3.The method for restoring damaged mural of historical and cultural scenic area by using AI technology according to claim 1, characterized in that, In step S3, the training specific steps include: S31: normalizing the non-zero values of the output of the convolutional layer of the network model; S32: regularizing the gradient norm of the model network layer; S33: using gradient descent method to iteratively optimize the network model.
4. The method for restoring missing murals in historical and cultural scenic spots by using AI technology according to claim 3, characterized in that, In step S33, the specific steps of using gradient descent method to iteratively optimize the network model include: S331: initializing the network model parameters, and using structural similarity loss as the loss function of the network model; S332: Gradient calculation is performed, the network model parameters are updated until the loss function reaches a preset threshold or a maximum number of iterations, and then optimal parameters are output, and an optimal restoration model is obtained according to the optimal parameters.
5. A system for restoring a damaged mural of a historical and cultural scenic area using an AI technology, which adopts the method for restoring a damaged mural of a historical and cultural scenic area using an AI technology according to any one of claims 1 to 4, characterized in that, The system comprises: A private data acquisition and processing module is configured to acquire and process historical cultural scenic spot damaged mural images to be restored, and historical image sets of complete mural images and damaged mural images, and perform normalization processing on the historical image sets; A self-attention encoder module is configured to obtain a global dependency relationship of feature vectors in a damaged mural image and calculate a distance-dependent weighted feature map, enhance local texture information of a rough prior, and restore lost or blurred rough texture and coherent visual structure; A self-attention decoder module is configured to generate a restored mural image and enhance a large range of restored image perception; A model training and verification module is configured to take the acquired complete mural images and damaged mural images as input data of a model, iteratively train a network composed of the self-attention encoder and the self-attention decoder, and finally save an optimal parameter model for restoring damaged murals. 6.The system for restoring damaged mural of historical and cultural scenic area by using AI technology according to claim 5, characterized in that, The self-attention encoder module comprises: A down-sampling Resnet unit is configured to obtain a local feature map of a damaged mural image; A DWT module unit is configured to implement coding of a global dependency relationship, obtain a distance-based weighted feature map, and calculate a latent vector label of a mask region to be passed to the self-attention decoder. 7.The system for restoring damaged mural of historical and cultural scenic area by using AI technology according to claim 5, characterized in that, The self-attention decoder module comprises: An up-sampling Resnet unit is configured to improve a spatial resolution of a damaged mural image to be repaired to an input size of a self-attention decoder layer; A DWT unit is configured to integrate features between the self-attention encoder and the self-attention decoder, receive features from the up-sampling ResNet module and the self-attention encoder, integrate the features to reduce visual bias and improve image restoration effects, gradually restore high-resolution features of an image through transposed convolution, and finally generate a reconstructed image; A Res-FFC unit is configured to enhance reuse of high-frequency features and optimize a repeated texture generation capability.
8. The system for restoring a missing mural of a historical and cultural scenic area by using an AI technology according to claim 5, characterized in that, The model training and verification module comprises: A preprocessing unit is configured to perform normalization processing on non-zero values output by a convolution layer of a network model, and fine-tune a network layer to regularize a gradient norm; An optimization unit is configured to optimize the network model by using a gradient descent method, and obtain and save an optimal restoration model.
9. An apparatus for restoring a damaged mural in a historical and cultural scenic area using an AI technology, comprising: The device at least comprises a camera, a memory, a processor and a display screen; each functional module of the device is completed by deploying the system for restoring damaged murals in historical and cultural scenic spots by using AI technology according to any one of claims 5 to 8; the camera is configured to acquire complete mural images and damaged mural images in historical and cultural scenic spots; the memory is configured to store mural image data and computer instructions acquired; the processor is configured to run the computer instructions to implement the method for restoring damaged murals in historical and cultural scenic spots by using AI technology according to any one of claims 1 to 4; and a touch display screen is configured to realize real-time human-computer interaction, and visually display damaged mural images and restored mural images.
Citation Information
Patent Citations
Digital mural image restoration method based on deep convolutional adversarial network
CN113870128A
Precise plastic mold detection method, device and equipment and storage medium
CN119164955A