Digital rubbing generation method, device, program product, equipment

Through the pseudo-rubbing style model and stylized network model based on the generative adversarial network, combined with the artistic word data set, the problem of poor applicability of style transfer technology in the generation of digital rubbings of stele inscriptions is solved, and efficient digital rubbing generation is achieved to meet rubbings with different needs. Make.

CN118506144BActive Publication Date: 2024-09-20NORTHWEST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410950836.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-09-20
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

The existing style transfer technology based on generative adversarial networks cannot be effectively applied in the generation scenario of digital rubbings of monuments. This is mainly because Chinese characters are special content objects and there are few style-related data sets, so the training process requires a large amount of sample data.

Method used

The pseudo-rubbing style model and stylized network model based on the generative adversarial network are used to generate digital rubbings through de-stylization processing and style fusion processing. The first and second generation are constructed using the pre-trained pseudo-rubbing style model and word-art data set. Adversarial networks are adversarially trained to generate target rubbing-style images.

Benefits of technology

It realizes the efficient generation of digital rubbings in the scene of digital rubbings generation of stele, only requires a small number of target rubbing style images, meets the production of rubbings with different needs, and avoids the cumbersomeness and low efficiency of traditional image processing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118506144B
    Figure CN118506144B
Patent Text Reader

Abstract

The present application provides a method, device, program product, and equipment for generating digital rubbings, and relates to the technical field of text image processing. The method of the present application includes obtaining a target rubbing style image and a de-stylized rubbing object image; using the target rubbing style image, the de-stylized rubbing object image, and a pre-trained quasi-rubbing style model to perform deep learning model training to obtain a stylized network model for performing target rubbing style fusion processing; inputting the de-stylized rubbing object image into the stylized network model for style fusion processing, and outputting the processed image as a digital rubbing of the rubbing object; the quasi-rubbing style model and the stylized network model are both constructed based on a generative adversarial network. The technical solution of the present application can effectively realize the generation of digital rubbings in the scene of generating digital rubbings of inscriptions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text image processing, and in particular to a method, device, program product, and equipment for generating digital rubbings. Background Art

[0002] In the traditional method of making rubbings of stele inscriptions (such as plain ink rubbings and wiping rubbings), rubbings of stele inscriptions are made by hammering and molding, which will damage the stele itself in the process. In order to protect the precious inscriptions, the making of paper rubbings of stele cultural relics from the Yuan Dynasty and before has been banned. The traditional rubbing craft requires the maker to have good professional qualities, and the rubbings made often vary from person to person, resulting in low production efficiency. In addition, rubbings made by traditional craft are not easy to preserve for a long time.

[0003] Based on this, with the development of digital technology, the use of digital image processing methods to make digital rubbings has become a research trend in this field, and related digital rubbing production technologies have emerged; in terms of protecting cultural relics and heritage, digital rubbings collect the structure and texture information of cultural relics in a non-contact manner to prevent cultural relics from being damaged by human beings; in terms of cultural heritage inheritance, digital rubbings store data in the form of digital information, which facilitates the preservation and classification of digital cultural relics; in terms of digital exhibitions, digital rubbings can display cultural relics through virtual reality technology, providing a new way for the promotion of cultural relics.

[0004] Digital rubbings are essentially a kind of image data, and their generation and production belongs to the category of image processing. Among the related technologies for digital rubbing generation, Zhu Xiaoli, Wu Zhongfu and others proposed a digital rubbing generation method based on traditional image processing technology, and used Photoshop software to realize the production of digital rubbings of relief images. In the specific process, the original cultural relic images were extracted, grayed, high-contrast retained, thresholded, background filled, inverted and other operations were performed, thereby preliminarily realizing the generation of digital rubbings. However, the implementation process is relatively cumbersome and inefficient (a large number of manual processing intervention steps are required).

[0005] Style transfer is to convert a content image based on content into an image of other styles while keeping the content unchanged. It was originally applied to image processing such as art painting, landscape pictures, and portraits. With the rapid development and application of artificial intelligence, style transfer has made great progress. For example, in 2016, Gatys, Ecker, and Bethge pioneered the use of neural networks for style transfer. Since then, the use of image style transfer technology based on deep learning has become a new technological development trend. In the field of style transfer, Generative Adversarial Network (GAN) is very popular among researchers. It is widely used in image generation and has achieved quite good results. Many variants of GAN have also been developed, such as PatchGAN, DCGAN, and Cycle GAN.

[0006] Based on the technical nature of digital rubbing production, it is obviously possible to use deep learning-based image style transfer technology to achieve the generation of digital rubbings, thereby avoiding the drawbacks of traditional image processing technology.

