A fast image generation method and device based on spatial sparse diffusion model

By combining the multi-dimensional comparison of the target image and the reference image and the feature division of the convolution layer in the diffusion model, the image generation process is optimized, solving the problems of inaccurate discriminator network analysis and waste of computing resources in the existing technology, and achieving More efficient image generation.

CN118297836BActive Publication Date: 2024-09-27SHANGHAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410483964.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-22
Publication Date
2024-09-27
Estimated Expiration
2044-04-22

AI Technical Summary

Technical Problem

The fidelity analysis of the discriminator network in the image generation process of existing diffusion models is not accurate enough, relying on pixel-level analysis and ignoring content and structural differences, resulting in a waste of computing resources and low operating efficiency.

Method used

Using a fast image generation method based on the spatial sparse diffusion model, by combining the color, structure and content comparison of the reference image and the target image, the convolutional layer learning feature image is extracted and the activation blocks are divided, the editing activation block index sequence is determined, and the iterative simulation is optimized process, saving computing resources.

Benefits of technology

It improves the accuracy and reliability of image generation, simplifies the iterative simulation process, reduces computing resource consumption and inference time, and improves the overall operating efficiency of the diffusion model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118297836B
    Figure CN118297836B
Patent Text Reader

Abstract

The present invention belongs to the field of computer vision technology, and relates to a fast image generation method and device based on a spatial sparse diffusion model. The method and device comprehensively analyze the fidelity of a reference image and a target image from three dimensions of color, structure and content, and judge whether there is a reconstruction demand for the reference image. If it is judged that there is no reconstruction demand, the diffusion model is directly output, otherwise the learning feature image of each current convolution layer of the diffusion model generator network for the target image is extracted, and the edit activation block index sequence of each current convolution layer of the diffusion model generator network is determined. The index sequence is combined with the reference image and re-input into the generator network for iterative simulation, which effectively saves computing resources and reasoning time. After the diffusion model output result is output, the generation energy efficiency evaluation coefficient of the diffusion model for the target image is analyzed and feedback is given, so as to promote the continuous development and improvement of the diffusion model technology and bring more innovations and breakthroughs to the field of image generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision technology, and in particular, relates to a fast image generation method and device based on a spatial sparse diffusion model. Background Art

[0002] The diffusion model is a powerful generative model that gradually adds noise to the data through a forward process, then predicts the noise added at each step through a reverse process, and gradually restores the noise-free image by removing the noise.

[0003] In recent years, the technology in the field of image generation has developed rapidly, and has evolved from convolutional neural networks to generative adversarial networks, and then to neural radiation fields and diffusion probability models. It has continuously broken through the boundaries of generation accuracy, cross-modal fusion and multimodal content creation, and demonstrated increasingly powerful generation capabilities and broad application prospects.

[0004] Although the existing editing method based on the diffusion model can obtain high-quality edited and restored images, it still has the following limitations: 1. The existing diffusion model discriminator network has a single dimension and shallow analysis depth for the realism analysis of the images generated by the generator. It relies on the editing similarity at the pixel level as the decisive basis, such as pixel color, pixel grayscale, pixel texture, etc., and ignores the differences in content, structure, and pixel details. As a result, the diffusion model discriminator network is not accurate and reliable when evaluating the realism of the generated images.

[0005] 2. The iterative simulation of the generator network in the existing diffusion model usually discards the previously generated images, resamples and simulates the images to be restored, and ignores the computational potential value of the previously generated images, resulting in a huge waste of computing resources and inference time, thereby reducing the overall operating efficiency of the diffusion model. Summary of the invention

[0006] In view of this, in order to solve the problems raised in the above background technology, a fast image generation method and device based on a spatial sparse diffusion model are proposed.

[0007] The technical solution adopted by the present invention to solve its technical problem is: in the first aspect, the present invention provides a fast image generation method based on a spatial sparse diffusion model, including: S1. Diffusion model input: input a target image into the diffusion model, and the diffusion model generator network simulates and generates a restored image of the target image, which is recorded as a reference image.

[0008] S2. Determine the need for reconstruction of the reference image: Analyze the realism of the reference image and the target image through the diffusion model discriminator network to determine whether there is a need for reconstruction of the reference image. If so, execute S3; if not, execute S5.

