Oracle bone inscription generation method based on structure perception diffusion model

By constructing a structure-aware diffusion model and combining it with a random mask generator and a U-Net information reconstruction network, the problems of unstable training and inconsistent restoration results in oracle bone inscription restoration are solved, and efficient and robust oracle bone image restoration is achieved, especially high-quality reconstruction in complex areas.

CN120747984APending Publication Date: 2025-10-03HENAN NORMAL UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510817880.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Existing deep learning technology in oracle bone restoration has problems such as unstable training process, pattern collapse, lack of semantic consistency in restoration results, and insufficient ability to reconstruct highly degraded images, especially low efficiency when dealing with complex areas.

Method used

An oracle bone script generation method based on the structure-aware diffusion model is adopted. By constructing a random mask generator and a U-Net information reconstruction network, combined with a dynamic loss system and an oracle bone script reconstruction sampling algorithm, the oracle bone script in the rubbings is gradually restored, and the loss weight is adaptively adjusted to improve the training stability and detail recovery ability of the restoration network.

Benefits of technology

It achieves high-quality oracle bone restoration in complex damaged areas, improves repair efficiency and accuracy, avoids training non-convergence and pattern collapse problems, has stronger detail restoration capabilities and robustness, and is suitable for low-resource scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747984A_ABST
    Figure CN120747984A_ABST
Patent Text Reader

Abstract

The invention provides an oracle generation method based on a structure perception diffusion model, and the method comprises the steps: carrying out the preprocessing of an oracle image in an oracle data set, and carrying out the data enhancement, and obtaining a training data set; preprocessing the oracle image in the detection data set to obtain a test data set; constructing a structure perception diffusion model, wherein the structure perception diffusion model comprises a random mask generator and a U-Net information reconstruction network, and the random mask generator marks the input complete oracle image through a Gaussian mask; the degraded image is predicted through the U-Net information reconstruction network; training the structure perception diffusion model by using the training data set and adopting a loss weight of a dynamic loss system automatic coordination mixed loss function to obtain a training information reconstruction model; and inputting the test data set into the training information reconstruction model to obtain a repaired oracle image. According to the method, modeling is perceived through the fusion structure, and a novel technical path which is stable, efficient and high in robustness is provided for oracle bone text image restoration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of oracle bone script restoration, and in particular to an oracle bone script generation method based on a structure-aware diffusion model. Background Art

[0002] Oracle-bone script reconstruction aims to address the issues of information loss and image quality degradation in oracle bone script images caused by weathering, damage, and blurring. Unlike general image reconstruction tasks, oracle bone script restoration (OBIR) requires processing rubbings with unique inscriptions. These rubbings are generated using specialized rice paper rubbing techniques. This meticulously preserves the morphological complexity of the original inscriptions while capturing historical traces of surface relief, such as cracked textures and natural corrosion, to complete the incomplete oracle bone script. This characteristic dictates two key features of oracle bone script reconstruction: first, the restoration target is highly targeted, requiring only the restoration of the character structure and strokes without processing background textures; second, the restoration logic must adapt to the dual information properties of the rubbings. However, existing general image reconstruction techniques based on noise robustness have limitations in this scenario. Furthermore, current deep learning-based research on oracle bone scripts primarily focuses on character classification and recognition, with relatively few studies on methods for oracle bone script reconstruction.

[0003] So far, oracle bone restoration technology can be divided into traditional reconstruction methods and modern technical methods. Traditional reconstruction methods rely on manual restoration and expert knowledge, which is time-consuming and susceptible to subjective influences. Modern methods are mostly based on simple interpolation or local restoration, which makes it difficult to handle complex missing areas and lacks intelligent adaptive restoration capabilities. Thanks to the development of deep learning and large model technology, generative adversarial networks (GANs) and diffusion models have powerful modeling capabilities through large-scale data learning, and can effectively repair missing parts of images. The typical diffusion model is divided into two processes: forward diffusion and reverse diffusion. The high-quality generation capability is achieved through the "noise addition-denoising" framework. Here, the forward diffusion refers to the gradual addition of noise to obtain a degraded image; reverse diffusion refers to the restoration of the image through continuous iterative denoising, and finally the predicted image is obtained. The basic framework is as follows. Figure 1 As shown in (b).

[0004] At present, image restoration models based on deep neural networks, especially GAN, usually adopt an end-to-end learning model, taking the missing area as input and generating a complete image through the network. Figure 1As shown in (a). The whole process is as follows: first, the image to be repaired is input into the encoder, which extracts the features of the image and compresses them into encoder features; then, these features are further processed by the fully connected layer and then passed to the decoder. The decoder is responsible for converting the processed features back into image format. The generated image should be as close to the original image as possible. The generated image is compared with the original image through a loss function. The loss function calculates the difference between the two and adjusts the parameters of the encoder and decoder through the backpropagation algorithm to minimize the loss. After multiple iterative optimizations, the image generated by the decoder gradually approaches the original image and finally outputs the repaired image. However, the above method still has the following significant shortcomings when actually applied to the task of oracle bone inscription restoration: it cannot fully model the structural priors and semantic laws of ancient characters, and the restoration results lack semantic consistency; the reconstruction ability of highly degraded images is limited; it is prone to pattern collapse, blurred repair details, and low efficiency during training.

[0005] The task of reconstructing oracle bone inscriptions is highly targeted, focusing on the text structure and strokes while ignoring background textures. Furthermore, the restoration logic must adapt to the dual information properties inherent in rubbings (e.g., information recording and artistic expression). However, in the current field of oracle bone inscription image restoration, researchers typically employ image restoration methods based on deep neural networks, with the most commonly used being image generation models that combine generative adversarial networks (GANs) and convolutional neural networks (CNNs). These methods demonstrate certain capabilities in general image restoration tasks, but in the task of restoring images of ancient inscriptions such as oracle bone inscriptions, which are extremely historical, structurally complex, and subject to diverse degradation, there are problems such as non-convergence during the training process, pattern collapse, a lack of structural and semantic modeling capabilities, and insufficient degradation processing capabilities. Furthermore, they typically rely on noise immunity, which exhibits limitations in this specific scenario. Summary of the Invention

[0006] In response to the technical problems that the existing commonly used deep learning technology uses generative adversarial networks (GANs) to repair oracle bone inscriptions, the model is prone to collapse during training and is inefficient when processing complex areas. This paper proposes an oracle bone inscription generation method based on the structure-aware diffusion model (SADM), which can automatically complete missing strokes, restore texture details and maintain semantic consistency, thereby improving the accuracy and efficiency of oracle bone inscription digitization research.

[0007] To achieve the above-mentioned purpose, the technical solution of the present invention is implemented as follows: a method for generating oracle bone inscriptions based on a structure-aware diffusion model, the steps of which are as follows:

[0008] Step 1: Preprocess the oracle bone inscription images in the oracle bone inscription dataset and perform data enhancement to obtain a training dataset; preprocess some of the oracle bone inscription images in the oracle bone inscription dataset to obtain a test dataset;

[0009] Step 2: Construct a structure-aware diffusion model: This includes a random mask generator and a U-Net information reconstruction network. The random mask generator annotates the input complete oracle bone script image using a Gaussian mask to obtain a degraded image; the U-Net information reconstruction network predicts the degraded image.

[0010] Step 3: Using the pre-processed oracle bone images in the training dataset, a dynamic loss system is used to automatically coordinate the weights of the hybrid loss function to train the structure-aware diffusion model, and a training information reconstruction model is obtained;

[0011] Step 4: Input the oracle bone script image in the test data set into the training information reconstruction model to obtain the repaired oracle bone script image.

