Citrus black spot intelligent diagnosis method based on preference multi-objective algorithm optimization large language model
By optimizing a large language model using a preference-based multi-objective algorithm and combining it with an evolutionary algorithm, the problem of insufficient feature mapping and model adaptation in hyperspectral images of citrus black spot disease was solved. This enabled adaptive modeling across datasets, improved the model's versatility and robustness, adapted it to different scenarios, and enhanced diagnostic accuracy and efficiency.
Patent Information
- Application Number
- CN202511250474.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2026-01-02
AI Technical Summary
Existing technologies have insufficient feature mapping and model adaptation capabilities when processing hyperspectral images of citrus black spot disease, lacking versatility and robustness. Furthermore, they rely on manual adjustments to feature extraction strategies and model structures, making it difficult to adapt to different scenarios.
A preference-based multi-objective algorithm is used to optimize a large language model. By combining evolutionary algorithms with the large language model, and through feature encoding and automatic generation of network models, adaptive modeling across datasets is achieved. The model is optimized using a mapping function and a triple delimiter structure, and iterative optimization is performed by combining a multi-objective fitness function and angle penalty distance.
The model's versatility and robustness have been improved, its high-dimensional data processing capabilities have been enhanced, and full-process automation and low-threshold accessibility have been achieved. The overall performance and practicality of the model have been optimized, its interpretability and scalability have been improved, it can adapt to different planting environments and equipment, and its diagnostic accuracy and efficiency have been increased.
Smart Images