[0009] S3. Determine the edited activation blocks of the convolutional layer: extract the learned feature images of the current convolutional layers of the diffusion model generator network for the target image, divide the learned feature images into activation blocks according to the set ratio, the activation blocks include activation feature data and image position coordinates, and determine the edited activation block index sequence of the current convolutional layers of the diffusion model generator network.

[0010] S4. Iterative simulation of target image: re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat S2.

[0011] S5. Diffusion model output: output the reference image as a diffusion model output result.

[0012] S6. Energy efficiency evaluation of target image generation: After the diffusion model outputs the results, analyze the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback.

[0013] In the second aspect, the present invention provides a fast image generation device based on a spatial sparse diffusion model, including: a diffusion model input module, a reference image reconstruction demand judgment module, a convolutional layer editing activation block determination module, a target image iterative simulation module, a diffusion model output module, a target image generation energy efficiency evaluation module and a cloud database.

[0014] The diffusion model input module is connected to the reference image reconstruction demand judgment module, the reference image reconstruction demand judgment module is respectively connected to the convolution layer editing activation block determination module and the diffusion model output module, the convolution layer editing activation block determination module is connected to the target image iterative simulation module, the target image iterative simulation module is connected to the reference image reconstruction demand judgment module, the diffusion model output module is connected to the target image generation energy efficiency evaluation module, and the cloud database is respectively connected to the reference image reconstruction demand judgment module and the convolution layer editing activation block determination module.

[0015] The diffusion model input module is used to input the target image into the diffusion model, and the diffusion model generator network simulates and generates a restored image of the target image, which is recorded as a reference image.

[0016] The reference image reconstruction requirement judgment module is used to analyze the realism of the reference image and the target image through the diffusion model discriminator network to determine whether there is a reconstruction requirement for the reference image. If so, the convolutional layer editing activation block determination module is executed; if not, the diffusion model output module is executed.

[0017] The convolution layer editing activation block determination module is used to extract the learning feature images of the current convolution layers of the diffusion model generator network for the target image, divide the learning feature images into activation blocks according to the set ratio, and the activation blocks include activation feature data and image position coordinates, and determine the editing activation block index sequence of the current convolution layers of the diffusion model generator network.

[0018] The target image iterative simulation module is used to re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat the reference image reconstruction demand judgment module.

[0019] The diffusion model output module is used to output the reference image as the diffusion model output result.

[0020] The target image generation energy efficiency evaluation module is used to analyze the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback after the diffusion model outputs the result.

[0021] The cloud database is used to store the fidelity threshold between the image generated by the diffusion model generator network and the input image, and to store the reasonable feature learning deviation rate threshold of the activation block.

[0022] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects: (1) The present invention comprehensively analyzes the realism of the reference image and the target image by combining the color comparison loss coefficient, structure comparison loss coefficient and content comparison loss coefficient of the reference image and the target image, which not only includes pixel-level contrast loss analysis, but also effectively considers the contrast differences in content, structure and tonal levels, which helps to improve the accuracy and reliability of the discriminator network in evaluating the realism of the generated image.

[0023] (2) The present invention extracts the learning feature images of the current convolutional layers of the diffusion model generator network for the target image, divides the learning feature images into activation blocks according to a set ratio, and comprehensively and carefully understands the accuracy of the learning features of the current convolutional layers of the generator network for the target image. The division of activation blocks helps to simplify the subsequent iterative simulation process of the generator network and improve the iterative simulation efficiency and accuracy in a targeted manner.

[0024] (3) The present invention determines the edited activation block index sequence of each current convolutional layer of the diffusion model generator network based on the activation feature data deviation comparison results of each activation block in the learning feature image of the convolutional layer and each activation block in the standard feature image, and locates each convolutional layer to re-adopt the feature learning position based on the reference image, effectively exerting the potential computing value of the reference image, further saving computing resources and reasoning time, thereby realizing the optimization of the diffusion model.