[0007] However, in the process of implementing the present invention, the inventors found that in the scenario of producing digital rubbings of inscriptions, Chinese characters are a special content object, and there are fewer data sets related to certain styles of inscriptions. The existing style transfer technology based on generative adversarial networks is mainly aimed at the migration and conversion of image styles, and the training process requires a large amount of sample data to support the training. The existing related technical solutions cannot be well applied in the scenario of generating digital rubbings of inscriptions.

[0008] Therefore, for the scenario of generating digital rubbings of inscriptions and similar scenarios, how to propose an effective and applicable technical solution for generating digital rubbings of inscriptions has become a technical problem that needs to be solved urgently.

[0009] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0010] In order to overcome the problems existing in the related art to at least a certain extent, the embodiments of the present application provide a digital rubbing generation method, device, program product, and equipment to effectively realize the generation of digital rubbings in the digital rubbing generation scenario of stele inscriptions.

[0011] First aspect

[0012] The present application embodiment provides a method for generating a digital rubbing, the method comprising:

[0013] Obtaining a target rubbing style image and a de-stylized rubbing object image;

[0014] Using the target rubbing style image, the de-stylized rubbing object image, and the pre-trained pseudo-rubbing style model, deep learning model training is performed to obtain a stylized network model for performing target rubbing style fusion processing;

[0015] Inputting the de-stylized image of the rubbing object into the stylized network model for style fusion processing, and outputting the processed image as a digital rubbing of the rubbing object;

[0016] Among them, the simulated rubbing style model and the stylized network model are both constructed based on the generative adversarial network, and the simulated rubbing dataset used in the process of constructing the simulated rubbing style model is constructed based on sample data of rubbing-like features in the artistic character dataset.

[0017] In some possible implementations, the construction and training process of the simulated rubbing style model includes:

[0018] Constructing a first training sample set based on a preset proportion of sample data in the simulated rubbing data set, wherein the sample data in the first training sample set are paired text images and text effect images;

[0019] A first generative adversarial network consisting of a generator and a discriminator is provided, wherein the generator adopts an encoder-decoder architecture, including two encoders and a decoder, wherein the two encoders are respectively used to map a text image and a text effect image to a shared feature space, the decoder is used to restore the image according to the image features encoded in the feature space and output the restoration result as the generator, and the discriminator is used to distinguish true from false images output from the generator;

[0020] The first generative adversarial network is trained using the first training sample set to obtain the simulated rubbing style model.

[0021] In some possible implementations, the process of training the first generative adversarial network using the first training sample set includes:

[0022] The text image in the first sample set and the text effect image paired with the text image are respectively used as inputs of the two encoders, and the text image is used as a reference input of the discriminator, so that the generator generates a corresponding fake image to confuse the discriminator, and then the discriminator performs true and false identification and feeds back the identification result to the generator;

[0023] Adversarial training is performed in this way, and the generator and discriminator are iteratively updated until the generator and discriminator reach Nash equilibrium.

[0024] In some possible implementations, the discriminator adopts a Markov discriminator.

[0025] In some possible implementations, the process of obtaining a stylized network model for performing target rubbing style fusion processing includes:

[0026] The target rubbing style image and the de-stylized rubbing object image are correspondingly cropped and cut according to a preset cutting rule, the resolution of each sub-image obtained by cutting is adjusted to meet the model input requirements, and a second training data set is constructed according to the adjusted images;

[0027] According to the model structure parameters of the simulated rubbing style model, setting and constructing a second generative adversarial network;

[0028] Using the second training data set, adversarial training is performed on the second generative adversarial network to obtain the stylized network model.

[0029] In some possible implementations, the process of obtaining the de-stylized image of the rubbing object includes:

[0030] Acquire original photo data of the rubbing object and perform preprocessing to obtain an intermediate image that meets the model input standard;

[0031] For the intermediate image, the simulated rubbing style model is called to perform a de-stylization operation to extract the glyph structure features of the characters in the image data to generate the de-stylized rubbing object image.

[0032] In some possible implementations, the word art dataset includes a TextEffectsDataset dataset.

[0033] Second aspect

[0034] The present application embodiment provides a digital rubbing generation device, the digital rubbing generation device comprising:

[0035] An acquisition module is used to acquire a target rubbing style image and a de-stylized rubbing object image;

[0036] A training processing module is used to perform deep learning model training using the target rubbing style image, the de-stylized rubbing object image, and the trained pseudo-rubbing style model to obtain a stylized network model for performing target rubbing style fusion processing;

[0037] A generation processing module, used for inputting the de-stylized image of the rubbing object into the stylized network model for style fusion processing, and outputting the processed image as a digital rubbing of the rubbing object;