[0012] Preferably, the oracle bone script dataset includes an oracle bone script multimodal dataset, an oracle bone script detection dataset, an oracle bone script rubbing dataset and a handwritten oracle bone script dataset; using the oracle bone script multimodal dataset, a single-character image is generated according to the character coordinate information, so that each glyph is extracted separately and used as an independent training sample. After generating the single-character image, invalid images with large areas of white pixels are screened out, and the training samples are data enhanced to obtain a training dataset; the test dataset is composed of the screened oracle bone script detection dataset, the handwritten oracle bone script dataset and the oracle bone script rubbing single-character dataset, and a single-character image is generated according to the coordinate information.

[0013] Preferably, the random mask generator performs a forward deterministic degradation operation of random masking on the complete oracle bone script image O0 to obtain a degraded image O T and real noise, where T is the total number of degradation steps; at step t-1, the degraded image O t-1 =M⊙O0, M represents the sum of the random binary occlusion masks in the random mask generator at each step up to step t-1, ⊙ represents the element-by-element multiplication, and the degraded image O obtained at step t is t is the degraded image O at step t-1 t-l Based on this, a new random mask Z is applied αi1 Got it.

[0014] Random Mask Z αi1 The generation method is: construct a two-dimensional Gaussian curve with a variance of α i1 , and discretize it into an array; normalize the Gaussian curve so that its peak is 1, and then subtract the peak from 1 to get a mask with the center close to 0 and the edge close to 1 Among them, (x, y) represent the horizontal and vertical coordinates of the pixels in the oracle bone script image, (x c ,y c ) is the coordinate of the degenerate center point, Represents the value of the mask at coordinate (x, y);

[0015] During the degradation process, gradually increase the parameters where α i1 The variance of the Gaussian curve representing step i1 directly controls the area covered by the oracle bone image at each step, generating a mask sequence {Z αi1}, the degradation process is:

[0016]

[0017] The degraded image O obtained in step t t That is, the degraded distribution D(O0,t) changes continuously with the iteration step t, and D(O0,0)=O0.

[0018] Preferably, the U-Net information reconstruction network adopts an encoder-decoder structure, including an encoder, an intermediate block and a decoder. The structures of the encoder and the decoder are symmetrical. The input image is input into the sinusoidal position embedding module, and the sinusoidal position embedding module is connected to the time embedding module. The degradation step number is encoded into a high-dimensional vector, which serves as conditional information to guide the network to identify the degree of degradation of the current image; the time embedding module is connected to the encoder through downsampling, and the encoder extracts higher-level semantic features layer by layer and transmits them to the intermediate block. The intermediate block captures global dependency information through multiple linear attention layers; the intermediate block is connected to the decoder, and the decoder gradually restores the spatial resolution through multiple upsampling modules. Each level of decoding process is accompanied by a jump connection introduced from the corresponding layer of the encoder to fuse the low-level detail features with the high-level semantic features; the decoded features are mapped to an output prediction image of the same size as the input image through a final convolution layer.

[0019] Preferably, the encoder is composed of multiple stages of downsampling, each stage of downsampling includes a first convolution block, a pre-normalized residual block, and a second convolution block connected in sequence, extracting higher-level semantic features layer by layer for use in the subsequent decoder jump connection; the two linear attention layers of the intermediate block are respectively connected to the outputs of the first convolution block and the second convolution block of the last stage of downsampling;

[0020] The first convolution block and the second convolution block in the encoder are residual hole convolutions;

[0021] The decoder consists of multiple upsampling stages, each of which also contains a first convolutional block, a pre-normalized residual block, and a second convolutional block, and fuses semantic features from the corresponding encoder through skip connections;

[0022] The U-Net information reconstruction network sets the initial degradation state O in the inference stage. TAnd iterate step by step from step number T to 0, using the current degraded image O in each step t , predicted image estimation And time step t, calculate the picture image O at the previous moment t-1 Expressed as: Among them, SamplingStep represents the sampling update function; by continuously iterating the above sampling steps, the restored output prediction image is finally obtained at t=0

[0023] Preferably, the network parameter θ of the U-Net information reconstruction network is optimized by minimizing a hybrid loss function, which includes pixel-level L1 loss, structure-aware SSIM loss, and feature-space-based perceptual loss. The feature-space-based perceptual loss is compared with the intermediate layer features extracted by the pre-trained VGG16 network to guide the U-Net information reconstruction network to restore the image with high quality from the perceptual level. At the same time, a dynamic loss weighting mechanism is added to automatically adjust the weights of each loss according to the training process.

[0024] Preferably, the hybrid loss function is:

[0025] L total =λ L1 L L1 +λ SSIM L SSIM +λ perceptual L perceptual ;

[0026] Among them, L L1 is the L1 loss, L SSIM is the SSIM loss, L perceptual is the perceptual loss; L1 ,λ SSIM and λ perceptual They are the loss weights of L1 loss, SSIM loss and perceptual loss;

[0027] Dynamically adjust the loss weight according to the training progress p. The formula is:

[0028]

[0029] Among them, S cur Represents the current number of training steps, S total Represents the total number of training steps, is the initial value of the loss weight of L1 loss, Represents the linear decreasing rate of the loss weight of L1 loss, is the initial value of the loss weight of SSIM loss, is the linear growth rate of the loss weight of SSIM loss, is the initial value of perceptual loss, Indicates the growth rate of perceived loss.

[0030] Preferably, the L1 loss is: Where N represents the total number of pixels in the oracle bone image, I recon (i) and I og (i) represents the value of the i-th pixel of the generated image and the real image respectively;

[0031] The SSIM loss is L SSIM =1-SSIM(I recon ,I og ),in,

[0032] Among them, μ x and μ y are the average brightness of images x and y respectively; σ x and σ y are the standard deviations of images x and y respectively; σ xy is the covariance of images x and y; C1 and C2 are both constants;

[0033] The perceptual loss is

[0034] Among them, Φ l (·) indicates that the feature map of the first layer of the pre-trained VGG network is calculated using the middle layer of VGG16, N l is the total number of pixels in the feature map of layer l, Φ l (I recon ) i and Φ l (I og ) i They respectively represent the value of the i-th feature pixel in the l-th layer feature.

[0035] Preferably, in the oracle image reconstruction in step four, the oracle image reconstruction sampling algorithm uses the degraded image in the current iteration and the corresponding output prediction image predicted by the U-Net information reconstruction network to generate a sample that is closer to the original image by a weighted combination of the two.

[0036] Preferably, the oracle image reconstruction sampling algorithm is implemented as follows: t At the beginning, the step-by-step inverse degradation operation of s=t, t-1, ..., 1 is performed in sequence; at each time step, the current degraded image O is reconstructed by the trained U-Net information network. s Make a prediction and get an estimate of the original image R is the operator of the U-Net information reconstruction network; residual correction is performed based on the degenerate form: the estimate of the current image is converted into Degenerate to the current time step s to get the distribution Then degenerate to the previous step s-1 to obtain the distribution Finally update the image state:

[0037] Among them, β is the control parameter.