[0025] (4) After the diffusion model outputs the result, the present invention analyzes the energy efficiency evaluation coefficient of the diffusion model for the target image and provides feedback, which helps to gain a deeper understanding of the energy efficiency performance of the diffusion model in the process of generating the target image, thereby promoting the continuous development and improvement of the diffusion model technology and bringing more innovations and breakthroughs to the field of image generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The present invention is further described using the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.

[0027] Figure 1 It is a schematic diagram of the method flow of the present invention.

[0028] Figure 2 This is a connection diagram of the device modules of the present invention. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 are within the scope of protection of the present invention.

[0030] Reference Figure 1 As shown, the first aspect of the present invention provides a fast image generation method based on a spatial sparse diffusion model, including: S1. Diffusion model input: input a target image into the diffusion model, and a restored image of the target image is simulated and generated by a diffusion model generator network, which is recorded as a reference image.

[0031] S2. Determine the need for reconstruction of the reference image: Analyze the realism of the reference image and the target image through the diffusion model discriminator network to determine whether there is a need for reconstruction of the reference image. If so, execute S3; if not, execute S5.

[0032] Specifically, the analysis process of the realism of the reference image and the target image is: the reference image and the target image are imported into the diffusion model discriminator network together, and each comparison layer of the diffusion model discriminator network outputs the color comparison loss coefficient γ1, structure comparison loss coefficient γ2 and content comparison loss coefficient γ3 of the reference image and the target image respectively.

[0033] Calculate the fidelity β between the reference image and the target image, in They are the corresponding weights of the preset color comparison loss coefficient, structure comparison loss coefficient, and content comparison loss coefficient. and e is a natural constant.

[0034] It should be noted that the reason why the corresponding weights of the above color comparison loss coefficient, structure comparison loss coefficient and content comparison loss coefficient increase in sequence is that in visual perception, the consistency of content has the most significant impact on image fidelity, which directly determines whether the main information and meaning conveyed by the image are accurate. In contrast, although structural information is important, in some cases, its slight changes may not be as eye-catching as content changes. Although color information can enhance the visual effect of the image, its weight is usually relatively low in the process of maintaining image fidelity, because the sensitivity of image restoration may not be as high as the sensitivity to structure and content.

[0035] For example, the above Specifically, it can be 0.25, 0.35, or 0.4.

[0036] The embodiment of the present invention comprehensively analyzes the realism of the reference image and the target image by combining the color comparison loss coefficient, structure comparison loss coefficient and content comparison loss coefficient of the reference image and the target image. It not only includes pixel-level contrast loss analysis, but also effectively considers the contrast differences in content, structure and tonal levels, which helps to improve the accuracy and reliability of the discriminator network in evaluating the realism of the generated image.

[0037] Specifically, the process of obtaining the color comparison loss coefficient of the reference image and the target image is as follows: converting the reference image and the target image into RGB color space, obtaining the RGB value of each pixel in the reference image and the target image respectively, making one-to-one correspondence between each pixel in the reference image and each pixel in the target image according to the pixel position, and taking the RGB value of each pixel in the target image as the RGB standard value of the corresponding pixel in the reference image, and then recording the RGB value of each pixel in the reference image and the RGB standard value as (r i ,g i ,b i ), (r′ i ,g′ i ,b′ i ), where i is the number of each pixel in the reference image, i = 1, 2, ..., a, calculate the chromaticity deviation index λ of each pixel in the reference image i1 ,

[0038] Convert the reference image and the target image into HSV color space, obtain the HSV value of each pixel in the reference image and the target image, and calculate the hue deviation index λ of each pixel in the reference image in the same way as the chromaticity deviation index calculation method of each pixel in the reference image i2 .

[0039] By formula The color comparison loss coefficient between the reference image and the target image is obtained, where a is the number of pixels in the reference image.

[0040] Specifically, the process of obtaining the structural comparison loss coefficient of the reference image and the target image is as follows: converting both the reference image and the target image into grayscale images, applying Sobel operators in the horizontal and vertical directions to perform convolution operations, respectively obtaining the gradient amplitude and gradient direction angle of each pixel in the reference image and the target image, and screening the edge pixels and non-edge pixels in the reference image and the target image according to a preset pixel gradient amplitude threshold, thereby outlining the edge area and non-edge area of ​​the reference image and the target image.