[0038] Among them, the simulated rubbing style model and the stylized network model are both constructed based on the generative adversarial network, and the simulated rubbing dataset used in the process of constructing the simulated rubbing style model is constructed based on sample data of rubbing-like features in the artistic character dataset.

[0039] The third aspect

[0040] An embodiment of the present application provides a computer program product, including computer program code. When the computer program code runs on a computer, the computer executes the method described above.

[0041] The fourth aspect

[0042] An embodiment of the present application provides an electronic device, including:

[0043] A memory having an executable program stored therein;

[0044] A processor is used to execute the executable program in the memory to implement the steps of the above method.

[0045] The digital rubbing generation method provided in the embodiment of the present application uses sample data based on rubbing-like features in the artistic word data set to train a pseudo-rubbing style model constructed based on a generative adversarial network. In this way, when performing the actual digital rubbing production process, the pre-trained model can be used to further train a stylized network model that can perform target rubbing style fusion processing using a small number of target rubbing style images. The stylized network model is then used to perform target style fusion processing on the target rubbing style image and the de-stylized rubbing object image, thereby obtaining the desired digital rubbing;

[0046] The above-mentioned digital rubbing production and generation method is adopted in the present application. For the original image data of the rubbing object, the overall process is to first de-stylize the data and then perform stylization processing. This can flexibly meet the rubbing production needs of different requirements. During its implementation, only a small number of target rubbing style images are required to generate images of the target rubbing style. The technical solution of the present application can effectively realize the generation of digital rubbings in the digital rubbing generation scenario of stele inscriptions.

[0047] Other advantages, objectives, and features of the present application will be described in part in the following description, and in part will be apparent to those skilled in the art based on the following examination and study, or may be taught from the practice of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to provide a further understanding of the technical solution of the present application or the prior art, and constitute a part of the specification. Among them, the accompanying drawings expressing the embodiments of the present application are used together with the embodiments of the present application to explain the technical solution of the present application, but do not constitute a limitation on the technical solution of the present application.

[0049] Figure 1 A schematic diagram of a flow chart of a method for generating a digital rubbing provided in one embodiment of the present application;

[0050] Figure 2 This is a schematic diagram illustrating the overall implementation of a digital rubbing generation method in one embodiment of the present application;

[0051] Figure 3 This is a schematic diagram illustrating part of the data in the proposed rubbing data set in one embodiment of the present application;

[0052] Figure 4 This is a schematic diagram illustrating the structure of a first generative adversarial network in one embodiment of the present application;

[0053] Figure 5 This is a schematic diagram illustrating the structure of an encoder in a generator of a first generative adversarial network in one embodiment of the present application;

[0054] Figure 6 This is a schematic diagram illustrating the structure of a decoder in a generator of a first generative adversarial network in one embodiment of the present application;

[0055] Figure 7 A schematic diagram illustrating the principle of constructing a second training data set in one embodiment of the present application;

[0056] Figure 8 A schematic diagram of the structure of a digital rubbing generation device provided in one embodiment of the present application;

[0057] Fig. 9 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other implementation methods obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.

[0059] As described in the background technology, based on the technical nature of digital rubbing production and generation, it is obviously possible to use deep learning-based image style transfer technology to achieve the generation of digital rubbings, thereby avoiding the drawbacks of using traditional image processing technology.

[0060] However, in the process of implementing the present invention, the inventors found that in the scenario of producing digital rubbings of inscriptions, Chinese characters are a special content object, and there are fewer data sets related to certain styles of inscriptions. The existing style transfer technology based on generative adversarial networks is mainly aimed at the migration and conversion of image styles, and the training process requires a large number of data sets to support the training. The existing related technical solutions cannot be well applied in the scenario of generating digital rubbings of inscriptions.

[0061] To address this problem, the present application proposes a method for generating digital rubbings.

[0062] In one embodiment, if Figure 1 As shown, the digital rubbing method includes:

[0063] Step S110, obtaining the target rubbing style image and the rubbing object image after de-stylization processing;

[0064] It should be noted here that the style texture style of the rubbings represented by the rubbing style in this application, if you want to generate a digital rubbing with rubbing style A, you first need to obtain an image of this type of style texture style. In this application, only a single image of a certain type of style rubbing is needed to well realize the generation of digital rubbings of this type of style, which is very suitable for the situation in actual scenes where there are few data sets related to certain style inscriptions;

