Training method, device and equipment for crop variety attribute information expansion model
By combining the topological structure of crop variety attribute information with a generative adversarial network, the problem of insufficient training samples for crop variety identification models is solved, and the accuracy of identification and model performance are improved.
Patent Information
- Application Number
- CN202410719614.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-10-22
AI Technical Summary
In the existing technology, the number of training samples for crop variety identification models is insufficient, resulting in the accuracy of crop variety identification failing to meet user needs.
By combining the topological structure of crop variety attribute information with traditional generative adversarial networks and training the generative adversarial network, the generated predicted crop variety attribute information is closer to the real information, thereby improving the performance of the crop variety attribute information expansion model.
It effectively expands the number of training samples of the crop variety identification model, improves the accuracy of crop variety identification, and enhances the performance of the model.
Smart Images

Figure CN118823767A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular relates to a training method, device and equipment for an agricultural crop variety attribute information expansion model. Background Art
[0002] With the rapid development of science and technology and the gradual maturity of artificial intelligence technology, artificial intelligence has gradually been applied to people's production and life to provide convenience for people. For example, artificial intelligence can be combined with agricultural production management to improve the efficiency and accuracy of industrial production management.
[0003] In the related art, by combining image processing technology, pattern recognition methods and traditional agriculture, a related model for crop variety identification can be obtained. However, due to the limitation of the number of sample data, the accuracy of crop variety identification models in the related art cannot meet the needs of users. Therefore, how to expand the number of training samples for crop variety identification models is an urgent problem to be solved by related technicians. Summary of the invention
[0004] The embodiments of the present application provide a training method, device and equipment for a crop variety attribute information expansion model, which can combine the corresponding topological structure of the crop variety attribute information with the traditional generative adversarial network, so that the predicted crop variety attribute information generated by the generative adversarial network is closer to the actual crop variety attribute information, thereby improving the performance of the crop variety attribute information expansion model.
[0005] In a first aspect, an embodiment of the present application provides a training method for a crop variety attribute information expansion model, including: obtaining crop variety attribute information and a first topological structure corresponding to the crop variety attribute information; using a generator in a generative adversarial network to obtain predicted crop variety attribute information; determining a second topological structure corresponding to the predicted crop variety attribute information; and using the crop variety attribute information, the first topological structure, the predicted crop variety attribute information, and the second topological structure to train a generative adversarial network to obtain a crop variety attribute information expansion model.
[0006] In one embodiment, the generative adversarial network also includes a discriminator; using the crop variety attribute information, the first topological structure, the predicted crop variety attribute information and the second topological structure, the generative adversarial network is trained, including: using the first topological structure and the second topological structure to calculate the topological loss function between the predicted crop variety attribute information and the crop variety attribute information; inputting the predicted crop variety attribute information into the discriminator to obtain the crop variety data information discrimination result; using the discrimination result to calculate the first loss function; determining the discriminant loss function of the discriminator based on the first loss function and the topological loss function; when the discriminator loss function does not meet the first preset training stop condition, Keeping the parameters of the generator unchanged, adjust the parameters of the discriminator, return and input the predicted crop variety attribute information into the discriminator, obtain the crop variety data information discrimination result, until the discrimination loss function meets the first preset training stop condition, and obtain the discriminator; using the discrimination result, calculate the second loss function; according to the second loss function and the topological loss function, determine the generation loss function of the generator; when the generation loss function does not meet the second preset training stop condition, keep the parameters of the discriminator unchanged, adjust the parameters of the generator, return to the generator using the generative adversarial network, obtain the predicted crop variety attribute information, until the generation loss function meets the second preset training stop condition, and obtain the generator.
[0007] In one embodiment, the first loss function is calculated using the discrimination result, including: using the discrimination result to calculate the predicted loss function corresponding to the predicted crop variety parameter information; calculating the true loss function corresponding to the crop variety attribute information; and determining the first loss function based on the predicted loss function and the true loss function.
[0008] In one embodiment, the first topological structure and the second topological structure are used to calculate the topological loss function between the predicted crop variety attribute information and the crop variety attribute information, including: using the first predicted topological structure and the second topological structure to calculate the topological weight information; using the first predicted topological structure, the second topological structure and the topological weight information to calculate the topological loss function corresponding to the predicted crop variety parameter information.
[0009] In one embodiment, after obtaining predicted crop variety attribute information in a generator using a generative adversarial network, the method also includes: calculating a distance parameter between the predicted crop variety parameter information and the crop variety parameter information; when the distance parameter is greater than a preset distance parameter, adjusting the parameters of the generator, and returning to calculating the distance parameter between the predicted crop variety parameter information and the crop variety parameter information until the distance parameter is less than or equal to the preset distance parameter.
[0010] In one embodiment, after obtaining the crop variety attribute information expansion model, the method also includes: inputting the crop variety parameter information into the crop variety attribute information expansion model to generate second crop variety parameter information; determining the crop variety feature label corresponding to the second crop variety parameter information; and using the second crop variety parameter information and the crop variety feature label to train a feature extraction model.
[0011] In one embodiment, a feature extraction model is trained using second crop variety parameter information and corresponding crop variety labels, including: inputting the second crop variety parameter information into the crop variety feature extraction model to be trained to obtain predicted crop variety feature information; calculating a third loss function of the crop variety feature extraction model based on the predicted crop variety feature information and the crop variety feature label; determining a model parameter change gradient of the model to be trained based on elastic characteristics and fluctuation characteristics of an elastic fluctuation algorithm when the third loss function does not meet a third preset training stop condition; updating model parameters of the model to be trained based on the model parameter change gradient to obtain an updated model to be trained; returning to input a sample of the crop variety feature information into the model to be trained to obtain predicted crop variety feature information, until the third loss function meets a third preset training stop condition to obtain a crop variety feature extraction model.
[0012] In one embodiment, after obtaining the crop variety attribute information expansion model, the method also includes: obtaining a third training sample, the third training sample including third crop variety parameter information obtained by using the crop variety parameter information expansion model and a corresponding third crop variety label; using the third crop variety parameter information and the corresponding third crop variety label to train a crop variety identification model to obtain a trained crop variety identification model.
[0013] In one embodiment, a crop variety recognition model is trained using third crop variety parameter information and corresponding third crop variety labels, including: for each node in the training gradient boosting tree model, the following steps AE are respectively executed cyclically until the difference information meets a preset stop condition: step A, for each crop variety feature, respectively executing: using the crop variety feature as the node feature of the current node, classifying to obtain a classification result; step B, for each classification result, respectively executing: determining, according to the classification result, the uncertainty value corresponding to the crop variety feature when the crop variety feature is the node feature of the current node; step C, using the target crop variety feature corresponding to the maximum uncertainty value as the node feature of the current node; Step D, according to the classification result, calculate the gain information of the current node, and when the gain information of the current node is less than the preset gain threshold, determine that the current node is a leaf node of the decision tree; when the gain information of the current node is greater than the preset gain threshold, determine that the current node has completed training, and update the next node of the current node to the current node, and return to step A until the gain information of the current node is less than the preset gain threshold, and obtain a decision tree that has completed training; Step E, use the predicted crop variety output by the trained decision tree and the corresponding crop variety label to calculate the difference information, and when the difference information does not meet the preset stop condition, return to step A until the difference information meets the preset stop condition, and obtain a crop variety recognition model that has completed training.
[0014] In one embodiment, after obtaining a trained crop variety identification model, the method further includes: calculating weight information corresponding to the crop variety identification model; using the weight information, calculating the gradient value corresponding to each node in the crop variety identification model; and when the gradient value exceeds a preset threshold, determining the node corresponding to the gradient value for pruning.
[0015] In one embodiment, after obtaining a trained crop variety recognition model, the method also includes: acquiring crop images; extracting features in the crop images using a feature extraction model to obtain crop features; the feature extraction model is the feature extraction model in the embodiment of the present application; and inputting the crop features into the crop variety recognition model to obtain crop variety information.
[0016] In a second aspect, an embodiment of the present application provides a training device for a crop variety attribute information expansion model, the device comprising:
[0017] A first acquisition module, used to acquire crop variety attribute information and a first topological structure corresponding to the crop variety attribute information;
[0018] The first acquisition module is used to obtain predicted crop variety attribute information using a generator of a generative adversarial network;
[0019] A determination module, used to determine a second topological structure corresponding to the predicted crop variety attribute information;
[0020] The training module is used to train a generative adversarial network using the crop variety attribute information, the first topological structure, the predicted crop variety attribute information and the second topological structure to obtain a crop variety attribute information expansion model.
[0021] In a third aspect, an embodiment of the present application provides a training device for a crop variety attribute information expansion model, the device comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method described in the first aspect or any one of the embodiments of the first aspect is implemented.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described in the first aspect or any one of the embodiments of the first aspect is implemented.
[0023] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method described in the first aspect or any one of the embodiments of the first aspect.
[0024] The training method, device, equipment and computer storage medium of the crop variety attribute information expansion model of the embodiment of the present application combine the corresponding topological structure of the crop variety attribute information with the traditional generative adversarial network, so that the predicted crop variety attribute information generated by the generative adversarial network is closer to the actual crop variety attribute information, thereby improving the performance of the crop variety attribute information expansion model. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0026] Figure 1 A flow chart of a method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown;
[0027] Figure 2 It is a flowchart of training a crop variety attribute information expansion model provided by an embodiment of the present application;
[0028] Figure 3A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown;
[0029] Figure 4 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown;
[0030] Figure 5 A schematic diagram of the structure of a multi-layer neural network provided by an embodiment of the present application is shown;
[0031] Figure 6 A schematic diagram of a process flow of an implementation of S470 provided in an embodiment of the present application is shown;
[0032] Figure 7 A flow chart of a method for training a crop variety attribute information expansion model provided in one embodiment of the present application is shown;
[0033] Figure 8 A schematic diagram of a process flow of an implementation of S760 provided in an embodiment of the present application is shown;
[0034] Fig. 9 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown;
[0035] Fig.10 It is a structural schematic diagram of a training device for a crop variety attribute information expansion model provided by another embodiment of the present application;
[0036] Fig.11 It is a structural diagram of a training device for a crop variety attribute information expansion model provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0037] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0038] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0039] With the continuous advancement of artificial intelligence technology, artificial intelligence technology has gradually been applied to various fields of people's production and life, thereby improving production efficiency. In related technologies, by combining image processing technology, pattern recognition methods and traditional agriculture, relevant models for crop variety identification are obtained. However, due to the small number of training samples of the crop variety identification model, the accuracy of the crop variety identification model for crop identification cannot meet user needs. Therefore, how to expand the number of training samples of the crop variety identification model is a problem that needs to be solved urgently by relevant technical personnel.
[0040] In order to solve the problems of the prior art, the embodiments of the present application provide a method, device and apparatus for training a crop variety attribute information expansion model. The following first introduces the method for training a crop variety attribute information expansion model provided by the embodiments of the present application.
[0041] Figure 1 FIG. 1 is a flow chart showing a method for training a crop variety attribute information expansion model according to an embodiment of the present application. Figure 1 As shown, the training method of the crop variety attribute information expansion model includes:
[0042] S110. Obtain a sample of crop variety attribute information and a first topological structure corresponding to the crop variety attribute information.
[0043] In the embodiment of the present application, the crop variety attribute information samples may be attribute information of different crops at different periods. For example, the crop variety attribute information samples may be attribute information of crops at different growth stages. It is understandable that the crop variety attribute information samples may be obtained by obtaining pictures of different varieties of crops at different growth stages and preprocessing the pictures.
[0044] In the embodiment of the present application, the crop variety attribute information sample may be a sample obtained by random sampling of all crop variety attribute information.
[0045] In one example, a sample of crop variety attribute information can be expressed as:
[0046] X real ={x r1 ,x r2 ,...,x rk}
[0047] Among them, k can represent the size of each batch of data.
[0048] In an embodiment of the present application, the crop variety attribute information samples can be mapped into a space with lower dimensionality to construct a topological structure corresponding to the crop variety attribute information samples, thereby reflecting the relative positions and relationships between the various data corresponding to the crop variety attribute information samples.
[0049] In an embodiment of the present application, the first topological structure corresponding to the crop variety attribute information sample can be constructed by reducing the dimensionality of the crop variety attribute information sample, for example, by t-distributed stochastic neighbor embedding (t-SNE) or other dimensionality reduction methods.
[0050] In one example, the preprocessed crop variety attribute information sample can be expressed as X = {x1, x2, ..., x n}. To obtain its topological structure and embed it into a low-dimensional space, t-SNE can be used as a dimensionality reduction method, which can be expressed as:
[0051] Y=tSNE(X) (1)
[0052] Here, Y is the set of data points in the embedding space.
[0053] In the embodiment of the present application, after the topological structure of the crop variety attribute information is established, each data in each crop variety attribute information sample has a corresponding embedding vector.
[0054] S120. Utilize the generator in the generative adversarial network to obtain predicted crop variety attribute information.
[0055] In the embodiment of the present application, a generator can be used to generate predicted crop variety attribute information from noise, wherein the noise can be a set of noise data randomly generated based on noise distribution.
[0056] In one example, the way to generate noise Z in the noise distribution can be expressed as:
[0057] Z={z1,z2,...,z k}
[0058] Among them, k can represent the size of each batch of data.
[0059] Furthermore, the generator G is used to generate predicted crop variety attribute information X from the noise Z fake , which can be expressed as:
[0060] X fake =G(Z;θ G ) (2)
[0061] Among them, θ G are the parameters of the generator.
[0062] S130. Determine a second topological structure corresponding to the predicted crop variety attribute information.
[0063] In the embodiment of the present application, a second topological structure corresponding to the predicted crop variety attribute information is determined. It can be understood that the construction method of the second topological structure can be consistent with the construction method of the first topological structure. Moreover, in the second topological structure of the predicted crop variety attribute information, each data in each predicted crop variety attribute information can have a corresponding second embedding vector.
[0064] S140, using the crop variety attribute information samples, the first topological structure, the predicted crop variety attribute information and the second topological structure, training a generative adversarial network to obtain a crop variety attribute information expansion model.
[0065] In an embodiment of the present application, a generative adversarial network can be trained through crop variety attribute information samples, a first topological structure, predicted crop variety attribute information and a second topological structure, thereby obtaining a trained crop variety attribute information expansion model.
[0066] In an embodiment of the present application, by constructing a first topological structure corresponding to a sample of crop variety attribute information and a second topological structure corresponding to the predicted crop variety attribute information generated by a generative adversarial network, the relative position and relationship between each data in the sample of crop variety attribute information are taken into account when training the generative adversarial network, thereby avoiding ignoring the key characteristics of the lack of crop variety attribute information in the data generated by the generator, thereby making the predicted crop variety attribute information generated by the generative adversarial network closer to the actual crop variety attribute information, thereby improving the performance of the crop variety attribute information expansion model.
[0067] In the embodiment of the present application, the generative adversarial network may include a generator (Generator, G) and a discriminator (Discriminator, D). Training the generative adversarial network includes training the generator and training the discriminator.
[0068] In the embodiment of the present application, Figure 2 FIG. 1 is a flow chart of training a crop variety attribute information expansion model provided by an embodiment of the present application, such as Figure 2 As shown, the training method of the crop variety attribute information expansion model includes:
[0069] S201. Obtain a sample of crop variety attribute information and a first topological structure corresponding to the crop variety attribute information.
[0070] S202. Utilize the generator in the generative adversarial network to obtain predicted crop variety attribute information.
[0071] S203: Determine a second topological structure corresponding to the predicted crop variety attribute information.
[0072] In the embodiment of the present application, steps S201-S203 are consistent with steps S110-S130 and are not described in detail here.
[0073] S204. Calculate a topological loss function between the predicted crop variety attribute information and the crop variety attribute information using the first topological structure and the second topological structure.
[0074] In an embodiment of the present application, the topological loss function may be used to represent the difference information between the first topological structure and the second topological structure, that is, to represent the difference information between the predicted crop variety attribute information and the crop variety attribute information.
[0075] In an example, the topological loss function L can be calculated by the following formula: topology :
[0076]
[0077] Among them, k can represent the size of each batch of data. ri It can be represented as the vector corresponding to each crop variety attribute information in the first topological structure. fi It can represent the vector corresponding to each predicted crop variety attribute information in the second topological structure. ||()||2 can represent the calculation of the second norm. ij The topological difference can be represented by the weight assignment, and can be calculated based on y ri and fi The distances in the respective topologies are determined.
[0078] In one example, the topological difference is assigned a weight w ij , can be calculated by the following formula:
[0079]
[0080] Among them, σ can represent the width parameter of a Gaussian kernel.
[0081] S205: input the predicted crop variety attribute information and the crop variety attribute information samples into the discriminator to obtain a discrimination result.
[0082] In the embodiment of the present application, the training of the discriminator can be understood as the ability of training the discriminator to distinguish between predicted crop variety attribute information and crop variety attribute information samples. It can be understood that the discriminator obtains the corresponding discrimination result by judging that the input information is a crop variety attribute information sample or predicted crop variety attribute information.
[0083] S206: Calculate a first loss function using the discrimination result.
[0084] In the embodiment of the present application, the first loss function can be used to represent the difference between the generator's discrimination result of the input information and the label information corresponding to the input information. It can be understood that the discriminator can make two judgments when the input information is a sample of crop variety attribute information, including that the input information is a sample of crop variety attribute information, or that the input information is predicted crop variety attribute information; when the input information is predicted crop variety attribute information, the discriminator can also make two judgments, including that the input information is a sample of crop variety attribute information, or that the input information is predicted crop variety attribute information.
[0085] In an embodiment of the present application, the first loss function may include a predicted loss function corresponding to the predicted crop variety attribute information and a true loss function corresponding to the crop variety attribute information sample.
[0086] In one example, the true loss function corresponding to the crop variety attribute information sample It can be calculated by the following formula:
[0087]
[0088] Among them, D(x ri ) can represent the discriminant result of the discriminator for the i-th crop variety attribute information sample. log() can represent logarithmic calculation.
[0089] In one example, the prediction loss function corresponding to the predicted crop variety attribute information is It can be calculated by the following formula:
[0090]
[0091] Among them, G(z i θ G ) can be expressed using θ G is the parameter generator G, which generates the predicted crop variety attribute information from the i-th noise in the noise distribution. i θ G )) can represent the discriminator’s discriminant result for predicting crop variety attribute information.
[0092] In an embodiment of the present application, a first loss function may be obtained by performing a weighted summation on the true loss function and the predicted loss function.
[0093] S207: Determine a discriminant loss function of the discriminator according to the first loss function and the topological loss function.
[0094] In the embodiment of the present application, the discriminant loss function of the discriminator can be obtained by weighted summing the first loss function and the topological loss function.
[0095] In an example, the discriminant loss function of the discriminator can be calculated by the following formula:
[0096]
[0097] Among them, β can represent a weight parameter, which is used to control the proportion of topological loss in discriminative loss.
[0098] In an embodiment of the present application, when determining the discriminant loss function, the attention mechanism of the generator when generating predicted crop variety attribute information can also be considered.
[0099] In one example, the attention mechanism of the generator when generating predicted crop variety attribute information can be expressed as follows:
[0100] A(x;α)=σ(h(x)·α) (8)
[0101] X fake =G(x⊙A(x;α)) (9)
[0102] Where A(x; α) is the attention weight, which is used to indicate the degree of attention the model pays to sample x. For example, a value is given to each pixel of the input image x, which indicates the degree of attention the model pays to this pixel. h(x) can represent a feature extraction function of the model, such as a preset neural network feature extraction function that has been trained. α is the attention parameter, which can be preset by the technician. σ can be a sigmoid activation function. ⊙ represents element-by-element multiplication.
[0103] Furthermore, the predicted crop variety attribute information X generated by the generator fake It can be guided to imitate the most important part of the crop variety attribute information sample that the model considers. In order to train the attention parameter α, the attention loss function L can be defined attention for:
[0104] L attention =||A(x;α)-A(x real ; α)||1 (10)
[0105] Among them, ||()||1 can represent the calculation of the 1-norm.
[0106] In the embodiment of the present application, when the attention loss function corresponding to the attention mechanism is taken as a factor of the discriminant loss function, the discriminant loss function L D It can be expressed as:
[0107]
[0108] Among them, δ can represent a weight parameter, which is used to control the weight parameter of the proportion of the attention loss function in the discriminant loss function.
[0109] S208, determining whether the discriminant loss function satisfies the first preset training stop condition, if not, executing step S209; if yes, executing S210.
[0110] S209: Keep the parameters of the generator unchanged and adjust the parameters of the discriminator.
[0111] S210: Calculate a second loss function using the discrimination result.
[0112] In the embodiment of the present application, when the discriminator loss function does not meet the first preset training stop condition, the parameters of the generator are kept unchanged and the parameters of the discriminator are adjusted. The predicted crop variety attribute information and the crop variety attribute information samples are re-input into the discriminator after the parameter adjustment, and the discriminator outputs the corresponding discrimination result. Then, the discriminant loss function is recalculated until the discriminant loss function meets the first preset training stop condition.
[0113] In the embodiment of the present application, the first preset training stop condition may be that a predetermined number of iterations is reached, or that the discrimination result of the discriminator satisfies a preset condition.
[0114] In the embodiment of the present application, the parameters of the discriminator can be adjusted by the discriminant loss function. In one example, the adjusted discriminator parameter θ' can be determined by the following formula: D :
[0115]
[0116] Among them, θ D can represent the historical parameters of the discriminator, It can represent the parameter adjustment gradient of the discriminator.
[0117] In the embodiment of the present application, when the discriminator loss function satisfies the first preset training stop condition, it can be determined that the discriminator training is completed. Further, the generator training can be performed.
[0118] S211. Determine the generation loss function of the generator based on the second loss function and the topology loss function.
[0119] In an embodiment of the present application, the generation loss function of the generator can be calculated using the second loss function and the topological loss function, so that the predicted crop variety attribute information generated by the generator is both close to the crop variety attribute information sample and can satisfy its topological structure, thereby improving the performance of the generator.
[0120] In one example, the generator’s generation loss function L G It can be calculated by the following formula:
[0121] L G = -log(D(G(z i θ G )))+βL topology (13)
[0122] Among them, β can represent a weight parameter.
[0123] S212: Determine whether the generated loss function satisfies the second preset training stop condition. If not, execute S213; if yes, terminate the training.
[0124] S213: Keep the parameters of the discriminator unchanged and adjust the parameters of the generator.
[0125] In the embodiment of the present application, when the generated loss function does not meet the second preset training stop condition, the parameters of the discriminator are kept unchanged and the parameters of the generator are adjusted. The predicted crop variety attribute information is regenerated using the generator after the adjusted parameters, and the discriminator makes a judgment, and the generated loss function is recalculated based on the judgment result until the generated loss function meets the second preset training stop condition.
[0126] In the embodiment of the present application, the parameters of the generator can be adjusted by generating a loss function. In one example, the adjusted generator parameter θ' can be determined by the following formula: G :
[0127]
[0128] Among them, θ G It can represent the historical parameter information of the generator. It can represent the parameter adjustment gradient of the generator.
[0129] In the embodiment of the present application, the training process of the generator and the discriminator in the generative adversarial network can be understood as a process of confrontation between the generator and the discriminator, that is, the training process of the generator and the discriminator can be a cyclic training process. In addition, the quality of the predicted crop variety attribute information generated by the generator can be evaluated by setting an independent validation set. If the evaluated quality is lower than the predetermined standard, the training process of the generator and the discriminator can be repeated.
[0130] In an embodiment of the present application, the termination condition for the generative adversarial network may be that the difference between the predicted crop variety attribute information generated by the generator and the crop variety attribute information sample is less than a predetermined threshold, or reaches a predetermined topological similarity, or reaches a predetermined number of iterations.
[0131] In the embodiment of the present application, the learning rate can be dynamically adjusted according to the performance of the generator and the discriminator.
[0132] In the embodiment of the present application, the predicted crop variety attribute information can be processed accordingly to improve the quality of the predicted crop variety attribute information. In one example, the predicted crop variety attribute information can be processed by filtering, sharpening, etc. to achieve the optimization purpose.
[0133] In an embodiment of the present application, when performing generative adversarial network training, the topological structure of the data is introduced into the loss functions of the generator and the discriminator, so that the generator can better adapt to and capture the changes and distribution of real data, avoiding the problem of the data generated by the generator lacking key characteristics.
[0134] In order to more effectively adapt to and capture the changes and distribution of real data, as another implementation of the present application, the present application also provides another implementation of the training method of the crop variety attribute information expansion model, please refer to the following embodiments for details.
[0135] See also Figure 3 , Figure 3 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown. The method comprises the following steps:
[0136] S310: Obtain a sample of crop variety attribute information and a first topological structure corresponding to the sample of crop variety attribute information.
[0137] S320. Utilize the generator in the generative adversarial network to obtain predicted crop variety attribute information.
[0138] S330, calculating the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample.
[0139] S340, determine whether the distance parameter is greater than the preset distance parameter, if so, execute step S350; if not, execute step S360.
[0140] S350. Adjust parameters of the generator.
[0141] S360: Determine a second topological structure corresponding to the predicted crop variety attribute information.
[0142] S370. Using the crop variety attribute information samples, the first topological structure, the predicted crop variety attribute information and the second topological structure, train a generative adversarial network to obtain a crop variety attribute information expansion model.
[0143] In the embodiment of the present application, steps S310 and S320 are consistent with steps S110 and S120, and steps S360 and S370 are consistent with steps S130 and S140, which are not elaborated herein.
[0144] In the embodiment of the present application, the distribution between the predicted crop variety attribute information and the crop variety attribute information samples can be determined by calculating the distance parameter between the predicted crop variety attribute information and the crop variety attribute information samples. The distribution can be represented by calculating the average distance value between multiple predicted crop variety attribute information and the crop variety attribute information samples.
[0145] In one example, the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample can be expressed by the following formula:
[0146]
[0147] Among them, k can represent the size of each batch of data. ri It can represent the attribute information sample of the i-th crop variety, G(z i θ G ) can be expressed using θ G is a parameter generator that generates predicted crop variety attribute information from the i-th noise in the noise distribution.
[0148] In an embodiment of the present application, if the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample is greater than the preset distance parameter τ, the generator parameters can be adjusted, and the predicted crop variety attribute information can be regenerated using the generator with adjusted parameters, and the distance parameter between the regenerated predicted crop variety attribute information and the crop variety attribute information sample is calculated until the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample is less than or equal to the preset distance parameter τ.
[0149] In the embodiment of the present application, the generator parameter can be adjusted by predicting the distance parameter between the crop variety attribute information and the crop variety attribute information sample. In one example, the adjusted generator parameter θ' can be calculated by the following formula: G :
[0150]
[0151] Among them, θ G It can represent the historical parameter information of the generator. It can represent the parameter adjustment gradient of the generator. α can represent the learning rate.
[0152] In the embodiment of the present application, the preset distance parameter τ may be a dynamic parameter. Furthermore, the preset distance parameter τ may be adjusted based on the distance parameter between the predicted crop variety attribute information of the previous batch and the crop variety attribute information sample.
[0153] In one example, the preset distance parameter τ can be expressed by the following formula:
[0154] τ t+1 =λτ t +(1-λ)d t (17)
[0155] Among them, λ can be a coefficient between 0 and 1, which is used to represent the last preset distance parameter τ t At the current preset distance parameter τ t+1 The weight in the calculation. t It can represent the distance parameter between the predicted crop variety attribute information of the previous batch and the crop variety attribute information samples.
[0156] In the embodiments of the present application, it can be understood that when the generator is trained, the above method can also be used to adjust the generator parameters.
[0157] In an embodiment of the present application, by calculating the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample, and presetting the distance parameter for comparison, the generator parameters are adjusted to more effectively adapt to and capture the changes and distribution of real data.
[0158] In order to realize the training of the agricultural variety attribute feature extraction model, as another implementation method of the present application, the present application also provides another implementation method of the training method of the crop variety attribute information expansion model, please refer to the following embodiments for details.
[0159] See also Figure 4 , Figure 4 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown. The method comprises the following steps:
[0160] S410: Obtain a sample of crop variety attribute information and a first topological structure corresponding to the sample of crop variety attribute information.
[0161] S420. Utilize the generator in the generative adversarial network to obtain predicted crop variety attribute information.
[0162] S430: Determine a second topological structure corresponding to the predicted crop variety attribute information.
[0163] S440, using the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information and the second topological structure, training a generative adversarial network to obtain a crop variety attribute information expansion model.
[0164] S450: Input the crop variety attribute information sample into the crop variety attribute information expansion model to generate second crop variety attribute information.
[0165] S460: Determine the crop variety characteristic label corresponding to the second crop variety attribute information.
[0166] S470: Train a crop variety feature extraction model using the second crop variety attribute information and the crop variety feature label.
[0167] In the embodiment of the present application, steps S410, S420, S430 and S440 are consistent with steps S110, S12, S130 and S140, and are not elaborated herein.
[0168] In the embodiment of the present application, the second crop variety attribute information is generated by using a trained crop variety attribute information expansion model.
[0169] In the embodiment of the present application, the second crop variety attribute information may have a larger data volume, thereby making the crop variety feature extraction model more accurate.
[0170] In an embodiment of the present application, the crop variety feature label corresponding to the second crop variety attribute information is determined. For example, the crop variety feature label corresponding to the second crop variety attribute information can be determined by a classifier.
[0171] In the embodiment of the present application, the second crop variety attribute information and the crop variety feature label can be used to train a neural network with multiple hidden layers to obtain a crop variety feature extraction model.
[0172] In one example, Figure 5 A schematic diagram of the structure of a multi-layer neural network provided by an embodiment of the present application is shown. Figure 5 The structure of the multi-layer neural network 500 includes three hidden layers, namely a first hidden layer 502, a second hidden layer 503 and a third hidden layer 504. Figure 5 The structure of the multi-layer neural network 500 shown also includes an input layer 501 and an output layer 505. Each hidden layer may have multiple neurons, and it is understood that each neuron may have its own weight parameter and bias parameter. In an example, if the neural network space is defined as Then any neuron P i It can be represented by a set of weights w i and a set of biases b i Definition. For example, and P i They can be expressed as:
[0173]
[0174] P i =(w i ,b i )
[0175] Where N is the number of points in parameter space.
[0176] In the embodiments of the present application, inspired by the principle of elastic fluctuations, that is, based on the natural phenomenon that elastic objects (such as springs, rubber bands, etc.) produce fluctuations after being acted upon by external forces and eventually tend to a steady state, the embodiments of the present application can use this phenomenon as a reference method for parameter optimization, thereby effectively avoiding falling into a local optimal solution during neural network training.
[0177] Figure 6 FIG. 4 is a flow chart showing an implementation of S470 provided in an embodiment of the present application. Figure 6As shown, the following steps are included:
[0178] S471. Input the second crop variety attribute information into the crop variety feature extraction model to be trained to obtain predicted crop variety feature information.
[0179] S472. Calculate the third loss function of the crop variety feature extraction model based on the predicted crop variety feature information and the crop variety feature label.
[0180] S473. Determine whether the third loss function satisfies the third preset training stop condition. If so, end the training; if not, execute step S474.
[0181] S474. Determine the parameter change gradient of the crop variety feature extraction model based on the elastic characteristics and fluctuation characteristics of the elastic fluctuation algorithm.
[0182] S475. Update the parameters of the crop variety feature extraction model according to the parameter change gradient to obtain an updated crop variety feature extraction model.
[0183] In the embodiment of the present application, before the second crop variety attribute information is input into the crop variety feature extraction model to be trained, the neural network, that is, the parameters of the crop variety feature extraction model, including the weight parameters and bias parameters of each neuron, can be initialized. In addition, before the second crop variety attribute information is input into the crop variety feature extraction model to be trained, the time step Δt can also be set.
[0184] In the embodiment of the present application, after initializing the relevant parameters, the predicted crop variety characteristic information is obtained by inputting the second crop variety attribute information into the crop variety feature extraction model to be trained.
[0185] In the embodiment of the present application, it is necessary to determine the crop variety characteristic label corresponding to the predicted crop variety characteristic information, so as to calculate the loss function by predicting the crop variety characteristic information and the corresponding crop variety characteristic label.
[0186] In an embodiment of the present application, the crop variety characteristic label corresponding to the predicted crop variety characteristic information can be determined by a classification model. In one example, the target output and the actual output can be obtained by inputting the information output by the last layer of the multi-layer neural network into a preset Softmax classifier, that is, the Softmax classifier is used to determine which are the predicted crop variety characteristic information and which are the crop variety characteristic labels.
[0187] In an embodiment of the present application, the third loss function of the crop variety feature extraction model can be calculated by predicting the crop variety feature information and the corresponding crop variety feature label. In one example, the third loss function can be expressed by the following formula:
[0188]
[0189] in, and i can represent the i-th predicted crop variety feature information and the corresponding crop variety feature label respectively. N can represent the number of second crop variety attribute information. T can represent the current training iteration number. α L and β L It can represent the amplitude coefficient of cosine and sine waves and can be preset by a technician. ω and φ are the frequencies of cosine and sine waves and can be preset by a technician.
[0190] Further, it is determined whether the third loss function satisfies the third preset training stop condition. If the third loss function does not satisfy the third preset training stop condition, the parameter change gradient of the crop variety feature extraction model can be determined according to the elasticity characteristics and fluctuation characteristics of the elastic fluctuation algorithm. And the parameters of the crop variety feature extraction model are updated through the change gradient.
[0191] In an embodiment of the present application, updating the parameters of the crop variety feature extraction model may include updating the weight parameters and / or bias parameters corresponding to each neuron in the crop variety feature extraction model.
[0192] In the embodiment of the present application, the elasticity characteristics and fluctuation characteristics of the elastic fluctuation algorithm can be adjusted through the oscillation adjustment mechanism, and then the parameter change gradient of the crop variety feature extraction model can be determined based on the adjusted elasticity characteristics and fluctuation characteristics. Among them, the oscillation adjustment mechanism can be an adjustment strategy for the elasticity characteristic, that is, the elastic constant κ, based on the adjustment strategy for the fluctuation characteristic, that is, the fluctuation speed v.
[0193] In the embodiment of the present application, the adjusted elastic characteristic κ can be calculated by the following formula:
[0194]
[0195] In addition, the adjusted volatility characteristic v can be calculated by the following formula:
[0196]
[0197] Among them, κ0 and v0 are the initial elastic constant and fluctuation speed, β z and γ z is the adjustment factor.
[0198] Furthermore, the following formula can be defined to determine the parameter change gradient of the crop variety feature extraction model, where Δw can be the change gradient of the weight parameter in the model, and Δb can be the change gradient of the bias parameter in the model:
[0199]
[0200]
[0201] in, represents the partial derivative calculation. Δt is the time step.
[0202] In the embodiment of the present application, the parameters of the crop variety feature extraction model can be updated by the parameter change gradient to achieve the updating of the parameters of the crop variety feature extraction model.
[0203] In one example, for the updated weight parameter w in the crop variety feature extraction model i+1 , can be calculated by the following formula:
[0204] w i+1 =w i +Δw (23)
[0205] In one example, for the updated bias parameter b in the crop variety feature extraction model i+1 , can be calculated by the following formula:
[0206] b i+1 =b i +Δb (24)
[0207] Among them, w i The current weight parameter of the i-th neuron in the crop variety feature extraction model; b i The current weight parameter of the i-th neuron in the crop variety feature extraction model can be used.
[0208] In an embodiment of the present application, a sample of crop variety characteristic information can be input into a crop variety characteristic extraction model after updating parameters to obtain corresponding predicted crop variety characteristic information, thereby recalculating the third loss function until the loss function meets the third preset stop condition.
[0209] In the embodiment of the present application, the third preset stop condition may include reaching a preset number of iterations, or the loss function converges.
[0210] In one example, whether the change of the loss value of the third loss function does not change within a preset number of iterations, i.e. convergence, can be used as the third preset stop condition. The change ΔL of the third loss function L() can be expressed as:
[0211] ΔL=L(w i+1 ,b i+1 )-L(w i ,b i ) (25)
[0212] Furthermore, according to the elastic wave algorithm and Taylor series expansion, the expansion (26) is obtained:
[0213]
[0214] Combining formula (21) to formula (24) and expanding formula (26), we get the change ΔL:
[0215]
[0216] In the embodiment of the present application, because ΔL is a negative value or zero, it can be ensured that the loss function L(w, b) decreases or remains unchanged.
[0217] In the embodiment of the present application, when it is determined that the loss function satisfies the third preset stop condition, it can be determined that the crop variety feature extraction model has completed training.
[0218] In an embodiment of the present application, by combining the elastic fluctuation algorithm with the training of the crop variety feature extraction model, it is possible to more accurately determine the adjustment gradient of each parameter in the model, achieve gradient optimization, and thus avoid the problem of the crop variety feature extraction model falling into a local optimal solution during training.
[0219] In order to realize the training of the agricultural variety identification model, as another implementation method of the present application, the present application also provides another implementation method of the training method of the crop variety attribute information expansion model, please refer to the following embodiments for details.
[0220] See also Figure 7 , Figure 7 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown. The method can be used in combination with any embodiment of the present application, and the method includes the following steps:
[0221] S710: Obtain a sample of crop variety attribute information and a first topological structure corresponding to the sample of crop variety attribute information.
[0222] S720. Utilize the generator in the generative adversarial network to obtain predicted crop variety attribute information.
[0223] S730: Determine a second topological structure corresponding to the predicted crop variety attribute information.
[0224] S740. Train a generative adversarial network using the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information, and the second topological structure to obtain a crop variety attribute information expansion model.
[0225] In the embodiment of the present application, steps S710, S720, S730 and S740 are consistent with steps S110, S12, S130 and S140, and are not elaborated herein.
[0226] S750: Obtain a third training sample.
[0227] The third training sample may be parameter attribute information of a third crop variety and a corresponding third crop variety label obtained by expanding the model using parameter attribute information of the crop variety.
[0228] S760: Use the third crop variety attribute information and the corresponding third crop variety label to train a crop variety recognition model to obtain a trained crop variety recognition model.
[0229] In the embodiment of the present application, the gradient boosting tree can be trained in combination with gradient pruning and Delkart thinking to obtain a crop variety recognition model. It can be understood that in the embodiment of the present application, the gradient boosting tree is pruned by Delkart thinking, so as to avoid the problem of gradient explosion caused by outliers during the training of the gradient boosting tree.
[0230] In the embodiment of the present application, the training of the gradient boosting decision tree may be a process of determining the node features of each node in the gradient boosting tree.
[0231] Figure 8 FIG. 2 is a flow chart showing an implementation of S760 provided in an embodiment of the present application. Figure 8 As shown, the method can be used in combination with any embodiment of the present application, and includes the following steps:
[0232] S761. Use the crop variety attribute information as the node feature of the current node in the gradient boosting tree model to be trained, and classify it to obtain a classification result.
[0233] In the embodiment of the present application, the crop variety attribute information may be the third crop variety attribute information contained in the third training sample, wherein the third crop variety attribute information may be obtained by expanding the model using the attribute information of the crop variety.
[0234] In the embodiment of the present application, an initial weight may be calculated for each crop variety attribute information, wherein the weight may be used to indicate the importance of each crop variety attribute information in the training process.
[0235] In an example, we can assume that the dataset of crop variety attribute information is:
[0236] D={(x1,y1),(x2,y2),…,(x n ,y n )}, where x i is a sample data of crop variety attribute information, y i is its corresponding label. Crop variety attribute information initialization weight for:
[0237]
[0238] in, It can be a universal quantitative symbol, that is, for any x in the crop variety attribute information i The initialization weights can be Here, n may be the number of sample data contained in the crop variety attribute information.
[0239] In an embodiment of the present application, the crop variety attributes can be used as node features of the current node in the gradient boosting tree model to be trained to perform classification and obtain classification results.
[0240] In the embodiment of the present application, the training of the gradient boosting tree to be trained can be implemented through the hierarchical structure from top to bottom in the decision tree model. It can be understood that each level of the decision tree can contain one or more nodes.
[0241] In one example, the current node may be a root node, and different crop variety attribute information may be used as node features of the root node to classify the input data and obtain the classification results corresponding to each crop variety attribute information. The node features of the decision tree nodes may be obtained by sampling the crop variety attribute information at any time.
[0242] In the embodiments of the present application, it can be understood that the attribute information of the crop variety output by the crop variety identification model can be used as the input information of the gradient boosting tree model to be trained to realize the training of the crop variety identification model.
[0243] S762. For each classification result, respectively execute: according to the classification result, determine the uncertainty value corresponding to the crop variety attribute when the crop variety attribute information is the node feature of the current node.
[0244] In the embodiment of the present application, the uncertainty value corresponding to the crop variety attribute can be determined based on the classification result for each case where the crop variety attribute information is determined as the node feature of the current node. It can be understood that the uncertainty can be the uncertainty of the splitting method of the current node under a crop variety attribute information.
[0245] S763. Use the target crop variety attribute corresponding to the maximum uncertainty value as the node feature of the current node.
[0246] In the embodiment of the present application, the crop variety attribute information with the largest uncertainty value is used as the target crop variety attribute, and the target crop variety attribute is used as the node feature of the current node. In one example, the crop variety attribute corresponding to the most challenging, i.e., the most uncertain splitting method, can be selected as the node feature of the current node.
[0247] S764. Calculate the gain information of the current node according to the classification result.
[0248] S765. Determine whether the gain information of the current node is less than a preset gain threshold. If so, execute step S766; if not, execute step S767.
[0249] S766: Determine that the current node is a leaf node of the decision tree.
[0250] S767: Determine that the current node has completed training, and update the next node of the current node to the current node.
[0251] In the embodiment of the present application, the depth information of the decision tree can be determined by calculating the gain information corresponding to the decision tree nodes.
[0252] In the embodiment of the present application, when the gain information of the current node is less than the preset gain threshold, the current node is determined to be a leaf node corresponding to the decision tree. When the gain information of the current node is greater than or equal to the preset gain threshold, it is determined that the current node has completed training, and the nodes contained in the next level can be trained. The next node can be updated to the current node to implement training of the next node.
[0253] In the embodiment of the present application, the information gain corresponding to each node can be maximized. In one example, the information gain IG can be calculated by the following formula:
[0254]
[0255] Among them, H can be Gini impurity or entropy, V is the value set of the feature, that is, the crop variety attribute information, D v It is the sub-dataset when the feature value is v, that is, the classification result corresponding to the attribute information of each crop variety.
[0256] S768. Calculate difference information using the predicted crop varieties and corresponding crop variety labels output by the trained decision tree.
[0257] S769, determine whether the difference information meets the preset stop condition, if so, end the training; if not, execute step S761.
[0258] In an embodiment of the present application, the difference information can be calculated by the predicted crop variety output by the trained decision tree and the corresponding crop variety label. And based on the difference information, it is determined whether the gradient boosting decision tree model has completed training. The difference information can be the difference between the predicted crop variety and the corresponding crop variety label.
[0259] In the embodiment of the present application, it can be assumed that the gradient boosting tree model F can be obtained by weighted summation of multiple decision trees. In one example, the gradient boosting decision tree model F can be expressed by the following formula:
[0260]
[0261] Among them, f k is the kth decision tree, β k is the weight corresponding to the decision tree.
[0262] In the embodiment of the present application, the difference information between the crop varieties of the trained decision tree and the corresponding crop varieties can be used as a new target for the next decision tree training. i ′ can be expressed as:
[0263] y i ′=y i -η×g i (31)
[0264] Where η is the step size. i Can represent the gradient value. In an example, the gradient value g i It can be calculated by the following formula:
[0265]
[0266] In the embodiment of the present application, the difference information can be calculated in the above manner. When the difference information does not meet the preset stop condition, the feature information of each node in the decision tree is readjusted until the preset stop condition is met.
[0267] In the embodiment of the present application, the preset stop condition may be a preset number of iterations or other stop criteria.
[0268] In the embodiment of the present application, during the training of the decision tree model, the error of each sample data corresponding to each crop variety attribute information corresponding to each node can be calculated. And the corresponding weight is adjusted according to the error, so that the sample data with larger error will receive more attention. In one example, the error information e corresponding to each sample data in the crop variety attribute information can be calculated by the following formula: i :
[0269] e i =y i -F(x i ) (33)
[0270] In the embodiment of the present application, the weights of each sample data corresponding to the crop variety attribute information can be adjusted according to the prediction error of the current decision tree. This ensures that in the subsequent training of the decision tree, the sample data with larger errors will receive more attention. In one example, the updated weights It can be expressed as:
[0271]
[0272] Here, α is the learning rate. It can represent the weight corresponding to the sample data in the current decision tree.
[0273] In the embodiment of the present application, during the training of the decision tree model, the gradient value of each sample data corresponding to each crop variety attribute information corresponding to each node can be calculated. When the gradient value is greater than a preset threshold, it is determined that the sample data corresponding to the crop variety attribute information corresponding to the gradient value needs to be clipped, thereby avoiding gradient explosion. In one example, the gradient clipping can be achieved by the following formula:
[0274] g i =sign(g i )×T (35)
[0275] Among them, sign() represents the sign function; T represents the preset threshold.
[0276] In an embodiment of the present application, by pruning nodes whose gradient values are greater than a preset threshold when training the gradient boosting tree, the problem of gradient explosion caused by the gradient boosting tree being affected by outliers is avoided.
[0277] In order to delete decision trees with small contributions or that cause overfitting, in an embodiment of the present application, the weight of a decision tree in the gradient boosting tree model can be calculated, and the decision tree can be removed if the weight is less than a threshold.
[0278] In the embodiment of the present application, the change of the overall gradient can also be monitored. In the case of large fluctuations or stabilization of the gradient, the learning rate can be adaptively adjusted to ensure the stability of the gradient boosting tree model. The calculation method of monitoring the change value △g of the gradient can be expressed as:
[0279]
[0280] in, It can represent the gradient value corresponding to the i-th sample data in the t-th crop variety attribute information. It can represent the gradient value corresponding to the i-th sample data in the t+1-th crop variety attribute information. It can be understood that when △g exceeds the threshold, the learning rate α is adjusted.
[0281] In the embodiment of the present application, in order to further improve the accuracy of the gradient boosting tree model, it is possible to consider fusing the models obtained in multiple training processes to obtain an integrated model. In one example, multiple models F1, F2, ..., F m The way to get the integrated model F′(x) can be expressed as:
[0282]
[0283] In the embodiments of the present application, in order to realize the identification of crop varieties, as another implementation method of the present application, the present application also provides another implementation method of the training method of the crop variety attribute information expansion model, please refer to the following embodiments for details.
[0284] See also Fig. 9 , Fig. 9 A flow chart of another method for training a crop variety attribute information expansion model provided by an embodiment of the present application is shown, and the method comprises the following steps:
[0285] S910: Acquire crop images.
[0286] In the embodiment of the present application, the acquired crop images may be images of the crops at different growth stages.
[0287] S920: Extract features from the crop image using a feature extraction model to obtain crop features.
[0288] Among them, the crop variety feature extraction model is any one of the crop variety feature extraction models in the embodiments of the present application.
[0289] In the embodiment of the present application, a feature extraction model can be used to extract features in the crop image to obtain corresponding features.
[0290] S930: Input crop characteristics into a crop variety identification model to obtain crop variety information.
[0291] In the embodiment of the present application, crop variety information is obtained by inputting crop characteristics into a crop variety identification model.
[0292] In one example, a picture of crops is obtained. And the dimension of the picture is 256×256×3. The crop picture can be preprocessed, and the crop variety recognition model can be used to obtain the fine-grained feature vector corresponding to the crop. Furthermore, the crop variety recognition model classifies the fine-grained feature vector and predicts its possible variety category, such as "wheat".
[0293] In the embodiment of the present application, after the features in the crop image are extracted by using a feature extraction model to obtain corresponding features, the features can be used to identify the crop varieties, thereby improving the accuracy of crop identification.
[0294] In the embodiment of the present application, crop variety attribute information samples used for training can be obtained through crop images.
[0295] In the embodiment of the present application, the crop image data may be a three-dimensional tensor. In one example, the three-dimensional tensor T used to represent the crop image may be expressed as:
[0296] T={t ijk}(i=1,2,...,M;j=1,2,...,N;k=1,2,...,O)
[0297] Where M and N represent the width and height of the image, respectively, and O represents the number of channels of the image. In one example, for a color RGB image, O=3. ijk Represents the pixel value at the i,j position in the image, in the k-th channel.
[0298] In the embodiment of the present application, the corresponding crop variety labels used for training can be annotated by relevant technicians. In one example, a vector L is used to represent the crop variety label, and the crop variety label L can be expressed as:
[0299] L = {l i}(i=1, 2, ..., P)
[0300] Where P is the total number of crop varieties. j is the label of the crop variety, specifically an integer from 1 to P.
[0301] In one example, a crop image is 256x256 in size and is a color RGB image. The data of this image can be represented as a three-dimensional tensor T, where M=256, N=256, and O=3. If the R channel value of a certain pixel position (x, y) in the image is 150, it can be represented as t xy1 =150. At the same time, suppose that there are five crop varieties in the present invention, that is, P = 5. If the crop corresponding to the image is the second variety, the label can be expressed as l j =2.
[0302] Furthermore, the acquired data is preprocessed, including data normalization, grayscale conversion, and size adjustment.
[0303] In one example, data normalization is achieved in the following manner: if the pixel value of the acquired image is (0, 255), data normalization can convert the range of pixel values from (0, 255) to (0, 1), which can be expressed as:
[0304]
[0305] Among them, t ijk is the original pixel value, t′ ijk is the normalized pixel value.
[0306] Furthermore, grayscale conversion is performed. In the embodiment of the present application, the image can be converted into a grayscale format, which can be expressed by the following formula:
[0307] g ij =0.299t′ ij1 +0.587t′ ij2 +0.114t′ ij3 (39)
[0308] Among them, g ij is the gray value, t′ ij1 , t′ ij2 , t′ ij3 They are the normalized R, G, and B channel values respectively.
[0309] Furthermore, the image size is adjusted. Since the images of crops may come from different camera devices, their sizes may be different. In order to enable the images to be processed uniformly, the present invention chooses to adjust their size to a fixed H×W. The conversion function can be defined as f(·), and the conversion is achieved by the following operations:
[0310] T′=f(T,H,W) (40)
[0311] Wherein, T is the original image data, and T′ is the image data after resizing.
[0312] Based on the training method of the crop variety attribute information expansion model provided in the above embodiment, the present application also provides a specific implementation of the training device of the crop variety attribute information expansion model. Please refer to the following embodiment.
[0313] See first Fig.10 The training device 1000 for the crop variety attribute information expansion model provided in the embodiment of the present application includes the following modules:
[0314] The first acquisition module 1001 is used to acquire a sample of crop variety attribute information and a first topological structure corresponding to the crop variety attribute information;
[0315] The second acquisition module 1002 is used to obtain predicted crop variety attribute information using a generator of a generative adversarial network;
[0316] A determination module 1003 is used to determine a second topological structure corresponding to the predicted crop variety attribute information;
[0317] The training module 1004 is used to train a generative adversarial network using the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information and the second topological structure to obtain a crop variety attribute information expansion model.
[0318] The training device of the crop variety attribute information expansion model in the embodiment of the present application combines the corresponding topological structure of the crop variety attribute information with the traditional generative adversarial network, so that the predicted crop variety attribute information generated by the generative adversarial network is closer to the actual crop variety attribute information, thereby improving the performance of the crop variety attribute information expansion model.
[0319] As an implementation method of the present application, the first acquisition module 1001 uses the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information and the second topological structure to train the generative adversarial network in the following manner: using the first topological structure and the second topological structure, calculating the topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample; inputting the predicted crop variety attribute information and the crop variety attribute information sample into the discriminator to obtain a discrimination result; using the discrimination result, calculating the first loss function; determining the discriminant loss function of the discriminator based on the first loss function and the topological loss function; and when the discriminator loss function does not meet the first preset training stop condition, In this case, keep the parameters of the generator unchanged, adjust the parameters of the discriminator, return to input the predicted crop variety attribute information and the crop variety attribute information sample into the discriminator, obtain the discrimination result, until the discrimination loss function meets the first preset training stop condition, and obtain the discriminator; use the discrimination result to calculate the second loss function; determine the generation loss function of the generator according to the second loss function and the topological loss function; when the generation loss function does not meet the second preset training stop condition, keep the parameters of the discriminator unchanged, adjust the parameters of the generator, return to use the generator in the generative adversarial network, obtain the predicted crop variety attribute information, until the generation loss function meets the second preset training stop condition, and obtain the generator.
[0320] As an implementation method of the present application, the first acquisition module 1001 uses the discrimination result to calculate the first loss function in the following manner: using the discrimination result, calculate the predicted loss function corresponding to the predicted crop variety attribute information; calculate the true loss function corresponding to the crop variety attribute information sample; determine the first loss function based on the predicted loss function and the true loss function.
[0321] As an implementation method of the present application, the first acquisition module 1001 uses the first topological structure and the second topological structure to calculate the topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample in the following manner: using the first predicted topological structure and the second topological structure to calculate the topological weight information; using the first predicted topological structure, the second topological structure and the topological weight information to calculate the topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample.
[0322] As an implementation method of the present application, after obtaining the predicted crop variety attribute information in the generator using the generative adversarial network, the second acquisition module 1002 is also used to: calculate the distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample; when the distance parameter is greater than the preset distance parameter, adjust the parameters of the generator, and return to using the generator in the generative adversarial network to obtain the predicted crop variety attribute information until the distance parameter is less than or equal to the preset distance parameter.
[0323] As an implementation of the present application, after obtaining the crop variety attribute information expansion model, the device further includes:
[0324] The crop variety feature extraction model training module 1005 is used to input the crop variety attribute information sample into the crop variety attribute information expansion model to generate the second crop variety attribute information; determine the crop variety feature label corresponding to the second crop variety attribute information; and use the second crop variety attribute information and the crop variety feature label to train the crop variety feature extraction model.
[0325] As an implementation method of the present application, the crop variety feature extraction model training module 1005 uses the second crop variety attribute information and the corresponding crop variety label to train the crop variety feature extraction model in the following manner: input the second crop variety attribute information into the crop variety feature extraction model to be trained to obtain predicted crop variety feature information; calculate the third loss function of the crop variety feature extraction model based on the predicted crop variety feature information and the crop variety feature label; when the third loss function does not meet the third preset training stop condition, determine the parameter change gradient of the crop variety feature extraction model based on the elasticity characteristics and fluctuation characteristics of the elastic fluctuation algorithm; update the parameters of the crop variety feature extraction model according to the parameter change gradient to obtain an updated crop variety feature extraction model; return and input the crop variety feature information sample into the updated crop variety feature extraction model to obtain predicted crop variety feature information, until the third loss function meets the third preset training stop condition to obtain the crop variety feature extraction model.
[0326] As an implementation of the present application, after obtaining the crop variety attribute information expansion model, the device further includes:
[0327] The crop variety identification model module training module 1006 is used to obtain a third training sample, which includes the third crop variety attribute information and the corresponding third crop variety label obtained by expanding the model using the attribute information of the crop variety; the crop variety identification model is trained using the third crop variety attribute information and the corresponding third crop variety label to obtain a crop variety identification model that has completed training.
[0328] As an implementation method of the present application, the crop variety identification model module training module 1006 uses the third crop variety attribute information and the corresponding third crop variety label to train the crop variety identification model in the following manner: for each node in the training gradient boosting tree model, the following steps AE are executed in a loop until the difference information meets the preset stop condition: Step A, for each crop variety attribute information, respectively execute: use the crop variety attribute information as the node feature of the current node, classify, and obtain the classification result; Step B, for each classification result, respectively execute: according to the classification result, determine the uncertainty value corresponding to the crop variety attribute information when the crop variety attribute information is the node feature of the current node; Step C, the target crop variety corresponding to the maximum uncertainty value attribute information as the node feature of the current node; step D, according to the classification result, calculate the gain information of the current node, and when the gain information of the current node is less than the preset gain threshold, determine that the current node is a leaf node of the decision tree; when the gain information of the current node is greater than or equal to the preset gain threshold, determine that the current node has completed training, and update the next node of the current node to the current node, and return to step A until the gain information of the current node is less than the preset gain threshold, and obtain a decision tree that has completed training; step E, use the predicted crop variety output by the trained decision tree and the corresponding crop variety label to calculate the difference information, and when the difference information does not meet the preset stop condition, return to step A until the difference information meets the preset stop condition, and obtain a crop variety recognition model that has completed training.
[0329] As an implementation method of the present application, the crop variety identification model module training module 1006 is also used to, after obtaining the trained crop variety identification model: calculate the weight information corresponding to the crop variety identification model; use the weight information to calculate the gradient value corresponding to each node in the crop variety identification model; when the gradient value exceeds a preset threshold, determine the node corresponding to the gradient value for pruning.
[0330] As an implementation method of the present application, the crop variety identification model module training module 1006 is also used to, after the trained crop variety identification model is obtained: obtain crop images; use the feature extraction model to extract features in the crop images to obtain crop features; the crop variety feature extraction model is the crop variety feature extraction model in the embodiment of the present application; input the crop features into the crop variety identification model to obtain crop variety information.
[0331] Fig.11 A schematic diagram of the hardware structure of the method for training the crop variety attribute information expansion model provided in an embodiment of the present application is shown.
[0332] The training device for the crop variety attribute information expansion model may include a processor 1101 and a memory 1102 storing computer program instructions.
[0333] Specifically, the processor 1101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0334] The memory 1102 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1102 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 1102 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 1102 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 1102 is a non-volatile solid-state memory.
[0335] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0336] The processor 1101 reads and executes the computer program instructions stored in the memory 1102 to implement any one of the training methods for the crop variety attribute information expansion model in the above embodiments.
[0337] In one example, the training device for the crop variety attribute information expansion model may further include a communication interface 1103 and a bus 1110. Fig.11 As shown, the processor 1101, the memory 1102, and the communication interface 1103 are connected via a bus 1110 and communicate with each other.
[0338] The communication interface 1103 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0339] Bus 1110 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1110 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0340] The training device of the crop variety attribute information expansion model can execute the training method of the crop variety attribute information expansion model in the embodiment of the present application based on the agricultural variety attribute information sample, thereby realizing the combination of Figure 1 and Fig.11 The invention describes a training method and device for a crop variety attribute information expansion model.
[0341] In addition, in combination with the training method of the crop variety attribute information expansion model in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the training methods of the crop variety attribute information expansion model in the above embodiment is implemented.
[0342] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0343] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0344] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0345] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment 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 program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0346] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for training a crop variety attribute information expansion model, characterized in that: include: Acquire a sample of crop variety attribute information and a first topological structure corresponding to the sample of crop variety attribute information; Using the generator in the generative adversarial network, we can predict the attribute information of crop varieties. Determining a second topological structure corresponding to the predicted crop variety attribute information; The crop variety attribute information samples, the first topological structure, the predicted crop variety attribute information and the second topological structure are used to train a generative adversarial network to obtain a crop variety attribute information expansion model.
2. The method according to claim 1, characterized in that The generative adversarial network also includes a discriminator; The method of training a generative adversarial network by using the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information and the second topological structure includes: Calculating a topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample using the first topological structure and the second topological structure; Inputting the predicted crop variety attribute information and the crop variety attribute information sample into the discriminator to obtain a discrimination result; Using the discrimination result, calculating a first loss function; Determine a discriminant loss function of the discriminator according to the first loss function and the topological loss function; In the case where the discriminant loss function does not satisfy the first preset training stop condition, keep the parameters of the generator unchanged, adjust the parameters of the discriminator, return to the step of inputting the predicted crop variety attribute information and the crop variety attribute information sample into the discriminator to obtain a discrimination result, until the discriminant loss function satisfies the first preset training stop condition, and obtains the discriminator; Calculate a second loss function using the discrimination result; Determine a generation loss function of the generator according to the second loss function and the topology loss function; When the generation loss function does not satisfy the second preset training stop condition, the parameters of the discriminator are kept unchanged, the parameters of the generator are adjusted, and the generator in the generative adversarial network is returned to obtain the predicted crop variety attribute information, until the generation loss function satisfies the second preset training stop condition to obtain the generator.
3. The method according to claim 2, characterized in that The step of calculating a first loss function by using the discrimination result includes: Using the discrimination result, calculating the prediction loss function corresponding to the predicted crop variety attribute information; Calculate the true loss function corresponding to the crop variety attribute information sample; A first loss function is determined according to the predicted loss function and the true loss function.
4. The method according to claim 2, characterized in that: The calculating of the topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample by using the first topological structure and the second topological structure includes: Calculating topological weight information using the first predicted topological structure and the second topological structure; The first predicted topological structure, the second topological structure and the topological weight information are used to calculate a topological loss function between the predicted crop variety attribute information and the crop variety attribute information sample.
5. The method according to any one of claims 1 to 4, characterized in that: In the generator using the generative adversarial network, after obtaining the predicted crop variety attribute information, the method further includes: Calculating a distance parameter between the predicted crop variety attribute information and the crop variety attribute information sample; When the distance parameter is greater than the preset distance parameter, the parameters of the generator are adjusted, and the generator in the generative adversarial network is returned to obtain predicted crop variety attribute information until the distance parameter is less than or equal to the preset distance parameter.
6. The method according to claim 1, characterized in that After obtaining the crop variety attribute information expansion model, the method further includes: Inputting the crop variety attribute information sample into the crop variety attribute information expansion model to generate second crop variety attribute information; Determining a crop variety characteristic label corresponding to the second crop variety attribute information; The crop variety feature extraction model is trained using the second crop variety attribute information and the crop variety feature label.
7. The method according to claim 6, characterized in that Using the second crop variety attribute information and the corresponding crop variety label, training a crop variety feature extraction model includes: Inputting the second crop variety attribute information into the crop variety feature extraction model to be trained to obtain predicted crop variety feature information; Calculating a third loss function of the crop variety feature extraction model according to the predicted crop variety feature information and the crop variety feature label; When the third loss function does not satisfy the third preset training stop condition, determining the parameter change gradient of the crop variety feature extraction model according to the elasticity characteristics and fluctuation characteristics of the elastic fluctuation algorithm; updating the parameters of the crop variety feature extraction model according to the parameter change gradient to obtain an updated crop variety feature extraction model; Return and input the second crop variety attribute information into the updated crop variety feature extraction model to obtain predicted crop variety feature information, until the third loss function meets the third preset training stop condition, to obtain the crop variety feature extraction model.
8. The method according to claim 1, characterized in that After obtaining the crop variety attribute information expansion model, the method further includes: Acquire a third training sample, wherein the third training sample includes third crop variety attribute information obtained by using the crop variety attribute information expansion model and a corresponding third crop variety label; The third crop variety attribute information and the corresponding third crop variety label are used to train a crop variety identification model to obtain a trained crop variety identification model.
9. The method according to claim 8, characterized in that The method of training a crop variety recognition model using the third crop variety attribute information and the corresponding third crop variety label includes: For each node in the training gradient boosted tree model, perform the following steps AD: Step A: for each crop variety attribute information, respectively perform: taking the crop variety attribute information as the node feature of the current node, classifying, and obtaining a classification result; Step B, for each classification result, respectively executing: determining, according to the classification result, an uncertainty value corresponding to the crop variety attribute information when the crop variety attribute information is a node feature of the current node; Step C, using the target crop variety attribute information corresponding to the maximum uncertainty value as the node feature of the current node; Step D, according to the classification result, calculate the gain information of the current node, and when the gain information of the current node is less than the preset gain threshold, determine that the current node is a leaf node of the decision tree; when the gain information of the current node is greater than or equal to the preset gain threshold, determine that the current node has completed training, and update the next node of the current node to the current node, and return to step A until the gain information of the current node is less than the preset gain threshold, and obtain a decision tree that has completed training; Step E: using the predicted crop varieties and corresponding crop variety labels output by the trained decision tree, calculating difference information, wherein the difference information is the difference between the predicted crop varieties and the crop variety labels; When the difference information does not satisfy the preset stop condition, steps AE are performed until the difference information satisfies the preset stop condition, thereby obtaining a crop variety recognition model that has completed training.
10. The method according to claim 8, characterized in that After obtaining the trained crop variety recognition model, the method further includes: Calculating weight information corresponding to the crop variety identification model; Utilizing the weight information, calculating the gradient value corresponding to each node in the crop variety identification model; When the gradient value exceeds a preset threshold, the node corresponding to the gradient value is determined to be pruned.
11. The method according to claim 8, characterized in that After obtaining the trained crop variety recognition model, the method further includes: Acquire crop images; Extracting features from the crop image using a crop variety feature extraction model to obtain crop features; the crop variety feature extraction model is the crop variety feature extraction model according to claim 6 or 7; The crop characteristics are input into the crop variety identification model to obtain crop variety information.
12. A training device for a crop variety attribute information expansion model, characterized in that: The device comprises: A first acquisition module, used to acquire a sample of crop variety attribute information and a first topological structure corresponding to the crop variety attribute information; The second acquisition module is used to obtain predicted crop variety attribute information using a generator of a generative adversarial network; A determination module, used to determine a second topological structure corresponding to the predicted crop variety attribute information; The training module is used to train a generative adversarial network using the crop variety attribute information sample, the first topological structure, the predicted crop variety attribute information and the second topological structure to obtain a crop variety attribute information expansion model.
13. A training device for a crop variety attribute information expansion model, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the training method of the crop variety attribute information expansion model as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the training method for the crop variety attribute information expansion model as described in any one of claims 1-11.
15. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the training method for the crop variety attribute information expansion model as described in any one of claims 1-11.
