Control parameter fine adjustment method for Chinese graph generation model in field of agricultural artificial intelligence
By using Euclidean distance and optimization methods to automatically adjust control parameters in the text generation picture model in the field of agricultural artificial intelligence, the problem that parameter settings in the existing technology cannot meet the diverse needs is solved, and high quality and high accuracy are achieved. The image generation improves the intelligence level of the model.
Patent Information
- Application Number
- CN202410768872.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
It is difficult for existing text-generated image models to dynamically adjust the parameters of generated images in agricultural applications, resulting in the inability to meet the diverse requirements for image quality and diversity of different text contents.
By obtaining the original text, randomly generate control parameters, generate pictures and calculate Euclidean distance, use optimization methods to find the optimal parameter combination, dynamically adjust the generated parameters to fit the text content, and use Gaussian process regression and Bayesian or local extreme value search Optimization method, automated parameter tuning.
It achieves image generation of higher quality and accuracy, reduces the complexity of manual parameter adjustment, improves the intelligence level and adaptability of the model, and meets the high requirements for image quality and accuracy in agricultural applications.
Smart Images

Figure CN118799449A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of agricultural artificial intelligence technology, and in particular to a control parameter fine-tuning method for a Chinese image generation model in the field of agricultural artificial intelligence. Background Art
[0002] In the field of agricultural artificial intelligence, text-generated image models are very important innovative tools, mainly used in agricultural landscape design, crop monitoring, education and training, and agricultural propaganda. Currently, the most widely cited text-generated image models in this field include DALL·E, CLIP+VQ-GAN, and Stable Diffusion. After completing the text generation model training, these three models can generate corresponding images based on the input text description, which greatly facilitates the generation and visualization of image data in agricultural applications.
[0003] Although these models perform well in generating images, setting the parameters of the generated images is a key step in practical use. For example, controlling the quality and diversity of the generated images requires setting specific parameters. These parameters usually include the resolution, number of steps, seed value, etc. of the generated images. In most cases, these parameters are set empirically, and once set, they will have a consistent impact on all text-generated images. However, different text content in agricultural applications has different requirements for the quality and diversity of generated images. For example, crop disease detection may require high-quality and highly accurate images, while designing farmland landscapes may place more emphasis on image diversity and creativity. Unified parameter settings cannot meet these diverse needs. Summary of the invention
[0004] In view of this, the present invention provides a control parameter fine-tuning method for the Chinese image generation model in the field of agricultural artificial intelligence. By utilizing the feedback of text-generated images, the generation parameters are dynamically adjusted without retraining the generation model, so that the final output image is more in line with the text content.
[0005] The technical purpose of the present invention is achieved in this way:
[0006] The present invention provides a control parameter fine-tuning method for a Chinese image model in the field of agricultural artificial intelligence, comprising the following steps:
[0007] S1 obtains the original text, inputs the original text into the text-to-graph model, randomly generates n control parameters, generates an image based on each control parameter, regenerates text from the generated image through the graph-to-text model, calculates the Euclidean distance between the original text and the generated text, and binds the control parameters and the corresponding Euclidean distances into groups to form n parameter combinations;
[0008] S2 uses an optimization method to optimize n parameter combinations to obtain the optimal parameter combination, uses the control parameters of the optimal parameter combination as the optimal control parameters, and outputs the corresponding generated image as the result.
[0009] Based on the above solution, preferably, step S1 includes:
[0010] S11 obtains the original text and obtains the word vector V0 of the original text;
[0011] S12 sets the random number n of control parameters;
[0012] S13 sets the initial value i=1;
[0013] S14 generates control parameter C according to random formula i ;
[0014] S15 uses the current control parameter C i Generate images;
[0015] S16 inputs the generated image into the image-to-text model, regenerates the text, and obtains the word vector V of the generated text i ;
[0016] S17 calculates the word vector V0 of the original text and the word vector V of the generated text i The Euclidean distance d i ;
[0017] S18 determines whether i is greater than or equal to n. If so, the control parameter C i After normalization, the control parameters and the corresponding Euclidean distances are bound into groups to form n parameter combinations. If not, set i=i+1 and return to step S14.
[0018] Based on the above scheme, preferably, the random formula is:
[0019]
[0020] In the formula, C i is the control parameter, i∈[1,n], Upper represents the maximum value of the control parameter, Lower represents the minimum value of the control parameter, n is the number of random times, and rand(0,1) is a random function that generates random numbers between 0 and 1.
[0021] On the basis of the above scheme, preferably, the optimization method is an optimization method based on Gaussian process regression and Bayesian or an optimization method based on local extreme value search.
[0022] Based on the above scheme, preferably, the optimization method based on Gaussian process regression and Bayesian includes:
[0023] A1. Construct a Gaussian process regression model, use the control parameters in the n parameter combinations as the input of the Gaussian process regression model, use the corresponding Euclidean distance as the output of the Gaussian process regression model, determine the kernel function of the Gaussian process regression model, and set the parameters of the kernel function, including the initial value and the optimization range, train the Gaussian process regression model using the n parameter combinations, predict the n parameter combinations according to the trained Gaussian process regression model, and select the output with the smallest Euclidean distance as the target distance;
[0024] A2. Set the search range of the control parameter, use Bayesian to solve the control parameter value corresponding to the target distance, use the control parameter value to set the target control parameter, apply it to the text-graph model, verify the generated image, and compare whether the Euclidean distance d between the generated text and the original text is less than the minimum Euclidean distance in the n sets of parameter combinations. If so, use the target control parameter as the optimal control parameter. If not, select the control parameter corresponding to the minimum Euclidean distance in the n sets of parameter combinations as the optimal control parameter.
[0025] Based on the above solution, preferably, step A1 includes:
[0026] A1.1 Each control parameter is assumed to contain two variables, namely h i and k i ;
[0027] A1.2 Construct a Gaussian process regression model. Set the Gaussian process regression model input as matrix C, which is composed of a one-dimensional vector C i Composition, each one-dimensional vector C i Contains h i and k i , set the Gaussian process regression model output to D, D is a one-dimensional vector, consisting of n d i Composition, d i Refers to the Euclidean distance among parameter combinations;
[0028] A1.3 Take D as a set, calculate the mean of D, and calculate the variance σ of D according to the mean and variance formula of D 2 ;
[0029] A1.4 Calculate the Euclidean distance of each row of matrix C to form a distance set, calculate the mean of the distance set, and calculate the variance β of C based on the mean and variance formula of the distance set 2 ;
[0030] A1.5 Set the kernel function of the Gaussian process regression model, which is composed of a constant kernel and an RBF kernel. The initial value of the constant kernel is σ 2 , the parameter in the RBF kernel is β 2 The optimization range of constant kernel and RBF kernel is 10 -2-10 2 ;
[0031] A1.6 Use n sets of parameter combinations to train the Gaussian process regression model and optimize the parameters of the kernel function by maximizing the marginal likelihood;
[0032] A1.7 takes the control parameters in the n sets of parameter combinations as input, uses the trained Gaussian process regression model to predict the Euclidean distance, and selects the minimum value of the n predicted Euclidean distances as the target distance.
[0033] Based on the above solution, preferably, step A2 includes:
[0034] A2.1 Setting the two variables h of the control parameters i and k i The boundary value of
[0035] A2.2 Use Bayesian optimization to solve h and k corresponding to the target distance;
[0036] A2.3 In the Vincent graph model, h and k are used to set the control parameters;
[0037] A2.4 Take the original text as input, generate an image using the text-to-graph model, input the generated image into the graph-to-text model to obtain the generated text, and calculate the Euclidean distance d between the original text and the generated text;
[0038] A2.5 determines whether d is less than the minimum value of the Euclidean distance among the n parameter combinations. If so, proceed to step A2.6; if not, proceed to step A2.7;
[0039] A2.6 Take h and k as the optimal variables, and the control parameters set by h and k are the optimal control parameters;
[0040] A2.7 Set h corresponding to the minimum value of the Euclidean distance among the n parameter combinations i and k i As the optimal variable, the control parameters it sets are the optimal control parameters.
[0041] On the basis of the above scheme, preferably, the optimization method based on local extreme value search includes:
[0042] B1. Find the local extreme point in n parameter combinations according to the Euclidean distance. The local extreme point refers to the control parameter with the minimum Euclidean distance in its neighborhood.
[0043] B2. Use the network search method to search near each local extreme point, use the search results as the network extreme value set, and select the control parameter corresponding to the minimum Euclidean distance in the network extreme value set as the optimal control parameter.
[0044] Based on the above solution, preferably, step B1 includes:
[0045] B1.1 Construct a data set in sequence by combining n parameters. Each element in the data set includes two variables h controlling the parameters. i , k i And the corresponding Euclidean distance d i ;
[0046] B1.2 Set i=1;
[0047] B1.3 Select an element i in the data set;
[0048] B1.4 If d i <d i-1 And d i <d i+1 , then d i is an extreme value, go to step B1.5; otherwise, go to step B1.6;
[0049] B1.5 will be i The corresponding variable h i , k i As a local extreme point, add it to the local extreme value set;
[0050] B1.6 determines whether i is equal to n. If so, proceed to step B1.7. If not, set i=i+1 and return to step B1.4.
[0051] B1.7 If d n <d n-1 , then d n is an extreme value, go to step B1.8; otherwise, go to step B1.9;
[0052] B1.8 will be d n The corresponding variable h n , k n As a local extreme point, add it to the local extreme value set;
[0053] B1.9 outputs a set of local extreme values.
[0054] Based on the above solution, preferably, step B2 includes:
[0055] B2.1 Set the parameters Δh = 0.01, Δk = 1, and the maximum number of recursive layers Maxlay = 3, where Δh and Δk are used to calculate new grid control parameters, and the maximum number of recursive layers Maxlay is the number of recursive times of the network search;
[0056] B2.2 selects an element in the local extreme value set, which includes the Euclidean distance and two variables h and k of the control parameter;
[0057] B2.3 Set the current recursion number t = 1;
[0058] B2.4 assigns the Euclidean distance of the current element to the Dmin variable;
[0059] B2.5 generates 8 new control parameters around the current element based on h and k, forming a parameter set, and performs deduplication processing;
[0060] B2.6 Set the control parameters in the parameter set to the text-to-graph model and generate a picture, then use the graph-to-text model to obtain generated text, calculate the Euclidean distance between the generated text and the original text, and add the control parameters of the calculated Euclidean distance to the calculated set;
[0061] B2.7 compares the minimum Euclidean distance dnet in the calculated set with Dmin. If Dmin is smaller than dnet, proceed to step B2.11. Otherwise, proceed to step B2.8.
[0062] B2.8 Check whether the current recursion number t reaches the maximum recursion layer number Maxlay. If so, end the search and go to step B2.12. If not, go to step B2.9.
[0063] B2.9 Replace h and k of the current element with h and k corresponding to dnet;
[0064] B2.10 Let t=t+1, and return to step B2.4;
[0065] B2.11 adds the control parameter of the current element to the final extreme value set and proceeds to step B2.13;
[0066] B2.12 adds the control parameters corresponding to dnet to the final extreme value set and proceeds to step B2.13;
[0067] B2.13 determines whether all elements in the local extreme value set are traversed. If so, select the element with the smallest Euclidean distance from the final extreme value set. The control parameter contained in this element is the optimal control parameter. If not, return to step B2.2.
[0068] The method of the present invention has the following beneficial effects compared with the prior art:
[0069] (1) The present invention achieves higher quality and higher accuracy image generation in the text-to-image model through automated control parameter optimization. The method uses the Euclidean distance between the generated text and the original text for verification and tuning, ensuring that the generated image accurately reflects the content described in the original text, thereby meeting the high requirements for image quality and accuracy in agricultural applications;
[0070] (2) The present invention uses optimization methods, such as Gaussian process regression and Bayesian optimization methods or local extreme value search-based optimization methods, to automate the parameter fine-tuning process, reducing the complexity of traditional manual parameter adjustment. This self-optimization capability enables the model to dynamically adapt to different scenarios and needs, improves the model's intelligence level, and demonstrates higher efficiency and convenience in agricultural production;
[0071] (3) The present invention improves the adaptability of the text-generated image model to different text descriptions and enhances its wide application in the agricultural field. Through continuous optimization and learning, the model can generate high-quality images in a variety of agricultural application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0073] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0074] Figure 2 It is a schematic diagram of the principle of an embodiment of the present invention;
[0075] Figure 3 It is a schematic diagram of the implementation process of an embodiment of the present invention;
[0076] Figure 4 A flow chart of a random experiment according to an embodiment of the present invention;
[0077] Figure 5 A flow chart of model training of Example 1 provided by the present invention;
[0078] Figure 6 The Bayesian optimization flow chart of Example 1 provided by the present invention;
[0079] Figure 7 A schematic diagram of an optimization method based on local extreme value search according to Embodiment 2 of the present invention;
[0080] Figure 8 The extreme value search flow chart of embodiment 2 provided by the present invention;
[0081] Fig. 9 This is a network search flow chart of Example 2 provided by the present invention. DETAILED DESCRIPTION
[0082] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0083] like Figure 1 As shown, the present invention provides a control parameter fine-tuning method for a Chinese raw image model in the field of agricultural artificial intelligence, comprising the following steps:
[0084] S1 obtains the original text, inputs the original text into the text-to-graph model, randomly generates n control parameters, generates an image based on each control parameter, regenerates text from the generated image through the graph-to-text model, calculates the Euclidean distance between the original text and the generated text, and binds the control parameters and the corresponding Euclidean distances into groups to form n parameter combinations;
[0085] S2 uses an optimization method to optimize n parameter combinations to obtain the optimal parameter combination, uses the control parameters of the optimal parameter combination as the optimal control parameters, and outputs the corresponding generated image as the result.
[0086] See also Figure 2 , the principle of the present invention is as follows:
[0087] First, by introducing the image-to-text model, the model of text-to-image generation is fed back and the feedback results are quantitatively evaluated to form multiple sets of control parameters C i and the corresponding distance value d i Randomly generate multiple sets of control parameters C i , using these parameters to generate images. Then, the generated images are converted back to text descriptions through the graph-to-text model, and these text descriptions are converted into corresponding word vectors V i Next, compare it with the word vector V0 of the original text and calculate the distance d under this set of control parameters. i .
[0088] After a piece of original text is input, the control parameter C of the text generated image is randomly selected within the set range. i These control parameters should include temperature and Top-K sampling. For example, temperature controls the randomness of the image generation process, and its value range is (0,1]; Top-K sampling controls the K most likely options considered at each step of image generation, and its value range is generally between [1,100]. Other control parameters have similar setting ranges.
[0089] Images can be generated through original text and control parameters. The generated images are input into the trained image-to-text model, the corresponding text description is generated in reverse, and the generated text is converted into word vector V i . Since the original word vector V0 and V i The dimensions are the same, and the distance d between them can be calculated using the Euclidean distance calculation formula i By comparing the word vector distance between the original input text and the generated text, we get an indicator to measure the fit between the text and the image. The smaller the value, the more the image generated by the text fits the original text, which indirectly explains the control parameter C i More suitable.
[0090] Special note: If the text-to-image model is set to generate multiple images at once, multiple text descriptions will be generated through the image-to-text model, and multiple word vectors will be generated. In this case, the distance between each word vector and the original word vector needs to be calculated, and the average of the multiple distances is d i .
[0091] Assume that under given text input conditions, there is a nonlinear relationship between the control parameter and the distance. By randomly modifying the control parameter, multiple sets of data can be generated. Based on these data, a nonlinear model or a local extremum search algorithm is established. The ultimate goal is to find the best control parameter. Set this control parameter to the Wensheng graph, and its distance is the minimum after calculation.
[0092] The present invention adopts two methods to obtain the optimal control parameters:
[0093] 1. Gaussian process regression and Bayesian optimization: First, a Gaussian process regression model is established based on the existing data, and then the Bayesian optimization technique is used to solve the control parameters that minimize the distance on this model.
[0094] 2. Local extreme value search: Assuming that the optimal control parameter must be near the extreme value with the smallest distance in the known data, first find the extreme point with the smallest distance through the existing data, and then perform a more refined grid search near the extreme point, gradually approaching, so as to obtain the optimal control parameter.
[0095] Both methods can improve the consistency and fit between the final output image and the text content by dynamically adjusting the control parameters without retraining the generative model.
[0096] See also Figure 3 , the specific implementation process of the present invention is:
[0097] In the trained text-to-image model, given a text input, there is a nonlinear relationship between the control parameters and the quality of the generated image. Gaussian process regression and Bayesian optimization techniques or local extreme value search can be used to solve a set of optimal control parameters while ensuring the highest image quality. This set of control parameters can ensure that in the text-to-image model, the generated image has the highest quality and is most consistent with the original text content.
[0098] Specifically, step S1 includes:
[0099] S11 obtains the original text and obtains the word vector V0 of the original text;
[0100] S12 sets the random number n of control parameters;
[0101] S13 sets the initial value i=1;
[0102] S14 generates control parameter C according to random formula i ;
[0103] S15 uses the current control parameter C i Generate images;
[0104] S16 inputs the generated image into the image-to-text model, regenerates the text, and obtains the word vector V of the generated text i ;
[0105] S17 calculates the word vector V0 of the original text and the word vector V of the generated text i The Euclidean distance d i ;
[0106] S18 determines whether i is greater than or equal to n. If so, the control parameter C i After normalization, the control parameters and the corresponding Euclidean distances are bound into groups to form n parameter combinations. If not, set i=i+1 and return to step S14.
[0107] Among them, the control parameter C is randomly generated each time. i When the values are different and each control parameter can be fully covered within its value range, the following random formula is used to generate random variables:
[0108]
[0109] In the formula, C i is the control parameter, i∈[1,n], Upper represents the maximum value of the control parameter, Lower represents the minimum value of the control parameter, n is the number of random times, and rand(0,1) is a random function that generates random numbers between 0 and 1.
[0110] In the present invention, all control parameters are randomly generated in accordance with the above random formula. i The value of the control parameter is rounded off. This embodiment assumes that the control parameter only includes temperature (denoted as h i ) and Top-K sampling (denoted as k i ) but the process can be extended to more parameters, the steps remain the same.
[0111] Here C i It is by h i and k i The vector is composed of the following form:
[0112] In this embodiment, the set n represents the number of data sets for which the distance between the control parameter and the corresponding word vector needs to be calculated. Specifically, setting n = 16 means that 16 operations of randomly generating control parameters are required, and then the distance between these parameters and the word vector corresponding to the original text is calculated. This value is related to the computing power: the greater the computing power, the larger the n value can be set; when the computing power is smaller, the n value should be set smaller. However, in order to ensure the accuracy of the optimization process, n should be at least 10.
[0113] See also Figure 4 In one embodiment of the present invention, the specific implementation of step S1 is as follows:
[0114] Step 1: Get the original text: In the text graph model, the text at the input is the original text. Before making the text graph, get the text first. After completion, proceed to step 2.
[0115] Step 2: Get the original text word vector V0: Extract the original text information and calculate the word vector V0 corresponding to the text. In this embodiment, V0 is a 768-dimensional one-dimensional vector, which will be used as the basis for calculating the distance of the generated text in subsequent steps. After completion, proceed to step 3.
[0116] Step 3: Set the number of random trials n: Set the number of random trials n. In this embodiment, n=16. Before determining the optimal generation parameters, it is necessary to randomly generate n control parameters using the original text and obtain the distances between the n parameters and the original text. After completion, proceed to step 4.
[0117] Step 4: Set the initial value i=1: Variable i is used to record the number of times generated. This variable is both the number of each random test and the number of random tests that have been conducted so far. After completion, proceed to step 5.
[0118] Step 5 Randomly generate control parameter C i : Generate each control parameter according to the control parameter random formula. In this embodiment, only the temperature h is generated.i and Top-K sampling k i , these two data constitute the control parameter vector C i . When finished, proceed to step 6.
[0119] Step 6 Generate an image: Set the control parameters of the Wensheng graph model (temperature and Top-K sampling), and then use the model to generate an image. After completion, proceed to step 7.
[0120] Step 7: Generate text: Use the trained text-to-image model to reversely generate text from the generated image. After completion, proceed to step 8.
[0121] Step 8 Obtain the generated text word vector V i :Extract generated text information and calculate its corresponding word vector V i . V i It is also a one-dimensional vector with a dimension of 768. After completion, proceed to step 9.
[0122] Step 9 Calculate V0 and V i The distance d i :Use the Euclidean distance formula to calculate V0 and V i The distance is 4 digits. The smaller the distance, the closer V i The closer the meaning is to V0, the more suitable the control parameters are. After completion, proceed to step 10.
[0123] Step 10i≥n: Determine whether n random experiments have been completed: If yes, it indicates that it has been completed, and proceed to step 12; otherwise, it indicates that it has not been completed and random experiments are required, and proceed to step 11.
[0124] Step 11i=i+1: increment i by 1 and start the next random test. After completion, proceed to step 5.
[0125] Step 12: Control parameter C i Normalization: Control parameter C i In this embodiment, since h i It is already normalized and does not need to be processed, but k i is an integer, its maximum value is 100, and k i Divide all elements in by 100.
[0126] In short: before selecting the appropriate control parameters, it is necessary to conduct n random control variable experiments. In this way, based on the original text, the control parameters that best fit the text in the text graph model can be calculated.
[0127] After conducting n experiments, we get n control parameters and the corresponding V0 and V i The Euclidean distance di , the control parameters and the corresponding Euclidean distances are bound into groups to form n parameter combinations.
[0128] Afterwards, the n parameter combinations are optimized using an optimization method to obtain the optimal parameter combination. The present invention uses two embodiments for optimization, namely, the optimization method is an optimization method based on Gaussian process regression and Bayesian or an optimization method based on local extreme value search.
[0129] Example 1
[0130] This embodiment uses an optimization method based on Gaussian process regression and Bayesian to optimize n parameter combinations and obtain the optimal parameter combination.
[0131] Specifically, the optimization methods based on Gaussian process regression and Bayesian include:
[0132] A1. Construct a Gaussian process regression model, use the control parameters in the n parameter combinations as the input of the Gaussian process regression model, use the corresponding Euclidean distance as the output of the Gaussian process regression model, determine the kernel function of the Gaussian process regression model, and set the parameters of the kernel function, including the initial value and the optimization range, train the Gaussian process regression model using the n parameter combinations, predict the n parameter combinations according to the trained Gaussian process regression model, and select the output with the smallest Euclidean distance as the target distance;
[0133] A2. Set the search range of the control parameter, use Bayesian to solve the control parameter value corresponding to the target distance, use the control parameter value to set the target control parameter, apply it to the text-graph model, verify the generated image, and compare whether the Euclidean distance d between the generated text and the original text is less than the minimum Euclidean distance in the n sets of parameter combinations. If so, use the target control parameter as the optimal control parameter. If not, select the control parameter corresponding to the minimum Euclidean distance in the n sets of parameter combinations as the optimal control parameter.
[0134] In this embodiment, a Gaussian process regression model is used to simulate the nonlinear relationship between the control parameter and the distance. Given the original text and a fixed text-generated image, the control parameter C i Distance d from word vector i There is a nonlinear relationship, so the Gaussian process regression model is particularly suitable for dealing with such regression problems with uncertainty and complexity. It performs well in fitting small samples and nonlinear regression, and is especially suitable for scenarios where uncertainty assessment of prediction results is required.
[0135] In the Gaussian process regression model, C is the input and D is the output. Their values are:
[0136]
[0137] In the matrix C, since k i The value is much larger than h i value, in order to prevent h i The value of k i Value masking requires k i In this embodiment, k i The value of is between 1 and 100. For each k i All are divided by 100 for normalization.
[0138] In Gaussian process regression, the designed kernel function is:
[0139]
[0140] The kernel function is a composite kernel function composed of a constant kernel and a radial basis function kernel (RBF). 2 , whose initial value is all d i The variance of the composition set, the optimization range is 10 -2 to 10 2 ; Radial basis function kernel RBF is Among them C i -C j Indicates the input parameter C i and C j The Euclidean distance, β 2 For all C i Variance of distance The optimization range is also 10 -2 to 10 2 .
[0141] Finally, we use Bayesian optimization techniques to solve the Gaussian process regression model and find the control parameters that minimize the distance between word vectors. Then, we regenerate the image using these control parameters and use the image-to-text technique to obtain the new word vector and calculate its distance from the original word vector. If the distance is greater than all d i are all small, then these control parameters are the optimal control parameters; otherwise, select d i The control parameter corresponding to the minimum value in the set is taken as the optimal control parameter.
[0142] Specifically, in this embodiment, step A1 includes:
[0143] A1.1 Each control parameter is assumed to contain two variables, namely h i and k i ;
[0144] A1.2 Construct a Gaussian process regression model. Set the Gaussian process regression model input as matrix C, which is composed of a one-dimensional vector C i Composition, each one-dimensional vector C i Contains hi and k i , set the Gaussian process regression model output to D, D is a one-dimensional vector, consisting of n d i Composition, d i Refers to the Euclidean distance among parameter combinations;
[0145] A1.3 Take D as a set, calculate the mean of D, and calculate the variance σ of D according to the mean and variance formula of D 2 ;
[0146] A1.4 Calculate the Euclidean distance of each row of matrix C to form a distance set, calculate the mean of the distance set, and calculate the variance β of C based on the mean and variance formula of the distance set 2 ;
[0147] A1.5 Set the kernel function of the Gaussian process regression model, which is composed of a constant kernel and an RBF kernel. The initial value of the constant kernel is σ 2 , the parameter in the RBF kernel is β 2 The optimization range of constant kernel and RBF kernel is 10 -2 -10 2 ;
[0148] A1.6 Use n sets of parameter combinations to train the Gaussian process regression model and optimize the parameters of the kernel function by maximizing the marginal likelihood;
[0149] A1.7 takes the control parameters in the n sets of parameter combinations as input, uses the trained Gaussian process regression model to predict the Euclidean distance, and selects the minimum value of the n predicted Euclidean distances as the target distance.
[0150] See also Figure 5 , a detailed implementation of step A1 is as follows:
[0151] Step 1: Set the model input to C. C is a one-dimensional vector C i Composition, each vector C i Contains 2 elements, namely h i and k i , the values of these elements are normalized. In this embodiment, C is a 16×2 matrix, which is set as the input of Gaussian process regression. After completion, go to step 2.
[0152] Step 2: Set the model output to D. D is a one-dimensional vector, consisting of i In this embodiment, D is a 16-dimensional one-dimensional vector, which is set as the output of Gaussian process regression. After completion, go to step 3.
[0153] Step 3: Calculate the variance σ of D 2First, consider D as a set, calculate the mean of D, and then use the variance formula to calculate the variance σ of D 2 . When finished, proceed to step 4.
[0154] Step 4: Calculate the variance β of C 2 First, calculate the Euclidean distance of each row of matrix C to form a distance set, then calculate the mean of the set, and finally use the variance formula to calculate the variance β 2 This value is the variance of C, β 2 . When finished, proceed to step 5.
[0155] Step 5: Set the kernel function. Set the kernel function of Gaussian process regression, which is composed of a constant kernel and an RBF kernel. The initial value of the constant kernel is σ 2 , the parameter in the RBF kernel is β 2 , the optimization range is 10-2 to 10 2 . When finished, proceed to step 6.
[0156] Step 6: Train the Gaussian process model. Use the test data to train the Gaussian process model, including optimizing the kernel function parameters so that the model can best fit the training data. Parameter optimization is achieved by maximizing the marginal likelihood.
[0157] In this embodiment, this process mainly utilizes random test data to train the Gaussian process model, thereby completing the fitting of the nonlinear relationship between the process parameter and the distance.
[0158] The variance formula is as follows:
[0159]
[0160] In the formula, n represents the number of d, d i is the i-th Euclidean distance, Represents the mean of the distances.
[0161] Specifically, in this embodiment, step A2 includes:
[0162] A2.1 Setting the two variables h of the control parameters i and k i The boundary value of
[0163] A2.2 Use Bayesian optimization to solve h and k corresponding to the target distance;
[0164] A2.3 In the Vincent graph model, h and k are used to set the control parameters;
[0165] A2.4 Take the original text as input, generate an image using the text-to-graph model, input the generated image into the graph-to-text model to obtain the generated text, and calculate the Euclidean distance d between the original text and the generated text;
[0166] A2.5 determines whether d is less than the minimum value of the Euclidean distance among the n parameter combinations. If so, proceed to step A2.6; if not, proceed to step A2.7;
[0167] A2.6 Take h and k as the optimal variables, and the control parameters set by h and k are the optimal control parameters;
[0168] A2.7 Set h corresponding to the minimum value of the Euclidean distance among the n parameter combinations i and k i As the optimal variable, the control parameters it sets are the optimal control parameters.
[0169] See also Figure 6 , a detailed implementation of step A2 is as follows:
[0170] Step 1: Set the output parameter boundaries: Set the boundary values for the output parameters temperature and Top-K sampling, because they are all normalized and their ranges are [0,1]. After completion, proceed to step 2.
[0171] Step 2: Use Bayesian optimization to solve h and k corresponding to the minimum value: When using Bayesian optimization to solve h and k corresponding to the minimum value in the Gaussian regression model, you need to restore the k value. Since the k value is normalized by dividing by 100, after calculating the k value, you need to multiply it by 100 and round it off to get the actual value of the Top-K sampling. After completion, proceed to step 3.
[0172] Step 3: Use h and k to set the control parameters: In the Wensheng graph model, use h and k to set the control parameters of the model. After completion, proceed to step 4.
[0173] Step 4: Calculate the distance d: Use the original text as input and follow the process described in step 1. First, use the text-to-graph model to generate an image, then use the graph-to-text model to generate text, and finally calculate the Euclidean distance d between the original text and the generated text in the word vector space.
[0174] Step 5d≤min{d i}: Determine whether d is less than the d calculated from the n test records i If yes, it means the predicted h and k are accurate, go to step 6; otherwise, it means the predicted h and k are inaccurate, go to step 7.
[0175] Step 6: h and k are the optimal control parameters: for the original text, under the control parameters of h and k, the generated image is the most suitable.
[0176] Step 7 Minimum d i The corresponding h i and k iis the optimal control parameter: Since the predicted h and k are inaccurate due to model errors, the minimum d in the n trial records is used. i The corresponding h i and k i are used as the optimal control parameters, and the generated picture is the most fitting to the original text.
[0177] In this embodiment, after obtaining the control parameters corresponding to the minimum value through Bayesian optimization, the results need to be verified. If the verification fails, the control parameter with the minimum distance in the random trials is selected as the final control parameter of the original text in the text-to-image model.
[0178] Embodiment 2
[0179] This embodiment uses an optimization method based on local extreme value search to optimize n parameter combinations and obtain the optimal parameter combination.
[0180] Specifically, the optimization method based on local extreme value search includes:
[0181] B1. Find local extreme points among n parameter combinations according to the Euclidean distance. A local extreme point refers to a control parameter with the minimum Euclidean distance in its neighborhood range.
[0182] B2. Use the network search method to search near each local extreme point, and take the search results as the network extreme value set. Select the control parameter corresponding to the minimum Euclidean distance in the network extreme value set as the optimal control parameter.
[0183] In this embodiment, n groups of control parameters C i and the corresponding distance d i have been generated. First, determine the local extreme value of the distance. The method is as follows:
[0184] If d1 < d2, then d1 is a local extreme value.
[0185] If d n < d n-1 , then d n is a local extreme value.
[0186] If d i < d i-1 and d i < d i+1 , then d i is a local extreme value.
[0187] Through this method, it can be determined that there is at least one local extreme value in the known data pairs, and there may also be multiple local extreme values.
[0188] Next, determine the corresponding control parameters through these extreme values, and establish a finer "cross-shaped" grid around these control parameters to ensure that the extreme points are located at the center of the grid.
[0189] As Figure 7 shown, add 8 search parameters around (h i , k i ). Here, set Δh = 0.01 and ΔK = 1. Set the control parameters with the new parameters and generate an image, then use the image-to-text model to obtain the word vectors of the generated text, and calculate the distances corresponding to the original text respectively. Finally, compare the newly calculated 8 distances with d i :
[0190] If d i is still the minimum value, then h i and k i are the extreme values in this area.
[0191] If there is a distance smaller than d i among the 8 points, then take the smaller point as the center and recursively construct a cross-shaped grid to find a smaller distance again. During the recursive process, if h i ±Δh and k i ±Δk exceed their value ranges, then use the boundary values to replace them.
[0192] According to this method, the extreme values in this area can be gradually found. Since the image-to-text and text-to-image models need to be used repeatedly, the calculation amount is relatively large. Therefore, it is recommended that the recursive level does not exceed 3 times, and the control parameters corresponding to the minimum distance among the 3 times are selected as the optimal control parameters in this area.
[0193] Finally, select a minimum extreme value among all local extreme value areas, and its control parameters are the best control parameters most suitable for this text.
[0194] Specifically, in this embodiment, step B1 includes:
[0195] B1.1 Construct a data set in order through n parameter combinations. Each element in the data set includes two variables h i , k i of the control parameters and the corresponding Euclidean distance d i ;
[0196] B1.2 Set i = 1;
[0197] B1.3 Select an element i in the data set;
[0198] B1.4 If d i < d i-1 and d i < d i+1 , then d iIf it is an extreme value, go to step B1.5; otherwise, go to step B1.6;
[0199] B1.5 Let d i The corresponding variables h i , k i As local extreme points, add them to the local extreme set;
[0200] B1.6 Determine whether i is equal to n. If so, go to step B1.7; if not, let i = i + 1 and return to step B1.4;
[0201] B1.7 If d n < d n-1 , then d n Is an extreme value, go to step B1.8; otherwise, go to step B1.9;
[0202] B1.8 Let d n The corresponding variables h n , k n As local extreme points, add them to the local extreme set;
[0203] B1.9 Output the local extreme set.
[0204] Please refer to Figure 8 , a detailed implementation of step B1 is as follows:
[0205] Step 1 Construct a data set: The data generated through random experiments are used to construct a data set in sequence. Each element in the data set includes the control parameters h i , k i And the corresponding distance d i . After completion, go to step 2.
[0206] Step 2 Set i = 1: Initialize the index variable i = 1, which represents the serial number of each element in the data set. After completion, go to step 3.
[0207] Step 3 Determine whether d1 < d2: Check whether the first element in the data set is an extreme value element. If so, it indicates that the first element is an extreme value element, go to step 4; otherwise, go to step 5.
[0208] Step 4 Record d1 as an extreme value element: The control parameters h1 and k1 corresponding to d1 are combined into an extreme value element and added to the local extreme set.
[0209] Step 5 i = n: Check whether the current element being processed is the last element in the data set, that is, i = n. If so, go to step 6; otherwise, go to step 8.
[0210] Step 6 d n < d n-1 : Check d nIs it an extreme value? If so, it means d n is an extreme value, go to step 7; otherwise, go to step 11, indicating that the program ends.
[0211] Step 7 Record d n For extreme elements: n The corresponding control parameter h n and k n Form extreme value elements and add them to the local extreme value set.
[0212] Step 8d i <d i-1 And d i <d i+1 :checkd i Is it an extreme value? If so, it means d i is an extreme value, go to step 9; otherwise, go to step 10 and continue to judge the next record.
[0213] Step 9 Record d i For extreme elements: i The corresponding control parameter h i and k i Form extreme value elements and add them to the local extreme value set.
[0214] Step 10: i=i+1: Increase the sequence number i by 1 to process the next element. Return to step 5 after completion.
[0215] Step 11: Output the local extreme value set: The program ends and the local extreme value set in the data set is output. The elements in the local extreme value set are the final results of this step.
[0216] Specifically, in this embodiment, step B2 includes:
[0217] B2.1 Set the parameters Δh = 0.01, Δk = 1, and the maximum number of recursive layers Maxlay = 3, where Δh and Δk are used to calculate new grid control parameters, and the maximum number of recursive layers Maxlay is the number of recursive times of the network search;
[0218] B2.2 selects an element in the local extreme value set, which includes the Euclidean distance and two variables h and k of the control parameter;
[0219] B2.3 Set the current recursion number t = 1;
[0220] B2.4 assigns the Euclidean distance of the current element to the Dmin variable;
[0221] B2.5 generates 8 new control parameters around the current element based on h and k, forming a parameter set, and performs deduplication processing;
[0222] B2.6 Set the control parameters in the parameter set to the text-to-graph model and generate a picture, then use the graph-to-text model to obtain generated text, calculate the Euclidean distance between the generated text and the original text, and add the control parameters of the calculated Euclidean distance to the calculated set;
[0223] B2.7 compares the minimum Euclidean distance dnet in the calculated set with Dmin. If Dmin is smaller than dnet, proceed to step B2.11. Otherwise, proceed to step B2.8.
[0224] B2.8 Check whether the current recursion number t reaches the maximum recursion layer number Maxlay. If so, end the search and go to step B2.12. If not, go to step B2.9.
[0225] B2.9 Replace h and k of the current element with h and k corresponding to dnet;
[0226] B2.10 Let t=t+1, and return to step B2.4;
[0227] B2.11 adds the control parameter of the current element to the final extreme value set and proceeds to step B2.13;
[0228] B2.12 adds the control parameters corresponding to dnet to the final extreme value set and proceeds to step B2.13;
[0229] B2.13 determines whether all elements in the local extreme value set are traversed. If so, select the element with the smallest Euclidean distance from the final extreme value set. The control parameter contained in this element is the optimal control parameter. If not, return to step B2.2.
[0230] See also Fig. 9 , a detailed implementation of step B2 is as follows:
[0231] Step 1 Parameter setting: This embodiment sets the parameters Δh = 0.01, Δk = 1, and the maximum number of recursive layers Maxlay = 3. Among them, Δh and Δk are used to calculate new grid control parameters. The maximum number of recursive layers Maxlay determines the number of recursive times of the grid search, which mainly depends on the computing power. At the same time, the initial value of the control parameter set of the calculated distance is set to the control parameter of the calculated distance in all random experiments. After completion, proceed to step 2.
[0232] Step 2: Select an element from the local extreme value set: Select an element from the local extreme value set, including the distance and control parameters h and k. If it is the first selection, select the first element; if it is not the first selection, select the next element to continue processing. After completion, proceed to step 3.
[0233] Step 3 Set the current recursion sequence number t = 1: Initialize the recursion layer counter t to 1. After completion, proceed to Step 4.
[0234] Step 4 Set Dmin as the distance of the current element: Assign the distance of the current element to the Dmin variable for comparison with the distances obtained in the grid search. After completion, proceed to Step 5.
[0235] Step 5 Generate a set of control parameters for the network search: Based on the current h and k, generate 8 new control parameters around them to form a set. After completion, proceed to Step 6.
[0236] Step 6 Eliminate the control parameters for which the distances have been calculated: Remove the control parameters for which the distances have been calculated from the set generated in Step 5 to avoid duplicate calculations. After completion, proceed to Step 7.
[0237] Step 7 Calculate the distances under the network search control parameters: Calculate the remaining control parameters in Step 6, set their values into the text-to-image model to generate images, then use the image-to-text model to generate text, and finally calculate the distance between the generated text and the original text. The specific method is the same as in Step 1. After completion, proceed to Step 8.
[0238] Step 8 Classify the control parameters into the calculated set: Add all the control parameters for which the distances have been calculated in Step 7 to the calculated set to eliminate duplicates when generating the network search control parameters next time. After completion, proceed to Step 9.
[0239] Step 9 Obtain the minimum distance dnet in the network search: Select the minimum value dnet from the set of distances calculated in Step 7. After completion, proceed to Step 10.
[0240] Step 10 Dmin < dnet: Compare the distance Dmin of the current element with the minimum distance dnet obtained from the network search. If Dmin is less than dnet, it means the current element is the local final extreme value at this point, and proceed to Step 14; otherwise, proceed to Step 11.
[0241] Step 11 t = Maxlay: Check whether the current recursion layer has reached the maximum recursion layer Maxlay. If so, end the search and proceed to Step 15; otherwise, proceed to Step 12 to continue the network search.
[0242] Step 12 Replace the current local extreme value element with the h and k corresponding to dnet: Replace the current local extreme value element with the h and k corresponding to dnet for continuous search. After completion, proceed to Step 13.
[0243] Step 13 t = t + 1: Increase the recursion layer t. Increment t by 1 for the next recursive search. After completion, return to Step 4.
[0244] Step 14: Add the current extreme value element to the final extreme value set: Add the data of the current extreme value point element to the final extreme value set. After completion, proceed to step 16.
[0245] Step 15: Add the elements corresponding to dnet to the final extreme value set: Add the control parameters corresponding to dnet to the final extreme value set. After completion, proceed to step 16.
[0246] Step 16: All local extreme value sets are traversed: Determine whether all local extreme value sets have been traversed. If yes, proceed to step 17; otherwise, return to step 2.
[0247] Step 17: Select the element with the minimum distance from the final extreme value set: Select the element with the minimum distance from the final extreme value set. The control parameters contained in the element are the optimal control parameters for the original text.
[0248] Specifically, after the optimal control parameters are obtained through optimization, they are set in the text-generated graph model, the original text is input, and the generated image obtained as output is the most suitable image.
[0249] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A control parameter fine-tuning method for a Chinese raw image model in the field of agricultural artificial intelligence, characterized in that: The steps include: S1 obtains the original text, inputs the original text into the text-to-graph model, randomly generates n control parameters, generates an image based on each control parameter, regenerates text from the generated image through the graph-to-text model, calculates the Euclidean distance between the original text and the generated text, and binds the control parameters and the corresponding Euclidean distances into groups to form n parameter combinations; S2 uses an optimization method to optimize n parameter combinations to obtain the optimal parameter combination, uses the control parameters of the optimal parameter combination as the optimal control parameters, and outputs the corresponding generated image as the result.
2. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 1 is characterized in that: Step S1 includes: S11 obtains the original text and obtains the word vector V0 of the original text; S12 sets the random number n of control parameters; S13 sets the initial value i=1; S14 generates control parameter C according to random formula i ; S15 uses the current control parameter C i Generate images; S16 inputs the generated image into the image-to-text model, regenerates the text, and obtains the word vector V of the generated text i ; S17 calculates the word vector V0 of the original text and the word vector V of the generated text i The Euclidean distance d i ; S18 determines whether i is greater than or equal to n. If so, the control parameter C i After normalization, the control parameters and the corresponding Euclidean distances are bound into groups to form n parameter combinations. If not, set i=i+1 and return to step S14.
3. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 2 is characterized in that: The random formula is: In the formula, C i is the control parameter, i∈[1,n], Upper represents the maximum value of the control parameter, Lower represents the minimum value of the control parameter, n is the number of random times, and rand(0,1) is a random function that generates random numbers between 0 and 1.
4. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 2, characterized in that: The optimization method is an optimization method based on Gaussian process regression and Bayesian or an optimization method based on local extreme value search.
5. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 4 is characterized in that: Optimization methods based on Gaussian process regression and Bayesian include: A1. Construct a Gaussian process regression model, use the control parameters in the n parameter combinations as the input of the Gaussian process regression model, use the corresponding Euclidean distance as the output of the Gaussian process regression model, determine the kernel function of the Gaussian process regression model, and set the parameters of the kernel function, including the initial value and the optimization range, train the Gaussian process regression model using the n parameter combinations, predict the n parameter combinations according to the trained Gaussian process regression model, and select the output with the smallest Euclidean distance as the target distance; A2. Set the search range of the control parameter, use Bayesian to solve the control parameter value corresponding to the target distance, use the control parameter value to set the target control parameter, apply it to the text-graph model, verify the generated image, and compare whether the Euclidean distance d between the generated text and the original text is less than the minimum Euclidean distance in the n sets of parameter combinations. If so, use the target control parameter as the optimal control parameter. If not, select the control parameter corresponding to the minimum Euclidean distance in the n sets of parameter combinations as the optimal control parameter.
6. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 5, characterized in that: Step A1 includes: A1.1 Each control parameter is assumed to contain two variables, namely h i and k i ; A1.2 Construct a Gaussian process regression model. Set the Gaussian process regression model input as matrix C, which is composed of a one-dimensional vector C i Composition, each one-dimensional vector C i Contains h i and k i , set the Gaussian process regression model output to D, D is a one-dimensional vector, consisting of n d i Composition, d i Refers to the Euclidean distance among parameter combinations; A1.3 Take D as a set, calculate the mean of D, and calculate the variance σ of D according to the mean and variance formula of D 2 ; A1.4 Calculate the Euclidean distance of each row of matrix C to form a distance set, calculate the mean of the distance set, and calculate the variance β of C based on the mean and variance formula of the distance set 2 ; A1.5 Set the kernel function of the Gaussian process regression model, which is composed of a constant kernel and an RBF kernel. The initial value of the constant kernel is σ2, and the parameter in the RBF kernel is β 2 The optimization range of constant kernel and RBF kernel is 10 -2 -10 2 ; A1.6 Use n sets of parameter combinations to train the Gaussian process regression model and optimize the parameters of the kernel function by maximizing the marginal likelihood; A1.7 takes the control parameters in the n sets of parameter combinations as input, uses the trained Gaussian process regression model to predict the Euclidean distance, and selects the minimum value of the n predicted Euclidean distances as the target distance.
7. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 6 is characterized in that: Step A2 includes: A2.1 Setting the two variables h of the control parameters i and k i The boundary value of A2.2 Use Bayesian optimization to solve h and k corresponding to the target distance; A2.3 In the Vincent graph model, h and k are used to set the control parameters; A2.4 Take the original text as input, generate an image using the text-to-graph model, input the generated image into the graph-to-text model to obtain the generated text, and calculate the Euclidean distance d between the original text and the generated text; A2.5 determines whether d is less than the minimum value of the Euclidean distance among the n parameter combinations. If so, proceed to step A2.6; if not, proceed to step A2.7; A2.6 Take h and k as the optimal variables, and the control parameters set by h and k are the optimal control parameters; A2.7 Set h corresponding to the minimum value of the Euclidean distance among the n parameter combinations i and k i As the optimal variable, the control parameters it sets are the optimal control parameters.
8. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 4 is characterized in that: Optimization methods based on local extremum search include: B1. Find the local extreme point in n parameter combinations according to the Euclidean distance. The local extreme point refers to the control parameter with the minimum Euclidean distance in its neighborhood. B2. Use the network search method to search near each local extreme point, use the search results as the network extreme value set, and select the control parameter corresponding to the minimum Euclidean distance in the network extreme value set as the optimal control parameter.
9. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 8, characterized in that: Step B1 includes: B1.1 Construct a data set in sequence by combining n parameters. Each element in the data set includes two variables h controlling the parameters. i , k i And the corresponding Euclidean distance d i ; B1.2 Set i=1; B1.3 Select an element i in the data set; B1.4 If d i <d i-1 And d i <d i+1 , then d i is an extreme value, go to step B1.5; otherwise, go to step B1.6; B1.5 will be i The corresponding variable h i , k i As a local extreme point, add it to the local extreme value set; B1.6 determines whether i is equal to n. If so, proceed to step B1.
7. If not, set i=i+1 and return to step B1.
4. B1.7 If d n <d n-1 , then d n is an extreme value, go to step B1.8; otherwise, go to step B1.9; B1.8 will be d n The corresponding variable h n , k n As a local extreme point, add it to the local extreme value set; B1.9 outputs a set of local extreme values.
10. The control parameter fine-tuning method of the Chinese image model in the field of agricultural artificial intelligence as claimed in claim 9, characterized in that: Step B2 includes: B2.1 Set the parameters Δh = 0.01, Δk = 1, and the maximum number of recursive layers Maxlay = 3, where Δh and Δk are used to calculate new grid control parameters, and the maximum number of recursive layers Maxlay is the number of recursive times of the network search; B2.2 selects an element in the local extreme value set, which includes the Euclidean distance and two variables h and k of the control parameter; B2.3 Set the current recursion number t = 1; B2.4 assigns the Euclidean distance of the current element to the Dmin variable; B2.5 generates 8 new control parameters around the current element based on h and k, forming a parameter set, and performs deduplication processing; B2.6 Set the control parameters in the parameter set to the text-to-graph model and generate a picture, then use the graph-to-text model to obtain generated text, calculate the Euclidean distance between the generated text and the original text, and add the control parameters of the calculated Euclidean distance to the calculated set; B2.7 compares the minimum Euclidean distance dnet in the calculated set with Dmin. If Dmin is smaller than dnet, proceed to step B2.
11. Otherwise, proceed to step B2.
8. B2.8 Check whether the current recursion number t reaches the maximum recursion layer number Maxlay. If so, end the search and go to step B2.
12. If not, go to step B2.
9. B2.9 Replace h and k of the current element with h and k corresponding to dnet; B2.10 Let t=t+1, and return to step B2.4; B2.11 adds the control parameter of the current element to the final extreme value set and proceeds to step B2.13; B2.12 adds the control parameters corresponding to dnet to the final extreme value set and proceeds to step B2.13; B2.13 determines whether all elements in the local extreme value set are traversed. If so, select the element with the smallest Euclidean distance from the final extreme value set. The control parameter contained in this element is the optimal control parameter. If not, return to step B2.2.
Citation Information
Patent Citations
Image processing method and device, equipment and medium
CN116682110A
Method, model and device for training text graph model, and electronic equipment
CN116894880A
Figure graph model training method and text graph method
CN116935169A
Image generation method, device and equipment and computer readable storage medium
CN117475038A