[0041] It should be noted that the specific process of obtaining the gradient amplitude and gradient direction angle of each pixel in the reference image and the target image is as follows: the Sobel operator is composed of a pair of 3×3 convolution kernels, and two convolution operations are performed on the grayscale image, one using the horizontal Sobel kernel and the other using the vertical Sobel kernel. Each convolution is equivalent to weighted summing the kernel in the corresponding direction with each pixel in the image and the pixels in its neighborhood, generating two new images: a gradient image reflecting the grayscale change of the image in the horizontal direction, denoted as G x , and the other is a gradient image reflecting the grayscale change in the vertical direction, denoted as G y , according to the formula Get the pixel gradient amplitude according to the formula Get the pixel direction angle.

[0042] Compare the edge area contour of the reference image with the edge area contour of the target image to obtain the edge contour overlap degree c of the reference image and the target image, and count the number of edge area pixels of the reference image and the target image respectively, denoted as m1 and m2. The edge structure similarity between the reference image and the target image is obtained.

[0043] It should be noted that the process of obtaining the edge contour overlap between the reference image and the target image is as follows: measuring the length of the overlap line curve between the edge area contour of the reference image and the edge area contour of the target image, measuring the length of the curve of the edge area contour of the target image, and taking the ratio of the length of the overlap line curve between the edge area contour of the reference image and the edge area contour of the target image to the length of the curve of the edge area contour of the target image as the edge contour overlap between the reference image and the target image.

[0044] The minimum bounding rectangles of the non-edge areas of the reference image and the target image are constructed respectively to obtain the non-edge size matching degree p of the reference image and the target image.

[0045] It should be noted that the process of obtaining the non-edge size matching degree between the reference image and the target image is as follows: the length and width of the minimum circumscribed rectangle of the non-edge area of ​​the reference image and the target image are measured respectively, denoted as d1, d2 and f1, f2, and the formula is used The non-edge size matching degree between the reference image and the target image is obtained.

[0046] According to the gradient direction angle of each pixel in the non-edge area of ​​the reference image and the target image, the gradient direction histograms of the non-edge area of ​​the reference image and the target image are constructed respectively, and the two are overlapped and compared to obtain the non-edge first-order texture similarity w1 of the reference image and the target image.

[0047] It should be noted that the process of obtaining the non-edge first-order texture similarity between the reference image and the target image is as follows: according to the preset gradient direction angle intervals, the number of pixels in the non-edge area of ​​the reference image for each gradient direction angle interval is screened and counted, and the gradient direction angle interval is used as the horizontal axis and the number of pixels is used as the vertical axis to construct the gradient direction histogram of the non-edge area of ​​the reference image. Similarly, the gradient direction histogram of the non-edge area of ​​the target image is obtained, and the total cylinder area s0 of the gradient direction histogram of the non-edge area of ​​the target image and the overlapping cylinder area s1 between the gradient direction histogram of the non-edge area of ​​the reference image are obtained. By the formula The non-edge first-order texture similarity between the reference image and the target image is obtained.

[0048] According to the gradient amplitude of each pixel in the non-edge area of ​​the reference image and the target image, the non-edge second-order texture similarity w2 between the reference image and the target image is obtained.

[0049] It should also be noted that the process of obtaining the non-edge second-order texture similarity between the reference image and the target image is consistent with the process of obtaining the non-edge first-order texture similarity between the reference image and the target image, and will not be repeated here.

[0050] By formula The non-edge structure similarity between the reference image and the target image is obtained.

[0051] Calculate the structural comparison loss coefficient γ2 between the reference image and the target image,

[0052] Specifically, the process of obtaining the content comparison loss coefficient between the reference image and the target image is as follows: calculating the pixel grayscale standard deviation of the reference image and using it as the noise level index of the reference image.

[0053] The area of ​​each artifact region in the reference image is obtained, and the ratio of the accumulated area of ​​the artifact region to the area of ​​the reference image is used as the artifact level index of the reference image.

[0054] The accumulated value of the artifact level index and the noise level index is used as the content comparison loss coefficient between the reference image and the target image.