[0038] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention aims to generate more accurate and complex oracle bone inscriptions, especially in complex damaged areas, to achieve the repair of incomplete oracle bone characters. Specifically, first, a single oracle bone character image dataset is obtained by retaining the rubbing (image) for processing and a deterministic transformation (such as a Gaussian mask) is applied to pre-process multiple oracle bone character datasets. A progressive Gaussian mask is introduced to control the size of the region to generate a locally random mask to simulate the real damage pattern on the complete rubbing. The structure-aware diffusion model is used to repair oracle bone characters, which can effectively solve the problem of unstable model and easy collapse of the pattern during training. Subsequently, in order to enhance the training of the repair network, the sampling method in the cold diffusion model is improved according to the characteristics of oracle bone characters, and a new sampling method is proposed: the Oracle Bone Image Reconstruction Sampling Algorithm (OBS), which is used to gradually The oracle bone inscriptions in the rubbings were restored. By controlling parameters to adjust the sampling images at different stages, the problem of different emphasis on the restoration quality of incomplete oracle bone inscriptions at different stages of reverse sampling using the diffusion model was solved, enabling the restoration model to obtain higher quality results. Then, a composite loss function consisting of perceptual loss, absolute error loss and SSIM loss was proposed, and combined with the developed adaptive dynamic adjustment mechanism, it was used to perceive the hierarchical structure of the reconstructed image at different stages, and adaptively adjust the weights of each loss function at different training stages to enhance the oracle bone structure and semantic modeling capabilities. Finally, experiments were conducted on multiple preprocessed public datasets to verify the effectiveness of the proposed method.

[0039] The present invention proposes a method for generating oracle bone script based on a structure-aware diffusion model, which mainly includes four steps: data preprocessing, model construction, training optimization, and image reconstruction. The oracle bone script image is enhanced to construct training and test data sets. The structure-aware diffusion model is constructed, including a random mask generator and a U-Net information reconstruction network. The random mask generator annotates the input complete oracle bone script image through a Gaussian mask, randomly generates local degraded areas in the image, and simulates oracle bone script defects. The U-Net information reconstruction network predicts the degraded image. A dynamic loss system is adopted in the training stage to adaptively coordinate the weights of L1, SSIM, and perceptual losses to improve the reconstruction quality and model stability. Oracle bone script reconstruction sampling and image generation, the oracle bone script reconstruction sampling strategy (OBS) is introduced in the inference stage to adaptively adjust the diffusion step size and noise perturbation to improve the detail reconstruction effect. The current image state, network prediction results, and time step information are integrated during the sampling process to effectively improve the ability to recover structural details. Experiments show that by significantly outperforming the baseline method in clarity, structural restoration and generalization ability in indicators such as FID, SSIM and RMSE, it provides a stable, efficient and robust new technical path for oracle bone image restoration, which is suitable for oracle bone digitization and restoration applications.

[0040] Compared with the current use of generative adversarial networks to perform oracle bone inscription restoration, the present invention uses an improved structure-aware diffusion model (SADM) to perform oracle bone inscription restoration with the following advantages: First, the SADM model training process is more stable, avoiding the common training non-convergence and pattern collapse problems of GAN, and is particularly suitable for application scenarios with high degradation and small samples such as oracle bone inscriptions. Secondly, the SADM model achieves image generation through a step-by-step noise restoration process, has stronger detail restoration capabilities and structural fidelity, and can effectively reconstruct stroke details and broken areas. In addition, the SADM model has stronger robustness to a variety of complex degradation phenomena, and can still stably output high-quality images under interference conditions such as blur, occlusion, and fracture. Compared with GAN's reliance on large-scale training data, this model can still maintain excellent restoration effects in low-resource scenarios. Finally, the generation process of the SADM model is highly controllable, which facilitates the introduction of conditional control mechanisms such as structural guidance, perceptual loss, and language information to enhance the semantic consistency and style unity of the restored content.

[0041] The present invention aims to provide a stable, efficient and robust new technical path for oracle bone inscription image restoration by integrating structure-aware modeling, effectively solving the problems of existing methods such as pattern collapse during the training process and reliance on anti-noise. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 This is a comparison diagram between the structure of the present invention and the structure of the generative adversarial network, where (a) is the generative adversarial network and (b) is the common diffusion model framework.

[0044] Figure 2 It is a framework diagram of the present invention.

[0045] Figure 3 This is a structural diagram of the information reconstruction network based on UNet of the present invention.

[0046] Figure 4 The following are the restoration results of the present invention under different masking conditions (the masking size is controlled by keeping the degradation parameters unchanged and changing the image specifications). In the figure, the original refers to the oracle bone script image being tested; the degraded refers to the image after the degradation operation; the standard sampling reconstruction refers to the image restored using the standard sampling algorithm (Algorithm 1); the OBS reconstruction refers to the image restored using the Oracle Bone Script Image Reconstruction Sampling (OBS) algorithm (Algorithm 2). Among them, (a) is the restoration effect image with an image size of 32×32, (b) is the restoration effect image with an image size of 64×64, and (c) is the restoration effect image with an image size of 128×128.

[0047] Figure 5 Comparison of reconstruction results for different datasets. In the figure, "original" refers to the oracle bone inscription image being tested; "degraded" refers to the image after degradation; "standard sampling reconstruction" refers to the image restored using the standard sampling algorithm (Algorithm 1); and "OBS reconstruction" refers to the image restored using the Oracle Bone Image Reconstruction Sampling (OBS) algorithm (Algorithm 2). (a) is the oracle bone inscription detection dataset (abbreviated as Testsingle), (b) is the oracle bone inscription rubbings OBC306 dataset, and (c) is the handwritten oracle bone inscription dataset (HWOBC).

[0048] Figure 6 The following images show the reconstruction results of the same oracle bone inscription under different masking conditions. In the figure, "original" refers to the oracle bone inscription image being tested; "degraded" refers to the image after the degradation operation; and "OBS reconstructed" refers to the image restored using the Oracle Bone Image Reconstruction Sampling (OBS) algorithm (Algorithm 2).

[0049] Figure 7This image shows the restoration results of a real-life incomplete oracle bone script. The leftmost image shows the original, complete handwritten oracle bone script corresponding to the incomplete text. BI refers to the actual incomplete oracle bone script image; P-BI refers to the processed oracle bone script image; DI refers to the degraded oracle bone script image; and RI refers to the restored oracle bone script image using the SADM model. DETAILED DESCRIPTION

