Method, system and equipment for recovering defective fresco of historical and cultural scenic area by using AI (artificial intelligence)
By constructing a network model of self-attention encoder and decoder, the structural distortion and blurred details in Dunhuang mural restoration are solved, high-quality mural restoration is achieved, and the visual coherence and detailed performance of the image are improved.
Patent Information
- Application Number
- CN202510006289.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-03
AI Technical Summary
The existing technology has bottlenecks such as structural distortion, blurred details and visual inconsistency when restoring Dunhuang murals.
A network model based on self-attention encoder and self-attention decoder is constructed. By collecting defective mural images, a local feature map is obtained using residual-connected convolutional neural networks, the weight is calculated by combining the U-Net image segmentation algorithm and the k-nearest neighbor distance algorithm, the mask area is generated, and iteratively optimized through the self-attention encoder and decoder to finally generate a high-resolution restored image.
It effectively solves the problems of structural distortion and blurred details during mural restoration, improves visual coherence and restoration quality, and improves the detailed expression and realism of the image.
Smart Images

Figure CN119904390A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data restoration technology, and in particular to a method, system and device for restoring damaged murals in historical and cultural scenic spots by using AI. Background Art
[0002] Dunhuang has been immersed in the culture of the heyday of the Han and Tang dynasties, and has many cultural relics such as grottoes and Buddhist caves. The Dunhuang Grottoes Art, including the Dunhuang murals, is a national Buddhist art that draws on the strengths of both China and foreign countries. It is world-renowned for its long history, grand scale, exquisite art, and profound connotations. It is known as the "dawn of human civilization" and "a treasure house of world Buddhist art."
[0003] Dunhuang murals are affected by 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 mass to which the murals are attached, and have suffered various types of diseases. The most typical ones are discoloration and fading of the mural pigments; cracking and peeling of the mural pigment layer; alkali slacking, powdering, hollowing, and shedding of the mural base layer; mildew and pollution of the pigment layer, and smoke caused by incense and cave dwellers in the past. Shedding and damage, also referred to as defects, refers to the peeling of the entire pigment layer of the mural. The internal structure of Dunhuang murals is relatively fragile, and coupled with thousands of years of natural erosion and even human destruction, defects are now common and most of them are serious. Research on the protection of cultural heritage such as Dunhuang murals and colored sculptures has existed for a long time. The physical restoration of damaged murals requires experienced professional painters, and the workload is very huge. In the 70 years since the 1940s, researchers from the Dunhuang Research Institute have restored about 5,000 square meters of murals in more than 280 caves.
[0004] However, when using AI to restore murals, there are bottleneck problems such as structural distortion, blurred details and visual incoherence. Summary of the invention
[0005] The present invention provides a method, system and device for restoring damaged murals in historical and cultural scenic spots using AI, so as to solve the defects such as structural distortion, blurred details and visual incoherence in the restoration in the prior art.
[0006] On the one hand, the present invention provides a method for restoring damaged murals in historical and cultural scenic spots using AI, comprising the following steps:
[0007] S1: Collect images of damaged murals to be restored. Obtain a historical image set based on complete mural images and damaged mural images. Normalize the historical image set and divide it into a training set and a test set according to a preset ratio.
[0008] S2: Build a network model based on self-attention encoder and self-attention decoder. The self-attention encoder is used to obtain global dependencies and calculate weighted feature maps based on distance dependencies.
[0009] S3: Use the training set to iterate the network model. Keep the network model parameters that achieve the preset accuracy on the test set to obtain the optimal restoration model.
[0010] S4: Input the defective mural image into the optimal restoration model and output the restored mural.
[0011] According to the present invention, a method for restoring damaged murals in historical and cultural scenic spots using AI is provided. In step S2, the operation steps of the self-attention encoder include:
[0012] S21: Use a residual connected convolutional neural network to obtain a local feature map of the defective mural image, where the high-level level of the residual connected convolutional neural network is used as the skip feature of the self-attention encoder, and the residual connected convolutional neural network includes a downsampling layer.
[0013] S22: Use the U-Net image segmentation algorithm to generate a mask area corresponding to the local feature map.
[0014] S23: Utilize the k-nearest neighbor distance algorithm, according to the distance relationship between the feature points in the local feature map, use the Gaussian function to calculate the weight of each feature point according to the distance value relationship, and multiply the calculated weight value by the corresponding pixel or feature point in the local feature map.
[0015] S24: Calculate the latent vector of the masked area and pass the quantized latent vector to the self-attention decoder.
[0016] According to the present invention, a method for restoring damaged murals in historical and cultural scenic spots using AI is provided. 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 defective mural image, adjust the spatial resolution of the defective mural image through upsampling technology until it matches the input size of the self-attention decoder layer, and generate a preliminary restored image from the root saw latent vector. The preliminary restored image is used as a coarse feature of the self-attention decoder.
[0018] 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.
[0019] S27: The self-attention encoder gradually restores the high-resolution features of the fused feature map through transposed convolution and finally generates a reconstructed image.
[0020] S28: Apply Fourier transform to the generated reconstructed image to enhance high-frequency features in the reconstructed image and optimize the generation of repeated textures. Then, convert the image back to the spatial domain through inverse Fourier transform to obtain the final restored image.
[0021] According to the present invention, a method for restoring damaged murals in historical and cultural scenic spots using AI is provided. In step S3, the specific training steps 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 gradient descent.
[0025] According to the present invention, a method for restoring damaged murals in historical and cultural scenic spots using AI is provided. In step S33, the network model is iteratively optimized using the gradient descent method. The specific steps 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 a preset threshold or a maximum number of iterations, then output the optimal parameters and obtain the optimal restoration model based on the optimal parameters.
[0028] On the other hand, the present invention also provides a system for restoring damaged murals in historical and cultural scenic spots using AI, comprising:
[0029] The private data acquisition and processing module is used to collect and process images of damaged murals to be restored in historical and cultural scenic spots, as well as historical image sets of complete mural images and damaged mural images, and to normalize the historical image sets.
[0030] The self-attention encoder module is used to obtain the global dependency of feature vectors in the defective mural image and calculate the weighted feature map based on distance dependency, enhance the rough prior local texture information, and restore the lost or blurred rough texture and coherent visual structure.
[0031] A self-attention decoder module is used to generate restored mural images and enhance the perception of a larger restored image range.
[0032] The model training and verification module is used to use the collected complete mural images and defective mural images as the input data of the model, and train the network composed of the self-attention encoder and self-attention decoder through multiple iterations, and finally save the optimal parameter model for restoring the defective mural.
[0033] According to a system for restoring damaged murals in historical and cultural scenic spots using AI provided by the present invention, the self-attention encoder module includes:
[0034] Downsampling Resnet unit: used to obtain the local feature map of the defective mural image.
[0035] DWT module unit: used to implement the encoding of global dependencies and obtain distance-based weighted feature maps, and calculate the potential vector label of the mask area and pass it to the self-attention decoder.
[0036] According to a system for restoring damaged murals in historical and cultural scenic spots using AI provided by the present invention, the self-attention decoder module includes:
[0037] The upsampling Resnet unit is used to increase the spatial resolution of the inpainted mural image to the input size of the self-attention decoder layer.
[0038] The DWT unit is used to integrate the features between the self-attention encoder and the self-attention decoder. It receives the features from the upsampling ResNet module and the self-attention encoder, integrates them to reduce visual bias, and improves the image restoration effect. Through transposed convolution, it gradually restores the high-resolution features of the image and finally generates a reconstructed image.
[0039] Res-FFC unit is used to enhance the reuse of high-frequency features and optimize the ability to generate repeated textures.
[0040] According to a system for restoring damaged murals in historical and cultural scenic spots using AI provided by the present invention, the model training and verification module includes:
[0041] Preprocessing unit: Normalize the non-zero values of the convolutional layer output of the network model and fine-tune the network layer to regularize the gradient norm.
[0042] Optimization unit: Use the gradient descent method to optimize the network model, obtain and save the optimal restoration model.
[0043] On the other hand, the present invention also provides a device for restoring damaged murals in historical and cultural scenic spots using AI, which at least includes a memory, a processor and a display screen. The functional modules of the device are deployed in a manner that uses a system for restoring damaged murals in historical and cultural scenic spots using AI. The high-definition camera of the electronic device is used to collect complete mural images and damaged mural images of 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 computer instructions to implement a method for restoring damaged murals in historical and cultural scenic spots using AI. The touch display screen is used for real-time human-computer interaction to visually display damaged mural images and restored mural images.
[0044] The present invention provides a method, system and device for restoring damaged murals in historical and cultural scenic spots using AI. The present invention solves the bottleneck problems such as structural distortion, blurred details and visual incoherence in the restoration of damaged murals by constructing a network model based on self-attention encoder and self-attention decoder. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 This is one of the flow charts of the method for restoring damaged murals in historical and cultural scenic spots by using AI provided by an embodiment of the present invention;
[0047] Figure 2 This is a system framework diagram for restoring damaged murals in historical and cultural scenic spots using AI provided by an embodiment of the present invention; DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] Example 1: Please refer to Figure 1 The embodiment of the present invention provides a method for restoring damaged murals in historical and cultural scenic spots by using AI, including:
[0050] S1: Collect images of damaged murals to be restored. Obtain a historical image set based on complete mural images and damaged mural images. Normalize the historical image set and divide it into a training set and a test set according to a preset ratio.
[0051] In this embodiment, a high-definition camera can be used to collect the murals. The high-definition camera can capture the subtle texture, color changes and detailed features of the murals, providing a more accurate and detailed record than traditional photography or hand-drawing. This high-precision record helps to preserve the original appearance of the murals and provides a reliable basis for subsequent research, restoration and replication. Using a high-definition camera for collection can avoid physical damage to the murals, especially for those fragile or vulnerable murals. This non-contact collection method is particularly important. Non-contact collection also helps to 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: Build a network model based on self-attention encoder and 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 through off-the-shelf implementation to ensure 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, and the model's understanding and recovery capabilities of image features can be enhanced, thereby improving the quality of restoration. The network model can add 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 ideas 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 consisting of multiple convolutional layers and non-linear activation functions, and y is the output.
[0056] The specific expression formula of the convolutional neural network is:
[0057]
[0058] Among them, y[n] is the convolution result, x1[m] is the input, and ω[n] is the convolution kernel.
[0059] S21: Use a residual connected convolutional neural network to obtain a local feature map of the defective mural image, where the high-level level of the residual connected convolutional neural network is used as the skip feature of the self-attention encoder, and the residual connected convolutional neural network includes a downsampling layer.
[0060] S22: Use the U-Net image segmentation algorithm to generate a mask area corresponding to the local feature map.
[0061] S23: Utilize the k-nearest neighbor distance algorithm, according to the distance relationship between the feature points in the local feature map, use the Gaussian function to calculate the weight of each feature point according to the distance value relationship, and multiply the calculated weight value by the corresponding pixel or feature point in the local feature map.
[0062] In this embodiment, the k-nearest neighbor distance algorithm is expressed as:
[0063]
[0064] Among them, d(X i , X j ) is the sample X i and between X j The distance, X ik For sample X i The value of X on k features, jk For sample X j The value on k features.
[0065] In this embodiment, the distance-dependent weight calculation can improve the accuracy of feature extraction, so that the model can learn the relationship between regions more effectively and improve the restoration ability of the complete image. The image segmentation algorithm is used to automatically identify and mark the defective area to generate a mask. The local feature map is weighted in combination with the distance weight of each pixel to ensure that the surrounding valid pixels contribute the most to the restoration of the defective part. For each pixel in the defective area, the average distance between it and the surrounding valid pixels is calculated using the following formula:
[0066]
[0067] Where ω is the 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 masked area and pass the quantized latent vector to the self-attention decoder.
[0069] In this embodiment, a latent vector is generated in the defective area to ensure that the self-attention encoder can learn the semantic information in the defective area. The generated latent vector is compressed and quantized to meet the input requirements of the self-attention decoder. Quantization processing can be performed using methods such as K-means clustering.
[0070] S25: Receive the quantized latent vector, generate a multi-scale representation of the defective mural image, adjust the spatial resolution of the defective mural image through upsampling technology until it matches the input size of the self-attention decoder layer, and generate a preliminary restored image from the root saw latent vector. The preliminary restored image is used as a coarse feature of the self-attention decoder.
[0071] In this embodiment, multi-scale representation of output features can be achieved through different decoding layers, and high-resolution features of the image can be restored using methods such as deconvolution and bilinear interpolation. Each decoding layer should activate the generated features, such as using the ReLU activation function to increase nonlinearity. The output layer is consistent with the size of the original input image, and local and global context information are matched to form a complete high-resolution image. Multi-scale representation improves the richness of image details and ensures the diversity and realism of 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 by splicing or weighted averaging. Additional convolutional layers may be required to make adjustments so that the number of channels of the fused feature map remains consistent. The integration provides a more comprehensive context, allowing the entire model to utilize richer feature information and promote the improvement of restoration quality.
[0074] S27: The self-attention encoder gradually restores the high-resolution features of the fused feature map through transposed convolution and finally generates 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 repeated textures. Then, convert the image back to the spatial domain through inverse Fourier transform to obtain the final restored image.
[0076] In this embodiment, the image is converted from the spatial domain to the frequency domain for processing by fast Fourier transform, and the high-frequency components of the image are increased to improve the detail performance. After the Fourier transform, the low-frequency and high-frequency features of the image can be processed separately, and then the final image is formed by inverse transform. The high-frequency features in the restoration process are enhanced by the Fourier transform method, making the image more perfect in details, especially when repairing small damage and patterns. The Fourier transform of the image can be expressed as:
[0077]
[0078] Among them, 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) The function is the core part of Fourier transform, which is used to convert signals in space domain or time domain to frequency domain. dxdy is the differential element of double integral, which represents the small area when integrating the two variables x and y.
[0079] S3: Use the training set to iterate the network model. Keep the network model parameters that achieve the preset accuracy on the test set to obtain the optimal restoration model.
[0080] In this embodiment, during the data input stage, data enhancement techniques such as random rotation and cropping can be performed to enhance the generalization ability of the model. The training set, validation set, and test set are divided at a ratio of 80%-10%-10%. During training, overfitting can be avoided by monitoring the validation loss and early stopping strategy, and an optimal model preservation mechanism can be formed. By optimizing the training process, the effectiveness and reliability of the model in practical applications can be ensured, and the efficiency and quality of image restoration can be improved.
[0081] S31: Normalize the non-zero values of the output of the convolutional layer of the network model.
[0082] In this embodiment, BatchNormalization can be used to perform normalization after each convolutional layer, which helps to accelerate training and improve model stability. Use popular libraries to simplify the implementation process. Normalization ensures the stability of the gradient and accelerates the model training speed, so that subsequent model training processes 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, which is a small positive number used to prevent division by zero, x e It is the normalized feature map.
[0085] S32: Regularize 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] Among them, 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 parameters θ.
[0089] S33: Use gradient descent method to iteratively optimize the network model.
[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 a preset threshold or a maximum number of iterations, then output the optimal parameters and obtain the optimal restoration model based on 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 through color correction or sharpening algorithm to improve the visual effect.
[0094] Based on the same general inventive concept, the present invention also protects a system for restoring damaged murals in historical and cultural scenic spots using AI. The system for restoring damaged murals in historical and cultural scenic spots using AI provided by the present invention is described below. The system for restoring damaged murals in historical and cultural scenic spots using AI described below can be referenced to each other in correspondence with the method described above.
[0095] The private data acquisition and processing module is used to collect and process images of damaged murals to be restored in historical and cultural scenic spots, as well as historical image sets of complete mural images and damaged mural images, and to normalize the historical image sets.
[0096] In this embodiment, the image size can be standardized, and grayscale standardization and brightness adjustment can be applied to make different images visually consistent, thereby increasing the training effectiveness of the model. Data enhancement, such as random rotation, scaling, and flipping, can also be performed to enhance the diversity of the data set and reduce overfitting.
[0097] The self-attention encoder module is used to obtain the global dependency of feature vectors in the defective mural image and calculate the weighted feature map based on distance dependency, enhance the rough prior local texture information, and restore the lost or blurred rough texture and coherent visual structure.
[0098] The self-attention encoding module includes:
[0099] Downsampling Resnet unit: used to obtain the local feature map of the defective mural image.
[0100] In this embodiment, batch normalization and activation function can be used to improve the stability and training efficiency of the model.
[0101] DWT module unit: used to implement the encoding of global dependencies and obtain distance-based weighted feature maps, and calculate the potential vector label of the mask area and pass it to the self-attention decoder.
[0102] A self-attention decoder module is used to generate restored mural images and enhance the perception of a larger restored image range.
[0103] The self-attention decoding module includes:
[0104] The upsampling Resnet unit is used to increase the spatial resolution of the inpainted mural image to the input size of the self-attention decoder layer.
[0105] The DWT unit is used to integrate the features between the self-attention encoder and the self-attention decoder. It receives the features from the upsampling ResNet module and the self-attention encoder, integrates them to reduce visual bias, and improves the image restoration effect. Through transposed convolution, it gradually restores the high-resolution features of the image and finally generates a reconstructed image.
[0106] Res-FFC unit is used to enhance the reuse of high-frequency features and optimize the ability to generate repeated textures.
[0107] The model training and verification module is used to use the collected complete mural images and defective mural images as the input data of the model, and train the network composed of the self-attention encoder and self-attention decoder through multiple iterations, and finally save the optimal parameter model for restoring the defective mural.
[0108] In this embodiment, a cross entropy loss function or other loss functions suitable for image reconstruction may be used to perform multiple iterative training to optimize the parameters of the self-attention encoder and decoder.
[0109] In order to realize the above-mentioned method of restoring damaged murals in historical and cultural scenic spots by using AI, the present embodiment also provides a device for restoring damaged murals in historical and cultural scenic spots by using AI, including a high-definition camera, a memory, a processor and a touch display screen. The high-definition camera of the electronic device is used to collect complete mural images and damaged mural images of the 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 computer instructions to realize a method of restoring damaged murals in historical and cultural scenic spots by using AI. The touch display screen is used for real-time human-computer interaction to visually display the damaged mural images and the restored mural images.
[0110] In this embodiment, the device may be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that can execute programs. The device of this embodiment includes at least but is not limited to: a memory and a processor that can communicate with each other through a system bus.
[0111] In this embodiment, the memory (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card, a flash card (FlashCard), etc. equipped on the computer device. Of course, the memory may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is generally used to store an operating system and various application software installed on the computer device. In addition, the memory may also be used to temporarily store various types of data that have been output or are to be output.
[0112] In some embodiments, the processor may 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 a computer device. In this embodiment, the processor is used to run the program code stored in the memory or process data, thereby implementing the steps of the motion control method of the four-wheel differential mobile robot, thereby achieving optimized control of the existing mobile robot and improving the accuracy and stability of the mobile robot's trajectory tracking.
[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some of the technical features therein by equivalent means; 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 invention. The gradient descent method is used to optimize the loss function so that the model can learn how to recover the missing area from the contextual information of the defective mural.
Claims
1. A method for restoring damaged murals in historical and cultural scenic spots using AI, characterized in that: The method comprises: S1: collecting images of defective murals to be restored; obtaining a historical image set based on complete mural images and defective mural images; normalizing the historical image set and dividing the historical image set into a training set and a test set according to a preset ratio; 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 a weighted feature map based on distance dependency; S3: Iterate the training of the network model using the training set; retain the network model parameters that achieve a preset accuracy on the test set to obtain an optimal restoration model; S4: Input the defective mural image into the optimal restoration model, and output the restored mural.
2. According to claim 1, a method for restoring damaged murals in historical and cultural scenic spots using AI is characterized in that: In step S2, the operation steps of the self-attention encoder include: S21: using a residual-connected convolutional neural network to obtain a local feature map of the defective mural image, wherein a high level of the residual-connected convolutional neural network is used as a skip feature of a self-attention encoder, and the residual-connected convolutional neural network includes a downsampling layer; S22: Use the U-Net image segmentation algorithm to generate a mask area 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 by the corresponding pixel or feature point in the local feature map; S24: Calculate the latent vector of the masked area, and pass the quantized latent vector to the self-attention decoder.
3. The method of restoring damaged murals in historical and cultural scenic spots using AI according to claim 1, characterized in that: In step S2, the operation steps of the self-attention decoder include: S25: receiving the quantized latent vector, generating a multi-scale representation of the defective mural image, adjusting the spatial resolution of the defective mural image by upsampling technology until it matches the input size of the self-attention decoder, root sawing the latent vector to generate a preliminary restored image, and the preliminary restored image is used as a coarse feature of the self-attention decoder; S26: combining the jump features of the self-attention encoder with the coarse features provided by the self-attention decoder to form a fused feature map; S27: the self-attention encoder gradually restores the high-resolution features of the fused feature map through transposed convolution, and finally generates a reconstructed image; S28: Applying Fourier transform to the generated reconstructed image to enhance high-frequency features in the reconstructed image and optimize the generation of repeated textures; then, converting the image back to the spatial domain through inverse Fourier transform to obtain a final restored image.
4. The method for restoring damaged murals in historical and cultural scenic spots using AI according to claim 1, characterized in that: In step S3, the specific training steps include: S31: normalize the non-zero values of the output of the convolutional layer of the network model; S32: Regularize the gradient norm of the model network layer; S33: Iteratively optimize the network model using a gradient descent method.
5. The method of restoring damaged murals in historical and cultural scenic spots using AI according to claim 4, characterized in that: In step S33, the network model is iteratively optimized using the gradient descent method. The specific steps include: S331: Initialize the network model parameters and use the structural similarity loss as the loss function of the network model; S332: Perform gradient calculation and update the network model parameters until the loss function reaches a preset threshold or a maximum number of iterations, then output the optimal parameters, and obtain the optimal restoration model based on the optimal parameters.
6. A system for restoring damaged murals in historical and cultural scenic spots using AI, which adopts the damaged mural restoration method as claimed in any one of claims 1 to 5, characterized in that: The system comprises: The private data collection and processing module is used to collect and process the damaged mural images to be restored in the historical and cultural scenic spots, as well as the historical image sets of complete mural images and damaged mural images, and to normalize the historical image sets; The self-attention encoder module is used to obtain the global dependency of feature vectors in the defective mural image and calculate the weighted feature map based on distance dependency, enhance the rough prior local texture information, and restore the lost or blurred rough texture and coherent visual structure; The self-attention decoder module is used to generate the restored mural image and enhance the perception of a larger restored image range; The model training and verification module is used to use the collected complete mural images and defective mural images as the input data of the model, and train the network composed of the self-attention encoder and self-attention decoder through multiple iterations, and finally save the optimal parameter model for restoring the defective mural.
7. The system for restoring damaged murals in historical and cultural scenic spots using AI according to claim 6, characterized in that: The self-attention encoder module includes: Downsampling Resnet unit: used to obtain the local feature map of the defective mural image; DWT module unit: used to implement the encoding of global dependencies and obtain distance-based weighted feature maps, and calculate the potential vector label of the mask area and pass it to the self-attention decoder.
8. The system for restoring damaged murals in historical and cultural scenic spots using AI according to claim 6, characterized in that: The self-attention decoding module comprises: The upsampling Resnet unit is used to increase the spatial resolution of the repaired mural image to the input size of the self-attention decoder layer; A DWT unit is used to integrate features between the self-attention encoder and the self-attention decoder, receive features from the upsampling ResNet module and the self-attention encoder, integrate them to reduce visual deviation and improve image restoration effect, gradually restore high-resolution features of the image through transposed convolution, and finally generate a reconstructed image; Res-FFC unit is used to enhance the reuse of high-frequency features and optimize the ability to generate repeated textures.
9. The system for restoring damaged murals in historical and cultural scenic spots using AI according to claim 6, characterized in that: The model training and verification module includes: Preprocessing unit: normalizes the non-zero values of the convolutional layer output of the network model and fine-tunes the network layer to regularize the gradient norm; Optimization unit: Use the gradient descent method to optimize the network model, obtain and save the optimal restoration model.
10. A device for restoring damaged murals in historical and cultural scenic spots using AI, characterized in that: The device at least includes: a camera, a memory, a processor and a display screen; the functional modules of the device are deployed in the manner of a system for restoring damaged murals in historical and cultural scenic spots using AI as described in claims 6 to 9; the camera is used to collect complete mural images and damaged mural images in historical and cultural scenic spots; the memory is used to store collected mural image data and computer instructions; the processor is used to run computer instructions to implement a method for restoring damaged murals in historical and cultural scenic spots using AI as described in any one of claims 1 to 6; the touch display screen is used for real-time human-computer interaction to 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
Dunhuang mural digital repairing method based on conditional implicit diffusion model
CN118521510A
Precise plastic mold detection method, device and equipment and storage medium
CN119164955A
Method for producing a mural
EP0968845A2
Video Coding With Guided Machine Learning Restoration
US20240098280A1
Cited By
Lightweight mural virtual restoration method based on inactive generative model
CN121391675A