[0055] It should be noted that each artifact region in the above-mentioned reference image can be identified by training a diffusion model discriminator network, and the number of pixels in the artifact region is used as the area.

[0056] Specifically, the judgment process of whether the reference image needs to be reconstructed is as follows: extracting the realism threshold β0 of the image generated by the diffusion model generator network stored in the WEB cloud and the input image, and comparing the realism β between the reference image and the target image. If β≥β0, it is judged that the reference image does not need to be reconstructed; if β<β0, it is judged that the reference image does need to be reconstructed.

[0057] S3. Determine the edited activation blocks of the convolutional layer: extract the learned feature images of the current convolutional layers of the diffusion model generator network for the target image, divide the learned feature images into activation blocks according to the set ratio, the activation blocks include activation feature data and image position coordinates, and determine the edited activation block index sequence of the current convolutional layers of the diffusion model generator network.

[0058] The embodiment of the present invention extracts the learning feature images of the current convolutional layers of the diffusion model generator network for the target image, divides the learning feature images into activation blocks according to a set ratio, and comprehensively and carefully understands the accuracy of the learning features of the current convolutional layers of the generator network for the target image. The division of activation blocks helps to simplify the subsequent iterative simulation process of the generator network and specifically improve the iterative simulation efficiency and accuracy.

[0059] Specifically, the process of determining the edited activation block index sequence of each current convolutional layer of the diffusion model generator network is as follows: determining the learning feature category corresponding to each convolutional layer of the diffusion model generator network, extracting the learning feature category corresponding to a certain convolutional layer, using the sparse processing tool of the diffusion model to set all other types of image features of the target image except the learning feature category corresponding to the convolutional layer to 0, generating a reference feature image of the target image for the learning feature category corresponding to the convolutional layer, recorded as the standard feature image of the convolutional layer, dividing the standard feature image into activation blocks according to a set ratio, and the activation feature data of the activation block is the feature indicator standard value of the learning feature category corresponding to the convolutional layer.

[0060] The activation blocks in the learning feature image of the convolutional layer are extracted, and the activation feature data of the activation blocks are used to create a value for the feature index of the corresponding learning feature category of the convolutional layer.

[0061] Then, according to the image position coordinates of the activation blocks, each activation block in the learning feature image of the convolutional layer is matched one by one with each activation block in the standard feature image, and the feature learning deviation rate of each activation block in the learning feature image of the convolutional layer is calculated and compared with the reasonable feature learning deviation rate threshold of the activation block stored in the WEB cloud. The activation blocks in the learning feature image of the convolutional layer whose feature learning deviation rate is greater than the reasonable feature learning deviation rate threshold of the activation block are marked as edited activation blocks, thereby forming the edited activation block index sequence of the convolutional layer, and then determining the edited activation block index sequence of each current convolutional layer of the scattered model generator network.

[0062] It should be noted that the calculation process of the feature learning deviation rate of the above-mentioned activation block is: obtain the absolute difference between the feature indicator creation value of the activation block and its corresponding feature indicator standard value, and take the ratio of the absolute difference to its corresponding feature indicator standard value as the feature learning deviation rate of the activation block.

[0063] The embodiment of the present invention determines the edited activation block index sequence of each current convolutional layer of the diffusion model generator network based on the activation feature data deviation comparison result of each activation block in the learning feature image of the convolutional layer and each activation block in the standard feature image, locates each convolutional layer to re-adopt the feature learning position based on the reference image, effectively exerts the potential computing value of the reference image, further saves computing resources and reasoning time, and thus realizes the optimization of the diffusion model.

[0064] S4. Iterative simulation of target image: re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat S2.

[0065] Specifically, the iterative simulation process of the target image is as follows: each convolutional layer of the diffusion model generator network locates the position of each edit activation block of the reference image according to its currently corresponding edit activation block index sequence and relearns to reconstruct its corresponding features, thereby simulating and generating a new reference image.

[0066] S5. Diffusion model output: output the reference image as a diffusion model output result.

[0067] S6. Energy efficiency evaluation of target image generation: After the diffusion model outputs the results, analyze the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback.