[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without creative work are within the scope of protection of the present invention.

[0051] like Figure 2 As shown in the figure, a method for generating oracle bone script based on structure-aware diffusion model is proposed. The original image O0 after the original processing is subjected to a multi-step deterministic degradation operation to obtain the degraded image O T , and then use the U-Net structure to perform multi-step iterative sampling and reconstruction on the degraded image to predict the image The overall framework is as follows Figure 2 As shown. The present invention can achieve high-quality restoration and reconstruction of complex oracle bone inscription images with complete strokes, unified style, and consistent semantics under the condition of deterministic degradation. The dynamic loss system and oracle bone inscription reconstruction sampling method are designed to encourage the network to learn diverse features, thereby achieving performance optimization of the task network. The present invention aims to generate more accurate inscriptions, especially in complex damaged areas, to contribute to the oracle bone inscription restoration task and improve the restoration efficiency. The processing flow chart of the present invention is shown as follows Figure 2 As shown, the specific steps include:

[0052] Step 1: Preprocess the oracle bone script images in the oracle bone script dataset and perform data enhancement to obtain a training dataset; preprocess the oracle bone script images in the detection dataset to obtain a test dataset.

[0053] Four publicly available oracle bone script image datasets were compiled: the Oracle Bone Script Multimodal Dataset (OBSM), the Oracle Bone Script Detection Dataset (Testsingle), the Oracle Bone Script Rubbings OBC306 Dataset, and the Handwritten Oracle Bone Script Dataset (HWOBC). Dataset Construction: The datasets were divided into training and test sets. During the training dataset construction, the Oracle Bone Script Multimodal Dataset was used to generate single-character images based on character coordinate information. This allowed each glyph to be extracted and used as an independent training sample, allowing the model to focus on the character reconstruction task. To ensure the quality and effectiveness of the training data, invalid images with large areas of white pixels were filtered out after generating the single characters. The final training set contained 74,178 images. The test dataset consisted of the processed Oracle Bone Script Detection Dataset (Testsingle), HWOBC, and OBC306 datasets, containing 51,687, 28,706, and 11,643 images, respectively. These images cover oracle bone script characters of varying forms and styles, making them suitable for evaluating the model's generalization capabilities. During the preprocessing process, the test dataset also generated single-word images using coordinate information to ensure that the model could face the reconstruction challenge of single-word images during testing. At the same time, to increase data diversity and improve the robustness of the model, various enhancement operations were performed on the training data, such as rotation, scaling, and contrast adjustment. Through enhancement operations, the model can better adapt to different image transformations and improve its generalization ability. When the experimental image size is 128*128, due to the large amount of computation, 3200, 2000, and 3900 images were randomly selected from the datasets Testsingle, OBC306, and HWOBC, respectively, during testing. To ensure more accurate model test index results, multiple groups of tests were conducted and the average value was taken. The sample types in the training and test datasets are mainly single oracle bone character rubbing images, which contain clear glyphs and texture details.

[0054] Step 2: Construct a structure-aware diffusion model: This includes a random mask generator and a U-Net information reconstruction network. The random mask generator annotates the input complete oracle bone image through a Gaussian mask to obtain a degraded image and real noise; the U-Net information reconstruction network predicts the degraded image to obtain a repaired image.

[0055] In the task of repairing oracle bone images, missing parts are defined for each image, and masks are used to represent these missing areas. Specifically, the missing parts simulate damage or occlusion in the image. In order to perform effective repair, a Gaussian mask is used to mark the missing parts of the image. The mask is a binary matrix of the same size as the input image, where the area with a value of 1 represents the unoccluded part of the image, and the area with a value of 0 represents the missing or removed part. For each oracle bone image, a mask is generated according to the requirements of the actual task (such as random removal, occlusion of specific areas, etc.), and the degree of missing parts is controlled by gradually increasing the size of the occluded area. These masks are used to guide the model to perform repairs, ensuring that the model can reconstruct the missing content based on the unoccluded parts of the image.

[0056] Input the complete oracle bone script image O0 after preprocessing, and perform forward deterministic degradation operations such as random occlusion by the random mask generator to obtain the degraded image O T and real noise, where at step t-1, the degraded image O t-1 =M⊙O0, M represents the sum of the random binary occlusion masks in the random mask generator at each step up to step t-1, ⊙ represents element-by-element multiplication, such as Figure 2 As shown. The degraded image O obtained in step t t is the degraded image O at step t-1 t-1 Based on this, a new random mask Z is applied αi1 The image obtained at each step is the result of further occluding the image at the previous step.

[0057] The forward deterministic degradation process is: given the original oracle bone image O0∈R N , N represents the dimension of the image, that is, the total number of all pixel channel values ​​in the image. t ,t) simulates the situation where local information is missing in the oracle bone script image, which is represented by the process of gradually adding masks. Specifically, for an oracle bone script image of size n×n, first construct a two-dimensional Gaussian curve with a variance of α and discretize it into an n×n array. Then, normalize the Gaussian curve so that its peak is 1, and then subtract the result from 1 to obtain a mask z with a center close to 0 and an edge close to 1. α During the degradation process, gradually increase the parameter Among them, T is the total number of degradation steps, α i1 represents the variance of the Gaussian mask of step i1, which directly controls the area covered by the image at each step and generates a mask sequence {Z αi1 The degradation process formula is as follows:

[0058]

[0059] Among them, (x, y) represent the horizontal and vertical coordinates of the pixels in the oracle bone script image, (x c ,y c ) is the coordinate of the degenerate center point,

[0060] Represents the value of the mask, indicating the weight of whether the position (x, y) is blocked. "⊙" represents element-by-element multiplication. The degraded image O obtained in the tth step t That is, the degraded distribution D(O0,t) changes continuously with iteration step t, and D(O0,0) = O0. In the standard diffusion framework, the distribution D is degraded by adding Gaussian noise proportional to the iteration step t. In experiments, due to the sparse structure of oracle bone inscriptions, randomization is introduced during mask generation to mask information in different areas. The degree of degradation depends on the iteration step t, thereby improving the model's robust reconstruction capabilities for locally missing information.

[0061] Using U-Net information reconstruction network to reconstruct the degraded image O t-1 Make a preliminary prediction and generate the repaired image O of the current iteration step t and prediction noise The specific structure of the entire information reconstruction network is as follows Figure 3As shown in the figure, the overall structure adopts an information reconstruction network design based on the U-Net architecture, combining convolutional blocks (ConvNeXt blocks) with a linear attention mechanism, aiming to effectively model local and global image features and improve reconstruction quality. The U-Net information reconstruction network first receives the input image and, through a sinusoidal position embedding (Sinusoidal PosEmb) module, encodes temporal information into a vector to guide the subsequent generation process. Before entering the backbone network, the input image undergoes a preliminary downsampling to meet the requirements of multi-scale processing. The image then enters the encoder (left side), which consists of multiple downsampling stages. Each stage includes two convolutional blocks (ConvNeXt blocks) and a pre-normalized residual block (PreNorm). These blocks extract higher-level semantic features layer by layer while compressing the spatial resolution. These features are then used in subsequent skip connections (i.e., in the subsequent upsampling stage) to preserve detailed information. The lowest-level features output by the encoder then enter the middle blocks, which employ two linear attention mechanisms (Linear A-Attention) to efficiently model global dependencies in the spatial dimension, enhance feature representation, and help the model better understand the overall structure of the image. Next comes the decoder (right side), whose structure is symmetrical to the encoder and primarily consists of multiple upsampling stages. Each stage also contains a convolutional block (ConvNeXt Block) and a pre-normalized residual block (Residual (PreNorm)). Skip connections are used to fuse features from the corresponding encoder, gradually recovering detailed information. Finally, after multiple upsampling steps, the output is an image with the same size as the input, which is the reconstructed image generated by the model. Overall, the network extracts features through downsampling, enhances modeling capabilities through the attention mechanism, and then recovers the image through upsampling. Residual and skip connections are used to preserve details, enabling it to perform well in the oracle bone script image completion task.

[0062] The main function of the downsampling connected to the second convolutional block in the encoder is to further reduce the spatial resolution of image features while increasing the receptive field, allowing the network to focus more on global semantic features rather than local texture, enhancing semantic abstraction and enabling subsequent convolutional blocks to extract higher-level structural information. The upsampling associated with the initial downsampling and this downsampling serves to restore spatial resolution, reconstruct local structure and detail information, incorporate features from skip connections, and fuse high-level semantic features with low-level texture to ensure image clarity and structural consistency. The decoder does not perform full upsampling in a single step, but instead gradually restores image information layer by layer. Each upsampling level repairs and restores details at a specific semantic level. Each level also fuses features from the encoder layer of the same resolution (skip connections) to ensure that lower-level details are not lost. This multi-level progressive restoration mechanism is key to achieving shape alignment, edge sharpness, and stroke restoration in image completion tasks, particularly text reconstruction. In summary, the initial downsampling is used to unify the scale, the encoder downsampling is used to extract multiple layers of semantic features, and the decoder upsampling is responsible for gradually restoring spatial resolution and fusing encoder information through skip connections. Ultimately, the decoder outputs a high-quality image reconstruction while maintaining structural integrity and rich details.

[0063] In the reconstruction of oracle bone images, it is first necessary to select the degradation operator D (partial random masking degradation effect, simulating the damage of oracle bone images) and the training information reconstruction model R (U-Net information reconstruction network integrating dynamic loss strategy), and then combine the two to use the diffusion method to reconstruct the severely degraded oracle bone images. For oracle bone images with a relatively light degree of degradation ("t≈0"), the training information reconstruction model R can be directly applied for reconstruction; but when the degree of degradation is large, the traditional method is prone to image blur. In contrast, the standard sampling method (i.e., Algorithm 1) adopts an iterative denoising strategy to gradually reduce the noise to improve the stability of reconstruction. However, this method is less effective when processing smooth or differentiable degraded images. In order to improve the reconstruction quality of oracle bone images, an oracle image reconstruction sampling (OBS) algorithm (i.e., Algorithm 2) is introduced. In the oracle bone image restoration task, the sampling process of the OBS algorithm achieves high-quality reconstruction of the damaged image by iteratively restoring the degradation process. This process starts from the degraded image O t At the beginning, the step-by-step inverse degradation operation of s=t, t-1, ..., 1 is performed in sequence. At each step, the current degraded image O is first reconstructed by the trained U-Net information reconstruction network R. s Make a prediction and get an estimate of the original image Then, instead of directly using the estimated image to replace the original image, the residual correction is performed based on its degraded form. Specifically, the current estimated image is Degenerate to the current time step s to get the distribution Then degenerate to the previous step s-1 to obtain the distribution Finally, update the image state using the following formula:

[0064]

[0065] This update method is essentially a further "degradation restoration correction" of the current degraded image O s That is, subtract the degradation form of the current predicted image at step s, and then add its degradation form at step s - 1. This "one step back and one step forward" method can more stably restore the degradation chain. Even if the information reconstruction model R itself is not completely accurate, it can maintain the consistency of each step of the image with the true degradation trajectory. However, since the recovery quality of the diffusion model varies at different stages of reverse sampling, a parameter β needs to be added to adjust the sampled image. When the parameter β = 0, the sampling method is the same as Algorithm 1. When β = 0.5, the sampling method is the same as the cold diffusion model. By controlling the value of the parameter β, the recovery model can obtain higher-quality results.

[0066] The OBS algorithm utilizes the degraded image O in the current iteration s and the corresponding clear image estimate predicted by the U-Net information reconstruction network to generate samples closer to the original image through a weighted combination of the two. It can be seen that regardless of whether the information reconstruction model R is a perfect inverse operator, for all s < t, both Algorithm 1 and Algorithm 2 can perfectly reconstruct the degraded image O of each iteration s = D(O0, s). For small values of O and s, Algorithm 2 is extremely tolerant of errors in the information reconstruction model R. If the trained information reconstruction model R cannot perfectly invert the degradation operation D, the pre-computed Algorithm 1 will produce errors, while Algorithm 2 will not be affected by the errors in the trained information reconstruction model R.

[0067] In the oracle bone script image reconstruction task, the reconstruction operator for information reconstruction is denoted as R and can invert the degradation operation D. The formula for the image degraded at time step t is as follows:

[0068] R(O t , t) ≈ O0(3)

[0069] In the information reconstruction network of the information reconstruction task, the U-Net structure is adopted, denoted as R θ , where the parameter θ is optimized through training. The input is the degraded image O t and the information t of the degradation step, and the output is the reconstructed image

[0070] In the information reconstruction task, the U-Net information reconstruction network constitutes the image reconstruction network R θ, where θ represents all trainable parameters. The image reconstruction network is used to degrade the image O t and the corresponding degradation step number t are input, aiming to predict the original image The U-Net network adopts an encoder-decoder structure as a whole, and reconstructs the image content through multi-level convolutional feature extraction and step-by-step restoration.

[0071] Specifically, the input degraded image O t First, it passes through several ConvNext modules and normalized residual connections to extract spatial features at different levels. The features of each stage are gradually reduced in resolution through downsampling operations, the receptive field is increased, and semantic information at a more abstract level is extracted. At the same time, the degradation step t is encoded into a high-dimensional vector through the sinusoidal position embedding module and the time embedding module, and injected into each convolution module as conditional information to guide the network to identify the degree of degradation of the current image, thereby realizing conditional modeling. The deep semantic features extracted in the encoding stage are passed to the intermediate block, which includes multiple linear attention layers, which can capture global dependency information and improve the network's structural reconstruction ability in missing areas. Then, in the decoder stage, the feature map is gradually restored to spatial resolution through multiple upsampling modules. Each level of decoding process is accompanied by a jump connection introduced from the corresponding layer of the encoder, which fuses the low-level detail features with the high-level semantic features, enhancing the restoration effect of local information such as edges and textures. Finally, the decoded features are mapped to an output prediction image of the same size as the input image through a final convolution layer. During training, the network parameters θ are optimized by minimizing the reconstruction loss function. This loss function includes the pixel-level L1 loss, the structure-aware SSIM loss, and the perceptual loss based on the feature space. The perceptual loss compares the features extracted from the intermediate layers of the pre-trained VGG16 network to guide the network to achieve high-quality image restoration at the perceptual level. A dynamic loss weighting mechanism is also incorporated to automatically adjust the weights of each loss based on the training progress, further improving model stability and final reconstruction quality.

[0072] Normalized residual connections improve the stability and feature expression capabilities of network training by introducing a normalization operation before each convolution or attention module. Specifically, the input features are first normalized, then sent to the convolution module or linear attention module to extract deep features, and finally added element-by-element to the original input to form a residual connection. This "normalization first, transformation later, and residual addition" structure is different from the traditional residual connection method of normalization after nonlinear processing. It is more suitable for deep networks or information reconstruction tasks with conditional modeling. It can effectively alleviate the problem of gradient disappearance or explosion, and enhance the network's ability to model local and global image structures. It performs particularly well in high-precision reconstruction tasks such as oracle bone inscription image completion.

[0073] It is worth noting that the network is part of the diffusion information reconstruction process, and its prediction output It does not generate the final result in one go, but serves the entire gradual degeneration process. In the inference phase, by setting the initial degraded state O T And iterate step by step from step number T to 0, using the current degraded image O in each step t , predicted original image estimation And time step t, calculate the picture image O at the previous moment t-1 The process can be formalized as follows:

[0074]

[0075] Among them, SamplingStep refers to the sampling update function, which means using the current degraded image O t and the predicted original image Based on the known occluded area, the predicted result is used to complete the occluded area, and the non-occluded area remains unchanged, thereby generating the image O at the previous moment t-1 .

[0076] By continuously iterating the above sampling steps, the restored complete image is finally obtained at t=0 Therefore, U-Net is not only used for image reconstruction at a specific step size, but also plays a key role in the entire anti-degradation chain, gradually advancing the restoration process from degraded images to complete images.

[0077] The OBS algorithm directly applies to the degraded image and uses the U-Net network to predict its inverse degradation state. The OBS algorithm controls the entire process from degraded image to final reconstructed image, not just a post-processing step.

[0078] The main responsibility of U-Net as a reconstruction network is to receive the image O in the current degraded state t ; Based on the current time step t and possible additional conditions (such as mask, structural information), output the estimated "previous step" image O t-1 Or clean image O0; U-Net does not directly modify the input image, but predicts how to reverse from the current degraded state to a state closer to the real image. The "modification" of the image is not completed within the network, but the sampling function "updates" the current image at each time step based on the network's prediction results.

[0079] The U-Net information reconstruction network introduces a residual dilated convolution module in the encoder to alleviate the vanishing gradient problem, ensure the effective transmission of deep-level features, enhance feature expression, and expand the receptive field. The entire information reconstruction network also incorporates temporal embedding coding to adapt to reconstruction requirements with varying degrees of degradation.

[0080] Step 3: Input the preprocessed oracle bone image in the training data set into the structure-aware diffusion model to obtain the repaired image. Use a dynamic loss system to automatically coordinate the weights of the mixed loss function to train the structure-aware diffusion model and obtain a training information reconstruction model.

[0081] The dynamic loss system in the model includes a mixed loss function of absolute error loss (L1 Loss), structural similarity loss (SSIMLoss) and perceptual loss (Perceptual Loss), and a dynamic loss adjustment strategy is added. As the training process progresses, the weights of each loss component change dynamically at different stages, so it is called structural perception.

[0082] Using the total loss function L total The structure-aware diffusion model is trained. Considering that different losses play different roles in different training stages, a dynamic loss system is proposed to automatically coordinate the weights before the mixed loss function and adopt error compensation update.

[0083] In the task of reconstructing information from oracle bone inscriptions, using only pixel-level metrics cannot effectively capture the fine strokes, complex texture structures, and overall morphology of oracle bone inscriptions. Therefore, the total loss function combines the absolute error loss (L1), the structural similarity loss (SSIM), and the perceptual loss to optimize pixel accuracy, local structure, and high-level semantic features.

[0084] L1 loss is used to calculate the pixel-level absolute error between the generated image and the real image. Compared with L2 loss, L1 loss is more robust to outliers and can reduce the blurriness of the generated image, improve the clarity of oracle bone script strokes, and avoid over-smoothing caused by averaging. The overall expression of L1 loss is:

[0085]

[0086] Where N represents the total number of pixels in the oracle bone image, I recon (i) and I og (i) represents the value of the i-th pixel in the generated image and the real image, respectively. i represents the position index of the i-th pixel in the image. It is an index among all pixels (including the channel dimension) and represents the unit of calculation of the difference between the pixel values ​​of the generated image and the real image at that position.

[0087] The SSIM loss function is introduced to evaluate the visual similarity of images, which comprehensively considers information such as image brightness, contrast, and structure, and can enhance the spatial consistency of oracle bone script strokes and reduce dislocation or morphological distortion, as shown in formula (5). x and μ y are the average brightness of images x and y respectively; σ x and σ y are the standard deviations of images x and y respectively; σ xy is the covariance of image x and y; C1 and C2 are constants used to stabilize the calculation and avoid the denominator being zero. Minimizing the SSIM loss function can enhance the model's learning of image structural information, making the generated oracle bone script closer to the original image in detail and improving overall recognizability, as shown in formula (6).

[0088]

[0089] L SSIM =1-SSIM(I recon ,I og ) (6)

[0090] Perceptual loss is different from L1 loss and SSIM loss. It uses the pre-trained VGG16 network to extract high-level features and calculates the difference between the generated image and the real image in the feature space. It combines global structure, texture and semantic information to make the generated image closer to the real image in visual perception, avoid stroke distortion, and ensure that the overall character shape conforms to the ancient writing standard. Its overall expression is shown in formula (7), where Φ l (·) indicates that the feature map of the first layer of the pre-trained VGG network is calculated using the middle layer of VGG16. l is the total number of pixels in the feature map of the first layer, that is, N l =H l ×W l ×C l , H l and W l are the height and width of the feature map of the first layer, C l is the number of channels of the convolutional layer. l (I recon ) i and Φ l (I og ) i They represent the value of the i-th feature pixel in the l-th layer (feature activation). The i in the perceptual loss represents the index unit after all positions and channels in the feature map are expanded, which is used to compare the difference between the predicted image and the real image in the high-level feature space item by item.

[0091]

[0092] The perceptual loss is based on the pre-trained VGG16 network. Through the similarity measurement in the high-dimensional feature space, it guides the generated image to be closer to the real image in visual perception. Its network structure is not embedded in the U-Net, but serves as a loss evaluation module to evaluate the quality of the generated image during the training phase and improve the image structure integrity and semantic consistency. Overall, the overall formula of the dynamic loss adjustment strategy is shown in formula (8). By setting the weight λ L1 ,λ SSIM ,λ perceptual Dynamic hyperparameters are used to control the weights of different loss terms to ensure that the model is reasonably optimized at different levels.

[0093] L total =λ L1 L L1 +λ SSIM L SSIM +λ perceptual L perceptual (8)

[0094] In the early stages of training, the images generated by the model are relatively blurry, and the model mainly learns the pixel distribution D(O0,t). The L1 loss needs to be enhanced to ensure convergence at the pixel level. In the later stages of training, the model is able to reconstruct the basic structure well, and the weight of the L1 loss should be reduced, and the SSIM loss and perceptual loss should be strengthened to improve the structural similarity and high-level semantic consistency of the image. To achieve this process, the training progress p is first normalized to the range [0,1]. The smaller the value of the training progress p, the earlier the training, and the closer it is to 1, the closer the training is to completion. cur Represents the current number of training steps, S total Represents the total number of training steps. On this basis, the loss weight is dynamically adjusted according to the training progress p to adapt to the optimization requirements of different stages. The specific formula is as follows:

[0095]

[0096]

[0097] Among them, the weight of L1 loss adopts a linear decreasing method, and its initial value is Set to 1, as the training progress p increases In order to gradually reduce the deceleration rate, the L1 loss is set to a minimum of 0.7, thereby emphasizing pixel-level accuracy in the early stages of training to avoid model instability caused by excessive gradients. The linear deceleration rate of L1 loss determines the extent of L1 weight reduction in each training stage. In the later stage of training, more attention is paid to structural and perceptual information, while the weight of SSIM loss is the opposite. It adopts a linear increasing strategy from the initial value Departure, according to the growth rate Gradually increase As training progresses, the ability to retain structural information is enhanced. To improve the spatial consistency and structural restoration of the generated oracle bone inscriptions, the maximum weight is set to 0.7, making the generated oracle bone inscriptions more realistic. It is expressed as the linear increasing rate of SSIM weight, which is continuously increased in the later stage of training to emphasize structural consistency. The perceptual loss also adopts an increasing strategy. In order to reduce the impact of the perceptual loss in the early stage of training, its initial value is Set to a small value of 0.02 to avoid the initial high-level features misleading the model generation, and gradually increase its weight as training progresses, the growth rate is Control increase The model is guided to pay more attention to high-level semantic information in the later stage, thereby improving the visual quality of the global glyph. Indicates the growth rate of perceptual loss, gradually strengthening the attention on semantic consistency.

[0098] Step 4: Input the oracle bone script image in the test data set into the training information reconstruction model to obtain the repaired oracle bone script image.

[0099] In the testing phase, the training information reconstruction model will degrade the oracle bone image O t Together with the degradation step number t, it is input into the trained reconstruction network R θ In the process, the encoder is used to extract features, time embedding is used to guide degradation modeling, and the attention module is used to enhance semantic information. Finally, the decoder is used to fuse local details and global structures to gradually restore the predicted image. This image is the reconstruction result of the model for the test image, and its restoration effect is subsequently evaluated through test indicators (such as SSIM, FID, etc.).

[0100] The information reconstruction model R is trained through multi-step iterative sampling and reconstruction operations, and the complete repaired oracle bone image is output. Finally, the present invention uses FID, SSIM, and RMSE indicators for evaluation to ensure that the reconstructed image Be as close as possible in content and structure to the original input O0.

[0101] The information reconstruction network R is trained through a multi-step iterative sampling mechanism θ , to degrade the image O t And its corresponding time step t is input, and the original image is gradually restored This process combines degradation modeling with time-aware reconstruction strategies. By encoding the degree of degradation and injecting it into each layer of the network, it guides the model to perform conditional targeted restoration. During the training phase, the model learns recovery capabilities from images with varying degrees of degradation, improving its adaptability and robustness to complex degradation types such as blur and missing images. The model structure adopts the U-Net architecture, introduces attention mechanisms and jump connections, and maintains overall structural consistency while restoring local details. Finally, during the testing phase, the oracle bone image is input into the trained model, and local random degradation is performed according to the trained parameters of the model. The complete image is then reconstructed through step-by-step sampling. To measure the quality of restoration, three indicators, SSIM, RMSE and FID, are used to compare the reconstructed images from the perspectives of structural similarity, pixel error and perceptual distribution. The difference from the original image O0 ensures that the completion result is as close as possible to the real image in terms of visual effect and semantic structure, thereby improving the accuracy and practicality of oracle bone restoration.

[0102] In order to further demonstrate the restoration performance of the present invention on oracle bone inscriptions, the reconstructed images of different samples are visualized. First, the reconstruction effects of different models under different mask areas are shown (e.g. Figure 4 Then, the test result images of different data sets are given, as shown in Figure 5 Finally, the reconstruction results of the same oracle bone script under different covering conditions are shown, as shown in Figure 6 The actual restoration effect of the incomplete oracle bone characters is shown in the figure below. Figure 7 shown.

[0103] from Figure 4 As can be seen, as the mask area decreases, the model's inpainting accuracy improves significantly. When the mask area is larger, although the inpainting effect is weaker, the model still has reconstruction capabilities and exhibits a certain level of inpainting accuracy. This is consistent with the conclusions drawn from the aforementioned quantitative analysis.

[0104] from Figure 5 As can be seen, the model is able to restore handwriting on different datasets. The higher accuracy on the rubbings dataset is likely due to the fact that it was trained only on rubbings. This significantly means that even without handwritten training data, the model can still effectively restore HWOBC handwriting.

[0105] from Figure 6 As can be seen, the proposed algorithm successfully reconstructs oracle bone inscriptions regardless of the size of the masked region. Specifically, when the test image size is 64×64 pixels (equivalent to a medium mask), the reconstructed oracle bone inscriptions appear smoother. This indicates that the algorithm achieves optimal restoration results for approximately half of the damaged oracle bone inscriptions.

[0106] from Figure 7It can be seen that the model has good repair capabilities for real oracle bone inscription images with different degrees of damage. Figure 7 The first five examples are successful restoration cases with a degree of damage between 45% and 60%, the sixth to eighth are successful restoration cases with a degree of damage within 20%, and the last three are restoration cases through denoising, which also shows that this method has good denoising and restoration capabilities.

[0107] The present invention is the first to consider using a structure-aware diffusion model to perform oracle bone inscription restoration, in order to achieve a more accurate restoration effect on complex oracle bone inscriptions. The present invention re-modifies the network architecture of the cold diffusion model to make it more suitable for the characteristics of oracle bone inscriptions and perform more effective restoration. First, the sampling method is improved, and an oracle bone image reconstruction sampling algorithm (OBS) is proposed. Since the restoration quality of the diffusion model varies at different stages of inversion sampling, a parameter β is added to adjust the sampled image so that the restoration model can obtain higher quality results. Then, since the use of a simple pixel-level metric (i.e., absolute error loss) in the oracle bone image reconstruction information task cannot effectively capture the fine strokes, complex texture structures, and overall morphology in the oracle bone image, a dynamic loss system is proposed, which combines the absolute error loss (L1), structural similarity loss (SSIM), and perceptual loss, and adds an adaptive dynamic adjustment mechanism to design a new loss function, which is collectively called a dynamic loss strategy, to optimize pixel accuracy and improve the accuracy of the restoration effect. Due to the particularity of oracle bone inscriptions and the shortcomings of existing methods, the most important thing about this invention is that it is the first time to use a structure-aware diffusion model to repair oracle bone inscriptions. At the same time, it proposes an OBS sampling algorithm and an adaptive dynamic loss system that combines absolute error loss, structural similarity line loss and perceptual loss, which effectively realizes the repair of complex oracle bone inscriptions and provides a new method for oracle bone inscription repair.

[0108] Although there are traditional restoration frameworks such as GAN and CNN, they are difficult to deal with the coexistence of high degradation and structural damage. The variant diffusion method can also be used for this task, but before this, there was no deterministic degradation modeling and structural perception mechanism for oracle bone inscription restoration. Focusing on the morphological structure of oracle bone inscriptions to simulate the incompleteness of oracle bone inscriptions and reconstruct the incomplete inscriptions, the proposed OBSD sampling method and the proposed loss function adopt a dynamic loss system, combining absolute error loss, structural similarity loss and perceptual loss, and adjusting the weights according to the training process, focusing on the characteristics of different stages. This is a method that has never appeared before. In addition, the present invention has been greatly improved compared to the baseline method before improvement, and the oracle bone inscription reconstruction has also shown good results.

[0109] Table 1 Comparison of experimental data between baseline model and improved SADM model

[0110]

[0111] To evaluate the restoration performance of the model, the FID, SSIM, and RMSE metrics were tested on three public datasets. Lower FID scores indicate smaller distribution differences between the generated and real images, indicating better restoration performance. SSIM values ​​closer to 1 indicate a higher structural and texture similarity between the generated and real images. Lower RMSE values ​​indicate smaller pixel-level differences between the generated and real images. Cold Diffusion was used as the baseline model, which is based solely on the L1 loss function. In contrast, the proposed SADM model incorporates a dynamic loss system. To ensure a fair comparison of performance metrics, the three evaluation metrics were calculated for degraded images. The reconstruction results obtained using standard sampling and our proposed SADM sampling method were then evaluated. The experimental results are summarized in Table 1. As shown in Table 1, the baseline and SADM models achieve comparable FID, SSIM, and RMSE values ​​for degraded images, indicating that the reconstructions are based on similar levels of image degradation. As shown in Table 1, standard reconstruction significantly improves performance compared to degraded images, with OBS reconstruction achieving particularly significant results. For example, for a 32×32 image, the FID score using standard sampling is 43.095, while after applying the OBS sampling method, the FID score drops to 14.086. Furthermore, for the same 32×32 image, the FID score of cold diffusion reconstruction using the OBS algorithm is 14.086, while the FID score of the SADM model is 8.517. This demonstrates that the proposed SADM model exhibits superior local reconstruction capabilities on all three test datasets compared to the baseline model, especially in scenarios involving smaller mask-simulated defect areas. Specifically, when the image size is 64×64, the FID scores of Testsingle and OBC306 are reduced by 36.06% and 41.27%, respectively. These results further highlight the excellent reconstruction accuracy achieved by the SADM model.

[0112] This invention proposes for the first time to use the diffusion model deterministic degradation masking reconstruction, the oracle bone image reconstruction sampling algorithm (OBS) and the dynamic loss system to perform oracle bone inscription restoration. This represents the feasibility of a new method for oracle bone inscription restoration, and compared with previous experimental methods, this method has achieved more accurate results in complex inscription restoration.

[0113] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for generating oracle bone inscriptions based on a structure-aware diffusion model, characterized in that: The steps are as follows: Step 1: Preprocess the oracle bone inscription images in the oracle bone inscription dataset and perform data enhancement to obtain a training dataset; preprocess some of the oracle bone inscription images in the oracle bone inscription dataset to obtain a test dataset; Step 2: Construct a structure-aware diffusion model: This includes a random mask generator and a U-Net information reconstruction network. The random mask generator annotates the input complete oracle bone script image using a Gaussian mask to obtain a degraded image; the U-Net information reconstruction network predicts the degraded image. Step 3: Using the pre-processed oracle bone images in the training dataset, a dynamic loss system is used to automatically coordinate the weights of the hybrid loss function to train the structure-aware diffusion model, and a training information reconstruction model is obtained; Step 4: Input the oracle bone script image in the test data set into the training information reconstruction model to obtain the repaired oracle bone script image.

2. The oracle bone script generation method based on the structure-aware diffusion model according to claim 1 is characterized in that: The oracle bone script dataset includes an oracle bone script multimodal dataset, an oracle bone script detection dataset, an oracle bone script rubbing dataset, and a handwritten oracle bone script dataset. The oracle bone script multimodal dataset is used to generate single-character images based on character coordinate information, so that each glyph is extracted separately and used as an independent training sample. After generating the single-character image, invalid images with large areas of white pixels are screened out, and data enhancement is performed on the training samples to obtain a training dataset. The test dataset is composed of the screened oracle bone script detection dataset, the handwritten oracle bone script dataset, and the oracle bone script rubbing single-character dataset, and the single-character image is generated based on the coordinate information.

3. The oracle bone script generation method based on the structure-aware diffusion model according to claim 1 is characterized in that: The random mask generator performs a forward deterministic degradation operation of random occlusion on the complete oracle bone script image O0 to obtain the degraded image O T and real noise, where T is the total number of degradation steps; at step t-1, the degraded image O t-1 =M⊙O0, M represents the sum of the random binary occlusion masks in the random mask generator at each step up to step t-1, ⊙ represents the element-by-element multiplication, and the degraded image O obtained at step t is t is the degraded image O at step t-1 t-1 Based on this, a new random mask Z is applied αi1 Got it. Random Mask Z αi1 The generation method is: construct a two-dimensional Gaussian curve with a variance of α i1 , and discretize it into an array; normalize the Gaussian curve so that its peak is 1, and then subtract the peak from 1 to get a mask with the center close to 0 and the edge close to 1 Among them, (x, y) represent the horizontal and vertical coordinates of the pixels in the oracle bone script image, (x c ,y c ) is the coordinate of the degenerate center point, Represents the value of the mask at coordinate (x, y); During the degradation process, gradually increase the parameters where α i1 The variance of the Gaussian curve representing step i1 directly controls the area covered by the oracle bone image at each step, generating a mask sequence {Z αi1 }, the degradation process is: The degraded image O obtained in step t t That is, the degraded distribution D(O0,t) changes continuously with the iteration step t, and D(O0,0)=O0.

4. The oracle bone script generation method based on the structure-aware diffusion model according to any one of claims 1 to 3, characterized in that: The U-Net information reconstruction network adopts an encoder-decoder structure, including an encoder, an intermediate block, and a decoder. The encoder and decoder have symmetrical structures. The input image is fed into a sinusoidal position embedding module, which is connected to a temporal embedding module. The number of degradation steps is encoded into a high-dimensional vector, which serves as conditional information to guide the network to identify the degree of degradation of the current image. The temporal embedding module is connected to the encoder through downsampling. The encoder extracts higher-level semantic features layer by layer and transmits them to the intermediate block. The intermediate block captures global dependency information through multiple linear attention layers. The intermediate block is connected to the decoder, which gradually restores the spatial resolution through multiple upsampling modules. Each level of decoding is accompanied by a skip connection introduced from the corresponding layer of the encoder to fuse the detailed features of the lower layer with the semantic features of the higher layer. After decoding The features of are mapped to an output prediction image of the same size as the input image through a final convolutional layer.

5. The oracle bone script generation method based on the structure-aware diffusion model according to claim 4 is characterized in that: The encoder consists of multiple stages of downsampling. Each stage of downsampling includes a first convolutional block, a pre-normalized residual block, and a second convolutional block connected in sequence. Higher-level semantic features are extracted layer by layer and used for skip connections in the subsequent decoder. The two linear attention layers in the middle block are connected to the outputs of the first and second convolutional blocks of the last stage of downsampling, respectively. The first convolution block and the second convolution block in the encoder are residual hole convolutions; The decoder consists of multiple upsampling stages, each of which also contains a first convolutional block, a pre-normalized residual block, and a second convolutional block, and fuses semantic features from the corresponding encoder through skip connections; The U-Net information reconstruction network sets the initial degradation state O in the inference stage. T And iterate step by step from step number T to 0, using the current degraded image O in each step t , predicted image estimation And time step t, calculate the picture image O at the previous moment t-1 Expressed as: Among them, SamplingStep represents the sampling update function; by continuously iterating the above sampling steps, the restored output prediction image is finally obtained at t=0 6. The oracle bone script generation method based on the structure-aware diffusion model according to claim 5 is characterized in that: The network parameters θ of the U-Net information reconstruction network are optimized by minimizing a hybrid loss function, which includes pixel-level L1 loss, structure-aware SSIM loss, and feature-space-based perceptual loss. The feature-space-based perceptual loss is compared with the intermediate layer features extracted by the pre-trained VGG16 network to guide the U-Net information reconstruction network to perform high-quality image restoration from the perceptual level. At the same time, a dynamic loss weighting mechanism is added to automatically adjust the weights of each loss according to the training process.

7. The oracle bone script generation method based on the structure-aware diffusion model according to claim 6 is characterized in that: The hybrid loss function is: L total =λ L1 L L1 +λ SSIM L SSIM +λ perceptual L perceptual ; Among them, L L1 is the L1 loss, L SSIM is the SSIM loss, L perceptual is the perceptual loss; L1 ,λ SSIM and λ perceptual They are the loss weights of L1 loss, SSIM loss and perceptual loss; Dynamically adjust the loss weight according to the training progress p. The formula is: Among them, S cur Represents the current number of training steps, S total Represents the total number of training steps, is the initial value of the loss weight of L1 loss, Represents the linear decreasing rate of the loss weight of L1 loss, is the initial value of the loss weight of SSIM loss, is the linear growth rate of the loss weight of SSIM loss, is the initial value of perceptual loss, Indicates the growth rate of perceived loss.

8. The oracle bone script generation method based on the structure-aware diffusion model according to claim 7 is characterized in that: The L1 loss is: Where N represents the total number of pixels in the oracle bone image, I recon (i) and I og (i) represents the value of the i-th pixel of the generated image and the real image respectively; The SSIM loss is L SSIM =1-SSIM(I recon ,I og ),in, Among them, μ x and μ y are the average brightness of images x and y respectively; σ x and σ y are the standard deviations of images x and y respectively; σ xy is the covariance of images x and y; C1 and C2 are both constants; The perceptual loss is Among them, Φ l (·) indicates that the feature map of the first layer of the pre-trained VGG network is calculated using the middle layer of VGG16, N l is the total number of pixels in the feature map of layer l, Φ l (I recon ) i and Φ l (I og ) i They respectively represent the value of the i-th feature pixel in the l-th layer feature.

9. The method for generating oracle bone inscriptions based on a structure-aware diffusion model according to any one of claims 5 to 8, characterized in that: In the oracle image reconstruction in step 4, the oracle image reconstruction sampling algorithm uses the degraded image in the current iteration and the corresponding output prediction image predicted by the U-Net information reconstruction network to generate a sample that is closer to the original image by a weighted combination of the two.

10. The oracle bone script generation method based on the structure-aware diffusion model according to claim 9 is characterized in that: The implementation method of the oracle image reconstruction sampling algorithm is as follows: t At the beginning, the step-by-step inverse degradation operation of s=t, t-1, ..., 1 is performed in sequence; at each time step, the current degraded image O is reconstructed by the trained U-Net information network. s Make a prediction and get an estimate of the original image R is the operator of the U-Net information reconstruction network; Residual correction based on the degenerate form: By estimating the current image Degenerate to the current time step s to get the distribution Then degenerate to the previous step s-1 to obtain the distribution Finally update the image state: Among them, β is the control parameter.

Citation Information

Cited By

  • Zero-sample image restoration and enhancement method and system based on text guidance

    CN122089592A

  • A text-guided zero-shot image restoration and enhancement method and system

    CN122089592B