Card surface background generation method and device, equipment, storage medium and product
By using the autoencoder model and wavelet loss function in the bank card background image generation, the problem of low generation quality in the prior art is solved, and high-quality bank card background image generation is achieved.
Patent Information
- Application Number
- CN202411708697.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art, deep learning generation models are prone to problems such as color distortion and image blur when generating bank card background images, resulting in low generation quality.
The autoencoder model is used as the target generation model, and is trained through the wavelet loss function, combined with multi-stage wavelet transformation to constrain the high-frequency and low-frequency information of the image, and adjust the model parameters to improve the generation and reconstruction capabilities.
It realizes the rapid generation of high-quality bank card background images, improves the quality of personalized card surface design, and avoids the problems of color distortion and image blur.
Smart Images

Figure CN119559282A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and in particular to a card background generation method, device, equipment, storage medium and product. Background Art
[0002] With the rapid development of financial technology in recent years, bank card customization has become a common service in the modern banking industry. Bank card customization services make users' payment experience more personalized and can effectively improve customer satisfaction. In the personalized card design of bank card customization, the background pattern is a key factor affecting the overall appearance of the bank card. However, the design or shooting of the background pattern often requires a lot of resources.
[0003] In the prior art, the generative model in deep learning can be used to generate background patterns. Deep learning (DL) is a research hotspot in recent years. It is a branch of machine learning. It uses the loss function as the constraint condition of the generative model, gradually fits the data set during the training process, uses the powerful computing power of the model to obtain the true distribution of the data set, and then uses the generative model to generate images with the same distribution as the input data set. Due to the certain randomness during generation, the generative model can generate a huge amount of new images. The loss function used in the current generative model has the problem of re-optimizing outliers and not paying attention to the determination of image spatial information. Therefore, the generated images are prone to problems such as color distortion and image blur, and it is impossible to obtain good generation quality. Summary of the invention
[0004] The present invention provides a card background generation method, device, equipment, storage medium and product to achieve high-quality generation of an image required for the card background.
[0005] According to one aspect of the present invention, a method for generating a card background is provided, comprising:
[0006] Get the original image;
[0007] Using the original image as input data of a target generation model, inputting the original image into the target generation model, and obtaining at least one candidate image output by the target generation model;
[0008] The card surface customization information and the target image among the candidate images are determined, and the card surface background is generated according to the card surface customization information and the target image.
[0009] Furthermore, the target generation model is an autoencoder model.
[0010] Furthermore, the training method of the target generation model includes:
[0011] Get training images;
[0012] Inputting the training image into the target generation model to be trained, performing multi-level decomposition on the training image through the target generation model to obtain high-frequency information and low-frequency information of different frequencies, and reconstructing the high-frequency information and the low-frequency information to obtain a reconstructed image;
[0013] According to a preset loss function, an error between the reconstructed image and the training image is determined, and the parameters of the target generation model are adjusted according to the error until the training is completed.
[0014] Furthermore, the loss function includes a wavelet loss function, and the wavelet loss function is determined by weighted summation of loss functions of different frequency information.
[0015] Furthermore, after the training is completed, it also includes:
[0016] The target generation model is evaluated according to preset evaluation indicators.
[0017] Furthermore, the evaluation index includes a high-frequency signal-to-noise ratio of an image, and the high-frequency signal-to-noise ratio of an image is determined according to a difference between the high-frequency information before and after reconstruction in the target generation model.
[0018] According to another aspect of the present invention, there is provided a device for generating a card background, comprising:
[0019] An original image acquisition module, used for acquiring the original image;
[0020] An alternative image generation module, used to use the original image as input data of a target generation model, input the original image into the target generation model, and obtain at least one alternative image output by the target generation model;
[0021] The card surface background generating module is used to determine the card surface customization information and the target image in the candidate images, and to generate the card surface background according to the card surface customization information and the target image.
[0022] Optionally, the target generation model is an autoencoder model.
[0023] Optionally, the device further includes a model training module, which is used to:
[0024] Get training images;
[0025] Inputting the training image into the target generation model to be trained, performing multi-level decomposition on the training image through the target generation model to obtain high-frequency information and low-frequency information of different frequencies, and reconstructing the high-frequency information and the low-frequency information to obtain a reconstructed image;
[0026] According to a preset loss function, an error between the reconstructed image and the training image is determined, and the parameters of the target generation model are adjusted according to the error until the training is completed.
[0027] Optionally, the loss function includes a wavelet loss function, and the wavelet loss function is determined by weighted summation of loss functions of different frequency information.
[0028] Optionally, the device further comprises a model evaluation module, which is used to:
[0029] The target generation model is evaluated according to preset evaluation indicators.
[0030] Optionally, the evaluation index includes a high-frequency signal-to-noise ratio of an image, and the high-frequency signal-to-noise ratio of the image is determined according to the difference between the high-frequency information before and after reconstruction in the target generation model.
[0031] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0032] at least one processor; and
[0033] a memory communicatively connected to the at least one processor; wherein,
[0034] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the card surface background generation method described in any embodiment of the present invention.
[0035] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for generating a card background as described in any embodiment of the present invention when executed.
[0036] According to another aspect of the present invention, a computer program product is provided, which includes a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the method for generating a card surface background described in any embodiment of the present invention are implemented.
[0037] The card surface background generation method disclosed in the present invention first obtains an original image; then uses the original image as input data of a target generation model, inputs the original image into the target generation model, and obtains at least one candidate image output by the target generation model; finally determines the card surface customization information and the target image in the candidate images, and generates the card surface background according to the card surface customization information and the target image. The card surface background generation method disclosed in the present invention uses a generation model to generate an image required for the card surface background, can quickly generate a high-quality image, and improves the quality of personalized card surface design.
[0038] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0040] Figure 1 is a flow chart of a method for generating a card background according to Embodiment 1 of the present invention;
[0041] Figure 2 is a structural diagram of an autoencoder provided according to Embodiment 1 of the present invention;
[0042] Figure 3 is a schematic diagram of the structure of a network layer provided according to Embodiment 1 of the present invention;
[0043] Figure 4 is a schematic diagram of a process of decomposing an image by wavelet transform provided in Embodiment 1 of the present invention;
[0044] Figure 5 is a schematic diagram of the composition of a wavelet loss function provided according to the first embodiment of the present invention;
[0045] Figure 6 It is a structural schematic diagram of a device for generating a card background according to a second embodiment of the present invention;
[0046] Figure 7 It is a structural schematic diagram of an electronic device for implementing the card surface background generation method of the third embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0049] Embodiment 1
[0050] Figure 1 This is a flowchart of a card background generation method provided in the first embodiment of the present invention. This embodiment is applicable to the case where a card background image is generated by using a set network model. The method can be executed by a card background generation device. The card background generation device can be implemented in the form of hardware and / or software. The card background generation device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0051] S110: Acquire an original image.
[0052] Among them, the original image is an image obtained by drawing by professional designers or collecting by photographers, and the original image can be input into the image generation model as a data set.
[0053] S120: Using the original image as input data of the target generation model, inputting the original image into the target generation model to obtain at least one candidate image output by the target generation model.
[0054] The target generation model is a model trained in this embodiment for generating images, and its input data is the original image data. After being processed by the model, a new image is generated and output. The candidate image is the image output by the target generation model, which can be provided to the user for selection to determine the image that is ultimately used for card background generation. In the field of machine learning, the main goal of the generation model is to learn the true distribution of the data set so that new data similar to the original image and in the true distribution can be obtained.
[0055] Optionally, the target generation model is an autoencoder model.
[0056] Specifically, there are two major branches of generative models, namely, autoencoder (AE) generative models and generative adversarial network (GAN) generative models. Among them, autoencoders are easier to train and have clearer theories. They are generally used to compress data to obtain high-dimensional features of the data (also called latent features). There are two main types of tasks in generative models based on autoencoders: generation and reconstruction. In essence, both require that the output of the autoencoder is in the same distribution as the input. Autoencoder models are usually composed of an encoder network and a decoder network. Autoencoders are usually able to extract the main features of the input data better. Figure 2 This is a schematic diagram of the structure of an autoencoder provided by an embodiment of the present invention. As shown in the figure, after the input passes through the encoder, a compressed representation of the data is obtained. The compressed representation is called a latent feature, which can be understood as the feature of the input data. Then the latent feature is sent to the decoder, and finally the decoder outputs the reconstructed data. The entire autoencoder model uses a loss function to measure the gap between input and output. During the training process, the model continuously optimizes the encoder and decoder with the reconstruction loss as the goal, so that the input and output of the autoencoder become more similar.
[0057] Preferably, the autoencoder model used in the embodiment of the present invention can be a typical autoencoder structure, and noise is added to the hidden feature layer to make the hidden feature space smoother, thereby ensuring the diversity of generation and the generalization performance of the network. In the autoencoder model, Adam can be used as the optimization function, the learning rate lr=0.005 is selected, and the other parts use the default settings. The network structure of the autoencoder model is shown in Table 1 and Table 2:
[0058] Table 1 Encoder network structure
[0059]
[0060]
[0061] Table 2 Decoder network structure
[0062]
[0063] Taking the network layer of the encoder in Table 1 as an example, [conv 32] means that the current network layer uses a convolution layer and its output channels are 32; [residual 64] means that the structure uses the classic ResNet residual structure and its output channels are 64; [residual 64]×down means that the network structure downsamples the feature map in the residual process; [residual 64]×2 means that the network layer is repeated twice in the network; [fc 1024] means multiple fully connected layers, and the final output channels of the fully connected layer are 1024. For the decoder in Table 2, the biggest difference between it and the encoder is that there is an additional [interpolate n] operation, which means that when passing through this network layer, the feature map will be upsampled and the output channels will be set to n.
[0064] Figure 3 It is a structural schematic diagram of a network layer provided by an embodiment of the present invention. As shown in the figure, the figure includes three structures (a), (b) and (c), among which (a) is a typical residual structure, (b) is a residual block with a downsampling operation, and (c) represents a deconvolution operation consisting of a nearest neighbor interpolation operation and a convolution layer.
[0065] Optionally, if an autoencoder model is used as a target generation model, the training method of the target generation model may be: obtaining a training image; inputting the training image into the target generation model to be trained, performing multi-level decomposition of the training image through the target generation model to obtain high-frequency information and low-frequency information of different frequencies, and reconstructing the high-frequency information and the low-frequency information to obtain a reconstructed image; according to a preset loss function, determining the error between the reconstructed image and the training image, and adjusting the parameters of the target generation model according to the error until the training is completed.
[0066] The loss function includes a wavelet loss function, and the wavelet loss function is determined by weighted summation of loss functions of different frequency information.
[0067] Specifically, the present invention selects an autoencoder as a generative model and proposes a wavelet loss function suitable for this type of model, aiming to improve the generation and reconstruction capabilities of the autoencoder. The wavelet loss function introduces the wavelet transform in traditional image processing into the loss function used to train the generative model, uses the wavelet transform to perform multi-level decomposition of the image, obtains multi-level high-frequency and low-frequency information of the image, and uses this information to constrain the image. Wavelet is a rapidly decaying and oscillating wave. The wavelet transform uses a finite-length decaying wavelet basis, whose integral with respect to time t is zero, as shown in the following formula:
[0068]
[0069] Among them, Ψ(t) is the wavelet function.
[0070] There are two important variables in wavelet transform: scale α and translation τ. The scale affects the expansion and contraction of the wavelet, and the translation affects the displacement of the wavelet relative to the origin. The translation is the key to the analysis of time characteristics by wavelet transform. The expression of wavelet transform is as follows:
[0071]
[0072] Among them, f(t) is the function of signal amplitude with respect to time, Ψ(t) is the wavelet basis of wavelet transform, which is obtained by transforming two key basis functions, wavelet function and scaling function. Under the joint action of wavelet function and scaling function, wavelet transform can decompose the signal.
[0073] Wavelet transform can be divided into multiple levels. Taking the first level wavelet transform as an example, the original image becomes parts corresponding to different frequencies after the first level transform. Among them, low-frequency information determines features such as the outline of the face and the layout of the facial features, while high-frequency information corresponds to detailed information such as the texture of the hair and teeth in the face. This information makes the image appear more realistic. The second level wavelet transform continues to decompose the low-frequency part, and so on, a multi-level wavelet transform of the image can be obtained.
[0074] Figure 4 This is a schematic diagram of the process of decomposing an image by wavelet transform provided by an embodiment of the present invention. As shown in the figure, the original image is decomposed into four parts after a wavelet transform, and then decomposed twice to obtain different high-frequency information. LL1 represents the low-frequency part of the image after the first wavelet transform. LH1, HL1 and HH1 represent the high-frequency part of the image after the first wavelet transform, LL2 represents the low-frequency part of the image after the second wavelet transform, and LH2, HL2 and HH2 represent the high-frequency part of the image after the second wavelet transform. The representation of the third level of decomposition is similar to the previous two times. The overall wavelet transform presents a shape similar to a "pyramid". Each wavelet transform makes the energy more concentrated, and the low-frequency part of the last level concentrates the main energy in the image.
[0075] Previous loss functions often only focus on the difference between pixels or deep features of the image, while the wavelet loss function focuses more on the difference between frequencies of the image. These frequency information of different levels of the image can be obtained through multi-level wavelet transform. To obtain a high-quality generated or reconstructed image, it is necessary to constrain the frequency information of the image at its multi-level decomposition. Specifically, the wavelet loss function can be determined by weighted summation of the loss functions of different frequency information.
[0076] After the first level of wavelet transform, three high-frequency information of LH1, HL1 and HH1 can be obtained. This method uses the mean absolute error (MAE) to constrain these high-frequency information. As the loss function continues to decrease, its gradient will also become smaller and smaller; the gradient of the MAE loss function is always 1, which is beneficial for obtaining a clearer image when used for the high-frequency part. Next, LL1 is further subjected to wavelet transform to obtain frequency information of a smaller scale. The wavelet loss function also performs MAE constraints on LH2, HL2 and HH2, and continues to perform wavelet transform on LL2. Finally, after the third level of wavelet transform, the lowest frequency part of the image is obtained, which is where the contour information in the entire image is most concentrated. In order to ensure that the low-frequency information can be fully retained, the mean squared error (MSE) loss function is used to constrain this.
[0077] The mean absolute error (MAE) loss function is the average of the absolute values of the deviations of all individual predicted values from the arithmetic mean. The mean squared error (MSE) loss function is used to measure the gap between the predicted value and the target value. Its calculation formula is as follows:
[0078]
[0079] Where P represents an image (or a feature map), N represents the total number of pixels, x represents the coordinates of a pixel in the image, and y(x) and y'(x) represent the pixel values of the original image and the reconstructed image at x, respectively.
[0080] However, it is difficult to obtain a natural image if only the above low-frequency and high-frequency information is used. Simply constraining the high-frequency part will make the image details insufficient, which is manifested as the image is still blurred. Therefore, the wavelet loss function also constrains the modulus of the high-frequency information, so that the high-frequency information is consistent in amplitude, but allows a slight deviation in direction, so that the details of the image will increase, and the details will have subtle differences from the original image that do not affect the subjective feeling. Specifically, in the calculation, the modulus of the vector is as consistent as possible, but the value of each element in the vector may be different. After the first-level wavelet transform, the wavelet loss function obtains LH1, HL1 and HH1. At this time, the modulus of these three high-frequency parts is calculated by pixel to obtain a matrix of the same size as the original, and the MSE loss function is used to constrain these moduli. Here, the MSE loss function and the mean absolute error loss function are used for optimization at the same time to make the modulus more stringent at the beginning of training. As the training progresses, the value of the MSE loss function will decrease faster than the MAE, and its weight will be lower. At this time, the focus is on the constraint of high-frequency information.
[0081] Based on this, the specific expression of the wavelet loss function based on wavelet transform can be obtained:
[0082] LOSS Wavelets =λ1Loss1+λ2Loss2+λ3Loss3+λ4Loss4+λ5Loss5
[0083] Among them, Loss1 represents the MSE constraint on the high-frequency part after the first-level wavelet transform; Loss2 represents the MAE constraint on the high-frequency part; Loss3 represents the MAE constraint on the high-frequency part after the second-level wavelet transform; Loss4 represents the MAE constraint on the high-frequency part after the third-level wavelet transform; Loss5 represents the MSE constraint on the low-frequency part. i (i=1,2,3,4,5) is used to measure the weights of different parts in the total loss function. Preferably, in order to obtain better image details, the constraints on high-frequency information can be strengthened, so a larger weight can be selected on the high-frequency signal, for example, λ1=40, λ2=10, λ3=2.5, λ4=0.3, λ5=0.2.
[0084] Furthermore, the specific expressions of each part of the wavelet loss function are as follows:
[0085]
[0086] Among them, l and l ′ Represent the low-frequency part (LL) of the original image and the reconstructed image after wavelet transformation, respectively. i and h i ′ Represent the high-frequency parts of the original image and the reconstructed image after the i-th level transformation, m and m ′ They represent the results of element-by-element modulus of the high-frequency parts of the original image and the reconstructed image respectively. Their shapes are consistent with LL, and n represents the number of samples.
[0087] Figure 5 This is a schematic diagram of the composition of a wavelet loss function provided by an embodiment of the present invention. As shown in the figure, blocks are used to replace different frequency components of an image after wavelet decomposition. The different background changes of the blocks reflect the process of multi-level decomposition of the frequency components. The final wavelet loss function can be obtained by comparing the frequency components of the same background in the figure.
[0088] Furthermore, after the model training is completed, it is necessary to obtain a sample that obeys the distribution of the original data from the generative model. The latent features obtained by direct random sampling from the entire space are too random. Not only are they distributed too widely, but also the number of samples increases exponentially when the dimension increases. Although the fitting ability of the neural network is very strong, it is still too ideal to fit the entire real number space. In order to solve this problem, the latent features that were originally randomly distributed in the entire multidimensional space can be constrained to a fixed distribution. Preferably, the maximum mean difference (MMD) can be used to constrain the latent variables to be consistent with the normal distribution, and the wavelet loss function proposed above can be used to constrain the reconstructed image.
[0089] Among them, the probability density function is the most common way to describe the distribution. For simple distributions such as normal and Poisson, it is easy to use a few parameters to determine its distribution function. However, if the distribution obeyed by the variable is very complex and does not conform to the known distribution form, then "moments" can be used to describe the differences between these distributions. When the k-order moments of two variables are consistent, the distributions of the two variables can be considered consistent. When the two distributions are inconsistent, the moment with the largest gap between the two distributions is used to represent the difference between the two distributions. The MMD algorithm obtains its high-order moments by mapping the variables to the reproducing kernel Hibert space.
[0090] Furthermore, after the training is completed, the target generation model can be evaluated according to preset evaluation indicators.
[0091] Specifically, the Peak Signal-to-Noise Ration (PSNR), which is commonly used in image reconstruction, has many similarities with the MSE loss function. When using MSE as the loss function of the autoencoder, the entire network will try to reduce the value of MSE as much as possible during optimization, which is equivalent to indirectly optimizing the PSNR indicator, which is unreasonable. FID is another important indicator for evaluating the quality of image generation. Its specific principle is to send the generated image into a network, take out one of the 2048-dimensional latent features, and calculate the difference between the latent features before and after reconstruction, which is similar to the principle of perceptual loss. When using evaluation indicators, many loss functions have already included these indicators. Therefore, using these indicators is only of reference value for some loss functions, and it is not appropriate to use them to measure image quality. If there is an objective indicator that can truly reflect the image quality, it can be used as a loss function during the training process, so that high-quality images can be obtained.
[0092] Optionally, the evaluation index includes a high-frequency signal-to-noise ratio of the image, and the high-frequency signal-to-noise ratio of the image is determined according to the difference between the high-frequency information before and after reconstruction in the target generation model.
[0093] Specifically, in order to better quantify the reconstruction performance of wavelet loss, the present invention proposes to use the image high frequency signal-to-noise ratio HF-SNR to measure the image quality. This indicator uses wavelet transform to decompose the image and obtain the two-level wavelet transform results of the image, namely Figure 4 LH1, HL1, HH1, LH2, HL2 and HH2 in . HF-SNR calculates the difference between these high-frequency information as shown in the following formula:
[0094]
[0095] Among them, f represents a high-frequency information of the original image, It represents the corresponding high-frequency information of the reconstructed image, and the summation operation is the sum of the differences between multiple different high-frequency information.
[0096] S130: Determine the card surface customization information and a target image among the candidate images, and generate a card surface background according to the card surface customization information and the target image.
[0097] The card customization information is the customized information required to generate the card background, such as the card number, name, etc.
[0098] In this embodiment, after one or more candidate images are generated by the target generation model, the candidate images can be screened and provided to the user for selection, and the target image can be determined based on the user's selection result. After the target image is determined, a customized card background can be generated based on the card customization information and the target image.
[0099] The card surface background generation method provided by the embodiment of the present invention first obtains an original image; then uses the original image as input data of a target generation model, inputs the original image into the target generation model, and obtains at least one candidate image output by the target generation model; finally determines the card surface customization information and the target image in the candidate images, and generates the card surface background according to the card surface customization information and the target image. The card surface background generation method disclosed by the present invention uses a generation model to generate an image required for the card surface background, can quickly generate a high-quality image, and improves the quality of personalized card surface design.
[0100] Embodiment 2
[0101] Figure 6 A schematic diagram of a card background generation device provided in the second embodiment of the present invention is shown in FIG. Figure 6 As shown, the device includes: an original image acquisition module 310, an alternative image generation module 320 and a card surface background generation module 330.
[0102] The original image acquisition module 310 is used to acquire the original image.
[0103] The candidate image generation module 320 is used to use the original image as input data of the target generation model, input the original image into the target generation model, and obtain at least one candidate image output by the target generation model.
[0104] The card surface background generating module 330 is used to determine the card surface customization information and the target image among the candidate images, and to generate the card surface background according to the card surface customization information and the target image.
[0105] Optionally, the target generation model is an autoencoder model.
[0106] Optionally, the device further includes a model training module 340, which is used to:
[0107] Acquire a training image; input the training image into the target generation model to be trained, perform multi-level decomposition of the training image through the target generation model to obtain high-frequency information and low-frequency information of different frequencies, and reconstruct the high-frequency information and the low-frequency information to obtain a reconstructed image; determine the error between the reconstructed image and the training image according to a preset loss function, and adjust the parameters of the target generation model according to the error until the training is completed.
[0108] Optionally, the loss function includes a wavelet loss function, and the wavelet loss function is determined by weighted summation of loss functions of different frequency information.
[0109] Optionally, the device further includes a model evaluation module 350 for evaluating the target generation model according to preset evaluation indicators.
[0110] Optionally, the evaluation index includes a high-frequency signal-to-noise ratio of the image, and the high-frequency signal-to-noise ratio of the image is determined according to the difference between the high-frequency information before and after reconstruction in the target generation model.
[0111] The device for generating a card background provided in the embodiment of the present invention can execute the method for generating a card background provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0112] Embodiment 3
[0113] Figure 7A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0114] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0115] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0116] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for generating a card background.
[0117] In some embodiments, the method for generating the card background can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of generating the card background described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the method for generating the card background by any other appropriate means (e.g., by means of firmware).
[0118] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0119] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0120] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0121] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0122] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0123] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0124] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0125] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating a card background, characterized in that: include: Get the original image; Using the original image as input data of a target generation model, inputting the original image into the target generation model, and obtaining at least one candidate image output by the target generation model; The card surface customization information and the target image among the candidate images are determined, and the card surface background is generated according to the card surface customization information and the target image.
2. The method according to claim 1, characterized in that The target generation model is an autoencoder model.
3. The method according to claim 2, characterized in that The training method of the target generation model includes: Get training images; Inputting the training image into the target generation model to be trained, performing multi-level decomposition on the training image through the target generation model to obtain high-frequency information and low-frequency information of different frequencies, and reconstructing the high-frequency information and the low-frequency information to obtain a reconstructed image; According to a preset loss function, an error between the reconstructed image and the training image is determined, and the parameters of the target generation model are adjusted according to the error until the training is completed.
4. The method according to claim 3, characterized in that The loss function comprises a wavelet loss function, and the wavelet loss function is determined by weighted summation of loss functions of different frequency information.
5. The method according to claim 3, characterized in that: After the training, it also includes: The target generation model is evaluated according to preset evaluation indicators.
6. The method according to claim 5, characterized in that The evaluation index includes an image high-frequency signal-to-noise ratio, and the image high-frequency signal-to-noise ratio is determined according to the difference between the high-frequency information before and after reconstruction in the target generation model.
7. A device for generating a card background, characterized in that: include: An original image acquisition module, used for acquiring the original image; An alternative image generation module, used to use the original image as input data of a target generation model, input the original image into the target generation model, and obtain at least one alternative image output by the target generation model; The card surface background generating module is used to determine the card surface customization information and the target image in the candidate images, and to generate the card surface background according to the card surface customization information and the target image.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for generating a card surface background according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for generating a card surface background according to any one of claims 1 to 6 when executed.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method for generating a card surface background as described in any one of claims 1 to 6 are implemented.