[0068] Specifically, the energy efficiency evaluation coefficient of the target image generated by the analytical diffusion model includes: after the diffusion model outputs the result, the statistical diffusion model is used to simulate the target image iteratively r and the number of edited activation blocks n of each convolutional layer of the generator network in each iterative simulation. jk, where j is the number of each iterative simulation, j = 1, 2, ..., r, k is the number of each convolutional layer of the generator network, k = 1, 2, ..., l, calculate the generation energy efficiency evaluation coefficient ξ of the diffusion model for the target image, where n (j-1)k The number of edited activation blocks of the kth convolutional layer of the generator network for the j-1th iteration of the diffusion model for the target image, l is the number of convolutional layers of the generator network, and r0 is the reference number of iterative simulations of the preset diffusion model for the image.

[0069] It should be noted that the number of iterative simulations of the above-mentioned diffusion model for the target image and the number of edited activation blocks of each convolutional layer of the generator network in each iterative simulation can be extracted from the simulation log records of the diffusion model.

[0070] After the diffusion model outputs the result, the embodiment of the present invention analyzes the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provides feedback, which helps to gain a deeper understanding of the energy efficiency performance of the diffusion model in the process of generating the target image, thereby promoting the continuous development and improvement of the diffusion model technology and bringing more innovations and breakthroughs to the field of image generation.

[0071] Reference Figure 2 As shown, the second aspect of the present invention provides a fast image generation device based on a spatial sparse diffusion model, including: a diffusion model input module, a reference image reconstruction demand judgment module, a convolutional layer editing activation block determination module, a target image iterative simulation module, a diffusion model output module, a target image generation energy efficiency evaluation module and a cloud database.

[0072] The diffusion model input module is connected to the reference image reconstruction demand judgment module, the reference image reconstruction demand judgment module is respectively connected to the convolution layer editing activation block determination module and the diffusion model output module, the convolution layer editing activation block determination module is connected to the target image iterative simulation module, the target image iterative simulation module is connected to the reference image reconstruction demand judgment module, the diffusion model output module is connected to the target image generation energy efficiency evaluation module, and the cloud database is respectively connected to the reference image reconstruction demand judgment module and the convolution layer editing activation block determination module.

[0073] The diffusion model input module is used to input the target image into the diffusion model, and the diffusion model generator network simulates and generates a restored image of the target image, which is recorded as a reference image.

[0074] The reference image reconstruction requirement judgment module is used to analyze the realism of the reference image and the target image through the diffusion model discriminator network to determine whether there is a reconstruction requirement for the reference image. If so, the convolutional layer editing activation block determination module is executed; if not, the diffusion model output module is executed.

[0075] The convolution layer editing activation block determination module is used to extract the learning feature images of the current convolution layers of the diffusion model generator network for the target image, divide the learning feature images into activation blocks according to the set ratio, and the activation blocks include activation feature data and image position coordinates, and determine the editing activation block index sequence of the current convolution layers of the diffusion model generator network.

[0076] The target image iterative simulation module is used to re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat the reference image reconstruction demand judgment module.

[0077] The diffusion model output module is used to output the reference image as the diffusion model output result.

[0078] The target image generation energy efficiency evaluation module is used to analyze the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback after the diffusion model outputs the result.

[0079] The cloud database is used to store the fidelity threshold between the image generated by the diffusion model generator network and the input image, and to store the reasonable feature learning deviation rate threshold of the activation block.

[0080] The data sources in the cloud database of this embodiment are shown in Table 1 below.

[0081] Table 1

[0082]

[0083] The above contents are merely examples and explanations of the structure of the present invention. The technicians in this technical field may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the structure of the invention or exceed the scope defined by the present invention, they should all fall within the protection scope of the present invention.

Claims