Figure CN121258882A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent detection, more particularly, to a citrus black spot disease intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model. BACKGROUND
[0002] Hyperspectral imaging (HSI) has high spectral resolution and rich spatial information, and is widely used in agricultural pest detection, mineral identification, food quality detection and other fields. Citrus black spot disease is one of the important diseases in citrus production, which seriously affects the yield and quality of citrus. The traditional method usually converts the HSI data of citrus into a one-dimensional feature vector through feature extraction (such as PCA, band selection, etc.), and then constructs a machine learning model (SVM, RF, XGBoost, etc.) with strong pertinence for classification or regression. This method needs to adjust the model structure, parameters and training strategy manually and pertinently when facing different scenes, and lacks universality and robustness, and the explainability is also poor. In recent years, large language models (LLM) have developed rapidly, and through pre-training of large-scale data sets, LLM has the ability of cross-task knowledge transfer and self-adaptive modeling, and can generate corresponding networks for target problems, which can be applied to practical problems and have strong universality. However, such networks still have problems of insufficient feature mapping and model adaptation ability when dealing with HSI such as citrus black spot hyperspectral images. SUMMARY
[0003] The present application aims to overcome at least one of the above-mentioned defects (shortcomings) of the prior art, and provides a citrus black spot disease intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model, which is used to solve the problem of insufficient feature mapping and model adaptation ability when dealing with HSI such as citrus black spot hyperspectral images.
[0004] The technical solution adopted by the present application is a citrus black spot disease intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model, which comprises the following steps: inputting the collected citrus hyperspectral image data into a citrus black spot disease detection model for detection, so as to identify the citrus black spot disease.
[0005] The method further comprises obtaining a citrus black spot disease detection model, and the steps are as follows:
[0006] S1: pre-processing the obtained citrus black spot hyperspectral image data;
[0007] S2: performing feature extraction and coding on the pre-processed citrus black spot hyperspectral image data to obtain low-dimensional feature vector data;
[0008] S3: converting the feature vector obtained by preprocessing the hyperspectral image and the detection task requirement vector into natural language description to generate a text prompt to provide context information for the large language model;
[0009] S4: the large language model automatically generates a network model suitable for the current hyperspectral image data based on the context information, and trains the network model using the data obtained in step S2;
[0010] S5: using a preference multi-objective evolutionary algorithm to iteratively optimize the trained network model, and taking the best network obtained as the final citrus black spot detection model.
[0011] In this application, the evolutionary algorithm is combined with the large language model for citrus hyperspectral data modeling. The hyperspectral data of citrus black spot from different sources, different resolutions and different application scenarios are adaptively modeled across datasets. The hyperspectral features are converted into structured descriptions to improve the understanding ability of the large language model for scientific data. In addition, a preference multi-objective optimization strategy is used to iteratively optimize the trained network model, so that the generated citrus black spot detection model considers both performance and efficiency, and is optimized in multiple performance indicators, expanding the application scenarios and application range of the model, thereby providing efficient and timely support for agricultural pest management.
[0012] Preferably, in the step S3, a mapping function is designed to encode the feature vector and the detection task requirement vector into a text prompt, wherein the encoding of the feature vector and the detection task requirement vector into the text prompt is represented as:
[0013] p=M(z,c)∈T
[0014] Wherein, p is a text prompt, M(z,c) is a mapping function; T is a text space.
[0015] In this application, a corresponding mapping function is designed so that the hyperspectral data for citrus black spot detection can be encoded into a text prompt. The large language model can more accurately understand the background of the input data based on the content of the text prompt, enhancing its response ability to specific detection tasks. Therefore, a citrus black spot detection model scheme suitable for the current citrus hyperspectral data is generated, making the intelligent diagnosis of citrus black spot more accurate and efficient.
[0016] Preferably, the formula of the mapping function is:
[0017] M(z,c)=Concat(Enc z (z),Enc c (c),Template)
[0018] Wherein, M(z,c) represents a mapping function; Encz (·) represents the conversion of the feature vector into a text description; Enc c (·) represents the conversion of the detection task requirement vector into natural language; Template represents a fixed prompt template for guiding the large language model.
[0019] Preferably, in the step S4 includes:
[0020] S41: output the network model in the form of triple delimiter structure, output the model structure, hyperparameters and training strategy at one time;
[0021] S42: use the parser to extract the structure, hyperparameters and strategy three contents in the output model by parsing the regular expression form, and write them into the model structure file, hyperparameter configuration file and training strategy program file respectively;
[0022] S43: load the preprocessed data in step S2, and use the data to train the network model by using the gradient descent algorithm.
[0023] In this step, first, the triple delimiter structure can output the model structure, hyperparameters and training strategy at one time, effectively avoiding the fitting deviation caused by information dispersion, providing complete basis for subsequent processing; then the parser uses regular expressions to accurately extract three types of key information and write them into corresponding files, realizing structured storage of information, greatly reducing the cost of manual sorting and improving the efficiency of model deployment; then after loading the preprocessed data, the gradient descent algorithm is used for training, which efficiently optimizes the model parameters and quickly adapts the citrus black spot HSI data characteristics, laying a high-quality training foundation for subsequent model optimization.
[0024] Preferably, before performing step S43 to formally train the network model, the generated network model is also verified for trainability:
[0025] First, check the network structure by syntax checking the model, and at the same time, input ≤1% of the preprocessed data into the network model to run and verify the trainability. If an error mark appears, mark it as untrainable and discard the output network model, then regenerate the network model; if no error mark appears, execute step S43.
[0026] In the present scheme, the generative network model is verified for trainability before formal training, and the network structure error is checked through syntax checking to avoid subsequent training failure caused by structural defects from the root; a small amount of data ≤1% is used to test the model operation, which quickly verifies the trainability of the model at low cost without wasting a large amount of data and computing power to try and error. This can timely filter and discard untrainable models, regenerate effective models, avoid invalid training to occupy resources, greatly reduce the waste of time and computing power, and at the same time ensure that the model entering the formal training has basic usability, provides a reliable premise for subsequent efficient training and model optimization, and improves the stability and efficiency of the overall diagnostic model construction process.
[0027] Preferably, in step S43, the model weight parameter w is also optimized for the training data set during the training process:
[0028]
[0029] wherein l(·) represents the loss function; R(w) is the regularization term; λ is the regularization weight; M θ *(x i ; w) represents the neural network model with input data x i and weight w, and y i represents the corresponding label value of the input.
[0030] In the present scheme, adjusting the weight parameter through the weight optimization formula can effectively suppress model overfitting, balance model complexity and generalization ability, and ensure that the model can still stably identify black spot disease on new citrus HSI data, providing a more general foundation model for subsequent preference multi-target algorithm optimization, and further ensuring the robustness of the final diagnostic model.
[0031] Preferably, in the step S5, the following is included:
[0032] S51: initialize the population, and generate a network by combining the model structure, hyperparameters and training strategy generated by the large language model as an individual in the initialized population, and form a population by multiple networks;
[0033] S52: design a multi-objective fitness function according to the model classification accuracy, inference speed and complexity;
[0034] S53: optimize the population according to the multi-objective fitness function, find the network that best meets the preference, and continuously iterate until convergence, so that the best network model obtained is the final citrus black spot disease detection model.
[0035] In the above step, the network generated by LLM is used as the initial population individual to ensure the quality of the population and avoid wasting computing power on invalid initial structure. The fitness function is designed in combination with classification accuracy, reasoning speed and complexity, and the extreme value of the target vector is calculated to comprehensively measure the overall performance of the model, taking into account both diagnostic accuracy and practical efficiency. Finally, the preferred network is selected through iterative optimization and convergence, which can find the optimal balance among multiple objectives, avoid performance short boards caused by single objective optimization, and output the final detection model that meets the actual needs, further improving the practicality and reliability of citrus black spot diagnosis.
[0036] Preferably, in the step S52, the multi-objective fitness function formula is:
[0037] F(θ) = α Acc(θ) - β Time(θ) - γ Complexity(θ)
[0038] Wherein, Acc(θ) represents the classification accuracy of the model generated by the parameter θ on the validation sample; Time(θ) represents the average inference time (ms) on the target hardware; Complexity(θ) represents the model complexity index, which is measured by the number of parameters of the entire model; α, β, γ represent the weight coefficients of the above parameters respectively.
[0039] Using the above formula, multiple different targets are introduced and each target is equipped with a corresponding weight coefficient, which can flexibly match different actual needs and avoid performance imbalance caused by single objective optimization, thereby providing accurate and practical performance measurement standards for subsequent population optimization and helping to select the optimal citrus black spot detection model that takes into account accuracy, efficiency and deployability.
[0040] Preferably, the step S53 includes:
[0041] S531: generating uniformly distributed points according to the simplex lattice design method, and then transforming the generated points into reference vectors;
[0042] S532: after generating the reference vectors, each individual is associated with the nearest reference vector according to the rule of minimum cosine value, so as to divide the population into sub-populations;
[0043] S533: according to the reference vector and the target vector, the angle penalty distance of each individual in the sub-population associated with each reference vector is calculated;
[0044] S534: select the individual with the smallest angle penalty distance in each sub-population to enter the next generation, then perform crossover and mutation operations, then construct new individuals from the networks with good performance as offspring to participate in the next round of selection, crossover and mutation, so as to continuously iterate and optimize until the fitness converges or the maximum number of iterations is reached, and the best network model is obtained.
[0045] In this step, first, a simplex lattice design method is used to generate a uniform reference vector to ensure comprehensive coverage of the multi-objective optimization direction; then, the minimum cosine value is used to divide the sub-population to achieve fine division of the search space and avoid optimization bias towards a single target; then, the angle penalty distance takes into account convergence and diversity to prevent premature convergence of the population; and the preferred individual in the sub-population is combined with cross variation iteration, which can continuously optimize in multiple dimensions such as accuracy, speed and complexity, and finally converges to a globally better network model that meets the actual preference, greatly improving the comprehensive performance and practicality of the citrus black spot detection model.
[0046] Preferably, in the step S533, the angle penalty distance formula is:
[0047]
[0048] Wherein, d t,i,j is the angle penalty distance; f′ t,i is the target vector; is the penalty term; and is the angle between the target vector f′ t,i and the reference vector v t,j .
[0049] By introducing the angle between the target vector and the reference vector to construct the penalty term, the above formula can punish individuals that deviate from the reference direction, guide the population to converge to the preset optimization direction, avoid search divergence, balance population diversity and convergence, prevent the optimization process from falling into local optimum, and ensure that better solutions are found in the multi-objective trade-off, providing accurate measurement basis for screening citrus black spot detection models with better comprehensive performance.
[0050] Compared with the prior art, the beneficial effects of the present application are:
[0051] 1. Improve model versatility and robustness: Break through the limitations of traditional methods relying on manual adjustment of feature extraction strategies, model structures and parameters, and through the cross-task knowledge transfer ability and preference of multi-objective evolutionary algorithm, the model can adapt to hyperspectral data of different planting environments, citrus varieties and collection devices, significantly reducing the scene dependence and improving the stability of cross-scene diagnosis.
[0052] 2. Enhance high-dimensional data processing capability: By compressing high-dimensional spectral data through targeted feature encoding, combining LLM to generate customized networks adapted to hyperspectral images, realizing cross-dataset adaptive modeling, converting hyperspectral features into structured descriptions, solving the problem of insufficient adaptation of traditional models and LLM to scientific data, improving the understanding ability of large language models for scientific data, strengthening the disease spot feature mapping ability, and improving the diagnosis accuracy and efficiency.
[0053] 3. Achieve full-process automation and low threshold: from data preprocessing, feature extraction, model generation to optimization, no manual intervention is needed, only through natural language prompts to drive model adaptation to task requirements, greatly reducing the dependence on domain experts, and facilitating the application of basic users.
[0054] 4. Optimize model comprehensive performance and practicality: based on the multi-objective fitness function of classification accuracy, reasoning speed and complexity, and the iterative optimization of angle penalty distance, according to the target device and performance requirements, set the preferred area, find the optimal balance among multi-dimensional performance, and consider performance and efficiency. According to the actual demand (such as precision first or efficiency first), output the adaptive model, and consider the diagnostic accuracy and deployment feasibility.
[0055] 5. Improve model interpretability and extensibility: through the traceability of natural language prompts, the transparency of optimization targets and structured network output, the traditional model "black box" problem is alleviated; at the same time, it provides a reusable framework for the application of LLM in agricultural hyperspectral diagnosis and other scientific data fields, and expands the application boundary of the technology. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 The method flowchart provided by the present application.
[0057] Figure 2 The iterative process diagram provided by the present application.
[0058] Figure 3 The model identification classification result diagram provided by the present application. DETAILED DESCRIPTION
[0059] The drawings of the present application are only used for illustrative description, and cannot be understood as a limitation of the present application. In order to better illustrate the following embodiments, some components of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0060] Example 1
[0061] The present embodiment provides a citrus black spot intelligent diagnosis method based on a preferred multi-objective algorithm optimized large language model, which comprises: inputting the collected citrus hyperspectral image data into a citrus black spot detection model for detection, so as to identify citrus black spot;
[0062] Preferably, in the present embodiment, a citrus black spot detection model is also obtained, as shown in Figure 1 The steps are:
[0063] Step S1: Preprocess the obtained citrus black spot hyperspectral image data;
[0064] Step S2: feature extraction and encoding on the pre-processed citrus black spot hyperspectral image data to obtain low-dimensional feature vector data;
[0065] Step S3: converting the feature vector obtained by pre-processing the hyperspectral image and the detection task requirement vector into natural language description to generate a text prompt to provide context information for the large language model;
[0066] Step S4: the large language model automatically generates a network model suitable for the current hyperspectral image data based on the context information, and trains the network model using the data obtained in step S2;
[0067] Step S5: using a preference multi-objective evolutionary algorithm to iteratively optimize the trained network model, and taking the best network obtained as the final citrus black spot detection model.
[0068] In this embodiment, the evolutionary algorithm is combined with the large language model for citrus hyperspectral data modeling, and cross-dataset adaptive modeling is realized for citrus black spot hyperspectral data of different sources, different resolutions, and different application scenarios. The structured description is converted from the hyperspectral features, and the understanding ability of the large language model for scientific data is improved. In addition, the preference multi-objective optimization strategy is used to iteratively optimize the trained network model, so that the generated citrus black spot detection model takes into account the performance and efficiency, and is best optimized in multiple performance indicators, expanding the application scenarios and application scope of the model, thereby providing efficient and timely support for agricultural pest management.
[0069] Preferably, the following steps are included in the step S1:
[0070] Step S11: band normalization, mean and standard deviation normalization of the citrus hyperspectral image data of each spectral band, eliminating the dimensional difference between different bands;
[0071] Specifically, let the citrus hyperspectral image data cube be X ∈ R H×W×B where H, W are spatial dimensions, and B represents the number of bands. Then calculate the mean μ b and standard deviation σ b of each band b of the citrus hyperspectral image data cube, and normalize the data, the normalization formula is as follows:
[0072]
[0073] Thus, by the above steps, the dimensional difference between different bands is eliminated, ensuring data consistency and improving the stability and accuracy of subsequent models.
[0074] Step S12: noise filtering, using Gaussian filtering or other filtering algorithms to remove noise introduced in the process of environmental and instrument collection;
[0075] Specifically, in this embodiment, Gaussian filtering is used to smooth the normalized data and filter out noise introduced in the process of environmental and instrument collection:
[0076]
[0077] where G m,n is the Gaussian kernel weight, and k is the filter window radius.
[0078] Step S13: data augmentation, expand the training samples by rotation, mirroring, translation and other methods, and improve the generalization ability of the model.
[0079] Preferably, in the step S2, comprising:
[0080] Step S21: applying one-dimensional convolution (Conv1D) to the spectral information of each pixel point to extract local spectral features;
[0081] Specifically, in this embodiment, the spectral information vector of each pixel is applied to one-dimensional convolution operation to extract local spectral features, and the formula of the local spectral features is:
[0082] f i,j =Conv1D(x i,j )∈R d
[0083] Step S22: combining the Transformer model to encode the features extracted by convolution to obtain more rich spectral and spatial joint representation, and finally output a low-dimensional feature vector as the input of the subsequent model.
[0084] Specifically, in this embodiment, the local feature set F={f i,j} extracted by convolution is input into the Transformer encoder to realize global context encoding:
[0085] Z=TransformerEncoder(F)∈R H×W×d
[0086] Then, through the pooling or dimension reduction operation, a low-dimensional feature vector is output:
[0087] z=Pooling(Z)∈R m
[0088] So the final output low-dimensional feature vector is used as the input of the subsequent model.
[0089] Preferably, in the step S3, a mapping function is designed to encode the feature vector and the detection task requirement vector (such as classification category, threshold requirement, etc.) into a text prompt, wherein the mapping function is defined as M(·), and the feature vector and the detection task requirement vector c = [c1, c2, …, cK] are encoded into a text prompt p as follows: k ] as follows:
[0090] p = M(z, c) ∈ T
[0091] wherein p is the text prompt, M(z, c) is the mapping function; and T is the text space.
[0092] Preferably, the mapping function is specifically implemented as a combination of multiple encoding modules, and the formula is as follows:
[0093] M(z, c) = Concat(Enc z (z), Enc c (c), Template)
[0094] wherein M(z, c) represents the mapping function; Enc z (·) represents converting the feature vector into a text description; Enc c (·) represents converting the detection task requirement vector into natural language; and Template represents a fixed prompt template for guiding the large language model.
[0095] In the present embodiment, the text prompt obtained by encoding is as follows:
[0096] “Input feature dimension is "m", the number of categories is "k", and the classification accuracy is required to be not less than 95%, and the inference time is less than "T" milliseconds. Please generate a classification model suitable for the hyperspectral data.”
[0097] Thus, the process realizes cross-modal conversion from numerical features to natural language, and the text prompts obtained by encoding provide context information for the large language model, guiding it to automatically generate a machine learning model scheme adapted to the current data and task.
[0098] Preferably, in the step S4, the following steps are included:
[0099] Step S41: In the present embodiment, the network model is output in a triple separator structure by using the network structure template and the structured semantic description as prompt words, and the model structure, hyperparameters and training strategy are output at one time;
[0100] Step S42: The parser extracts the structure, hyperparameters and strategy contents in the output model by parsing the regular expression form, and writes them into the model structure file, the hyperparameter configuration file and the training strategy program file respectively, facilitating training and testing.
[0101] Further preferably, the formal training of the network model in step S43 further comprises a trainability verification of the generated network model:
[0102] Firstly, the model is checked for syntax to check the network structure, and at the same time, the network model is run with ≤1% preprocessed data input, and the trainability is verified. If an error mark appears, it is marked as untrainable and the output network model is discarded, and then the network model is regenerated. If no error mark appears, step S43 is performed.
[0103] Thus, in the embodiment, the trainability of the generated network model is verified before formal training, and the network structure error is checked through syntax checking to avoid subsequent training failure caused by structural defects from the root. The model is tested with ≤1% of small amount of data to quickly verify the trainability of the model at low cost without wasting a large amount of data and computing power. This can timely filter and discard untrainable models, regenerate effective models, avoid invalid training to occupy resources, greatly reduce the waste of time and computing power, and at the same time ensure that the model entering the formal training has basic usability, provides a reliable premise for subsequent efficient training and model optimization, and improves the stability and efficiency of the overall diagnostic model construction process.
[0104] Step S43: Load the preprocessed data in step S2, and use the data to train the network model using a gradient descent algorithm.
[0105] Preferably, in step S43, it further comprises: in the training process, for the training data set D = {(x i ,y i )}, the model weight parameter w is optimized:
[0106]
[0107] Wherein, l(·) represents the loss function; R(w) is the regularization term; λ is the regularization weight; M θ *(x i ; w) represents the neural network model with input data x i and weight w, and y i represents the corresponding label value of the input.
[0108] Thus, by the above steps, the triple separator structure can be used to integrate the output model structure, hyperparameters and training strategy at one time, effectively avoiding the adaptation bias caused by information dispersion, providing complete basis for subsequent processing; then the parser uses regular expressions to accurately extract the three types of key information and write them into the corresponding files, realizing structured storage of information, greatly reducing the cost of manual sorting and improving the efficiency of model deployment; then after loading the preprocessed data, the gradient descent algorithm is used for training, which efficiently optimizes the model parameters and quickly adapts the model to the HSI data characteristics of citrus black spot, laying a high-quality training foundation for subsequent model optimization.
[0109] Preferably, the step S5 comprises:
[0110] Step S51: initialize the population, and generate a network by a large language model to serve as an individual in the initialized population, and multiple networks constitute a population;
[0111] Specifically, in the embodiment, the network structure, hyperparameters and training strategy generated by the large model constitute a network as an individual in the initialized population P0, and multiple networks constitute a population:
[0112]
[0113] Wherein, N represents the population size;
[0114] Step S52: design a multi-objective fitness function according to the model classification accuracy, inference speed and complexity;
[0115] Preferably, in the step S52, the multi-objective fitness function formula is:
[0116] F(θ)=α·Acc(θ)-β·Time(θ)-γ·Complexity(θ)
[0117] Wherein, Acc(θ) represents the classification accuracy of the model generated by the parameter θ on the validation sample; Time(θ) represents the average inference time (ms) on the target hardware; Complexity(θ) represents the model complexity index, which is measured by the number of parameters of the entire model; α, β, γ represent the weight coefficients of the above parameters respectively.
[0118] Specifically, in the calculation formula, for each objective function, i.e. each target vector f i (θ), the minimum value and the maximum value of the current population are normalized as:
[0119]
[0120] Thus, by using the designed multi-objective fitness function formula, multiple different objectives are introduced and each objective is equipped with a corresponding weight coefficient, which can flexibly match different actual needs, avoid performance imbalance caused by single objective optimization, and thus provide accurate and practical performance measurement standards for subsequent population optimization, helping to screen out the optimal citrus black spot detection model considering accuracy, efficiency and deployability.
[0121] Step S53: optimizing the population according to the multi-objective fitness function, finding the most preferred network, and continuously iterating until convergence, so that the obtained optimal network model is the final citrus black spot detection model.
[0122] Specifically, the step S53 includes:
[0123] Step S531: in order to generate uniformly distributed reference vectors, uniformly distributed points u i are generated according to the simplex lattice design method, which is expressed as:
[0124]
[0125] wherein i = 1,...,N is the number of points; j = 1,...,M is the number of objectives; H is the number of layers of the simplex method;
[0126] Then the generated points u i are transformed into reference vectors v i :
[0127]
[0128] If there is a preference, the reference vectors are adjusted according to the preference by setting the center vector v c :
[0129]
[0130] wherein r is a specified radius, and v i ′ is a new reference vector falling within the preferred area.
[0131] Step S532: after generating the reference vectors, each individual is associated to the nearest reference vector according to the minimum cosine value rule, so as to divide the population into sub-populations:
[0132]
[0133] wherein P t,k is the kth sub-population of the population P t , I t,i is the ith individual of the sub-population P t,k , The target vector f′ t,i and reference vector v t,j The included angle.
[0134] Step S533: Based on the reference vector and the target vector, calculate the angular penalty distance (APD) d of each individual in the subpopulation associated with each reference vector. t,i,j ;
[0135] Preferably, in step S533, the angle penalty distance formula is:
[0136]
[0137] Where, d t,i,j The distance is penalized by the angle; f′ t,i The target vector; For penalty items; Let f′ be the target vector t,i and reference vector v t,j The included angle.
[0138] More preferably, in this embodiment, the penalty term can be calculated in the following manner:
[0139]
[0140] Where M is the number of targets, N is the number of reference vectors, and t max It is a predefined maximum number of iterations. It is the reference vector v t,j and the current generation target vector v t,i The minimum angle between them, α is the control Custom parameters for the rate of change.
[0141] Finally, the individual with the smallest angular penalty distance from each subpopulation is selected to enter the next generation to participate in subsequent crossover and mutation.
[0142] Therefore, in this embodiment, by introducing the angle between the target vector and the reference vector to construct a penalty term, it is possible to impose a penalty on individuals that deviate from the reference direction, guide the population to converge toward the preset optimization direction, avoid search divergence, and balance population diversity and convergence, prevent the optimization process from getting stuck in local optima, and ensure that a better solution is found in the multi-objective trade-off, providing an accurate measurement basis for screening out a citrus black spot disease detection model with better overall performance.
[0143] Step S534: Select the individual with the smallest angular penalty distance in each subpopulation to enter the next generation, and then perform crossover and mutation operations. Then construct new individuals from the high-performing network as offspring to participate in the next round of selection, crossover and mutation. Through continuous iterative optimization, until the fitness converges or the maximum number of iterations is reached, the best network model is obtained.
[0144] Specifically, this step includes:
[0145] Construct a mutation prompt file, such as adding a layer to the network, modifying the activation strategy, or increasing the complexity of the network.
[0146] The mutation operation involves selecting random prompts from the mutation prompt file for the chosen individuals, modifying the network, and constructing a new network configuration as the offspring.
[0147] Crossover operations select two individuals from the population and use fixed cue words, such as merging the network structures of the two individuals, to generate a new network.
[0148] Through the crossover and mutation operations described above, the algorithm constructs new individuals from high-performing networks as offspring to participate in the next round of selection, crossover, and mutation.
[0149] P t =Evolve(P t-1 ), t=1,2,…,T
[0150] Therefore, iterative optimization is continuously performed in this manner, such as... Figure 2 As shown, Figure 2 This is a schematic diagram of the iterative process provided in this embodiment, continuing until the fitness converges or the maximum number of iterations is reached. Figure 2 This paper demonstrates the distribution of population evolution in a multi-objective algorithm without setting a preference direction. Initially, the population is concentrated in certain regions, but as iterations progress, the distribution gradually becomes more uniform, covering combinations of objective functions with different preferences. This indicates that the algorithm possesses strong exploratory capabilities, extending from locally concentrated areas to a wider search space, thereby discovering diverse solutions. This uniform distribution not only demonstrates the algorithm's effective coverage of different preferences, such as smaller network size, better performance, or faster inference speed objectives, but also increases the likelihood of finding the optimal or near-optimal network structure that satisfies the classification of citrus black spot disease using this algorithm.
[0151] Finally, after the evolutionary algorithm terminates its iterations, the optimal network can be obtained:
[0152]
[0153] The generated optimal network is used as a citrus black spot disease detection model for classification and detection of citrus hyperspectral data.
[0154] Thus, the network generated by the LLM is used as the initial population individual to guarantee the quality of the population and avoid wasting computing power on invalid initial structures. The fitness function is designed in combination with classification accuracy, reasoning speed, and complexity, and the extreme value of the target vector is calculated to comprehensively measure the overall performance of the model, taking into account both diagnostic accuracy and practical efficiency. Finally, the preferred network is selected through iterative optimization and convergence, which can find the optimal balance among multiple objectives, avoid performance short boards caused by single objective optimization, and output the final detection model that meets the actual needs, further improving the practicality and reliability of citrus black spot disease diagnosis.
[0155] Preferably, in the present embodiment, it also includes: using the obtained optimal model to classify the newly collected citrus black spot disease hyperspectral data x test
[0156]
[0157] Thus, the corresponding classification label or detection result is output, achieving efficient and accurate target recognition. The classification result obtained by recognition is shown in Figure 3 As can be seen from Figure 3 , the generated model performs well after training on the citrus black spot disease recognition task. The training set and test set accuracy gradually increases with the increase of training rounds (epochs) and eventually tends to be stable, close to 1.0, which indicates that the model can learn the characteristics of citrus black spot disease well. Figure 3 The right side of the figure in shows that the training and test loss decreases with the increase of training rounds. The training loss eventually approaches 0, and the test loss also remains at a low level, indicating that the model has good generalization ability on the training set and test set. Overall, the model can reliably identify citrus black spot disease in practical applications, providing technical support for early diagnosis and prevention of the disease.
[0158] Obviously, the above embodiments of the present application are only examples for clearly illustrating the technical solutions of the present application, and are not intended to limit the specific embodiments of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the claims of the present application.
Claims
1. A citrus black spot intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model, the method comprising: The collected citrus hyperspectral image data is input into the citrus black spot detection model for detection, so as to identify the citrus black spot; It is characterized in that further comprising obtaining a citrus black spot detection model, and the steps are: S1: preprocessing the obtained citrus black spot hyperspectral image data; S2: feature extraction and encoding of the preprocessed citrus black spot hyperspectral image data to obtain low-dimensional feature vector data; S3: converting the feature vector obtained by preprocessing the hyperspectral image and the detection task requirement vector into natural language description to generate a text prompt to provide context information for the large language model; S4: the large language model automatically generates a network model suitable for the current hyperspectral image data based on the context information, and trains the network model using the data obtained in step S2; S5: using a preference multi-objective evolutionary algorithm to iteratively optimize the trained network model, and taking the best network obtained as the final citrus black spot detection model.
2. The method according to claim 1, wherein the method is characterized in that, In the step S3, a mapping function is designed to encode the feature vector and the detection task requirement vector into a text prompt, wherein the encoding of the feature vector and the detection task requirement vector into the text prompt is represented as: p=M(z,c)∈T Where p is a text prompt, M(z, c) is a mapping function; T is a text space.
3. The method of claim 2, wherein the method is a citrus black spot intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model. The formula of the mapping function is: M(z, c) = Concat(Enc z (z), Enc c (c), Template) where M(z, c) represents a mapping function; Enc z () represents converting the feature vector into a text description; Enc c () represents converting the detection task requirement into natural language; Template represents a fixed prompt template for guiding the large language model.
4. The method of claim 1, wherein the method is a method of intelligently diagnosing citrus black spot based on a preference multi-objective algorithm optimized large language model. In the step S4, it includes: S41: outputting the network model in the form of a triple separator structure, outputting the model structure, hyperparameters and training strategy at one time; S42: using a parser to extract the structure, hyperparameters and strategy three contents in the output model by parsing the regular expression form, and writing them into the model structure file, hyperparameter configuration file and training strategy program file respectively; S43: loading the preprocessed data in step S2, and using the data to train the network model by using a gradient descent algorithm.
5. The method of claim 4, wherein the method is a method of intelligently diagnosing citrus black spot based on a preference multi-objective algorithm optimized large language model. Before performing step S43 to formally train the network model, the generated network model is further verified for trainability: First, check the network structure by syntax checking the model, and at the same time, input ≤1% of the preprocessed data into the network model for running to verify the trainability, if an error mark appears, mark it as untrainable and discard the output network model, then regenerate the network model; If no error mark appears, step S43 is executed.
6. The method of claim 5, wherein the method is a citrus black spot intelligent diagnosis method based on a preference multi-objective algorithm optimized large language model. In step S43, it further includes: during the training process, optimizing the model weight parameter w with respect to the training data set: Wherein, l(·) represents a loss function; R(w) is a regularization term; λ is a regularization weight; M θ *(x i ; w) represents a neural network model with input data x i , weight w, and y i represents the corresponding label value of the input.
7. The method of claim 4, wherein the method is a method of intelligently diagnosing citrus melanose based on a preferred multi-objective algorithm optimized large language model. In the step S5, it includes: S51: initializing the population, taking the model structure, hyperparameters and training strategy generated by the large language model to form a network as an individual in the initialization population, and forming a population with multiple networks; S52: designing a multi-objective fitness function according to the model classification accuracy, inference speed and complexity; S53: optimizing the population according to the multi-objective fitness function, finding the network most suitable for the preference, and continuously iterating until convergence, so that the best network model obtained is the final citrus black spot detection model.
8. The method of claim 7, wherein the method is a method of intelligently diagnosing citrus melanose based on a preferred multi-objective algorithm optimized large language model. In the step S52, the formula of the multi-objective fitness function is: F(θ) = α·Acc(θ) - β·Time(θ) - γ·Complexity(θ) wherein, Acc(θ) represents the classification accuracy of the model generated by the parameter θ on the validation sample; Time(θ) represents the average inference time on the target hardware; Complexity(θ) represents the model complexity index, which is measured by the number of parameters of the entire model; α, β, γ represent the weight coefficients of the above parameters respectively.
9. The method of claim 7, wherein the method is a method of intelligently diagnosing citrus black spot based on a preferred multi-objective algorithm optimized large language model. The step S53 comprises: S531: generating uniformly distributed points according to the simplex lattice design method, and then transforming the generated points into reference vectors; S532: after generating the reference vectors, each individual is associated with the nearest reference vector according to the minimum cosine value rule, so as to divide the population into sub-populations; S533: according to the reference vectors and the target vector, the angle penalty distance of the individuals in the sub-population associated with each reference vector is calculated; S534: the individual with the minimum angle penalty distance in each sub-population is selected into the next generation, and then the crossover and mutation operations are performed, and then new individuals are constructed from the excellent networks as offspring to participate in the selection, crossover and mutation of the next round, so as to continuously iterate and optimize until the fitness converges or the maximum number of iterations is reached, and the best network model is obtained.
10. The method of claim 9, wherein the method is based on a preference-based multi-objective algorithm for optimizing a large language model for intelligent diagnosis of citrus melanose, and wherein the method comprises: In the step S533, the angle penalty distance formula is: where d t,i,j is the angle penalty distance; f′ t,i is the target vector; is the penalty term; is the angle between the target vector f′ t,i and the reference vector v t,j .