[0065] In this step, the rubbing object refers to the object for which a digital rubbing is to be generated, such as a stone inscription. In practice, the image of the stone inscription can be obtained by non-contact means such as taking a photo (such an image is also referred to as an "original image" in this application). Figure 2 In the T0 legend in the figure), in order to realize the overall rubbing production of the present application, the original image needs to be de-stylized in advance (relative to the meaning of the rubbing style mentioned above, the de-stylization processing here mainly refers to the processing performed to obtain the text glyph features of the rubbing object), and the rubbing object image after de-stylization processing is obtained (this type of image is also referred to as "de-stylized image" in the present application), such as Figure 2 Figure 1.

[0066] Then, step S120 is performed, using the target rubbing style image, the rubbing object image after stylization processing, and the pre-trained pseudo-rubbing style model to perform deep learning model training to obtain a stylized network model for performing target rubbing style fusion processing;

[0067] The simulated rubbing style model and the stylized network model involved in this step are both constructed based on the generative adversarial network. The simulated rubbing data set used in the process of constructing the simulated rubbing style model is constructed based on the sample data of rubbing-like features in the artistic character data set. In other words, in the technical solution of the present application, a pre-trained model (i.e., the simulated rubbing style model) trained based on the simulated rubbing data set is adopted, and the pre-trained model is used to quickly obtain the required stylized network model that can execute the target rubbing style fusion processing;

[0068] The simulated rubbing dataset involved here is constructed based on the sample data of rubbing-like features in the existing artistic character dataset. For example, the TextEffectsDataset dataset well known to technical personnel in this field can be selected, and the simulated rubbing dataset can be constructed based on the sample data of rubbing-like features in the dataset, so as to obtain an effective pre-training model.

[0069] Then, step S130 is performed, wherein the de-stylized image of the rubbing object is input into the stylized network model for style fusion processing, and the processed image is output as a digital rubbing of the rubbing object;

[0070] In this step, for the stylized image of the rubbing object, the stylized network model obtained in step S120 is used to perform style fusion processing on the de-stylized image, thereby obtaining a stylized image of the target rubbing style (such as Figure 2 ), outputting a digital rubbing with the stylized image as the rubbing object;

[0071] In other words, if Figure 2 As shown, the digital rubbing generation method of the present application generally includes two stages: de-stylization processing and stylization processing. This method is conducive to flexibly generating digital rubbings of the required style for the same rubbing object, meeting the corresponding needs in actual scenarios.

[0072] The above-mentioned digital rubbing production and generation method is adopted in the present application. For the original image data of the rubbing object, the overall process of first de-stylization processing and then stylization processing is adopted, which can flexibly meet different rubbing production needs. During its implementation process, only a single target rubbing style image is required to generate an image of the target rubbing style; the technical solution of the present application can effectively realize the generation of digital rubbings in the digital rubbing generation scenario of stele inscriptions.

[0073] To facilitate understanding of the technical solution of the present application, the technical solution for implementing the present application is further described below in conjunction with other embodiments.

[0074] Based on the above embodiments, in one embodiment, the process of constructing the simulated rubbing style model includes:

[0075] Constructing a first training sample set based on a preset proportion of sample data in the simulated rubbing data set, wherein the sample data in the first training sample set are paired text images and text effect images;

[0076] As mentioned above, the simulated rubbing dataset is constructed based on sample data of rubbing-like features in the existing art word dataset. Specifically, in the simulated rubbing dataset in this embodiment, the art word dataset TextEffectsDataset is selected as the basic dataset, and according to the rubbing feature texture, sample data similar to the rubbing features are screened out on the basis of the TextEffectsDataset dataset, and then some collectible rubbing style sample data are added for supplementation. Finally, 35 style types and 837 pictures of each style are obtained in the pre-training dataset (simulated rubbing dataset). The sample data in the simulated rubbing dataset are divided into training set and verification set according to a preset ratio (such as 9:1). The training set here is referred to as the first training sample set in this application. The sample data in the sample set are paired text images and text effect images, such as Figure 3 Shown are some sample data in the training set (in each pair of data, the figure on the left is a text image, and the figure on the right is a text effect image).

[0077] In the process of constructing the rubbing style model, Figure 4 As shown, it also includes setting a first generative adversarial network consisting of a generator and a discriminator, the generator adopts an encoder-decoder architecture, including two encoders (such as Figure 4 Ea and Eb) and a decoder, wherein the two encoders are respectively used to map the text image and the text effect image to a shared feature space, the decoder is used to restore the image according to the image features encoded in the feature space and output the restoration result as the generator, and the discriminator is used to distinguish the true from the false from the image output from the generator;