1. A fast image generation method based on spatial sparse diffusion model, It is characterized in that include: S1. Diffusion model input: Input the target image to the diffusion model, and the diffusion model generator network simulates and generates a restored image of the target image, which is recorded as the reference image; S2. Determine the reconstruction requirement of the reference image: Analyze the fidelity of the reference image and the target image through the diffusion model discriminator network to determine whether there is a reconstruction requirement for the reference image. If so, execute S3; if not, execute S5; S3. Convolutional layer edit activation block determination: extract the learning feature image of each current convolutional layer of the diffusion model generator network for the target image, divide the learning feature image into activation blocks according to a set ratio, the activation block includes activation feature data and image position coordinates, and determine the edit activation block index sequence of each current convolutional layer of the diffusion model generator network; S4. Iterative simulation of target image: re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat S2; S5. Diffusion model output: outputting the reference image as a diffusion model output result; S6. Energy efficiency evaluation of target image generation: after the diffusion model outputs the results, analyze the energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback; The analysis process of the fidelity of the reference image and the target image is as follows: the reference image and the target image are introduced into the diffusion model discriminator network together, and each comparison layer of the diffusion model discriminator network outputs the color comparison loss coefficient of the reference image and the target image respectively. , structural comparison loss coefficient And the content comparison loss coefficient ; Calculate the fidelity between the reference image and the target image , ,in They are the corresponding weights of the preset color comparison loss coefficient, structure comparison loss coefficient, and content comparison loss coefficient. and , is a natural constant; The acquisition process of the color comparison loss coefficient of the reference image and the target image is as follows: converting the reference image and the target image into RGB color space, respectively acquiring the RGB value of each pixel in the reference image and the target image, corresponding each pixel in the reference image to each pixel in the target image according to the pixel position, and using the RGB value of each pixel in the target image as the RGB standard value of the corresponding pixel in the reference image, and then recording the RGB value of each pixel in the reference image and the RGB standard value as , ,in is the number of each pixel in the reference image, , calculate the chromaticity deviation index of each pixel in the reference image , ; Convert the reference image and the target image into HSV color space, obtain the HSV value of each pixel in the reference image and the target image, and calculate the hue deviation index of each pixel in the reference image in the same way as the chromaticity deviation index calculation method of each pixel in the reference image. ; By formula Get the color comparison loss coefficient between the reference image and the target image, where is the number of pixels in the reference image; The process of obtaining the structural comparison loss coefficient of the reference image and the target image is as follows: converting the reference image and the target image into grayscale images, applying Sobel operators in the horizontal and vertical directions to perform convolution operations, respectively obtaining the gradient amplitude and gradient direction angle of each pixel in the reference image and the target image, and screening the edge pixels and non-edge pixels in the reference image and the target image according to a preset pixel gradient amplitude threshold, thereby outlining the edge area and non-edge area of ​​the reference image and the target image; Compare the edge area contour of the reference image with the edge area contour of the target image to obtain the overlap between the edge contours of the reference image and the target image , respectively count the number of pixels in the edge area of ​​the reference image and the target image, recorded as , according to the formula Obtain the edge structure similarity between the reference image and the target image; The minimum bounding rectangle is constructed for the non-edge areas of the reference image and the target image respectively to obtain the matching degree of the non-edge size of the reference image and the target image. ; According to the gradient direction angle of each pixel in the non-edge area of ​​the reference image and the target image, the gradient direction histogram of the non-edge area of ​​the reference image and the target image is constructed respectively, and the two are overlapped and compared to obtain the non-edge first-order texture similarity of the reference image and the target image. ; According to the gradient amplitude of each pixel in the non-edge area of ​​the reference image and the target image, the non-edge second-order texture similarity between the reference image and the target image is obtained. ; By formula Obtaining the non-edge structural similarity between the reference image and the target image; Calculate the structural comparison loss coefficient between the reference image and the target image , ; The process of obtaining the content comparison loss coefficient between the reference image and the target image is as follows: calculating the pixel grayscale standard deviation of the reference image and using it as the noise level index of the reference image; The area of ​​each artifact region in the reference image is obtained, and the ratio of the accumulated area of ​​the artifact region to the area of ​​the reference image is used as the artifact level index of the reference image; The accumulated value of the artifact level index and the noise level index is used as the content comparison loss coefficient between the reference image and the target image.

2. The fast image generation method based on the spatial sparse diffusion model according to claim 1, Features: The judgment process of whether the reference image needs to be reconstructed is as follows: extracting the fidelity threshold between the image generated by the diffusion model generator network stored in the WEB cloud and the input image , the fidelity between the reference image and the target image For comparison, if , then it is determined that there is no reconstruction requirement for the reference image. If , it is determined that the reference image needs to be reconstructed.

