Diffusion probability model-based text graph method, apparatus and device, and storage medium
By designing the solver framework, searching and selecting the optimal solution strategy, the problem of low generation quality of the diffusion probability model at a low number of steps is solved, and efficient image generation is achieved.
Patent Information
- Application Number
- CN202410851073.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-27
AI Technical Summary
The existing diffusion probability model generates low quality images at a low number of steps, and the solver performance is insufficient and cannot effectively improve the generation efficiency.
By designing the solver framework, search multiple candidate solvers and evaluate their real performance, and select the optimal solution strategy to improve the performance of the diffusion probability model, including neural network type, Taylor expansion order, derivative estimation method, corrector use and other strategies .
The image generation quality and generation efficiency of the diffusion probability model are significantly improved with fewer steps, and the performance of the solver is optimized.
Smart Images

Figure CN118710754A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and storage medium for generating a vincent graph based on a diffusion probability model. Background Art
[0002] The diffusion probabilistic model (DPM) is a generative model, also known as a diffusion model, which is widely used in generative artificial intelligence tasks such as Wenshengtu. The diffusion probability model DPM models the mapping between a simple prior distribution and a target distribution through a reversible stochastic differential equation (SDE) or ordinary differential equation (ODE). The process of generating images using the diffusion probability model can be regarded as the process of numerically solving the corresponding SDE or ODE. The numerical solution of the differential equation requires dividing the continuous time axis into several discrete time steps, and iterating between adjacent time steps according to the given iterative formula to calculate the data value at the time step, and then using the pre-trained neural network to predict the noise or data based on the data value, so as to solve the diffusion probability model based on the noise and data predicted by the neural network to obtain the generated image. Among them, the number of discrete time steps is called the number of steps, and the number of steps is proportional to the delay required to generate the image. In order to reduce the delay of the diffusion probability model to generate the image, a smaller number of steps can be used. However, fewer steps will lead to larger discretization errors, which will reduce the quality of images generated by the diffusion probability model. Therefore, designing a suitable numerical solver to reduce the number of steps while maintaining the quality of generation is an important research direction in the diffusion probability model.
[0003] There are many adjustable strategies in existing numerical solvers (for example, Denoising Diffusion Implicit Models (DDIM), Diffusion Probability Model Solver Series (DPM-Solvers), Unified Predictor Corrector method (UniPC)), such as the choice of solution order, time step division, etc. However, these solvers only choose the above strategies according to artificial empirical criteria. This strategy selection method will result in the existing solvers being unable to achieve good performance when the step limit is very low (for example, 4-10 steps), that is, the existing solvers have low generation quality when solving diffusion probability models at a lower number of steps. In addition, existing solvers will use the same solution strategy in each iteration, which also reduces the solver's solution performance. Summary of the invention
[0004] In view of this, the present disclosure proposes a Wensheng graph method, device, equipment and storage medium based on a diffusion probability model, which can improve the performance of the solver in solving the diffusion probability model under a given fewer number of steps, and at the same time is beneficial to improving the image generation quality and generation efficiency of the diffusion probability model under a fewer number of steps.
[0005] According to one aspect of the present disclosure, a method for generating a text image based on a diffusion probability model is provided, comprising: obtaining a description text of a to-be-generated image; inputting the description text into the diffusion probability model, and using a target solver to solve the diffusion probability model to obtain a target image generated by the diffusion probability model; wherein the generation process of the target solver comprises: obtaining a specified number of steps corresponding to the diffusion probability model, wherein the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model; based on the specified number of steps, searching for multiple candidate solvers according to a preset solver framework and evaluating the true performance of each candidate solver, wherein each candidate solver comprises a solution strategy corresponding to each time step in a plurality of time steps corresponding to the specified number of steps, wherein the solver framework is used to constrain the search space of the solution strategy, and wherein the true performance characterizes the quality of the image obtained by solving the diffusion probability model using the candidate solver; and determining the target solver corresponding to the diffusion probability model from the multiple candidate solvers according to the true performance of each candidate solver.
[0006] In a possible implementation, the solver framework includes at least one of the following: a type of neural network, the type of neural network includes a noise prediction network and a data prediction network, the noise prediction network is used to predict the noise part of the diffusion probability model input, and the data prediction network is used to predict the data part of the diffusion probability model input; a starting point for differentiating a time step, the starting point includes a time step before the time step; a value range of a retained order of Taylor expansion of the diffusion probability model, the value range of the retained order of Taylor expansion includes integers between 1 and 4; a Taylor expansion of the diffusion probability model The derivative estimation method of each order derivative in the Le expansion; whether to use a corrector, the corrector is used to correct the data value output by the diffusion probability model at any time step; the selection position of each time step in multiple time steps corresponding to the specified number of steps; whether to use the input data of the neural network at the maximum time step to replace the output data of the neural network at the maximum time step; whether to scale the time step encoding results of the neural networks at different time steps, and the time step encoding scaling factor used when scaling the time step encoding results of the neural network at any time step, the time step encoding scaling factor is used to scale the time step encoding results.
[0007] In a possible implementation, the derivative estimation method includes performing Taylor differencing on the derivative and adjusting the amplitude of the Taylor differencing result; the solver framework also includes: a value range of the number of additional points used for Taylor differencing of the k-order derivative, the additional points include the time step of the calculated data value before the current time step of the data value to be calculated, and the value range of the number of additional points m includes k≤m≤n, k represents the order of the derivative to be estimated, and n represents the retained order of Taylor expansion of the diffusion probability model; and / or, an adjustment coefficient used for amplitude adjustment of the Taylor differencing result of the k-order derivative, the adjustment coefficient includes a value that conforms to 1+O(h k ) form, O(h k ) represents the accuracy of the Taylor difference result of the k-th order derivative, h k Represents the step size between the current time step and the extra point.
[0008] In one possible implementation, the neural network includes an encoder and a decoder, and there are multiple jump connections between multiple encoding layers in the encoder and multiple decoding layers in the decoder; wherein the solver framework also includes: whether to scale the feature data transmitted by multiple jump connections of the neural network at different time steps, and when scaling the feature data transmitted by multiple jump connections of the neural network at different time steps, a combination of jump connection scaling coefficients used at different time steps, the jump connection scaling coefficient combination including the jump connection scaling coefficients corresponding to each of the multiple jump connections, and the jump connection scaling coefficients are used to scale the feature data transmitted by the jump connections.
[0009] In a possible implementation, the solution strategy corresponding to any time step includes at least one of the following: the type of neural network, the selected position of the time step, the starting point corresponding to the time step, the retained order of Taylor expansion, the derivative estimation method of each order of derivatives in the Taylor expansion, whether to use a corrector, whether to use the input data of the neural network with the maximum time step instead of the output data of the neural network with the maximum time step, whether to scale the time step encoding results of different time steps, the time step encoding scaling factor used when scaling the time step encoding result of any time step, whether to scale the feature data transmitted by multiple jump connections of neural networks with different time steps, and the jump connection scaling factor combination used for different time steps when scaling the feature data transmitted by multiple jump connections of neural networks with different time steps; wherein the derivative estimation method includes the number of additional points used for Taylor difference and / or the adjustment coefficient used for amplitude adjustment of Taylor difference results.
[0010] In a possible implementation, based on the specified number of steps, multiple candidate solvers are searched out according to a preset solver framework and the actual performance of each candidate solver is evaluated, including: in the j-th round of search, based on the specified number of steps, multiple j-th round candidate solvers are evolutionarily searched out from the solver framework, and the actual performance of each j-th round candidate solver is evaluated, j∈[1,L], L is the total number of search rounds; using the multiple j-th round candidate solvers and the actual performance of each j-th round candidate solver, a j-1-th round performance predictor is trained to obtain a trained j-th round performance predictor, which is used to predict the performance of the solver; wherein, when j=1, the evolutionary search performed in the first round of search is performed based on the actual performance of the solver, and when j is greater than 1, the evolutionary search performed in the j-th round of search is performed on the performance predicted by the j-1-th round performance predictor for the solver.
[0011] In a possible implementation, the evaluating the true performance of each candidate solver includes: based on the sample text, using each candidate solver to solve the diffusion probability model respectively to obtain the image data solved by each candidate solver; based on a preset image quality evaluation index, evaluating the image quality of the image data solved by each candidate solver respectively, wherein the true performance includes the image quality of the image data.
[0012] According to another aspect of the present disclosure, a device for generating text images based on a diffusion probability model is provided, comprising: a text acquisition module for acquiring a description text of a to-be-generated image; an image generation module for inputting the description text into the diffusion probability model, and using a target solver to solve the diffusion probability model to obtain a target image generated by the diffusion probability model; wherein the generation process of the target solver comprises: acquiring a specified number of steps corresponding to the diffusion probability model, wherein the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model; based on the specified number of steps, searching for multiple candidate solvers according to a preset solver framework and evaluating the true performance of each candidate solver, wherein each candidate solver comprises a solution strategy corresponding to each time step in a plurality of time steps corresponding to the specified number of steps, wherein the solver framework is used to constrain the search space of the solution strategy, and the true performance characterizes the quality of the image obtained by solving the diffusion probability model using the candidate solver; and determining the target solver corresponding to the diffusion probability model from the multiple candidate solvers according to the true performance of each candidate solver.
[0013] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0014] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.
[0015] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0016] According to various aspects of the present disclosure, based on the specified number of steps required to solve the diffusion probability model, multiple candidate solvers are searched according to a preset solver framework, each candidate solver includes a solution strategy corresponding to each time step in multiple time steps, and then a target solver for solving the diffusion probability model is selected according to the actual performance of each candidate solver, so that the selected target solver can have the optimal solution strategy under the specified number of steps, thereby effectively improving the performance of the target solver in solving the diffusion probability model, especially the target solver contains a solution strategy corresponding to each time step, which can effectively improve the image generation quality and generation efficiency of the diffusion probability model under a smaller number of steps.
[0017] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0019] Figure 1 A flow chart of a Vincent diagram method based on a diffusion probability model according to an embodiment of the present disclosure is shown.
[0020] Figure 2a A schematic diagram showing a time axis corresponding to a diffusion probability model according to an embodiment of the present disclosure.
[0021] Figure 2b A schematic diagram of the network structure of a U-Net neural network according to an embodiment of the present disclosure is shown.
[0022] Figure 3 A flow chart of an evolutionary search algorithm according to an embodiment of the present disclosure is shown.
[0023] Figure 4 A schematic diagram of a multi-stage search based on a performance predictor according to an embodiment of the present disclosure is shown.
[0024] Figure 5 A block diagram of a Vincent graph device based on a diffusion probability model according to an embodiment of the present disclosure is shown.
[0025] Figure 6 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0026] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0027] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0028] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0029] As mentioned above, the selection of solution strategies in existing solvers is only carried out according to empirical criteria. This empirical strategy selection method will make the existing solvers unable to achieve good performance when the step limit is very low (for example, 4-10 steps). In addition, the existing solvers will use the same strategy in each iteration, which reduces the adjustment space of the solution strategy and affects the solution performance of the solver. At present, there is no work to systematically explore the optimal selection method of these solution strategies. In addition, the presentation forms of existing solvers are very different, and there is a lack of unified discussion. Therefore, the embodiment of the present disclosure proposes a solver framework, which follows the exponential integral form and Taylor expansion processing method used in the DPM-Solver work, and can unify the existing solvers based on exponential integrals, and propose a search method for optimizing the solution strategy based on the solver framework, so as to improve the image generation quality and generation efficiency of the diffusion probability model when the diffusion probability model is used to perform the Wensheng map task.
[0030] In practical applications, the Wenshengtu method of the embodiment of the present disclosure can be deployed on various terminal devices through software or hardware modification. The terminal device involved in the present application can refer to a device with a wireless connection function. The wireless connection function refers to the ability to connect to other terminal devices through wireless connection methods such as wifi and Bluetooth. The terminal device of the present application can also have the function of communicating through a wired connection. The terminal device of the present application can be a touch screen, a non-touch screen, or a screen-free device. The touch screen can control the terminal device by clicking and sliding on the display screen with fingers, stylus, etc. The non-touch screen device can be connected to an input device such as a mouse, keyboard, touch panel, etc., and the terminal device can be controlled through the input device. For example, the device without a screen can be a Bluetooth speaker without a screen. For example, the terminal device of the present disclosure can be a computer, a smart phone, a netbook, a tablet computer, a laptop computer, a wearable electronic device (such as a smart bracelet, a smart watch, etc.), a TV, a virtual reality device, etc.
[0031] The Wenshengtu method of the embodiment of the present disclosure can also be deployed on a server, which can be located in the cloud or locally, and can be a physical device or a virtual device, such as a virtual machine, a container, etc., with a wireless communication function, wherein the wireless communication function can be set in the chip (system) or other parts or components of the server. It can refer to a device with a wireless connection function, and the wireless connection function refers to the ability to connect to other servers or terminal devices through wireless connection methods such as Wi-Fi and Bluetooth. The server of the present disclosure may also have the function of communicating through a wired connection. For example, the server of the present disclosure can be located in the cloud, communicate with the terminal device, receive the description text sent by the terminal device, and use the Wenshengtu method deployed on the server to generate a target image that conforms to the description text and return it to the terminal device.
[0032] The following Figures 1 to 4 The Wensheng diagram method based on the diffusion probability model proposed in the embodiment of the present disclosure is introduced in detail.
[0033] Figure 1 FIG. 1 is a flowchart of a method for generating a Wensheng diagram based on a diffusion probability model according to an embodiment of the present disclosure. The method can be executed by the above-mentioned terminal device or server, such as Figure 1 As shown, the method includes: step S11 to step S12.
[0034] In step S11, a description text of the image to be generated is obtained;
[0035] In practical applications, the description text may be text (e.g., keywords, tags, complete sentences or codes, etc.) input by a user for generating an image, and a text input box may be provided to the user to obtain the description text input by the user. It should be understood that the embodiments of the present disclosure do not limit the method for obtaining the description text and the specific content.
[0036] In step S12, the description text is input into the diffusion probability model, and the diffusion probability model is solved by using a target solver to obtain a target image generated by the diffusion probability model; wherein the generation process of the target solver includes:
[0037] Step S21, obtaining a specified number of steps corresponding to the diffusion probability model, where the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model;
[0038] Step S22, based on the specified number of steps, searching for multiple candidate solvers according to a preset solver framework and evaluating the real performance of each candidate solver, each candidate solver includes a solution strategy corresponding to each time step in a plurality of time steps corresponding to the specified number of steps, the solver framework is used to constrain the search space of the solution strategy, and the real performance characterizes the quality of the image obtained by solving the diffusion probability model using the candidate solver;
[0039] Step S23, determining a target solver corresponding to the diffusion probability model from a plurality of candidate solvers according to the actual performance of each candidate solver.
[0040] In step S21, the specified number of steps can be independently designed by the user according to actual needs. Optionally, in order to improve the efficiency of the diffusion probability model in generating the target image, the specified number of steps can be set to a lower number of steps. For example, the value range of the specified number of steps can be 4-10 steps, which is not limited in this embodiment of the present disclosure.
[0041] In a possible implementation, in step S22, the solver framework includes at least one of the following:
[0042] The type of neural network includes a noise prediction network and a data prediction network. The noise prediction network is used to predict the noise part of the diffusion probability model input, and the data prediction network is used to predict the data part of the diffusion probability model input;
[0043] The starting point for differentiating the time step, including the time step before the time step;
[0044] A value range of a retention order of Taylor expansion of the diffusion probability model, wherein the value range of the retention order of Taylor expansion includes integers between 1 and 4;
[0045] The derivative estimation method of each order of derivatives in the Taylor expansion of the diffusion probability model;
[0046] Whether to use the corrector, which is used to correct the data value output by the diffusion probability model at any time step;
[0047] The position of each time step in multiple time steps corresponding to the specified number of steps.
[0048] As mentioned above, when solving the diffusion probability model, a neural network needs to be used to predict noise or data. Therefore, two types of noise prediction networks and data prediction networks can be provided in the solver framework, so that you can choose to use the noise prediction network to predict the noise part or use the data prediction network to predict the data part. Exemplarily, when the noise prediction network is used, the Taylor expansion of the diffusion probability model can be written as formula (1-1), and when the data prediction network is used, the Taylor expansion of the diffusion probability model can be written as formula (1-2). The data value of each time step can be obtained by solving formula (1-1) or formula (1-2), and the data value of the last time step is solved, that is, the image generated by the diffusion probability model:
[0049]
[0050] Among them, t represents any time step, s represents the starting point of differentiation corresponding to time step t, and h = λ t -λ s , α t , σ t , α s , σ s can be understood as the hyperparameters corresponding to the diffusion probability model at time step t and starting point s, respectively, x t represents the data value generated by the diffusion probability model at time step t, x s represents the data value generated by the diffusion probability model at the starting point s, n represents the retention order of the Taylor display of the diffusion probability model, k∈[0,n], ∈ θ represents the noise prediction network, x θ Represents data prediction network; represents the k-order derivative of the noise prediction network at the starting point s, represents the k-order derivative of the data prediction network at the starting point s; O(h n+2 ) represents the truncation error of the Taylor expansion.
[0051] As can be seen from the above formulas (1-1) and (1-2), the data value of the starting point s is required when calculating the data value of any time step. The selection of the starting point s will affect both the linear term and the Taylor expansion summation term of the above iterative formula. The starting point s can be selected from the time step before the current time step where the data value has been calculated. Optionally, the starting point s can include the time step before the time step. Figure 2a Taking the time axis with a time range of [T, 0] as an example, since the process of generating an image using the diffusion probability model is iterating from time T to time 0 on the time axis, then for the i-th time step t i , t i The corresponding starting point s can be t i+1 That is, we can use the previous time step t i+1 The corresponding data value is solved for the i-th time step t i The data value of .
[0052] In practical applications, the retained order n of Taylor expansion can be selected from any integer range greater than or equal to 1 and less than or equal to the specified number of steps, but too high a retained order n will require additional points farther away for derivative estimation, which will make the derivative estimation error larger and the derivative estimation efficiency lower. Therefore, the value range of the retained order is set to an integer between 1 and 4 in the solver framework, that is, the retained order can be selected from integers from 1 to 4 to reduce the derivative estimation error and improve the derivative estimation efficiency.
[0053] In practical applications, any known numerical derivation method in the art can be used to estimate the derivatives of each order in the Taylor expansion, that is, a variety of known numerical derivation methods can be set in the solver framework, so that the solver framework of the embodiment of the present disclosure has great flexibility.
[0054] Optionally, an embodiment of the present disclosure provides a derivative estimation method including performing Taylor difference on the derivative and adjusting the amplitude of the Taylor difference result. Thus, the above solver framework further includes:
[0055] a range of values for the number of additional points used for Taylor differencing of a k-order derivative, the additional points including time steps at which data values have been calculated prior to a current time step at which data values are to be calculated, the range of values for the number of additional points m including k≤m≤n, k representing the order of the derivative to be estimated, and n representing the retained order for Taylor expansion of the diffusion probability model; and / or,
[0056] The adjustment coefficient used to adjust the amplitude of the Taylor difference result of the k-th order derivative includes the adjustment coefficient that conforms to 1+O(h k ) form, O(h k ) represents the accuracy of the Taylor difference result of the k-th order derivative, h kRepresents the step size between the current time step and the extra point.
[0057] The above-mentioned derivative estimation method can be understood as splitting the derivative estimation process into two steps: Taylor difference and amplitude adjustment, wherein the Taylor difference process for the k-th order derivative includes: Taylor expansion of the diffusion probability model at m (m≥k) additional points for the estimated point (i.e., the current time step) to obtain m Taylor expansions, and then combining the m Taylor expansions to solve the linear equations to eliminate other order derivatives, retaining only the k-th order derivative, and obtaining the Taylor difference result of the k-th order derivative. In the existing solvers, in order to ensure the convergence order, m=n is often selected. In the solver framework implemented in the present disclosure, the value range of constraint m is k≤m≤n. The process of amplitude adjustment of the Taylor difference result of the k-th order derivative includes: multiplying the Taylor difference result of the k-th order derivative by a value that satisfies 1+O(h k ) form of adjustment coefficient, this amplitude adjustment method not only does not affect the derivative estimation accuracy, but also plays a potential role in correcting the estimation deviation. In practical applications, amplitude adjustment can be used only for the first-order derivative to simplify the estimation of higher-order derivatives. Of course, amplitude adjustment can also be used for all order derivatives, which is not limited in the embodiments of the present disclosure. It should be understood that the additional point is different from the above starting point s.
[0058] Optionally, O(h k ) For example, it can at least include but is not limited to selecting from the following formulas (2-1) to (2-4):
[0059] O(h k )=0 (2-1)
[0060]
[0061] When the noise prediction network is used, h′=h, and when the data prediction network is used, h′=-h. It should be understood that when O(h k )=0, 1+O(h k )=1, which means no amplitude adjustment is performed on the Taylor difference result.
[0062] In practical applications, after a single-step solution is completed using a solver, a corrector can be used to improve the accuracy of the solved data value, that is, the corrector can be used to calculate the current iteration again based on the function value calculated by the data value obtained at the current time step to correct the data value solved at the current time step, or the data value solved at the current time step can be input into the corrector to correct the data value, and after obtaining the correction result output by the corrector, the correction result output by the corrector is substituted into the above-mentioned diffusion probability model for re-solving to obtain the corrected data value. Among them, the use of the corrector can be regarded as the process of re-solving the data value after obtaining the function value corresponding to the data value solved at the current time step. Therefore, the solution strategy used to re-solve the data value can include the items in the above-mentioned solver framework. For the sake of simplicity, in the embodiment of the present disclosure, it is only necessary to decide whether to use the corrector, and when deciding to use the corrector, the solution strategy obtained by increasing all orders in the original solution strategy of the current time step by 1 is used as the solution strategy used for re-solving. It can also be understood as substituting the correction result output by the corrector into the diffusion probability model to perform a re-solution, and the retained order of the Taylor expansion used in the process of adding 1.
[0063] Optionally, when deciding to use the corrector, a set of solution strategies can be resampled from the solver framework as the solution strategy used to re-solve the current time step. Optionally, in order to save time overhead, a pseudo-corrector strategy can also be used, that is, after the data value is corrected by the corrector, it is no longer re-solved according to the correction result, but the correction result output by the corrector is directly used as the data value corresponding to the current time step, which can save the number of solution steps and improve the solution efficiency. Among them, those skilled in the art can use any known corrector in the art, for example, the unified corrector (UniC) set in the UniPC solver to realize the correction of the data value solved for the current time step, which is not limited to the embodiments of the present disclosure.
[0064] It should be understood that the above items are the decision items in the single-step solution process provided by the solver framework, and each step can independently decide the above items. The global item that can be decided is the division method of discrete time steps, that is, the solver framework provided by the embodiment of the present disclosure can allow the selection position of each discrete time step to be decided on a continuous time axis, wherein, according to the specified number of steps set by the diffusion probability model, the number of time steps corresponding to the specified number of steps can be divided from the preset time axis (that is, the time range T to 0), and the position of each divided time step on the time axis is also the selection position.
[0065] It can be understood that the decision items provided in the above solver framework are mainly related to the numerical solution method of the ODE itself, and have nothing to do with the neural network expression items in the ODE. Therefore, in addition to the various decision items provided by the above embodiments of the present disclosure, the embodiments of the present disclosure also propose to include some decision items related to the neural network items in the above solver framework. Specifically, the above solver framework can also include at least one of the following:
[0066] Whether to use the input data of the neural network at the maximum time step instead of the output data of the neural network at the maximum time step;
[0067] whether to scale the time step encoding results of the neural network at different time steps, and the time step encoding scaling factor used when scaling the time step encoding result of the neural network at any time step, the time step encoding scaling factor being used to scale the time step encoding result;
[0068] Whether to scale feature data transmitted by multiple skip connections of a neural network at different time steps, and, when scaling feature data transmitted by multiple skip connections of a neural network at different time steps, a combination of skip connection scaling coefficients used at different time steps, wherein the combination of skip connection scaling coefficients includes skip connection scaling coefficients corresponding to each of the multiple skip connections, and the skip connection scaling coefficients are used to scale the feature data transmitted by the skip connections.
[0069] Among them, whether to use the input data of the neural network at the maximum time step to replace the output data of the neural network at the maximum time step can be understood as whether to use the input of the neural network to replace the output of the neural network at the current time step when the time step is equal to the maximum value T (that is, the first time step). This is because the training goal of the above neural network can be to predict the expected value of the noise component at the current time step t and the trajectory value, that is, When t = T, we have approximately t x0+σ t ∈=x T =∈. Therefore, the input data x of the neural network at the current time step can be directly used T The output data ∈ of the neural network of this step is replaced to improve the efficiency of solving the diffusion probability model. The above solver framework also regards whether to use the above replacement method as a selectable decision item.
[0070] As described above, the neural network includes a noise prediction network and a data prediction network. It can be known that the data prediction network is a neural network obtained by adding a data conversion module to the noise prediction network, and the data conversion module can perform data conversion on the output of the noise prediction network to obtain prediction data; therefore, whether to use the input data of the neural network with the maximum time step to replace the output data of the neural network with the maximum time step can include: whether to use the input data of the noise prediction network with the maximum time step to replace the output data of the noise prediction network with the maximum time step; that is, when the neural network adopts the noise prediction network, the neural network in the decision-making items of the above-mentioned replacement method can be the noise prediction network itself, and when the neural network adopts the data prediction network, the neural network in the decision-making items of the above-mentioned replacement method can be the noise prediction network contained in the data prediction network.
[0071] It can be known that when the above neural network predicts noise or data, it will encode the current time step and input the time step encoding result into the relevant layer or block of the neural network, and the time step encoding results of the neural network at different time steps will greatly affect the processing result of the image by its backbone network (or the solution result of ODE). Therefore, the embodiment of the present disclosure also proposes a decision item for whether to scale the time step encoding result, decide whether to adjust the solution result of ODE, and when deciding to scale the time step encoding result, the time step encoding scaling factor at each time step can be used as a decision item that can be independently decided in the solver framework, so as to obtain the target solver with the best solution performance. When using a neural network to predict noise or data, the time step encoding scaling factor searched out at any time step can be multiplied by the time step encoding result of the time step and the multiplication result can be input into the relevant layer or block of the neural network. It should be understood that the searched time step encoding scaling factor can be any value, and the embodiment of the present disclosure is not limited to this.
[0072] In practical applications, the network structure of the above neural network can adopt the U-Net network structure. It can be known that the U-Net neural network includes an encoder (i.e., a downsampling network) and a decoder (i.e., an upsampling network). The encoder includes multiple encoding layers (i.e., downsampling layers), and the decoder includes multiple decoding layers (i.e., upsampling layers). There are multiple jump connections between the multiple encoding layers and the multiple decoding layers, for example Figure 2bA schematic diagram of the network structure of a U-Net neural network is shown, in which there are multiple jump connections between multiple encoding layers in the encoder and multiple decoding layers in the decoder. The outputs of different encoding layers can be directly transmitted to the corresponding decoding layers through the jump connections, and the feature data transmitted by the jump connections at different positions of the U-Net neural network are not the same. The shallow jump connections tend to transmit the underlying high-frequency information data, and the deep jump connections tend to transmit the global low-frequency information data. When solving ODE, the solution errors at different time steps are not the same in sensitivity to the feature data transmitted by these jump connections. Therefore, the embodiment of the present disclosure proposes to set a jump connection scaling coefficient to scale the feature data transmitted by the jump connection, in the hope that adjusting the transmission of these feature data by setting the jump connection scaling coefficient may enable the ODE to obtain a better solution result. Specifically, an additional skip connection scaling coefficient can be set for each skip connection of the neural network, and the skip connection scaling coefficients of multiple skip connections form a skip connection scaling coefficient combination, and whether to scale the feature data output by the multiple skip connections and the skip connection scaling coefficient combination at different time steps when deciding to scale the feature data transmitted by the multiple skip connections are made into decision-making items that can be independently decided in the solution framework, so that the corresponding skip connection scaling coefficient combination can be searched for different time steps later. When the neural network performs noise or data prediction, the skip connection scaling coefficient of each skip connection can be multiplied with the feature data transmitted by each skip connection and the multiplication result is input to the corresponding decoding layer.
[0073] Based on the solver framework provided by the above-mentioned embodiment of the present disclosure, the solution strategy corresponding to any time step includes at least one of the following: the type of neural network, the selected position of the time step, the starting point corresponding to the time step, the retained order of the Taylor expansion, the derivative estimation method of each order derivative in the Taylor expansion, whether to use a corrector, whether to use the input data of the neural network with the maximum time step to replace the output data of the neural network with the maximum time step, whether to scale the time step encoding results of different time steps, the time step encoding scaling factor used when scaling the time step encoding result of any time step, whether to scale the feature data transmitted by multiple jump connections of the neural network with different time steps, and the jump connection scaling factor combination used for different time steps when scaling the feature data transmitted by multiple jump connections of the neural network with different time steps; wherein, the derivative estimation method includes the number of additional points used for Taylor difference and / or the adjustment coefficient used for amplitude adjustment of Taylor difference results. It should be understood that if a time steps are divided based on the specified number of steps, each candidate solver includes a solution strategies corresponding to a time steps, and each time step will search out its corresponding solution strategy.
[0074] Based on the solver framework provided by the above-mentioned embodiment of the present disclosure, various existing solvers can be obtained by selecting corresponding strategies for each item in the solver framework. That is, the solver framework of the embodiment of the present disclosure can unify various exponential integral-based solvers. For example, Table 1 shows that by selecting corresponding solution strategies for each item in the solver framework, a variety of existing solvers can be generated.
[0075] Table 1 Solver strategy
[0076]
[0077]
[0078] In step S22, a person skilled in the art may use a search algorithm known in the art, such as an evolutionary search algorithm, to search for multiple candidate solvers from the solver framework based on a specified number of steps, which is not limited by the embodiment of the present disclosure. The actual performance of each candidate solver searched out may then be evaluated. In a possible implementation, the actual performance of each candidate solver is evaluated, including:
[0079] Based on the sample text, each candidate solver is used to solve the diffusion probability model respectively, and the image data solved by each candidate solver is obtained;
[0080] Based on a preset image quality evaluation index, the image quality of the image data solved by each candidate solver is evaluated respectively, wherein the actual performance includes the image quality of the image data.
[0081] Among them, the sample text can be input into the diffusion probability model, and each candidate solver can be used to solve the diffusion probability model respectively to obtain the image data solved by each candidate solver, that is, the image data generated by the diffusion probability model under the solution of each candidate solver.
[0082] Among them, the image quality evaluation index can be any known index for evaluating image quality in the art, such as Signal to Noise Ratio (SNR), Structural Similarity Index (SSIM), FID (Fréchet Inception Distance), etc., which are not limited to the embodiments of the present disclosure. Exemplarily, the structural similarity or FID index between the sample image corresponding to the sample text and the image data solved by the candidate solver can be evaluated to obtain the image quality of the image data. In the embodiments of the present disclosure, by evaluating the image quality of the image data solved by each candidate solver, the true performance of each candidate solver can be effectively characterized.
[0083] Optionally, the present disclosure also provides Figure 3 The schematic diagram of a multi-stage search method based on a performance predictor is shown, which can efficiently search for multiple candidate solvers, such as Figure 3 As shown, the multi-stage search method loops through the following four steps: 1. Evolutionary search (i.e., evolutionary sampling) of several complete candidate solvers (e.g. Figure 3 1. Where S1 to S6 represent multiple candidate solvers obtained by evolutionary search). In the first cycle, evolutionary search is performed based on the actual performance of the solver; in other rounds of evolutionary search, it is performed based on the performance predicted by the performance predictor. 2. Evaluate the actual performance of each candidate solver (for example, the evaluated actual performance can be expressed in the form of performance scores) to obtain a number of training data consisting of candidate solvers and actual performance. 3. Use all the obtained training data to train the performance predictor, which takes the candidate solver as input and outputs the predicted performance of the predicted candidate solver. 4. Use the trained performance predictor to guide subsequent rounds of evolutionary search.
[0084] based on Figure 3 In the multi-stage search method shown, the above step S22, based on the specified number of steps, searches for multiple candidate solvers according to the preset solver framework and evaluates the actual performance of each candidate solver, which may include:
[0085] Step S221, in the j-th round search process, based on the specified number of steps, multiple j-th round candidate solvers are evolutionarily searched from the solver framework, and the actual performance of each j-th round candidate solver is evaluated, j∈[1,L], L is the total number of search rounds;
[0086] Step S222, using multiple j-th round candidate solvers and the actual performance of each j-th round candidate solver, training the j-1-th round performance predictor to obtain a trained j-th round performance predictor, the performance predictor is used to predict the performance of the solver;
[0087] When j=1, the evolutionary search performed in the first round of search is performed based on the actual performance of the solver, and when j is greater than 1, the evolutionary search performed in the jth round of search is performed based on the performance predicted by the j-1th round performance predictor. The performance predicted by the performance predictor can characterize the quality of the image that can be obtained by using the solver to solve the diffusion probability model.
[0088] To facilitate understanding of the above multi-stage search method, first Figure 4 A brief introduction to an existing evolutionary search algorithm is shown below. Figure 4As shown, the evolutionary search algorithm may include: generating an initial population, calculating and evaluating the fitness of individuals in the population, performing evolutionary operations such as selection, recombination, and mutation on individuals in the population based on the fitness of the individuals in the population, and obtaining a new generation of population. If the termination condition is not met (for example, the total number of iterations is not reached), the fitness of individuals in the new generation of population is calculated again and evolutionary operations are performed on the individuals in the population to obtain a new generation of population again, until the termination condition is met, and the latest generation of population generated by the last cycle is output as the output result of the evolutionary search.
[0089] Based on the above evolutionary search algorithm, if three rounds of search processes are set, that is, L is 3, in the first round of search process, the process of evolutionarily searching for multiple first-round candidate solvers from the solver framework may include: sampling multiple solvers from the search space constrained by the solver framework as the first-generation population of the first round of search, evaluating the true performance of each solver (that is, population individual) in the first-generation population as the fitness of the population individual, based on the true performance of each solver in the first-generation population, performing evolutionary operations on the population individuals in the first-generation population to obtain the second-generation population, and then evaluating the second-generation population. The actual performance of each solver in the population is obtained, and then based on the actual performance of each solver in the second generation population, the second generation population is evolved to obtain the third generation population, until the preset evolution termination condition is met, and the last generation population is output as multiple first-round candidate solvers searched out by the first round search process, and the actual performance of each first-round candidate solver is evaluated, and then, the initial performance predictor (that is, the 0th round performance predictor) is trained using multiple first-round candidate solvers and the actual performance of each first-round candidate solver to obtain the trained first-round performance predictor;
[0090] In the second round of search, the process of evolutionarily searching for multiple second round candidate solvers from the solver framework may include: sampling multiple solvers from the search space constrained by the solver framework as the first generation population for the second round of search, at this time using the trained first round performance predictor to predict the performance of each solver (i.e., population individual) in the first generation population, obtaining the predicted performance of each solver in the first generation population as the fitness of the population individual, based on the predicted performance of each solver in the first generation population, performing evolutionary operations on the population individuals in the first generation population to obtain the second generation population, and then using the first round performance predictor to predict the performance of each solver in the first generation population. The first-round performance predictor predicts the performance of each solver in the second-generation population, and then based on the predicted performance of each solver in the second-generation population, the second-generation population is evolved to obtain a third-generation population, until a preset evolution termination condition is met, and the last-generation population is output as a plurality of second-round candidate solvers searched out by the second-round search process, and the true performance of each second-round candidate solver is evaluated, and then, the first-round performance predictor is trained using the plurality of second-round candidate solvers and the true performance of each second-round candidate solver to obtain a trained second-round performance predictor;
[0091] In the third round of search, the process of evolutionarily searching for multiple third-round candidate solvers from the solver framework may include: sampling multiple solvers from the search space constrained by the solver framework as the first-generation population for the third round of search, at this time using the second-round performance predictor after training to predict the performance of each solver (i.e., population individual) in the first-generation population to obtain the predicted performance of each solver in the first-generation population, based on the predicted performance of each solver in the first-generation population, performing evolutionary operations on the population individuals in the first-generation population to obtain the second-generation population, and then using the second-round performance predictor to predict the performance of each solver in the second-generation population, and then performing evolutionary operations on the second-generation population based on the predicted performance of each solver in the second-generation population to obtain the third-generation population, until the preset evolution termination condition is met, outputting the last-generation population as the multiple third-round candidate solvers searched out by the third round of search, and evaluating the actual performance of each third-round candidate solver. Among them, in the third round of search process, the multiple third round candidate solvers and each candidate solver can be used to train the above-mentioned second round performance predictor, and of course the second round performance predictor can no longer be trained, which is not limited by the embodiment of the present disclosure. It should be understood that the multiple candidate solvers searched from the preset solver framework include the multiple first round candidate solvers, multiple second round candidate solvers, and multiple third round candidate solvers obtained by the above three rounds of evolutionary search process.
[0092] In practical applications, the above-mentioned performance predictor can adopt any neural network model, machine learning model, etc. in the art, and the embodiments of the present disclosure are not limited to this. The number of candidate solvers searched out in each round of search process can be set according to actual needs. For example, if 200 candidate solvers need to be generated through 3 rounds of search processes, the first round of search process can be set to evolutionarily search and truly evaluate 50% of the total candidate solvers, and the subsequent two rounds of search processes can be evolutionarily searched and truly evaluated. 25% of the total candidate solvers, that is, 100 candidate solvers can be searched and evaluated in the first round, and 50 candidate solvers can be searched and evaluated in the second and third rounds respectively.
[0093] Among them, the real performance evaluation method provided in the above-mentioned embodiment of the present disclosure can be referred to to realize the evaluation of the real performance of the j-th round candidate solvers in the above-mentioned rounds of search, and the evaluation of the real performance of each solver in each generation population in the first round of search, which will not be elaborated here.
[0094] In practical applications, after obtaining multiple candidate solvers searched from the solver framework and the actual performance of each candidate solver through the above step S22, in step S23, the candidate solver with the highest actual performance can be determined from the multiple candidate solvers according to the actual performance of each candidate solver as the target solver corresponding to the diffusion probability model. Of course, the candidate solver whose actual performance meets the specified performance can also be selected as the target solver according to actual needs, and the embodiment of the present disclosure is not limited to this. Furthermore, after obtaining the target solver corresponding to the diffusion probability model, the target solver can be used to solve the diffusion probability model of the input description text to obtain the target image generated by the diffusion probability model. Among them, the embodiment of the present disclosure does not limit the specific operation process of using the target solver to solve the diffusion probability model, and the diffusion probability model can be used to generate a target image that conforms to the description text.
[0095] According to an embodiment of the present disclosure, a plurality of candidate solvers are searched from a preset solver framework based on a specified number of steps required for solving a diffusion probability model, each candidate solver includes a solution strategy corresponding to each time step in a plurality of time steps, and then a target solver for solving the diffusion probability model is selected based on the actual performance of each candidate solver, so that the selected target solver has the optimal solution strategy under the specified number of steps, thereby effectively improving the performance of the target solver in solving the diffusion probability model, especially the target solver includes a solution strategy corresponding to each time step, which can effectively improve the image generation quality and generation efficiency of the diffusion probability model under a smaller number of steps.
[0096] The above-mentioned embodiment of the present disclosure proposes a solver framework for the uniformity of the diffusion probability model, and the above-mentioned solver framework includes several decision items, and each decision item has several strategies to choose from. In addition, the use of the above-mentioned solver framework can enable the target solver to use an independent solution strategy in each step of the solution. By using corresponding strategies for different decision items, the solver framework can unify the existing exponential integral-based solvers into the framework. And, based on the above-mentioned solver framework, the embodiment of the present disclosure also proposes a multi-stage search method based on a performance predictor, which can efficiently search for the optimal solution strategy under a given step limit. The embodiment of the present disclosure has also been tested on multiple data sets, and better solution effects have been achieved than existing solvers. For example, Table 2 shows the test results of the solution performance of the target solver and the existing solver generated by the embodiment of the present disclosure on some data sets (LSUN.Bedroom, ImageNet-128, ImageNet-256).
[0097] Table 2 Performance test results
[0098]
[0099] Among them, the performance value in Table 2 is measured by FID. The baseline solver can select existing solvers such as DPM-Solver, DPM-Solver++ and UniPC that use multi-step methods. The embodiments of the present disclosure test the commonly used empirical solution strategies configured by these baseline solvers, including 2nd and 3rd order DPM-Solver, 2nd and 3rd order DPM-Solver++, 3rd order UniPC, etc. The baseline solver-W in the above Table 2 represents the worst solution strategy among all configurations; the baseline solver-B represents the best solution strategy among all configurations. It can be seen from Table 2 that within 4-10 steps, the solution performance of the target solver provided by the embodiment of the present disclosure on each data set is higher than the best solution strategy configured by the existing baseline solver. In addition, the embodiments of the present disclosure are also tested on the stable diffusion model with a wide range of application scenarios, and the performance test results shown in Table 3 are obtained.
[0100] Table 3 Performance test results
[0101]
[0102] As can be seen from Table 3, the target solver of the embodiment of the present disclosure has significantly improved solution performance compared to the best solution strategy configured by all baseline solvers. Target Solver-500 / Target Solver-250 in Table 3 respectively represent the results of using only 500 or 250 images for real performance evaluation during search, which shows that under the condition of low search overhead, the solution performance of the target solver of the embodiment of the present disclosure can still be greatly improved, which is better than the solution effect of any existing baseline solver.
[0103] Figure 5 A block diagram of a Wensheng graph device based on a diffusion probability model according to an embodiment of the present disclosure is shown, as shown in FIG. Figure 5 As shown, the device comprises:
[0104] The text acquisition module 501 is used to acquire the description text of the image to be generated;
[0105] An image generation module 502, used for inputting the description text into the diffusion probability model, and solving the diffusion probability model using a target solver to obtain a target image generated by the diffusion probability model;
[0106] The process of generating the target solver includes:
[0107] Obtaining a specified number of steps corresponding to the diffusion probability model, where the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model;
[0108] Based on the specified number of steps, multiple candidate solvers are searched out according to a preset solver framework and the real performance of each candidate solver is evaluated, each candidate solver includes a solution strategy corresponding to each time step in multiple time steps corresponding to the specified number of steps, the solver framework is used to constrain the search space of the solution strategy, and the real performance represents the quality of the image obtained by using the candidate solver to solve the diffusion probability model;
[0109] According to the actual performance of each candidate solver, a target solver corresponding to the diffusion probability model is determined from the multiple candidate solvers.
[0110] In a possible implementation, the solver framework includes at least one of the following:
[0111] The type of neural network includes a noise prediction network and a data prediction network, wherein the noise prediction network is used to predict the noise part of the diffusion probability model input, and the data prediction network is used to predict the data part of the diffusion probability model input;
[0112] a starting point for differentiating a time step, the starting point including a time step preceding the time step;
[0113] A value range of a retention order of Taylor expansion of the diffusion probability model, wherein the value range of the retention order of Taylor expansion includes integers between 1 and 4;
[0114] A derivative estimation method for each order of derivatives in the Taylor expansion of the diffusion probability model;
[0115] whether to use a corrector, the corrector being used to correct the data value output by the diffusion probability model at any time step;
[0116] A selection position of each time step in a plurality of time steps corresponding to the specified number of steps;
[0117] Whether to use the input data of the neural network at the maximum time step instead of the output data of the neural network at the maximum time step;
[0118] Whether to scale the time step encoding results of the neural network at different time steps, and the time step encoding scaling factor used when scaling the time step encoding result of the neural network at any time step, wherein the time step encoding scaling factor is used to scale the time step encoding result.
[0119] In a possible implementation, the derivative estimation method includes performing Taylor differencing on the derivative and adjusting the amplitude of the Taylor differencing result; the solver framework also includes: a value range of the number of additional points used for Taylor differencing of the k-order derivative, the additional points include the time step of the calculated data value before the current time step of the data value to be calculated, and the value range of the number of additional points m includes k≤m≤n, k represents the order of the derivative to be estimated, and n represents the retained order of Taylor expansion of the diffusion probability model; and / or, an adjustment coefficient used for amplitude adjustment of the Taylor differencing result of the k-order derivative, the adjustment coefficient includes a value that conforms to 1+O(h k ) form, O(h k ) represents the accuracy of the Taylor difference result of the k-th order derivative, h k Represents the step size between the current time step and the extra point.
[0120] In one possible implementation, the neural network includes an encoder and a decoder, and there are multiple jump connections between multiple encoding layers in the encoder and multiple decoding layers in the decoder; wherein the solver framework also includes: whether to scale the feature data transmitted by multiple jump connections of the neural network at different time steps, and when scaling the feature data transmitted by multiple jump connections of the neural network at different time steps, a combination of jump connection scaling coefficients used at different time steps, the jump connection scaling coefficient combination including the jump connection scaling coefficients corresponding to each of the multiple jump connections, and the jump connection scaling coefficients are used to scale the feature data transmitted by the jump connections.
[0121] In a possible implementation, the solution strategy corresponding to any time step includes at least one of the following: the type of neural network, the selected position of the time step, the starting point corresponding to the time step, the retained order of Taylor expansion, the derivative estimation method of each order of derivatives in the Taylor expansion, whether to use a corrector, whether to use the input data of the neural network with the maximum time step instead of the output data of the neural network with the maximum time step, whether to scale the time step encoding results of different time steps, the time step encoding scaling factor used when scaling the time step encoding result of any time step, whether to scale the feature data transmitted by multiple jump connections of neural networks with different time steps, and the jump connection scaling factor combination used for different time steps when scaling the feature data transmitted by multiple jump connections of neural networks with different time steps; wherein the derivative estimation method includes the number of additional points used for Taylor difference and / or the adjustment coefficient used for amplitude adjustment of Taylor difference results.
[0122] In a possible implementation, based on the specified number of steps, multiple candidate solvers are searched out from a preset solver framework and the actual performance of each candidate solver is evaluated, including: in the j-th round of search, based on the specified number of steps, multiple j-th round candidate solvers are evolutionarily searched out from the solver framework, and the actual performance of each j-th round candidate solver is evaluated, j∈[1,L], L is the total number of search rounds; using the multiple j-th round candidate solvers and the actual performance of each j-th round candidate solver, a j-1-th round performance predictor is trained to obtain a trained j-th round performance predictor, which is used to predict the performance of the solver; wherein, when j=1, the evolutionary search performed in the first round of search is performed based on the actual performance of the solver, and when j is greater than 1, the evolutionary search performed in the j-th round of search is performed on the performance predicted by the j-1-th round performance predictor for the solver.
[0123] In a possible implementation, the evaluating the true performance of each candidate solver includes: based on the sample text, using each candidate solver to solve the diffusion probability model respectively to obtain the image data solved by each candidate solver; based on a preset image quality evaluation index, evaluating the image quality of the image data solved by each candidate solver respectively, wherein the true performance includes the image quality of the image data.
[0124] According to an embodiment of the present disclosure, based on the specified number of steps required to solve the diffusion probability model, multiple candidate solvers are searched according to a preset solver framework, each candidate solver includes a solution strategy corresponding to each time step in multiple time steps, and then a target solver for solving the diffusion probability model is selected according to the actual performance of each candidate solver, so that the selected target solver can have the optimal solution strategy under the specified number of steps, thereby effectively improving the performance of the target solver in solving the diffusion probability model, especially the target solver contains a solution strategy corresponding to each time step, which can effectively improve the image generation quality and generation efficiency of the diffusion probability model under a smaller number of steps.
[0125] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0126] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0127] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0128] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0129] Figure 6 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 6, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0130] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0131] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0132] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0133] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: 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), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0134] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0135] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0136] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0137] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0138] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0139] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0140] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A Wensheng diagram method based on a diffusion probability model, characterized in that: include: Get the description text of the image to be generated; Inputting the description text into the diffusion probability model, and solving the diffusion probability model using a target solver to obtain a target image generated by the diffusion probability model; The process of generating the target solver includes: Obtaining a specified number of steps corresponding to the diffusion probability model, where the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model; Based on the specified number of steps, multiple candidate solvers are searched out according to a preset solver framework and the real performance of each candidate solver is evaluated, each candidate solver includes a solution strategy corresponding to each time step in multiple time steps corresponding to the specified number of steps, the solver framework is used to constrain the search space of the solution strategy, and the real performance represents the quality of the image obtained by using the candidate solver to solve the diffusion probability model; According to the actual performance of each candidate solver, a target solver corresponding to the diffusion probability model is determined from the multiple candidate solvers.
2. The method according to claim 1, characterized in that The solver framework includes at least one of the following: The type of neural network includes a noise prediction network and a data prediction network, wherein the noise prediction network is used to predict the noise part of the diffusion probability model input, and the data prediction network is used to predict the data part of the diffusion probability model input; a starting point for differentiating a time step, the starting point including a time step preceding the time step; A value range of a retention order of Taylor expansion of the diffusion probability model, wherein the value range of the retention order of Taylor expansion includes integers between 1 and 4; A derivative estimation method for each order of derivatives in the Taylor expansion of the diffusion probability model; whether to use a corrector, the corrector being used to correct the data value output by the diffusion probability model at any time step; A selection position of each time step in a plurality of time steps corresponding to the specified number of steps; Whether to use the input data of the neural network at the maximum time step instead of the output data of the neural network at the maximum time step; Whether to scale the time step encoding results of the neural network at different time steps, and the time step encoding scaling factor used when scaling the time step encoding result of the neural network at any time step, wherein the time step encoding scaling factor is used to scale the time step encoding result.
3. The method according to claim 2, characterized in that The derivative estimation method includes performing Taylor difference on the derivative and adjusting the amplitude of the Taylor difference result; the solver framework also includes: a range of values of the number of additional points used for Taylor differencing of a k-order derivative, the additional points including time steps at which data values have been calculated before a current time step at which data values are to be calculated, the range of values of the number of additional points m including k≤m≤n, k representing the order of the derivative to be estimated, and n representing the retained order of Taylor expansion of the diffusion probability model; and / or, The adjustment coefficient used to adjust the amplitude of the Taylor difference result of the k-th order derivative includes the following: k ) form, O(h k ) represents the accuracy of the Taylor difference result of the k-th order derivative, h k Represents the step size between the current time step and the extra point.
4. The method according to claim 3, characterized in that The neural network includes an encoder and a decoder, and multiple jump connections exist between multiple encoding layers in the encoder and multiple decoding layers in the decoder; wherein the solver framework also includes: Whether to scale feature data transmitted by multiple skip connections of a neural network at different time steps, and, when scaling feature data transmitted by multiple skip connections of a neural network at different time steps, a combination of skip connection scaling coefficients used at different time steps, wherein the combination of skip connection scaling coefficients includes skip connection scaling coefficients corresponding to each of the multiple skip connections, and the skip connection scaling coefficients are used to scale the feature data transmitted by the skip connections.
5. The method according to claim 4, characterized in that The solution strategy corresponding to any time step includes at least one of the following: the type of neural network, the selected position of the time step, the starting point corresponding to the time step, the retained order of Taylor expansion, the derivative estimation method of each order of derivatives in the Taylor expansion, whether to use a corrector, whether to use the input data of the neural network with the maximum time step instead of the output data of the neural network with the maximum time step, whether to scale the time step encoding results of different time steps, the time step encoding scaling factor used when scaling the time step encoding result of any time step, whether to scale the feature data transmitted by multiple jump connections of neural networks with different time steps, and the jump connection scaling factor combination used for different time steps when scaling the feature data transmitted by multiple jump connections of neural networks with different time steps; wherein the derivative estimation method includes the number of additional points used for Taylor difference and / or the adjustment coefficient used for amplitude adjustment of Taylor difference results.
6. The method according to any one of claims 1 to 5, characterized in that: Based on the specified number of steps, searching for multiple candidate solvers according to a preset solver framework and evaluating the actual performance of each candidate solver includes: In the j-th round search process, based on the specified number of steps, multiple j-th round candidate solvers are evolutionarily searched from the solver framework, and the actual performance of each j-th round candidate solver is evaluated, j∈[1,L], L is the total number of search rounds; Using the multiple j-th round candidate solvers and the actual performance of each j-th round candidate solver, a j-1-th round performance predictor is trained to obtain a trained j-th round performance predictor, where the performance predictor is used to predict the performance of the solver; Among them, when j=1, the evolutionary search performed in the first round of search is based on the actual performance of the solver. When j is greater than 1, the evolutionary search performed in the j-th round of search is based on the performance predicted by the j-1-th round performance predictor for the solver.
7. The method according to any one of claims 1 to 5, characterized in that: The evaluation of the actual performance of each candidate solver includes: Based on the sample text, using each candidate solver to respectively solve the diffusion probability model to obtain image data solved by each candidate solver; Based on a preset image quality evaluation index, the image quality of the image data solved by each candidate solver is evaluated respectively, wherein the true performance includes the image quality of the image data.
8. A Wensheng graph device based on a diffusion probability model, characterized in that: include: A text acquisition module is used to obtain the description text of the image to be generated; An image generation module, used for inputting the description text into the diffusion probability model, and solving the diffusion probability model using a target solver to obtain a target image generated by the diffusion probability model; The process of generating the target solver includes: Obtaining a specified number of steps corresponding to the diffusion probability model, where the specified number of steps is used to indicate the number of time steps required to solve the diffusion probability model; Based on the specified number of steps, multiple candidate solvers are searched out according to a preset solver framework and the real performance of each candidate solver is evaluated, each candidate solver includes a solution strategy corresponding to each time step in multiple time steps corresponding to the specified number of steps, the solver framework is used to constrain the search space of the solution strategy, and the real performance represents the quality of the image obtained by using the candidate solver to solve the diffusion probability model; According to the actual performance of each candidate solver, a target solver corresponding to the diffusion probability model is determined from the multiple candidate solvers.
9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 7 when executing the instructions stored in the memory.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Model processing method and system, electronic equipment and storage medium
CN119273927A
Model processing method, system, electronic device and storage medium
CN119273927B
Diffusion model reasoning acceleration method based on optimal time step sequence search and knowledge distillation
CN121809699A
Diffusion model inference acceleration method based on optimal time step sequence search and knowledge distillation
CN121809699B