[0078] It is easy for those skilled in the art to understand that in this scenario application, the task of the generator in the generative adversarial network is to generate fake images to deceive the discriminator. During the network training process, the generator continuously produces fake images, and then combines the judgment scores of the discriminator to continuously optimize the generated fake images; the task of the discriminator is to find the fake images generated by the generator and analyze the image features of the fake images to improve its ability to identify fake images. In the iterative process, the capabilities of both are continuously improved, and the quality of the generated images is also continuously improved. Finally, the two will reach a relatively balanced state, that is, the training is completed.

[0079] In other words, the construction process of the simulated rubbing style model also includes a training process, that is, it also includes a process of training the first generative adversarial network using the first training sample set to obtain the simulated rubbing style model.

[0080] Specifically, the process of training the first generative adversarial network using the first training sample set includes:

[0081] The text image in the first training sample set and the text effect image paired with the text image are respectively used as the input of the two encoders (such as Figure 4 Ea, Eb in , and use the text image as the reference input of the discriminator (such as Figure 4 , so that the generator (such as Figure 4 The generator in the algorithm generates corresponding fake images to confuse the discriminator, and then the discriminator performs true and false identification and feeds the identification results back to the generator;

[0082] Adversarial training is performed in this way, and the generator and discriminator are iteratively updated until the generator and discriminator reach Nash equilibrium.

[0083] To facilitate understanding of the technical solution of the present application, the technical principles involved in the proposed rubbing style model in the technical solution of the present application are further explained below:

[0084] For the sake of convenience, the two encoders involved in the training process are referred to as content encoders and , (corresponding to Figure 4 Ea, Eb), the generator is called , the decoder is called ; During training, the content encoder Extract font structure features in the source de-stylized image (corresponding to the text image), content encoder Extract the style features that need to be removed from the inscription image (corresponding to the text effect image); decoder Content Encoder , The font feature encoding combination mapping obtained in the above method generates a mapping relationship from the style image to the de-stylized image, allowing the generative network to learn the ability to generate de-stylized images. The fake image and the real image (corresponding to the text image) generated by the generator are used as the input of the discriminator. The discriminator compares the fake image with the real de-stylized image to obtain the evaluation score to inform the generator to optimize. In this way, during the model training process, the model loss is constantly changing, reflecting the maturity of the evolution of the generative adversarial network numerically until the end of the training;

[0085] Through such iterative training, under the conditions of known style image parameters Y (i.e., parameters of the input text effect image) and de-styled image parameters X (i.e., parameters of the input text image), a feature sequence K can be obtained. The feature sequence K represents the mapping relationship between Y and X. The actual model training results in a large parameter set (K).

[0086] The simulated rubbing style model thus obtained obviously has the ability to be de-stylized (i.e., given K and Y, X is obtained). Therefore, in some embodiments of the present application, the process of obtaining the de-stylized rubbing object image includes:

[0087] Obtain the original photo data of the rubbing object and preprocess it to obtain an intermediate image that meets the model input standard (such as segmenting the entire inscription photo into single words and adjusting the resolution of the single word photo to the input requirement of 256px×256px, etc.);

[0088] For the intermediate image, the pseudo-rubbing style model is called to perform a de-stylization operation (using the de-stylization capability of the pseudo-rubbing style model) to extract the glyph structure features of the characters in the image data to generate a de-stylized rubbing object image, such as Figure 2 De-stylized processing shown.

[0089] In the actual implementation of the solution, the structure of the above content encoder and decoder can refer to the structure of U-net. For example, in a specific implementation, Figure 5 As shown in Table 1, the main parameters of the encoder include convolution kernel size, step size, and number of channels;

[0090] Table 1- Main parameters of encoder

[0091]

[0092] The process of the encoder processing image features is similar to the file compression process. During the compression process, the feature details of the image are preserved and the image features are stored as much as possible in the form of feature coding sequences. In the encoder convolution block, the size of the convolution kernel of each layer decreases successively, and the number of channels decreases successively. The larger the number of channels, the more obvious the extracted image detail features are. The shallow layer focuses on the boundary information of the image, while the deep convolution block focuses on the image texture detail information. The output of the shallow block will be used as the input of the deep encoding block. As the pooling operation of the encoding block deepens, the image size also decreases successively. The pooling operation can use MaxPool2d to maintain the font structure features and boundary information to the greatest extent, simplifying the number of model training parameters.

[0093] According to the design characteristics of the U-net network, the decoder structure is symmetrical with the encoder. Figure 6As shown, the main parameters of the decoder in this application also include the convolution kernel size, step size and number of channels, etc.; the role of the decoder is to restore the feature sequence extracted by the encoder into a picture as the output of the generator, so the feature extraction effect of the encoder will be directly displayed in the decoder. The whole process is similar to file decompression, and the feature sequence compressed by the encoder is decompressed and restored in a specific format.

[0094] In addition, it should be noted that the discriminator of the traditional GAN ​​uses a fixed value to represent the probability that the image is a real image, and the judgment of the real image is relatively simple; in this regard, as a specific implementation method, in some embodiments, the discriminator in the technical solution of the present application adopts a Markov discriminator.

[0095] Those skilled in the art may know that the Markov discriminator abandons the traditional discriminator's method of judging the true probability with fixed values, and uses an "n*n" matrix to store the image authenticity. The value of each block in the matrix represents the probability of the authenticity of the corresponding position of the image, and finally the authenticity of the entire image is represented by calculating the mean of the authenticity probability of each area. This method enables the discriminator to focus more on the control of image details in judging the image, and the judgment of the font stroke structure is more convincing. The control of details is applicable to the judgment of the font structure characteristics in the scenario of this application, so that the generator can restore the font structure characteristics of the image more clearly and specifically.

[0096] In actual implementation, this application draws on the implementation method of the Pix2Pix model and designs the discriminator to have four convolution blocks. The BatchNorm2d normalization layer and the Leaky Relu activation layer are set in the convolution. The main convolution parameters are shown in Table 2:

[0097] Table 2 - Main parameter structure of discriminator

[0098]

[0099] In addition, it is easy to understand that in the actual implementation of the solution, a model verification process is also involved. Similar to the existing GAN implementation method, the effect can be evaluated based on the relevant loss function.

[0100] Specifically, in some embodiments, the total loss function set in this application is Including anti-loss , feature loss and pixel loss , a numerical evaluation is made from the perspectives of font structure characteristics and pixel differences of the generated image, which can be expressed by the following formula:

[0101] (1)

[0102] In expression (1), , , They correspond to the adversarial loss , feature loss and pixel loss The specific calculation method of each loss in expression (1) can be set according to relevant existing technologies and scenario requirements. For example, the adversarial loss function of WGan-GP can be used as the calculation method of the above adversarial loss.

[0103] In the actual implementation of the present application scheme, the loss change of the model for de-stylizing the Xuanmiao Pagoda Stele image is close to 0.01 after training to 120 batches. After 200 batches, the feature loss value of the model for the de-stylized image has reached 0.01324. After 200 batches, the feature loss value of the model for de-stylizing the Duobao Pagoda Induction Stele is 0.01137. It can be seen intuitively from the loss change values ​​that after 120 batches, the model can basically restore the font structure features and boundary information of the image.

[0104] In addition, based on scenario requirements, during the implementation of the technical solution of the present application, an image quality evaluation index (Image Quality Assessment, IQA) may be introduced to evaluate the performance of the image generation algorithm. For example, the evaluation criteria may use two models, structural similarity index measure (SSIM) and cosine similarity (Cos Sim), to numerically evaluate the quality of the image generated by the de-stylized model. The relevant implementation principle of this evaluation method can be found in the existing relevant technical materials, and this application will not be further elaborated here.

[0105] The following is an explanation of the process of obtaining the stylized network model in the technical solution of this application.

[0106] As mentioned above, the essence of obtaining the simulated rubbing style model is to obtain a feature sequence K that represents the mapping relationship between Y and X, where Y (unstyled image parameters) and X (styled image parameters) are in a one-to-one correspondence; obviously, in practical applications, de-stylization is equivalent to finding Y when X and K are known, and stylization is equivalent to finding X when Y and K are known. The stylized network model in this application is established based on the latter case.

[0107] Specifically, in one embodiment, the process of obtaining a stylized network model for performing target rubbing style fusion processing includes:

[0108] Step a: According to preset cutting rules, the target rubbing style image and the de-stylized rubbing object image are correspondingly cropped and cut, the resolution of each sub-image obtained by cutting is adjusted to meet the model input requirements, and a second training data set is constructed based on the adjusted images.

[0109] It should be noted that the styles of rubbings vary due to factors such as different times, different production processes and different production materials. It is impossible to collect a sufficient number of data sets for training for various styles in the production of digital rubbings. In the application scenario of this application, in extreme cases, there is only one image of a certain target style. The applicant has found that Figure 7 As shown in the figure, the style of the real rubbing background is almost the same at different positions, and the difference is at the pixel level. Based on this, when the pre-trained model (the simulated rubbing style model) is known, the sample can be expanded according to the target rubbing style image, and the pre-trained model can be retrained (or retrained) based on the expanded samples to obtain a usable stylized network model;

[0110] That is, as described above, the target rubbing style image and the de-stylized rubbing object image are correspondingly cut according to a preset cutting rule (such as a script-based method to implement random cutting of squares), and the resolution is adjusted to achieve sample expansion, thereby forming a usable second training sample set.

[0111] Then, step b is performed, and a second generative adversarial network is set according to the model structure parameters of the simulated rubbing style model, that is, a new generative adversarial network to be trained is set using the model structure parameters of the simulated rubbing style model. In other words, the structure of the generative adversarial network is essentially the same as Figure 4 As shown, the specific relevant parameters of the model are the same as the simulated rubbing style model.

[0112] Then, step c is performed to perform adversarial training on the second generative adversarial network using the second training data set to obtain a stylized network model.

[0113] In step c, the training method is substantially the same as the training method for obtaining the simulated rubbing style model mentioned above. Specifically, in the second training sample set, the image obtained by cutting and adjusting the target rubbing style image corresponds to the text effect image in the first training set; in the second training sample set, the image obtained by cutting and adjusting the rubbing object image after de-stylization processing corresponds to the text image in the first training set; and then the sample data input method and model iteration mentioned above can be used to implement the training of the second generative adversarial network, so as to obtain a stylized network model;

[0114] It is easy to understand that in this process, since only the adjustment of style image parameters is learned, its essence is a fine-tuning of the simulated rubbing style model. The resulting stylized network model is as follows: Figure 2 As shown in the lower middle figure.

[0115] The stylized network model can then be used to achieve the fusion processing of the target rubbing style on the de-stylized rubbing object image.

[0116] In addition, it should be noted that in the actual implementation of the solution (such as programming to implement a digital rubbing production system), the proposed rubbing style model needs to be pre-built and trained (such as forming a callable model file), and the above-mentioned de-stylization process, the secondary training process, and the stylization process can be automatically carried out in the system background; such as the secondary training process and the stylization process do not have to be carried out separately. Based on the specific programming implementation, from the user's perspective, in the application, only the de-stylized rubbing object image and the target rubbing style image need to be passed in at the same time. The relevant secondary training and stylized application execution can be automatically carried out in the system background based on the above-mentioned implementation principle. From the user's perspective, the system will directly output the required digital rubbing after obtaining the relevant input.

[0117] Figure 8 A schematic diagram of the structure of a digital rubbing generation device provided in one embodiment of the present application is shown in FIG. Figure 8 As shown, the digital rubbing generation device 300 includes:

[0118] An acquisition module 301 is used to acquire a target rubbing style image and a de-stylized rubbing object image;

[0119] The training processing module 302 is used to perform deep learning model training using the target rubbing style image, the de-stylized rubbing object image, and the trained pseudo-rubbing style model to obtain a stylized network model for performing target rubbing style fusion processing;

[0120] A generation processing module 303 is used to input the de-stylized image of the rubbing object into the stylized network model for style fusion processing, and output the processed image as a digital rubbing of the rubbing object;

[0121] Among them, the simulated rubbing style model and the stylized network model are both constructed based on the generative adversarial network, and the simulated rubbing dataset used in the process of constructing the simulated rubbing style model is constructed based on sample data of rubbing-like features in the artistic character dataset.

[0122] Regarding the digital rubbing generation device 300 in the above-mentioned related embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0123] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown as follows: Fig. 9 As shown, the electronic device 400 includes:

[0124] Memory 401, on which executable programs are stored;

[0125] The processor 402 is used to execute the executable program in the memory 401 to implement the steps of the above method.

[0126] Regarding the electronic device 400 in the above embodiment, the specific manner in which its processor 402 executes the program in the memory 401 has been described in detail in the embodiment of the method, and will not be elaborated here.

[0127] According to the method provided in an embodiment of the present application, a computer program product is also provided in one embodiment of the present application. The computer program product includes: a computer program code. When the computer program code runs on a computer, the computer executes the method in the above embodiment.

[0128] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0129] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0130] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0131] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by any person familiar with the technology within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for generating digital rubbings, characterized in that: include: Obtaining a target rubbing style image and a de-stylized rubbing object image; Using the target rubbing style image, the de-stylized rubbing object image, and the pre-trained pseudo-rubbing style model, deep learning model training is performed to obtain a stylized network model for performing target rubbing style fusion processing; Inputting the de-stylized image of the rubbing object into the stylized network model for style fusion processing, and outputting the processed image as a digital rubbing of the rubbing object; The simulated rubbing style model and the stylized network model are both constructed based on a generative adversarial network, and the simulated rubbing dataset used in the process of constructing the simulated rubbing style model is constructed based on sample data of rubbing-like features in the artistic character dataset; The construction and training process of the simulated rubbing style model includes: Constructing a first training sample set based on a preset proportion of sample data in the simulated rubbing data set, wherein the sample data in the first training sample set are paired text images and text effect images; A first generative adversarial network consisting of a generator and a discriminator is provided, wherein the generator adopts an encoder-decoder architecture, including two encoders and a decoder, wherein the two encoders are respectively used to map a text image and a text effect image to a shared feature space, the decoder is used to restore the image according to the image features encoded in the feature space and output the restoration result as the generator, and the discriminator is used to distinguish true from false images output from the generator; Using the first training sample set to train the first generative adversarial network to obtain the simulated rubbing style model; The process of training the first generative adversarial network using the first training sample set includes: Using the text image in the first training sample set and the text effect image paired with the text image as the input of the two encoders respectively, and using the text image as the reference input of the discriminator, so that the generator generates a corresponding fake image to confuse the discriminator, and then the discriminator performs true and false identification and feeds back the identification result to the generator; The adversarial training is carried out in this way, and the generator and discriminator are updated iteratively until the generator and the discriminator reach Nash equilibrium; The process of obtaining a stylized network model for performing target rubbing style fusion processing includes: The target rubbing style image and the de-stylized rubbing object image are correspondingly cropped and cut according to a preset cutting rule, the resolution of each sub-image obtained by cutting is adjusted to meet the model input requirements, and a second training data set is constructed according to the adjusted images; According to the model structure parameters of the simulated rubbing style model, a new generative adversarial network to be trained is set as a second generative adversarial network; Using the second training data set, adversarial training is performed on the second generative adversarial network to obtain the stylized network model.