3. The fast image generation method based on the spatial sparse diffusion model according to claim 1, Features: The process of determining the edited activation block index sequence of each current convolutional layer of the diffusion model generator network is as follows: determining the learning feature category corresponding to each convolutional layer of the diffusion model generator network, extracting the learning feature category corresponding to a certain convolutional layer, using the sparse processing tool of the diffusion model to set the remaining types of image features of the target image except the learning feature category corresponding to the convolutional layer to 0, generating a reference feature image of the target image for the learning feature category corresponding to the convolutional layer, recorded as the standard feature image of the convolutional layer, dividing the standard feature image into activation blocks according to a set ratio, and the activation feature data of the activation block is the feature index standard value of the learning feature category corresponding to the convolutional layer; Extracting each activation block in the learning feature image of the convolution layer, the activation feature data of the activation block is used to create a value for a feature index of the corresponding learning feature category of the convolution layer; Then, according to the image position coordinates of the activation blocks, each activation block in the learning feature image of the convolutional layer is matched one by one with each activation block in the standard feature image, and the feature learning deviation rate of each activation block in the learning feature image of the convolutional layer is calculated and compared with the reasonable feature learning deviation rate threshold of the activation block stored in the WEB cloud. The activation blocks in the learning feature image of the convolutional layer whose feature learning deviation rate is greater than the reasonable feature learning deviation rate threshold of the activation block are marked as edited activation blocks, thereby forming the edited activation block index sequence of the convolutional layer, and then determining the edited activation block index sequence of each current convolutional layer of the scattered model generator network.

4. The fast image generation method based on the spatial sparse diffusion model according to claim 1, Features: The iterative simulation process of the target image is as follows: each convolutional layer of the diffusion model generator network locates the positions of each edit activation block of the reference image according to its currently corresponding edit activation block index sequence and relearns to reconstruct its corresponding features, thereby simulating and generating a new reference image.

5. The fast image generation method based on the spatial sparse diffusion model according to claim 1, Features: The energy efficiency evaluation coefficient of the target image generated by the analytical diffusion model includes: after the diffusion model outputs the result, the number of iterative simulations of the diffusion model for the target image is counted. And the number of activation blocks edited in each convolutional layer of the simulated generator network at each iteration ,in is the number of each iteration simulation, , is the number of each convolutional layer of the generator network, , calculate the generation energy efficiency evaluation coefficient of the diffusion model for the target image , ,in The diffusion model is used for the target image The iteration simulates the generator network The number of activation blocks in each convolutional layer, is the number of convolutional layers in the generator network, Iterates the image reference number of times for the preset diffusion model.

6. A fast image generation device based on a spatial sparse diffusion model, used to execute the method according to any one of claims 1 to 5, It is characterized in that include: The diffusion model input module is used to input the target image into the diffusion model, and the diffusion model generator network simulates and generates a restored image of the target image, which is recorded as a reference image; A reference image reconstruction demand judgment module is used to analyze the fidelity of the reference image and the target image through a diffusion model discriminator network to determine whether the reference image needs to be reconstructed. If so, the convolution layer editing activation block determination module is executed; if not, the diffusion model output module is executed; A convolutional layer edit activation block determination module is used to extract the learning feature images of the current convolutional layers of the diffusion model generator network for the target image, divide the learning feature images into activation blocks according to a set ratio, and the activation blocks include activation feature data and image position coordinates, and determine the edit activation block index sequence of the current convolutional layers of the diffusion model generator network; The target image iterative simulation module is used to re-input the reference image and the edited activation block index sequence of each current convolutional layer into the diffusion model, perform iterative simulation of the target image, and then repeat the reference image reconstruction demand judgment module; A diffusion model output module, used for outputting the reference image as a diffusion model output result; The target image generation energy efficiency evaluation module is used to analyze the generation energy efficiency evaluation coefficient of the diffusion model for the target image and provide feedback after the diffusion model outputs the result; The cloud database is used to store the fidelity threshold between the image generated by the diffusion model generator network and the input image, and to store the reasonable feature learning deviation rate threshold of the activation block.