An improved plant disease data enhancement method
By introducing a potential diffusion model and optimizing it with ControlNet, LORA and text embedding guidance models, the problem of insufficient data diversity generated by traditional data augmentation methods is solved, and the quality of plant disease data and generalization capabilities are significantly improved.
Patent Information
- Application Number
- CN202411735805.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-29
AI Technical Summary
The limited diversity generated by traditional plant disease data augmentation methods leads to the unrepresentative data samples generated, which may mislead the model and cannot meet the needs of high-quality plant disease data acquisition.
A potential diffusion model is introduced, and combined with the ControlNet algorithm, LORA optimization algorithm and text embedding guidance model, the potential diffusion model is optimized and adjusted repeatedly to generate higher-quality plant disease pictures.
It significantly improves the quality of plant disease data in plant disease pictures, improves the generalization ability of the model, and is conducive to plant disease management.
Smart Images

Figure CN119228678B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to an improved plant disease data enhancement method. Background Art
[0002] Plant diseases pose a major threat to global agriculture, affecting crop yield and quality, and thus food security and economic stability. As the world's population continues to grow, the need to increase agricultural productivity requires effective disease management strategies. Traditional plant disease classification methods usually rely on expert knowledge and manual inspection, requiring a large number of manually annotated leaf images, a process that is time-consuming, laborious, and prone to human error.
[0003] Based on this, few-shot learning methods are widely used in plant disease classification. The current few-shot methods are mainly divided into three types: meta-learning-based methods, transfer learning-based methods, and data augmentation-based methods. Meta-learning enables the model to quickly adapt to new tasks by learning across multiple tasks. However, it requires a lot of computing resources, and its effectiveness depends on the relevance between tasks. Similarly, transfer learning uses knowledge acquired from one task to improve the performance of another related task, thereby significantly reducing the amount of data required for the target task. Transfer learning is very popular in practical applications, but there is a risk of negative transfer, where defects in the pre-trained model may have an adverse effect on the new task. In addition, pre-trained models are usually large, which may increase storage and computing requirements.
[0004] Traditional data augmentation methods transform the original training data by flipping and rotating the image to generate new samples to increase data diversity and improve the generalization ability of the model. However, the diversity generated by these methods is very limited, and excessive transformation may cause data samples to be unrepresentative and thus mislead the model. Therefore, traditional data augmentation methods have great limitations and cannot meet the needs of obtaining high-quality plant disease data. Summary of the invention
[0005] In view of the deficiencies in the prior art, the object of the present invention is to provide an improved plant disease data enhancement method for improving the quality of generated plant disease data.
[0006] To achieve the above object, the present invention provides the following technical solution: an improved plant disease data enhancement method, comprising:
[0007] Step S1, introducing a plant disease data set and a potential diffusion model, wherein the plant disease data set contains a plurality of plant pictures, each of the plant pictures is used as an input of the potential diffusion model, and a plurality of pre-set groups of prompt texts are used as text prompt conditions of the potential diffusion model, and the potential diffusion model is used to output a plurality of plant disease pictures containing plant disease data;
[0008] Step S2, integrating the ControlNet algorithm into the neural network architecture of the potential diffusion model, using the ControlNet algorithm to extract image features in the plant picture, and using the image features as a guide to adjust the output of the potential diffusion model to preliminarily optimize the potential diffusion model;
[0009] Step S3, using the LORA optimization algorithm to maintain the original weight matrix of the potential diffusion model unchanged, and updating the low-rank decomposition of the weight adjustment matrix in the potential diffusion model to optimize the potential diffusion model again;
[0010] Step S4, using the text embedding guidance model to extract text features from each of the prompt texts, and embedding the text features into the denoising network of the latent diffusion model to further optimize the latent diffusion model.
[0011] Furthermore, the potential diffusion model is based on the LDM model, and the training step of the potential diffusion model includes a forward diffusion step and a reverse denoising step, and the forward diffusion step includes:
[0012] Step S11, taking each of the plant pictures as training samples, and using the VAE encoder to convert the training samples into latent space feature variables;
[0013] Step S12, in the forward diffusion process, gradually adding Gaussian noise to the latent space feature variable to convert it into pure noise;
[0014] The reverse denoising step comprises:
[0015] Step S13, taking the pure noise as the input of the denoising network, using the denoising network to perform prediction and gradually remove the noise therein to obtain a denoised spatial feature variable;
[0016] Step S14, using the VAE decoder to convert the denoised spatial feature variables into the plant disease picture.
[0017] Furthermore, the mathematical expression of the forward diffusion step is configured as:
[0018]
[0019]
[0020] in, is used to represent the latent space feature variables, is used to represent the training sample, For the pure noise, , and It is used to indicate the intensity coefficient of added noise. is the Gaussian noise added in the forward diffusion step;
[0021] The mathematical expression of the reverse denoising step is configured as:
[0022]
[0023]
[0024] in, Used to indicate that the parameter is The denoising network gives a time step of The prediction noise at Used to represent the time-dependent scaling factor, Used to represent the Gaussian noise term in the reverse denoising step;
[0025] The minimum expected loss calculation process of the potential diffusion model is configured as follows:
[0026]
[0027] in, Used to express expectations, Used to represent the time step, Used to represent the text features, Used to indicate that the parameter is The prediction noise given by the denoising network is As a condition.
[0028] Furthermore, the step S2 comprises:
[0029] Step S21, integrating the ControlNet algorithm into the pre-trained potential diffusion model, and using the ControlNet algorithm to extract Canny features, Softedge features or Depth features in the plant picture as the image features;
[0030] Step S22, using the image feature as an image feature condition, and converting the image feature condition into an output of the latent diffusion model;
[0031] Step S23, combining the cross attention mechanism with the text prompt condition to control the SD decoder of the original network to optimize the potential diffusion model.
[0032] Furthermore, the output mathematical expression of the potential diffusion model is configured as:
[0033]
[0034] in, is used to represent the output of the latent diffusion model, Used to indicate that the parameter is The denoising network, For a zero convolution block, the zero convolution block is a convolution module with an initial value of 0, is used to represent the image feature condition, are used to represent the parameters of the replicated network block and the zero-convolution block, respectively.
[0035] Furthermore, the step S3 comprises:
[0036] Step S31, decomposing the weight adjustment matrix into two smaller matrices with low rank and matrix ;
[0037] Step S32, according to the matrix and the matrix Generate residuals;
[0038] Step S33: generating an output of a hidden layer of the latent diffusion model according to the residual and the original weight matrix to optimize the latent diffusion model.
[0039] Furthermore, the output calculation formula of the hidden layer of the potential diffusion model is configured as:
[0040]
[0041] in, It is used to represent the output of the hidden layer. Used to represent the input vector, is used to represent the weight adjustment matrix, Used to represent the original weight matrix.
[0042] Furthermore, the plant disease data set also includes external environmental parameters and lens parameters acquired in real time when collecting each of the plant images, the external environmental parameters include ambient temperature, ambient humidity and light intensity, and the lens parameters include initial light transmittance and initial signal-to-noise ratio;
[0043] In the process of extracting the image features by the ControlNet algorithm in step S2, the initial transmittance and the initial signal-to-noise ratio are processed according to the ambient temperature, the ambient humidity and the light intensity to obtain the actual transmittance and the actual signal-to-noise ratio, and optimized image features are generated according to the actual transmittance, the actual signal-to-noise ratio and the preset standard transmittance and standard signal-to-noise ratio, and the optimized image features are used as a guide to adjust the output of the potential diffusion model.
[0044] Furthermore, the calculation formula of the actual light transmittance is configured as:
[0045]
[0046] in, It is used to indicate the actual light transmittance, It is used to represent the initial light transmittance, Used to indicate the ambient temperature, Used to indicate the ambient humidity, Used to represent the light intensity, , , They are used to represent the preset initial temperature, initial humidity and initial light, respectively. , , are used to represent the preset first light transmittance interference coefficient, second light transmittance interference coefficient and third light transmittance interference coefficient respectively;
[0047] The calculation formula of the actual signal-to-noise ratio is configured as:
[0048]
[0049] in, is used to represent the actual signal-to-noise ratio, is used to represent the initial signal-to-noise ratio, , , They are respectively used to represent the preset first light transmittance interference coefficient, the second light transmittance interference coefficient and the third light transmittance interference coefficient.
[0050] Furthermore, the calculation formula for optimizing the image features is configured as:
[0051]
[0052] in, For representing the optimized image features, For representing the image features, , They are used to represent the preset transmittance conversion coefficient and signal-to-noise ratio conversion coefficient respectively. , are respectively used to represent the standard transmittance and the standard signal-to-noise ratio.
[0053] Beneficial effects of the present invention:
[0054] The present invention firstly introduces a latent diffusion model, and uses the ControlNet algorithm to extract image features to adjust the output of the latent diffusion model, thereby realizing preliminary optimization of the latent diffusion model; at the same time, the LORA optimization algorithm is used to update the low-rank decomposition of the weight adjustment matrix in the latent diffusion model, thereby further optimizing the latent diffusion model; in addition, the text embedding guidance model is used to extract text features from each prompt text, and the text features are embedded in the denoising network of the latent diffusion model, thereby further optimizing the latent diffusion model;
[0055] Therefore, the present invention combines the ControlNet algorithm, the LORA optimization algorithm and the text embedding guidance model to perform multiple optimization adjustments on the potential diffusion model, which significantly improves the quality of plant disease data in the final output plant disease pictures, is beneficial to plant disease management, and at the same time improves the generalization ability of the potential diffusion model. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a flowchart of the steps of the improved plant disease data enhancement method of the present invention;
[0057] Figure 2 is a flowchart of step S1 in the present invention;
[0058] Figure 3 is a flowchart of step S2 in the present invention;
[0059] Figure 4 It is a step flow chart of step S3 in the present invention. DETAILED DESCRIPTION
[0060] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. The same parts are represented by the same reference numerals. It should be noted that the words "front", "rear", "left", "right", "upper" and "lower" used in the following description refer to directions in the accompanying drawings, and the words "bottom surface" and "top surface", "inner" and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.
[0061] Example 1, reference Figure 1 , which is the first embodiment of the present invention, provides an improved plant disease data enhancement method, which can improve the quality of generated plant disease data, including:
[0062] Step S1, introducing a plant disease data set and a potential diffusion model, wherein the plant disease data set contains a plurality of plant pictures, each plant picture is used as an input of the potential diffusion model, and a plurality of pre-set groups of prompt texts are used as text prompt conditions of the potential diffusion model, and the potential diffusion model is used to output a plurality of plant disease pictures containing plant disease data;
[0063] Step S2, integrating the ControlNet algorithm into the neural network architecture of the latent diffusion model, using the ControlNet algorithm to extract image features from the plant image, and using the image features as a guide to adjust the output of the latent diffusion model to preliminarily optimize the latent diffusion model. ControlNet introduces control variables into the denoising process, thereby achieving more precise guidance and ensuring that the synthetic samples closely follow the required properties;
[0064] Step S3, using the LORA optimization algorithm to maintain the original weight matrix of the potential diffusion model unchanged, and updating the low-rank decomposition of the weight adjustment matrix in the potential diffusion model to optimize the potential diffusion model again;
[0065] Step S4, using the text embedding guidance model to extract text features from each prompt text, embedding the text features into the denoising network of the latent diffusion model to further optimize the latent diffusion model, the text embedding guidance model inputs a dense representation of the text prompt, capturing the necessary semantic information for accurate generation, in the text-to-image generation task, using text embedding to guide the stable diffusion process has been proven to be an effective method to improve the accuracy and quality of the generated results, specifically, the CLIP model is used to convert the input text prompt into a high-dimensional semantic vector. This high-dimensional semantic vector informs each step of the denoising process in the latent diffusion model, ensuring that the generated image is increasingly consistent with the text description, this method significantly improves the visual and semantic consistency of the generated image in the text-to-image generation task.
[0066] Specifically, in this embodiment, the text embedding guidance model may be a CLIP model.
[0067] Working principle of embodiment 1:
[0068] This embodiment first introduces the latent diffusion model, and uses the ControlNet algorithm to extract image features to adjust the output of the latent diffusion model, so as to achieve preliminary optimization of the latent diffusion model; at the same time, the LORA optimization algorithm is used to update the low-rank decomposition of the weight adjustment matrix in the latent diffusion model to optimize the latent diffusion model again; in addition, the text embedding guidance model is used to extract text features in each prompt text, and the text features are embedded in the denoising network of the latent diffusion model to further optimize the latent diffusion model;
[0069] Therefore, this embodiment combines the ControlNet algorithm, the LORA optimization algorithm and the text embedding guidance model to optimize and adjust the potential diffusion model multiple times, significantly improving the quality of the plant disease data in the final output plant disease picture, which is beneficial to plant disease management and improves the generalization ability of the potential diffusion model. After the potential diffusion model is optimized multiple times, this embodiment experiments the model to test the data quality of the output plant disease data. The plant disease data set in this experiment is based on the PlantVillage data set, which is a comprehensive collection of high-resolution images used to study plant diseases. The plant disease data set contains plant images of 38 plant species, and the plant disease data set includes plant images in a healthy state and plant images in an unhealthy state suffering from diseases, with a total of 54,305 images of size 256x256. In order to evaluate the performance of the potential diffusion model that is finally optimized in this embodiment, we randomly select 90% of the images as the test set. From the remaining images, they are further divided into a training set and a validation set in a ratio of 8:2. This setting enables us to evaluate the classification ability of the potential diffusion model under various conditions of limited training data. The hardware used for the experiment in this embodiment is an Intel(R) Xeon(R) Gold 5218R CPU @2.10GHz, equipped with three NVIDIA GeForce RTX 3090 GPUs, each with 24,260MB of memory. The software environment includes Python 3.10.14 and PyTorch 2.0.1 running on the Ubuntu 20.04 operating system. In this embodiment, the YOLOv8 network is selected as the classifier, and the experiment is repeated on the original data set and the plant disease image data set obtained using stable diffusion enhancement.
[0070] Table 1 is the experimental parameter design table. The design of experimental parameters is shown in Table 1:
[0071] Table 1
[0072] Parameter Tags Configuration Number of training rounds: 200 rounds Input dimensions: 256 × 256 × 3 Batch Size: 64 Mosaic Enhancement: Open Number of worker threads 8 Random Seed: 0 Weight decay: 0.0005 Warm up momentum: 0.9 momentum: 0.937 Automatic mixed precision: Open Optimizer: SGD
[0073] The training settings for each experiment are the same: Stochastic Gradient Descent (SGD) is selected as the optimizer, the learning rate is 0.01, the momentum is 0.9, and the weight decay is 0.0005. Traditional data enhancement methods such as flipping, cropping, and rotation will be used to improve the classification performance in this example. The loss function adopts the common BCE loss, and each training experience is 200 times.
[0074] FID is a metric used to evaluate the quality of images generated by generative models (such as GANs). It measures the similarity between the distributions of generated images and real images by comparing the feature representations extracted from the pre-trained Inception network.
[0075] The FID score quantifies the distance between the distribution of real images and generated images in the feature space. A lower FID score indicates that the generated images are more similar to the real images, meaning better image quality and diversity.
[0076] Table 2 is a table of FID scores of different methods. The FID scores of different methods are shown in Table 2:
[0077] Table 2
[0078]
[0079] Using 50% of the remaining dataset, the performance of various generation methods is evaluated based on the FID scores of different categories of plant health and disease. The compared methods include StyeGAN2, DFMGAN, DDPM, LDM, and our optimized latent diffusion model in this example. The FID score is a widely used metric for evaluating the quality of generated images, and the lower the score, the higher the similarity with the real image. Table 2 shows the effectiveness of our optimized latent diffusion model in generating high-quality images in this example, achieving the lowest FID score among all categories, and thus the best performance.
[0080] TOP-1 accuracy is a metric used to evaluate the performance of a classification model by measuring the percentage of instances for which the model's highest predicted class matches the true class label. It involves selecting the class with the highest predicted probability for each instance in the test set, comparing that prediction to the actual class, and calculating the ratio of correct predictions to the total number of instances, expressed as a percentage. This example uses this metric to measure the effectiveness of YOLOv8 classification.
[0081] Table 3 is the TOP-1 accuracy table of different methods. The TOP-1 accuracy of different methods is shown in Table 3:
[0082] Table 3
[0083]
[0084] In order to verify the enhancement ability of images generated by the diffusion model of limited samples on the classification network, this embodiment conducted comparative experiments on a series of YOLOv8 classification networks. Specifically, these experiments were conducted using 25%, 50% and 100% of the original datasets and the corresponding datasets enhanced by the diffusion model. The results are shown in Table 3. In most cases, the classifier trained on the enhanced dataset is significantly better than the classifier trained on the non-enhanced dataset.
[0085] Table 4 is an ablation experiment table. The ablation experiment is shown in Table 4:
[0086] Table 4
[0087]
[0088] In order to evaluate the contribution of ControlNet and Embeddings (text embedding guidance model) to the quality of images generated by the diffusion model and their impact on detection performance, we performed ablation experiments using YOLOv8n-cls and 50% of the dataset. As shown in Table 4, it is shown that when no component is used, the FID and TOP-1 accuracy of the generated image are significantly reduced. Incorporating any component can improve the generation and classification performance, among which the effect of ControlNet is more obvious. This enhancement may be due to the fact that ControlNet can ensure that the generated image is very similar to the original dataset in terms of wheel and shape, thus avoiding distorted images. Therefore, the realism of the generated image is improved, thereby enhancing the classification performance.
[0089] Preferably, the latent diffusion model is based on the LDM model, and the training steps of the latent diffusion model include a forward diffusion step and a reverse denoising step, such as Figure 2 As shown, the forward diffusion step includes:
[0090] Step S11, taking each plant picture as a training sample, and using the VAE encoder to convert the training sample into a latent space feature variable;
[0091] Step S12, in the forward diffusion process, gradually adding Gaussian noise to the latent space feature variables to convert them into pure noise;
[0092] The reverse denoising steps include:
[0093] Step S13, taking pure noise as the input of the denoising network, using the denoising network to make predictions and gradually remove the noise therein to obtain denoised spatial feature variables;
[0094] Step S14, using the VAE decoder to convert the denoised spatial feature variables into plant disease pictures.
[0095] Specifically, in this embodiment, the latent diffusion model provides a solution for generating a leaf disease data set from a finite sample. The latent diffusion model is generated based on LDM, which is known for its ability to produce realistic and diverse outputs and forms the basis of this embodiment. The latent diffusion model consists of a forward diffusion process and a reverse denoising process. In the forward diffusion process, in order to reduce computational complexity and time, the training samples will be converted into latent space feature variables by the encoder of the pre-trained VAE. Subsequently, the latent space feature variables will gradually add Gaussian noise through the diffusion process until they become pure noise. In the reverse denoising process, the latent diffusion model will use the pure noise obtained by the diffusion process or random sampling as the input of the U-Net denoising network to make predictions and gradually remove the added noise. Finally, the VAE decoder transforms the denoised spatial feature variables obtained in the previous step into the generated plant disease picture.
[0096] Preferably, the mathematical expression of the forward diffusion step is configured as:
[0097]
[0098]
[0099] in, Used to represent latent space feature variables, Used to represent training samples, Used to represent pure noise, , and It is used to indicate the intensity coefficient of added noise. is the Gaussian noise added in the forward diffusion step;
[0100] The mathematical expression of the reverse denoising step is configured as:
[0101]
[0102]
[0103] in, Used to indicate that the parameter is The denoising network gives a time step of The prediction noise at Used to represent the time-dependent scaling factor, Used to represent the Gaussian noise term in the reverse denoising step;
[0104] The minimum expected loss calculation process of the potential diffusion model is configured as:
[0105]
[0106] in, Used to express expectations, Used to represent the time step, Used to represent text features. Used to indicate that the parameter is The prediction noise given by the denoising network is As a condition.
[0107] Preferably, Figure 3 As shown, step S2 includes:
[0108] Step S21, integrating the ControlNet algorithm into the pre-trained potential diffusion model, and using the ControlNet algorithm to extract Canny features, Softedge features or Depth features in the plant image as image features;
[0109] Step S22, using the image features as image feature conditions, and converting the image feature conditions into outputs of a potential diffusion model;
[0110] In step S23, the cross-attention mechanism is combined with the text prompt condition to control the SD decoder of the original network to optimize the potential diffusion model.
[0111] Preferably, the output mathematical expression of the potential diffusion model is configured as:
[0112]
[0113] in, Used to represent the output of the latent diffusion model, Used to indicate that the parameter is The denoising network, Used for zero convolution blocks, which are convolution modules with an initial value of 0. Used to represent image feature conditions, are used to represent the parameters of the replicated network block and the zero-convolution block, respectively.
[0114] Specifically, in this embodiment, in order to improve the quality of data generation, we integrate ControlNet into the stable diffusion model. Before generation, ControlNet extracts the CannySoftedge or Depth features of the input image and uses it as an image feature condition to further guide the generation process. In order to add ControlNet to the pre-trained diffusion model, we freeze the parameters of the original network and clone a trainable copy of the stable diffusion block. Controlnet converts the image feature condition into an output, and then controls the SD decoder of the original network through a cross-attention mechanism combined with the text prompt condition. The zero convolution block is a convolution module with an initial value of 0. This works here to ensure that the early training stage equal to the output of the original network, thus protecting the network from acoustic interference. By integrating these control mechanisms, ControINet significantly improves the quality and diversity of the generated outputs, ensuring that they meet specific standards imposed by the control variables.
[0115] Preferably, Figure 4 As shown, step S3 includes:
[0116] Step S31, decompose the weight adjustment matrix into two smaller matrices with low rank and matrix ;
[0117] Step S32, according to the matrix and matrix Generate residuals;
[0118] Step S33, generating the output of the hidden layer of the potential diffusion model according to the residual and the original weight matrix to optimize the potential diffusion model.
[0119] Specifically, in this embodiment, the matrix Gaussian normal distribution The residual r is generated using a random matrix A sampled from a Gaussian normal distribution and a bias matrix B = 0, which is then added to the hidden representation h.
[0120] Preferably, the output calculation formula of the hidden layer of the potential diffusion model is configured as:
[0121]
[0122] in, It is used to represent the output of the hidden layer. Used to represent the input vector, Used to represent the weight adjustment matrix, Used to represent the original weight matrix.
[0123] Specifically, in this embodiment, the main advantage of LORA is that it reduces the number of parameters that need to be updated during fine-tuning. This embodiment does not need to update the complete weight matrix, but only needs to update the gradients of the low-rank matrices A and B, because the residual r is a much smaller adjustable parameter than the latitude d. This significantly reduces computing resources and reduces the risk of overfitting the disease dataset.
[0124] Embodiment 2 is the second embodiment of the present invention. Different from the previous embodiment, this embodiment provides environmental parameters and lens parameters, and can further optimize the data quality output by the potential diffusion model according to the environmental parameters and lens parameters. In the plant disease data set, the external environmental parameters and lens parameters acquired in real time when each plant image is collected are also included. The external environmental parameters include ambient temperature, ambient humidity and light intensity, and the lens parameters include initial light transmittance and initial signal-to-noise ratio.
[0125] In the process of extracting image features by the ControlNet algorithm in step S2, the initial transmittance and initial signal-to-noise ratio are processed according to the ambient temperature, ambient humidity and light intensity to obtain the actual transmittance and actual signal-to-noise ratio, and the optimized image features are generated according to the actual transmittance, actual signal-to-noise ratio and the preset standard transmittance and standard signal-to-noise ratio, and the optimized image features are used as a guide to adjust the output of the potential diffusion model.
[0126] Working principle of embodiment 2:
[0127] In the process of plant image collection, the ambient temperature, ambient humidity and light intensity in the external environment will interfere with the transmittance and signal-to-noise ratio of the collection device. When other conditions remain unchanged, the image collected by the device will be distorted, thus affecting the subsequent training and prediction process of the potential diffusion model. In order to eliminate the influence of the ambient temperature, ambient humidity and light intensity in the external environment on the transmittance and signal-to-noise ratio of the collection device, the actual transmittance and actual signal-to-noise ratio are first obtained by processing the initial transmittance and initial signal-to-noise ratio according to the ambient temperature, ambient humidity and light intensity, and then the optimized image features are generated according to the actual transmittance, actual signal-to-noise ratio and the preset standard transmittance and standard signal-to-noise ratio. Finally, the optimized image features are used as a guide to adjust the output of the potential diffusion model, which can effectively filter out the influence of ambient temperature, ambient humidity and light intensity on the potential diffusion model, thereby further improving the quality of the output data of the potential diffusion model.
[0128] Preferably, the calculation formula of the actual light transmittance is configured as:
[0129]
[0130] in, Used to indicate actual light transmittance. Used to indicate the initial transmittance, Used to indicate ambient temperature. Used to indicate ambient humidity. Used to indicate light intensity. , , They are used to represent the preset initial temperature, initial humidity and initial light, respectively. , , are used to represent the preset first light transmittance interference coefficient, second light transmittance interference coefficient and third light transmittance interference coefficient respectively;
[0131] The calculation formula of the actual signal-to-noise ratio is configured as:
[0132]
[0133] in, Used to indicate the actual signal-to-noise ratio, It is used to represent the initial signal-to-noise ratio, , , They are respectively used to represent the preset first light transmittance interference coefficient, the second light transmittance interference coefficient and the third light transmittance interference coefficient.
[0134] Specifically, in this embodiment, the initial temperature is subtracted from the ambient temperature to obtain the temperature difference, and the temperature difference is multiplied by the first light transmittance interference coefficient to obtain the temperature difference interference value; the initial humidity is subtracted from the ambient humidity to obtain the humidity difference, and the humidity difference is multiplied by the second light transmittance interference coefficient to obtain the humidity difference interference value; the initial light is subtracted from the light intensity to obtain the light difference, and the light interference value is multiplied by the third light transmittance interference coefficient to obtain the light interference value; finally, the temperature difference interference value, the humidity difference interference value, and the light interference value are added together, multiplied by the initial signal-to-noise ratio, and then divided by the sum of the first light transmittance interference coefficient, the second light transmittance interference coefficient, and the third light transmittance interference coefficient to obtain the actual signal-to-noise ratio; similarly, the actual transmittance can be obtained.
[0135] Preferably, the calculation formula for optimizing image features is configured as:
[0136]
[0137] in, Used to represent optimized image features, Used to represent image features, , They are used to represent the preset transmittance conversion coefficient and signal-to-noise ratio conversion coefficient respectively. , Used to indicate standard transmittance and standard signal-to-noise ratio respectively.
[0138] Specifically, in this embodiment, the actual transmittance is subtracted from the standard transmittance to obtain a transmittance deviation value; the actual signal-to-noise ratio is subtracted from the standard signal-to-noise ratio to obtain a signal-to-noise ratio deviation value, the square of the transmittance deviation value is multiplied by the transmittance conversion coefficient to obtain a transmittance interference value, the square of the signal-to-noise ratio deviation value is multiplied by the signal-to-noise ratio conversion coefficient to obtain a signal-to-noise ratio interference value, the transmittance interference value is added to the signal-to-noise ratio interference value and the square root is taken, and finally divided by the image feature to obtain an optimized image feature that has filtered out the effects of the signal-to-noise ratio and transmittance.
[0139] The above are only preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. An improved plant disease data enhancement method, characterized in that: include: Step S1, introducing a plant disease data set and a potential diffusion model, wherein the plant disease data set contains a plurality of plant pictures, each of the plant pictures is used as an input of the potential diffusion model, and a plurality of pre-set groups of prompt texts are used as text prompt conditions of the potential diffusion model, and the potential diffusion model is used to output a plurality of plant disease pictures containing plant disease data; Step S2, integrating the ControlNet algorithm into the neural network architecture of the potential diffusion model, using the ControlNet algorithm to extract image features in the plant picture, and using the image features as a guide to adjust the output of the potential diffusion model to preliminarily optimize the potential diffusion model; Step S3, using the LORA optimization algorithm to maintain the original weight matrix of the potential diffusion model unchanged, and updating the low-rank decomposition of the weight adjustment matrix in the potential diffusion model to optimize the potential diffusion model again; Step S4, extracting text features from each of the prompt texts using a text embedding guidance model, and embedding the text features into a denoising network of the latent diffusion model to further optimize the latent diffusion model; The step S2 comprises: Step S21, integrating the ControlNet algorithm into the pre-trained potential diffusion model, and using the ControlNet algorithm to extract Canny features, Softedge features or Depth features in the plant picture as the image features; Step S22, using the image feature as an image feature condition, and converting the image feature condition into an output of the latent diffusion model; Step S23, combining the cross attention mechanism with the text prompt condition to control the SD decoder of the original network to optimize the potential diffusion model; The output mathematical expression of the potential diffusion model is configured as: in, is used to represent the output of the latent diffusion model, Used to indicate that the parameter is The denoising network, For a zero convolution block, the zero convolution block is a convolution module with an initial value of 0, is used to represent the image feature condition, are used to represent the parameters of the replicated network block and the zero convolution block respectively; The step S3 comprises: Step S31, decomposing the weight adjustment matrix into two smaller matrices with low rank and matrix ; Step S32, according to the matrix and the matrix Generate residuals; Step S33: generating an output of a hidden layer of the latent diffusion model according to the residual and the original weight matrix to optimize the latent diffusion model.
2. The improved plant disease data enhancement method according to claim 1, characterized in that: The potential diffusion model is based on the LDM model. The training steps of the potential diffusion model include a forward diffusion step and a reverse denoising step. The forward diffusion step includes: Step S11, taking each of the plant pictures as training samples, and using the VAE encoder to convert the training samples into latent space feature variables; Step S12, in the forward diffusion process, gradually adding Gaussian noise to the latent space feature variable to convert it into pure noise; The reverse denoising step comprises: Step S13, taking the pure noise as the input of the denoising network, using the denoising network to perform prediction and gradually remove the noise therein to obtain a denoised spatial feature variable; Step S14, using the VAE decoder to convert the denoised spatial feature variables into the plant disease picture.
3. The improved plant disease data enhancement method according to claim 2, characterized in that: The mathematical expression of the forward diffusion step is configured as: in, is used to represent the latent space feature variables, is used to represent the training sample, For the pure noise, , and It is used to indicate the intensity coefficient of added noise. is the Gaussian noise added in the forward diffusion step; The mathematical expression of the reverse denoising step is configured as: in, Used to indicate that the parameter is The denoising network gives a time step of The prediction noise at Used to represent the time-dependent scaling factor, Used to represent the Gaussian noise term in the reverse denoising step; The minimum expected loss calculation process of the potential diffusion model is configured as follows: in, Used to express expectations, Used to represent the time step, Used to represent the text features, Used to indicate that the parameter is The prediction noise given by the denoising network is As a condition.
4. The improved plant disease data enhancement method according to claim 1, characterized in that: The output calculation formula of the hidden layer of the potential diffusion model is configured as: in, It is used to represent the output of the hidden layer. Used to represent the input vector, is used to represent the weight adjustment matrix, Used to represent the original weight matrix.
5. The improved plant disease data enhancement method according to claim 1, characterized in that: The plant disease data set also includes external environmental parameters and lens parameters acquired in real time when collecting each of the plant images, wherein the external environmental parameters include ambient temperature, ambient humidity and light intensity, and the lens parameters include initial light transmittance and initial signal-to-noise ratio; In the process of extracting the image features by the ControlNet algorithm in step S2, the initial transmittance and the initial signal-to-noise ratio are processed according to the ambient temperature, the ambient humidity and the light intensity to obtain the actual transmittance and the actual signal-to-noise ratio, and optimized image features are generated according to the actual transmittance, the actual signal-to-noise ratio and the preset standard transmittance and standard signal-to-noise ratio, and the optimized image features are used as a guide to adjust the output of the potential diffusion model.
6. The improved plant disease data enhancement method according to claim 5, characterized in that: The calculation formula of the actual light transmittance is configured as: in, It is used to indicate the actual light transmittance, It is used to represent the initial light transmittance, Used to indicate the ambient temperature, Used to indicate the ambient humidity, Used to represent the light intensity, , , They are used to represent the preset initial temperature, initial humidity and initial light, respectively. , , are used to represent the preset first light transmittance interference coefficient, second light transmittance interference coefficient and third light transmittance interference coefficient respectively; The calculation formula of the actual signal-to-noise ratio is configured as: in, is used to represent the actual signal-to-noise ratio, is used to represent the initial signal-to-noise ratio, , , They are respectively used to represent the preset first light transmittance interference coefficient, the second light transmittance interference coefficient and the third light transmittance interference coefficient.
7. The improved plant disease data enhancement method according to claim 6, characterized in that: The calculation formula for optimizing the image features is configured as follows: in, For representing the optimized image features, For representing the image features, , They are used to represent the preset transmittance conversion coefficient and signal-to-noise ratio conversion coefficient respectively. , are respectively used to represent the standard transmittance and the standard signal-to-noise ratio.
Citation Information
Patent Citations
Method and device for generating picture with accurate characters according to character description and storage medium
CN117252957A
Multi-view plant generation method and device based on cross-modal image generation
CN117314755A