2. The method for generating digital rubbings according to claim 1, characterized in that: The discriminator adopts a Markov discriminator.

3. The method for generating digital rubbings according to claim 1, characterized in that: The process of obtaining the de-stylized image of the rubbing object includes: Acquire original photo data of the rubbing object and perform preprocessing to obtain an intermediate image that meets the model input standard; For the intermediate image, the simulated rubbing style model is called to perform a de-stylization operation to extract the glyph structure features of the characters in the image data to generate the de-stylized rubbing object image.

4. The method for generating digital rubbings according to claim 1, characterized in that: The word art dataset includes the TextEffectsDataset dataset.

5. A digital rubbing generation device, characterized in that: include: An acquisition module is used to acquire a target rubbing style image and a de-stylized rubbing object image; A training processing module is used to perform deep learning model training using the target rubbing style image, the de-stylized rubbing object image, and the trained pseudo-rubbing style model to obtain a stylized network model for performing target rubbing style fusion processing; A generation processing module, used for inputting the de-stylized image of the rubbing object into the stylized network model for style fusion processing, and outputting the processed image as a digital rubbing of the rubbing object; The simulated rubbing style model and the stylized network model are both constructed based on a generative adversarial network, and the simulated rubbing dataset used in the process of constructing the simulated rubbing style model is constructed based on sample data of rubbing-like features in the artistic character dataset; The construction and training process of the simulated rubbing style model includes: Constructing a first training sample set based on a preset proportion of sample data in the simulated rubbing data set, wherein the sample data in the first training sample set are paired text images and text effect images; A first generative adversarial network consisting of a generator and a discriminator is provided, wherein the generator adopts an encoder-decoder architecture, including two encoders and a decoder, wherein the two encoders are respectively used to map a text image and a text effect image to a shared feature space, the decoder is used to restore the image according to the image features encoded in the feature space and output the restoration result as the generator, and the discriminator is used to distinguish true from false images output from the generator; Using the first training sample set to train the first generative adversarial network to obtain the simulated rubbing style model; The process of training the first generative adversarial network using the first training sample set includes: Using the text image in the first training sample set and the text effect image paired with the text image as the input of the two encoders respectively, and using the text image as the reference input of the discriminator, so that the generator generates a corresponding fake image to confuse the discriminator, and then the discriminator performs true and false identification and feeds back the identification result to the generator; The adversarial training is carried out in this way, and the generator and discriminator are updated iteratively until the generator and the discriminator reach Nash equilibrium; The process of obtaining a stylized network model for performing target rubbing style fusion processing includes: The target rubbing style image and the de-stylized rubbing object image are correspondingly cropped and cut according to a preset cutting rule, the resolution of each sub-image obtained by cutting is adjusted to meet the model input requirements, and a second training data set is constructed according to the adjusted images; According to the model structure parameters of the simulated rubbing style model, a new generative adversarial network to be trained is set as a second generative adversarial network; Using the second training data set, adversarial training is performed on the second generative adversarial network to obtain the stylized network model.

6. A computer program product, comprising computer program code, characterized in that When the computer program code is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.

7. A digital rubbing generation device, characterized in that: include: A memory having an executable program stored therein; A processor, configured to execute the executable program in the memory to implement the steps of the method according to any one of claims 1 to 4.