Disease and pest monitoring and diagnosis method based on lightweight deep separation convolution model
Through the pest monitoring method based on lightweight deep separation convolution model, the problems of inefficiency and high computational complexity in the prior art are solved, efficient and accurate pest monitoring and diagnosis are achieved, suitable for edge equipment, and detailed diagnostic reports and control suggestions are provided.
Patent Information
- Application Number
- CN202510334086.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing pest monitoring methods are inefficient, have high computational complexity, are difficult to deploy on resource-constrained edge devices, and lack effective pest and disease regional location and hierarchical diagnosis.
Pest monitoring and diagnosis methods based on lightweight deep separation convolution model are adopted, and pest features are extracted through image acquisition, preprocessing and feature extraction, deep convolution and point-by-point convolution operations are used, and weighted adjustments are made through feature fusion module and attention mechanism to ultimately realize the detection and identification of pests and diseases.
It reduces the calculation amount and model parameters, improves processing efficiency and classification accuracy, is suitable for resource-constrained edge devices, avoids overfitting problems, enhances the robustness of the model, and provides detailed diagnostic reports and prevention and control measures and suggestions.
Smart Images

Figure CN119851143A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pest image recognition, and specifically to a pest monitoring and diagnosis method based on a lightweight deep separation convolution model. Background Art
[0002] In the agricultural sector, pest and disease monitoring and diagnosis are important links in ensuring crop health and yield. Traditional pest and disease monitoring methods mainly rely on manual observation and recording, which is not only inefficient but also has limited accuracy and coverage. In recent years, with the development of artificial intelligence and computer vision technology, pest and disease monitoring methods based on image recognition have received widespread attention. These methods usually collect farmland images through image acquisition equipment and analyze them through deep learning models to identify the types and distribution of pests and diseases.
[0003] However, existing deep learning-based pest and disease monitoring methods still face multiple challenges in application. First, the existing models have a large amount of computation, which makes the models inefficient when processing high-resolution images, especially on resource-limited edge devices, which makes it difficult to achieve real-time processing. Secondly, although deep convolutional neural networks (CNNs) can extract image features, their network structure is complex and the number of parameters is large, which makes the training and inference process time-consuming and prone to overfitting. Furthermore, most existing technologies lack effective regional positioning and graded diagnosis of pests and diseases, making it difficult to provide accurate prevention and control measures. Especially in complex environments with uneven distribution of pests and diseases, there are still bottlenecks in improving classification accuracy and positioning effects.
[0004] Therefore, how to achieve efficient and accurate pest and disease monitoring and diagnosis while ensuring low computational complexity, and further provide targeted prevention and control recommendations, has become an important direction of current technological development. Summary of the invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, the technical problem solved by the present invention is that most of the existing pest and disease monitoring methods rely on manual observation or traditional image recognition technology. These methods are often inefficient and limited by the accuracy of manual operation, and it is difficult to meet the real-time monitoring needs in large-scale agricultural production. With the development of deep learning technology, although some automated methods based on deep convolutional neural networks have been proposed, these methods usually face problems such as high computational complexity, large number of model parameters, and slow reasoning speed, and are particularly difficult to deploy on resource-constrained edge devices. In addition, the existing methods are still limited in their ability to locate and classify pests and diseases in the region, lack effective regional distribution analysis and prevention and control measures recommendations, resulting in insufficient accuracy and practicality in practical applications.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a pest monitoring and diagnosis method based on a lightweight deep separation convolution model, comprising: Agricultural crop image data is collected through image acquisition equipment; the collected images are preprocessed; the features in the preprocessed images are extracted using a lightweight deep separation convolution model, and the pest and disease features are extracted through deep convolution and point-by-point convolution operations; based on the pest and disease features, the pest and disease areas in the image are detected, the pest and disease detection results are output, and the pest and disease types are identified.
[0008] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, the image preprocessing includes: applying adaptive Gaussian filtering to the collected image to remove noise, dynamically adjusting the standard deviation σ(x, y) of the Gaussian kernel according to the noise level of the local area of the image through the adaptive Gaussian filter; using contrast-limited adaptive histogram equalization to enhance the contrast of the image processed by the adaptive Gaussian filter, dividing the image into a number of N×N sub-blocks, calculating the histogram for each sub-block and limiting the contrast enhancement threshold, and combining the edge enhancement coefficient according to the edge detection result. The image processed by contrast enhancement is adjusted according to the result; the image processed by contrast enhancement is converted from RGB color space to HSV color space to separate hue, saturation and brightness information; the converted HSV image is linearly normalized to standardize the pixel values to a predetermined range; the Canny edge detection algorithm is applied to the normalized image to enhance edge information through Gaussian filtering, gradient calculation, non-maximum suppression and double threshold processing; the image processed by Canny edge detection is cropped according to the preset region of interest method; the cropped image is scaled to the input size required by the lightweight depth separation convolution model using a content-aware bilinear interpolation algorithm.
[0009] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, wherein: the lightweight deep separation convolution model includes: Deep convolution layer, point-by-point convolution layer, feature fusion module and classification layer; the deep convolution layer, each deep convolution layer includes K d There are independent convolution kernels D of size m×m k , k=1,2...,K d , perform convolution operation on each input channel to generate an intermediate feature map; the point-by-point convolution layer, each point-by-point convolution layer includes K P A convolution kernel P of size 1×1 p , p=1, 2..., Kp, for the intermediate feature map F generated by the deep convolution dPerform point-by-point convolution operations to generate a fused feature map; the feature fusion module includes a feature fusion layer and an attention mechanism; the feature fusion layer weights and fuses the feature maps extracted by multiple convolution blocks to generate a fused feature map F f (x, y); the attention mechanism calculates the attention weight β(x, y) for the fused feature map F f Weighted adjustment is performed to generate an enhanced feature map; the classification layer includes a fully connected layer, an activation layer and an output layer; the fully connected layer expands the enhanced feature map into a one-dimensional vector, and performs feature combination and weight calculation through the fully connected layer, and the fully connected layer includes a number of neurons for generating multi-dimensional feature representation; the activation layer applies an activation function after the output of the fully connected layer, normalizes multiple categories, and generates a probability distribution for each type of pests and diseases; the output layer determines the classification label of the pests and diseases according to the output result of the activation layer.
[0010] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, wherein: the intermediate feature map is represented as:
[0011] in, (x, y) represents the output value of the kth depth convolution kernel at position (x, y), k represents the index of the depth convolution kernel, (x, y) represents the position coordinates of the pixel in the image, (x+i, y+j) represents the pixel value at position (x+i, y+j) on the kth channel of the input image. k (i, j) represents the weight of the kth depth convolution kernel at position (i, j), and m represents the size of the depth convolution kernel.
[0012] The fused feature map is expressed as:
[0013] in, Represents the point-by-point convolution kernel The weight on the kth channel, (x, y) represents the pixel value of the fused feature map on the pth channel after point-by-point convolution, K P represents the number of point-by-point convolution kernels, corresponding to the number of channels of the output feature map, p represents the index of the point-by-point convolution kernel, K d Represents the total number of depthwise convolution kernels.
[0014] The activation function is expressed as,
[0015] in, (x, y) is the output value of the p-th channel at position (x, y) after being processed by the ReLU activation function, where p represents the index of the channel and ReLU represents the ReLU activation function.
[0016] The fused feature map is expressed as:
[0017] in, (x, y) represents the weights dynamically adjusted according to the characteristics of pests and diseases. (x, y) represents the output value of the fused feature map; the enhanced feature map is represented as,
[0018] Among them, β(x,y) represents the attention weight based on the characteristics of pests and diseases, and F att (x,y) represents the enhanced feature map.
[0019] As a preferred solution of the pest monitoring and diagnosis method based on lightweight deep separation convolution model described in the present invention, before extracting the pest characteristics, it also includes: Collect image data of different types of pests and diseases; annotate the image data with the pest and disease category and location; apply data enhancement technology to perform data enhancement operations on the annotated image data; initialize the deep convolution kernel, point-by-point convolution kernel and fully connected layer weights in the classification layer in the lightweight deep separation convolution model, and initialize the bias of all convolution layers and fully connected layers to zero; select a multi-category cross entropy loss function, and combine it with the regression loss function as needed to optimize the prediction of the location of pests and diseases; use the Adam optimizer, set the initial learning rate, and dynamically adjust the learning rate according to the performance of the validation set; perform model training and model validation.
[0020] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, the detection of the pest area in the image includes: Preprocess the pest image to be predicted to generate a standardized and size-adapted input image; input the preprocessed image into the trained lightweight deep separation convolution model, extract the pest features through the deep convolution layer, point-by-point convolution layer and feature fusion module, and generate an enhanced feature map F att ; Input the enhanced feature map into the fully connected layer, and identify the type of pests and diseases through the fully connected layer and the Softmax activation layer.
[0021] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, the output result of the activation layer is expressed as:
[0022] Among them, O c represents the output result of the classification layer, Softmax represents the Softmax activation function, and W c represents the weight matrix of the classification layer, b c Represents the bias vector of the classification layer.
[0023] As a preferred solution of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model described in the present invention, wherein: the identification of pest types includes: A probability threshold for pest and disease category is set, and the probability value of each pest and disease category in the output result is compared with a preset threshold; the pest and disease category with a probability value higher than the threshold is taken as the final classification result; in combination with the geographic location information, the classification result output by the model is associated with the geographic location information of the crop to generate a regional pest and disease distribution map; a diagnosis report is generated, and based on the classification result and the geographic location information, a diagnosis report including the pest and disease type, distribution area and severity is generated; and prevention and control measures are recommended to trigger prevention and control measures according to the pest and disease type in the diagnosis report.
[0024] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model as described above are implemented.
[0025] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the pest monitoring and diagnosis method based on the lightweight deep separation convolution model as described above.
[0026] Beneficial effects of the present invention: The pest and disease monitoring and diagnosis method based on the lightweight deep separation convolution model provided by the present invention effectively reduces the amount of calculation and the number of model parameters by adopting a lightweight deep separation convolution model, improves processing efficiency, and ensures a high classification accuracy, which is particularly suitable for real-time pest and disease monitoring in resource-constrained edge devices. Compared with traditional deep learning models, the present invention can more accurately extract pest and disease features, avoid overfitting problems, and improve the robustness of the model in complex environments. By combining the feature fusion module and the attention mechanism, the present invention can enhance the focus on key pest and disease features and further improve the accuracy of classification and detection. In addition, the pest and disease type and regional distribution information output by the model can generate a detailed diagnostic report, provide scientific prevention and control measures, and help agricultural producers accurately implement policies, reduce pesticide use, and increase crop yields. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0028] Figure 1 An overall flow chart of a method for monitoring and diagnosing pests and diseases based on a lightweight deep separation convolution model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0031] Example 1, reference Figure 1 , which is an embodiment of the present invention, provides a pest monitoring and diagnosis method based on a lightweight deep separation convolution model, including: Agricultural crop image data is collected through image acquisition equipment; the collected images are preprocessed; the features in the preprocessed images are extracted using a lightweight deep separation convolution model, and the pest and disease features are extracted through deep convolution and point-by-point convolution operations; based on the pest and disease features, the pest and disease areas in the image are detected, the pest and disease detection results are output, and the pest and disease types are identified.
[0032] The image preprocessing includes: applying adaptive Gaussian filtering to the collected image to remove noise, dynamically adjusting the standard deviation σ(x, y) of the Gaussian kernel according to the noise level of the local area of the image through the adaptive Gaussian filter; using contrast-limited adaptive histogram equalization to perform contrast enhancement on the image processed by the adaptive Gaussian filter, dividing the image into a number of sub-blocks of size N×N, calculating the histogram for each sub-block and limiting the threshold of contrast enhancement, and adjusting the contrast enhancement according to the edge detection result in combination with the edge enhancement coefficient; converting the image processed by the contrast enhancement from the RGB color space to the HSV color space, separating the hue, saturation and brightness information; performing linear normalization processing on the converted HSV image, and standardizing the pixel value to a predetermined range; applying the Canny edge detection algorithm to the normalized image to enhance the edge information through Gaussian filtering, gradient calculation, non-maximum suppression and double threshold processing; cropping the image processed by the Canny edge detection according to a preset region of interest method; and scaling the cropped image to the input size required by the lightweight depth separation convolution model using a content-aware bilinear interpolation algorithm.
[0033] The lightweight deep separation convolution model includes: Deep convolution layer, point-by-point convolution layer, feature fusion module and classification layer; the deep convolution layer, each deep convolution layer includes K d There are independent convolution kernels D of size m×m k , k=1,2...,K d , perform convolution operation on each input channel to generate an intermediate feature map; the point-by-point convolution layer, each point-by-point convolution layer includes K P A convolution kernel P of size 1×1 p , p=1, 2..., Kp, for the intermediate feature map F generated by the deep convolution d Perform point-by-point convolution operations to generate a fused feature map; the feature fusion module includes a feature fusion layer and an attention mechanism; the feature fusion layer weights and fuses the feature maps extracted by multiple convolution blocks to generate a fused feature map F f (x, y); the attention mechanism calculates the attention weight β(x, y) for the fused feature map F f Weighted adjustment is performed to generate an enhanced feature map; the classification layer includes a fully connected layer, an activation layer and an output layer; the fully connected layer expands the enhanced feature map into a one-dimensional vector, and performs feature combination and weight calculation through the fully connected layer, and the fully connected layer includes a number of neurons for generating multi-dimensional feature representation; the activation layer applies an activation function after the output of the fully connected layer, normalizes multiple categories, and generates a probability distribution for each type of pests and diseases; the output layer determines the classification label of the pests and diseases according to the output result of the activation layer.
[0034] The intermediate feature map is expressed as,
[0035] in, (x, y) represents the output value of the kth depth convolution kernel at position (x, y), k represents the index of the depth convolution kernel, (x, y) represents the position coordinates of the pixel in the image, (x+i, y+j) represents the pixel value at position (x+i, y+j) on the kth channel of the input image. k (i, j) represents the weight of the kth depth convolution kernel at position (i, j), and m represents the size of the depth convolution kernel.
[0036] The fused feature map is expressed as:
[0037] in, Represents the point-by-point convolution kernel The weight on the kth channel, (x, y) represents the pixel value of the fused feature map on the pth channel after point-by-point convolution, K P represents the number of point-by-point convolution kernels, corresponding to the number of channels of the output feature map, p represents the index of the point-by-point convolution kernel, K d Represents the total number of depthwise convolution kernels.
[0038] The activation function is expressed as,
[0039] in, (x, y) is the output value of the p-th channel at position (x, y) after being processed by the ReLU activation function, where p represents the index of the channel and ReLU represents the ReLU activation function.
[0040] The fused feature map is expressed as:
[0041] in, (x, y) represents the weights dynamically adjusted according to the characteristics of pests and diseases. (x, y) represents the output value of the fused feature map; the enhanced feature map is represented as,
[0042] Among them, β(x,y) represents the attention weight based on the characteristics of pests and diseases, and F att (x,y) represents the enhanced feature map.
[0043] Before extracting the pest characteristics, the method further includes: Collect image data of different types of pests and diseases; annotate the image data with the pest and disease category and location; apply data enhancement technology to perform data enhancement operations on the annotated image data; initialize the deep convolution kernel, point-by-point convolution kernel and fully connected layer weights in the classification layer in the lightweight deep separation convolution model, and initialize the bias of all convolution layers and fully connected layers to zero; select a multi-category cross entropy loss function, and combine it with the regression loss function as needed to optimize the prediction of the location of pests and diseases; use the Adam optimizer, set the initial learning rate, and dynamically adjust the learning rate according to the performance of the validation set; perform model training and model validation.
[0044] The detecting of the pest and disease area in the image includes: Preprocess the pest image to be predicted to generate a standardized and size-adapted input image; input the preprocessed image into the trained lightweight deep separation convolution model, extract the pest features through the deep convolution layer, point-by-point convolution layer and feature fusion module, and generate an enhanced feature map F att ; Input the enhanced feature map into the fully connected layer, and identify the type of pests and diseases through the fully connected layer and the Softmax activation layer.
[0045] The output result of the activation layer is expressed as,
[0046] Among them, O c represents the output result of the classification layer, Softmax represents the Softmax activation function, and W c represents the weight matrix of the classification layer, b c Represents the bias vector of the classification layer.
[0047] The identification of pest and disease types includes: A probability threshold for pest and disease category is set, and the probability value of each pest and disease category in the output result is compared with a preset threshold; the pest and disease category with a probability value higher than the threshold is taken as the final classification result; in combination with the geographic location information, the classification result output by the model is associated with the geographic location information of the crop to generate a regional pest and disease distribution map; a diagnosis report is generated, and based on the classification result and the geographic location information, a diagnosis report including the pest and disease type, distribution area and severity is generated; and prevention and control measures are recommended to trigger prevention and control measures according to the pest and disease type in the diagnosis report.
[0048] Gaussian filtering is applied to the collected image to remove noise. The Gaussian filter uses a two-dimensional Gaussian kernel with a standard deviation of σ to perform image convolution operations. The image processed by Gaussian filtering is contrast enhanced using contrast-limited adaptive histogram equalization (CLAHE). The block size of CLAHE is N×N, and the threshold for limiting contrast enhancement is a limit value L. The contrast-enhanced image is converted from RGB color space to HSV color space, and the color component conversion is achieved through a pixel-by-pixel color space conversion formula. The converted HSV image is normalized, and a linear normalization method is used to linearly map the pixel value to 0. to 1; applying the Canny edge detection algorithm to the normalized image to enhance edge information, the Canny algorithm includes four steps of Gaussian filtering, gradient calculation, non-maximum suppression and double threshold processing, and the low threshold and the high threshold are set to Tlow and Thigh respectively; cropping the image processed by the Canny edge detection according to a preset region of interest (ROI), and the ROI is determined by a predefined coordinate range; scaling the cropped image to the input size required by the lightweight depth separation convolution model, and using a bilinear interpolation algorithm to adjust the image to a specified width and height, such as 224×224 pixels.
[0049] Specifically, the image preprocessing steps include: Step a) Adaptive Gaussian filtering for noise removal: First, the collected original image I (x, y) is subjected to noise removal. The image is smoothed using an adaptive Gaussian filter G (x, y, σ (x, y)) to obtain the denoised image I' (x, y). This step aims to reduce random noise in the image while retaining the edge information of the image, laying the foundation for subsequent contrast enhancement and feature extraction.
[0050] The Gaussian filter formula is expressed as:
[0051] Where G(x,y) represents a two-dimensional Gaussian kernel function, which is used to smooth the image and reduce noise. σ(x,y) is the standard deviation of the adaptive Gaussian kernel, which is dynamically adjusted according to the local noise level of the image. x and y represent the horizontal and vertical coordinates of the Gaussian kernel, respectively.
[0052] The convolution operation is expressed as:
[0053] Among them, I'(x,y) represents the denoised image, I(x,y) represents the original image, and * represents the convolution operator, which means the convolution of the image I(x,y) and the Gaussian kernel G(x,y).
[0054] Through the convolution operation of the adaptive Gaussian filter G(x,y,σ(x,y)) and the original image I(x,y), the image can be effectively smoothed, the interference of random noise can be reduced, and the edge information of the image can be retained. This provides a clear image foundation for subsequent contrast enhancement and feature extraction.
[0055] It reduces random noise, improves image quality, retains key edge information, and ensures the integrity of pest and disease characteristics.
[0056] Step b) Edge enhancement contrast equalization of CLAHE: The denoised image I' (x, y) is contrast enhanced, and the edge-enhanced contrast-limited adaptive histogram equalization algorithm is used to generate a contrast-enhanced image I'' (x, y). This step makes the characteristics of pests and diseases more obvious through local contrast enhancement, and further improves image details by combining edge information.
[0057] Step b) is divided into three sub-steps: image segmentation, histogram equalization and edge enhancement, and image reconstruction. Each sub-step is closely related to ensure the consistency of the processing results.
[0058] Image segmentation includes: dividing the image I'(x, y) into several non-overlapping sub-blocks B of size N×N i,j , expressed as:
[0059] Among them, B i,j represents the sub-block at the i-th row and j-th column, N represents the size of the sub-block (for example, N=8), and i,j represent the row and column indexes of the sub-block.
[0060] Dividing the image into local areas facilitates local contrast equalization within each sub-block and enhances the local details of the image.
[0061] Histogram equalization and edge enhancement include: For each sub-block B i,j Perform histogram equalization and combine it with the edge enhancement coefficient E i,j (k), generate equalized and edge-enhanced sub-block B' i,j .
[0062] The histogram equalization formula is expressed as:
[0063] Among them, H i,j (k) represents sub-block B i,j The number of pixels at gray level k, H' i,j(k) represents the histogram value after equalization, L represents the contrast limit threshold (for example, L = 2.0), which prevents excessive equalization from causing noise amplification, C represents the maximum allowable frequency of the histogram, which controls the upper limit of the histogram, and E i,j (k) represents the edge enhancement coefficient, which is dynamically adjusted according to the edge detection results.
[0064] The edge enhancement coefficient is calculated as:
[0065] Where α represents the edge enhancement factor (e.g. α = 0.5), which controls the strength of edge enhancement, ▽I' i,j (k) represents sub-block B i,j The gradient information of gray level k is used to measure the edge strength.
[0066] Histogram calculation and equalization are performed by calculating the grayscale histogram H of each sub-block. i,j (k), and through the contrast-limited histogram equalization formula H' i,j (k) Adjust the histogram to prevent excessive equalization from causing noise amplification. Combined with the edge enhancement coefficient E i,j (k), weight the equalized histogram to enhance the edge details in the image. i,j (k) Applied to sub-block B i,j , generate the processed sub-block B' i,j .
[0067] The edge enhancement CLAHE algorithm can enhance the local contrast and edge details of the image, making the characteristics of pests and diseases more obvious, while avoiding the noise amplification problem caused by over-enhancement.
[0068] Step c) RGB to HSV color space conversion: Convert the contrast-enhanced and edge-enhanced image I'' (x, y) from the RGB color space to the HSV color space to obtain the HSV image I HSV (x, y). Color space conversion helps to better separate color information, making color features more prominent in subsequent feature extraction. RGB to HSV conversion is expressed as:
[0069] Among them, H represents the type of color, ranging from [0°, 360°], S represents the purity of the color, ranging from [0, 1], and R, G, and B are the red, green, and blue components of the original RGB image respectively.
[0070] By applying the above formula pixel by pixel, the RGB image I''(x,y) is converted to the HSV image IHSV(x,y) to better separate the color information, which is helpful for subsequent feature extraction and analysis.
[0071] The HSV color space separates hue, saturation, and brightness, making color features more independent, which is helpful for subsequent feature extraction and pest identification. Through color space conversion, richer color features are provided to improve the classification and detection capabilities of deep learning models.
[0072] Step d) Image normalization: For HSV image I HSV (x, y) is normalized and the pixel values are normalized to the predetermined range [0, 1] using a linear normalization method to generate a normalized image I norm (x, y) represents the normalized image, expressed as:
[0073] Among them, I norm (x, y) represents the normalized image, I HSV (x, y) represents the HSV image, I HSV (x, y) represents the HSV image, I min Represents image I HSV The minimum pixel value of (x, y), I max Represents image I HSV The maximum pixel value at (x,y).
[0074] Mapping pixel values to the range of [0,1] ensures that all images have a uniform scale when input into the deep learning model, which promotes the training efficiency and convergence speed of the model. The standardized pixel values help avoid the problem of gradient vanishing or exploding during training and improve the stability of the model.
[0075] Normalization processing is based on high-quality images after color space conversion, ensuring the consistency and numerical stability of model input, and providing a reliable data foundation for the training and reasoning of deep learning models.
[0076] Step e) Optimized Canny edge detection algorithm: For the normalized image I norm (x, y) Apply the optimized Canny edge detection algorithm to enhance the edge information in the image and obtain the edge-enhanced image I edge (x, y). This step further improves the identifiability of pest and disease features through precise edge extraction.
[0077] Step e) is divided into four sub-steps: Gaussian filtering, gradient calculation, non-maximum suppression, and double threshold processing.
[0078] Gaussian filtering includes: using a Gaussian kernel G(x,y) with a standard deviation of σ to filter the image I norm (x, y) is smoothed to obtain the smoothed image I smooth (x,y), expressed as:
[0079] Among them, I smooth (x, y) represents the smoothed image, G(x, y) represents the two-dimensional Gaussian kernel function (same as step a), and * represents the convolution operator.
[0080] Reduce high-frequency noise in the image and improve the accuracy of edge detection. By properly selecting the value of σ, the image can be smoothed while retaining edge information.
[0081] The Sobel operator is used to calculate the gradient magnitude G(x, y) and gradient direction θ(x, y) of the image.
[0082] Sobel operator convolution kernel, expressed as:
[0083] The gradient magnitude and direction are calculated and expressed as:
[0084]
[0085] Among them, G x (x,y) and G y (x, y) are the gradients in the horizontal and vertical directions respectively, which are convolved with the Sobel convolution kernel S x and S y After convolution calculation, G(x,y) is the gradient magnitude, which indicates the strength of the edge in the image, and θ(x,y) is the gradient direction, which indicates the direction angle of the edge.
[0086] By using the Sobel convolution kernel S x and S y Convolution operation to calculate the horizontal and vertical gradients G of the image x (x,y) and G y (x, y), and further calculate the gradient magnitude G(x, y) and gradient direction θ(x, y).
[0087] The gradient magnitude G(x,y) represents the strength of the edge and helps to accurately locate the subsequent edge.
[0088] Edge direction: The gradient direction θ(x,y) provides the direction information of the edge and supports the accurate execution of the non-maximum suppression process.
[0089] Non-maximum suppression includes: refining the gradient amplitude G(x,y), retaining the local maximum points, suppressing non-edge pixels, and obtaining the refined gradient amplitude G nms (x,y), expressed as:
[0090] Among them, G nms (x,y) represents the gradient magnitude after refinement.
[0091] For pixels that are local maxima in the gradient direction, compare the current pixel G(x,y) with its neighboring pixels in the gradient direction according to the gradient direction θ(x,y). If the current pixel is a local maximum, retain its gradient magnitude; otherwise, set its gradient magnitude to 0.
[0092] The most significant edges are retained, the width of the edges is reduced, and the accuracy of edge detection is improved. By suppressing non-maximum points, the false detection of edges is reduced and the quality of edge information is improved.
[0093] Dual threshold processing includes: Set the low threshold T low and high threshold T high , edge pixels are determined according to the following formula:
[0094] Among them, I edge (x, y) represents the image after edge enhancement, T low represents a low threshold, used to detect weak edges, T high Represents a high threshold, used to detect strong edges.
[0095] Edge connection connects strong edges and weak edges to form the final edge-enhanced image I edge (x,y).
[0096] According to the image characteristics and pest characteristics, the low threshold and high threshold are adjusted dynamically; when the gradient amplitude G nms (x,y)BigT high , directly judged as an edge. Gradient amplitude G nms (x,y) between T low and T high If it is connected to a strong edge, it is retained as an edge, otherwise it is suppressed.
[0097] Edge connection: Through edge tracking, connect strong edges and the weak edges connected to them to generate a complete edge image I edge (x,y).
[0098] Through dual threshold processing, the accuracy and robustness of edge detection are ensured, and false detection and missed edge detection are reduced. Through edge connection, the continuity and integrity of the edge are ensured, and the identifiability of pest and disease characteristics is improved.
[0099] The gradient amplitude after non-maximum suppression refinement provides accurate edge intensity information for double threshold processing, ensuring high precision and high quality of edge detection.
[0100] The optimized Canny edge detection algorithm uses four steps: Gaussian filtering, gradient calculation, non-maximum suppression, and double threshold processing to accurately extract edge information in images, enhance the identifiability of pest and disease features, and improve the detection and classification capabilities of deep learning models.
[0101] Step f) Image cropping based on the preset region of interest (ROI): According to the preset region of interest (ROI), the image I processed by Canny edge detection is edge (x, y) is cropped to obtain the cropped image I crop (x,y). This step aims to focus on the key areas where pests and diseases may appear, reduce background interference, and improve the efficiency of subsequent feature extraction and model recognition, which is expressed as:
[0102] Among them, I crop (x, y) represents the cropped image, I edge (x, y) represents the edge-enhanced image, (x1, y1) represents the coordinates of the upper left corner of the ROI, (x2, y2) represents the coordinates of the lower right corner of the ROI, and x, y represent the horizontal and vertical coordinates of the image.
[0103] The cropping steps include: Define ROI coordinates: Predefine the ROI coordinate range from (x1, y1) to (x2, y2), where: (x1,y1) = coordinates of the upper left corner (x2,y2) = coordinates of the upper right corner Crop the image: Crop the image from image I according to the defined ROI coordinate range. edge (x, y) to crop the ROI area and obtain the cropped image I crop (x,y).
[0104] By accurately defining the coordinate range of ROI, the key areas where pests and diseases may appear in the image are cropped to generate the cropped image I crop (x,y), providing a focused image area for subsequent feature extraction and model recognition.
[0105] By cropping the ROI, we can focus on the areas where pests and diseases may appear, improve the efficiency and accuracy of feature extraction, reduce the impact of irrelevant background areas, and improve the robustness of model recognition.
[0106] Image cropping is based on high-quality images after edge detection, ensuring that the cropped ROI area contains key pest and disease features, providing accurate input for feature extraction of the deep learning model.
[0107] Step g) Content-aware bilinear interpolation algorithm for image scaling: The cropped image I crop (x, y) is scaled to the input size W'×H' (e.g. 224×224 pixels) required by the lightweight depth separation convolution model, and the content-aware bilinear interpolation algorithm is used to generate the final preprocessed image I final (u,v). This step ensures that the image size meets the model requirements while retaining the image details and avoiding distortion, expressed as:
[0108]
[0109] Among them, I final (u,v) represents the final preprocessed image, u,v represents the scaled image I final The pixel coordinates of W and H represent the cropped image I crop The width and height of W', H' represent the input size required by the model (such as 224 × 224 pixels). represents the floor function, which is used to determine the corresponding original image pixel position under the scaling ratio, w(i,j) represents the bilinear interpolation weight, C(x,y) represents the weight factor based on the image content, and the interpolation weight is adjusted according to the local features of the image.
[0110] The bilinear interpolation implementation process includes: determining the corresponding position of the target pixel position (u, v) in the original image, expressed as:
[0111] Among them, x, y represent the corresponding continuous coordinate positions in the original image, and u, v represent the discrete pixel coordinates in the target image.
[0112] Calculate the weights w(i,j) of the four surrounding pixels, expressed as:
[0113] in, and are the rounded-down values of x and y respectively, and C(x,y) represents the content-aware weight factor, which adjusts the interpolation weight according to the local features of the image.
[0114] Calculate the final pixel value I final (u,v), expressed as:
[0115] Among them, I crop (⋅,⋅) represents the pixel value of the cropped image.
[0116] The cropped image I is transformed into crop(x,y) Scale to the input size W'×H' required by the model. The algorithm dynamically adjusts the weight w(i,j) according to the image content during the interpolation process to retain more detail information and avoid image distortion.
[0117] Ensure that the image size meets the input requirements of the lightweight depth separation convolution model. Through content-aware bilinear interpolation, more image detail information is retained, image distortion is avoided, and the recognition accuracy of the model is improved.
[0118] Through the content-aware bilinear interpolation algorithm, we can ensure that the image retains more detail information during the scaling process, avoid image distortion, and adapt to the input requirements of the lightweight deep separation convolution model, thereby improving the accuracy and efficiency of the model in pest and disease identification.
[0119] It should be noted that traditional pest and disease image recognition methods usually rely on a single image processing technology, such as simply applying Gaussian filtering for noise removal or using ordinary histogram equalization to enhance contrast. These methods are easily interfered by random noise when dealing with complex backgrounds and diverse pest and disease features, resulting in blurred edge information, and the contrast enhancement effect is limited, making it difficult to effectively highlight the subtle features of pests and diseases. It should be noted that in the process of enhancing image details and contrast, traditional methods often fail to take into account the retention of edge information and the suppression of noise, resulting in insufficient information in the feature extraction stage, affecting the recognition accuracy of subsequent deep learning models. Further, the present invention introduces an adaptive Gaussian filter, dynamically adjusts the standard deviation of the filter according to the local noise level of the image, effectively smoothes the image while retaining key edge information. In addition, an edge-enhanced contrast-limited adaptive histogram equalization algorithm is used to combine edge information on the basis of enhancing local contrast to further enhance image details. Through these optimization measures, the present invention provides a more sophisticated and adaptive image preprocessing solution that overcomes the shortcomings of traditional methods in complex environments.
[0120] Furthermore, the image preprocessing process of the present invention effectively removes random noise in the image through adaptive Gaussian filtering, while retaining important edge information, laying a solid foundation for subsequent contrast enhancement and feature extraction. It should be noted that the CLAHE algorithm using edge enhancement improves the contrast of the image in the local area, making the subtle features of pests and diseases more significant and enhancing the detail expression of the image. In addition, the Canny edge detection algorithm with dynamically adjusted thresholds optimizes the accuracy of edge extraction and ensures the continuity and integrity of edge information. Through the content-aware bilinear interpolation algorithm, the image details are retained and the distortion is minimized during the scaling process, ensuring the image quality and feature integrity of the input to the deep separation convolution model. These beneficial effects jointly improve the accuracy, efficiency and robustness of the pest and disease identification system, and significantly enhance the performance of the model in practical applications.
[0121] Specifically, the image preprocessing method of the present invention can achieve efficient noise removal and edge retention, ensure image quality, and enhance the recognizability of pest and disease features. Specifically, adaptive parameter adjustment and edge enhancement technology are used to dynamically respond to the characteristics of different images, thereby improving the flexibility and adaptability of processing. It should be noted that, combined with the region of interest (ROI) cropping and content-aware interpolation algorithm, the focus area and zoom process of the image are optimized, background interference is reduced, and the detail information of the key area is retained. Furthermore, the parameters in each algorithm step can be dynamically adjusted according to actual application requirements, such as the standard deviation range setting in adaptive Gaussian filtering, the block size and contrast limit threshold setting of CLAHE, and the threshold adjustment strategy of Canny edge detection. These design advantages not only improve the accuracy and efficiency of image processing, but also provide high-quality input data for the lightweight deep separation convolution model, significantly improving the overall performance and practical value of the pest and disease monitoring and diagnosis system.
[0122] Specifically, the model training process includes: Agricultural crop image data containing different types of pests and diseases can be collected through agricultural research institutions, farmland monitoring equipment (such as drones, smart cameras) or public image databases. The collected images should cover a variety of pest and disease types, crop types, environmental conditions and different crop growth stages to ensure the comprehensiveness and diversity of the data set. For example, collect pest and disease images of leaves, stems, fruits and other parts in different seasons and different lighting conditions to capture the manifestations of pests and diseases at different growth stages and environmental conditions.
[0123] The collected image data will be annotated by experts in the agricultural field or professionally trained annotators. The annotation content includes but is not limited to: (1) Pest and disease category: such as leaf spot, aphids, mites, etc., to ensure accurate identification of each pest and disease category.
[0124] (2) Pest and disease location: Use bounding boxes or pixel-level segmentation masks to mark the specific locations of pests and diseases in the image to facilitate the model to accurately locate them.
[0125] (3) Severity: Label the severity of the impact of pests and diseases on crops, such as mild, moderate, or severe, to help the model learn the feature differences at different severity levels.
[0126] The labeled image data is classified according to the pest type, crop type and other related features to form a multi-category, multi-label data set. Ensure that the amount of data in each category is sufficient so that the model can learn and distinguish the characteristics of different pests and diseases. At the same time, the data of different crop types are evenly distributed to avoid overfitting the model to a certain crop type.
[0127] In order to improve the generalization and robustness of the model, a variety of data enhancement techniques are applied to the training set images, especially to optimize the characteristics of agricultural pests and diseases images, including but not limited to: (1) Geometric transformation: Rotation: Randomly rotate the image by a certain angle (such as -30° to +30°) to simulate the performance of pests and diseases under different shooting angles.
[0128] Flip: Flip the image horizontally and vertically to increase the diversity of the data and prevent the model from being biased towards a specific direction.
[0129] Translation: Randomly translate the image in the horizontal and vertical directions to simulate the distribution of pests and diseases in different parts of the crop.
[0130] Scaling: Randomly scale the size of the image to maintain the recognizability of pest and disease features, while enhancing the model's ability to recognize pests and diseases of different sizes.
[0131] Shearing: Apply affine transformation to perform image shearing to simulate the different distribution and morphological changes of pests and diseases on crops.
[0132] (2) Color change: Brightness adjustment: Randomly adjust the brightness of the image to simulate the performance of pests and diseases under different lighting conditions.
[0133] Contrast adjustment: Randomly adjust the contrast of the image to enhance the contrast of pest and disease features and improve the recognition ability of the model.
[0134] Saturation adjustment: Randomly adjust the saturation of the image to simulate color changes under different environmental conditions.
[0135] Hue adjustment: Randomly adjust the hue of the image to enhance the model’s robustness to different colors.
[0136] (3) Noise addition: Add random noise to the image, such as Gaussian noise and salt and pepper noise, to improve the recognition ability of the model in a noisy environment and simulate the image noise that may occur in actual shooting.
[0137] (4) Cropping and filling: Randomly crop parts of the image and fill them in to simulate partial occlusion or incomplete display of pests and diseases, thus enhancing the model's processing capabilities.
[0138] By applying a variety of data enhancement techniques, we simulate various changes and interferences that may occur in actual pest and disease images, and improve the model's adaptability and robustness to image diversity. These enhancement measures help the model maintain efficient recognition performance in different environments and conditions, reduce dependence on training data, and improve the stability of the model in practical applications.
[0139] The He initialization or Xavier initialization method is used to initialize the depth convolution kernel D in the lightweight depth separation convolution model. k , point-by-point convolution kernel P p and the weight W of the fully connected layer in the classification layer c Initialization is performed to ensure that the model has good convergence in the early stages of training and to avoid gradient vanishing or exploding problems.
[0140] The bias b of all convolutional layers and fully connected layers c Initialize to zero or according to a specific strategy to avoid bias problems in the early stages of training and improve the training stability of the model.
[0141] Reasonable weight and bias initialization can accelerate the convergence process of the model, improve training efficiency, and reduce the gradient vanishing or exploding problems that occur during training. At the same time, stable initialization helps the model quickly learn effective features in the early stages of training and improve the performance of the final model.
[0142] For the classification task, a multi-class cross entropy loss function is chosen, which is defined as:
[0143] Among them, C represents the total number of pests and diseases, y i represents the binary indicator variable of the i-th category in the true label (1 for existence and 0 for non-existence), Represents the probability value of the i-th category predicted by the model.
[0144] To address the imbalance in the distribution of pest and disease categories, adjust the category weight w in the cross entropy loss function i , defined as
[0145] Among them, w i Represents the weight of the i-th category, which is adjusted according to the number of category samples to balance the contribution of different categories to the loss function and prevent the model from being overly biased towards categories with a large number of samples.
[0146] For the detection task, a regression loss function (such as mean square error) is combined to optimize the prediction accuracy of the pest location, which is defined as
[0147] Where J represents the total number of areas with detected pests and diseases, (x j ,y j ) represents the actual location coordinates of the jth pest area, Represents the predicted location coordinates of the jth pest and disease area.
[0148] Comprehensive classification loss and positioning loss, define the total loss function expression
[0149] Among them, λ represents the weight coefficient, which is used to balance the relative importance of classification loss and localization loss. The optimal value is usually determined through experiments.
[0150] Through multi-category cross entropy loss function and category weight adjustment, the data imbalance problem between different pest and disease categories is effectively handled, and the model's recognition ability for minority categories is improved. Combined with the positioning loss function, it ensures that the model can not only accurately classify the type of pest and disease, but also accurately locate its position in the crop, meeting the needs of actual pest and disease monitoring. The design of the comprehensive loss function enables the model to achieve a good balance between classification and positioning tasks, improving the overall diagnostic performance.
[0151] The Adam optimizer is used because it combines the advantages of momentum and adaptive learning rate adjustment and is suitable for processing large-scale data and complex models. The Adam optimizer dynamically adjusts the learning rate of each parameter by calculating the first-order moment (mean) and second-order moment (uncentered variance), improving training efficiency and stability.
[0152] The initial learning rate is set to 0.001 and is dynamically adjusted based on the validation set performance (e.g., using a learning rate decay strategy). For example, whenever the validation set loss does not decrease for a number of consecutive epochs, the learning rate is halved to avoid stagnation at the local minimum.
[0153] Choose an appropriate batch size (such as 32 or 64) to balance training speed and memory usage, while ensuring that each batch contains a variety of pest and disease types and crop varieties to enhance the model's ability to learn different features.
[0154] The adaptive learning rate and momentum mechanism of the Adam optimizer can accelerate the convergence process of the model and improve the training efficiency. The dynamic adjustment of the learning rate strategy ensures that the model can flexibly respond to the learning needs of different stages during the training process and avoid falling into the local optimum too early. At the same time, the reasonable batch size selection helps to improve the stability and performance of the model training and ensure the effective learning of the model on diversified data.
[0155] The data-augmented training images are input into the lightweight deep separation convolution model, and forward propagation is performed through the deep convolution layer, point-by-point convolution layer, feature fusion module and classification layer to generate prediction results, including the pest and disease category probability and location coordinates.
[0156] The loss value between the model prediction result and the true label is calculated based on the defined total loss function, taking into account the classification accuracy and positioning accuracy.
[0157] The gradient is calculated through the back-propagation algorithm, and the model parameters (weights and biases) are updated according to the Adam optimizer to gradually optimize the model performance.
[0158] Set up multiple rounds of training (such as 100 rounds), each round containing several batches, until the model performs stably on the validation set or reaches the predetermined convergence condition.
[0159] To avoid overfitting, terminate the training early when the validation set loss stops decreasing or shows signs of overfitting. For example, stop training when the validation set loss does not decrease for 10 consecutive epochs.
[0160] Through the systematic forward propagation and back propagation process, the model can effectively learn the characteristics of pests and diseases, and gradually optimize its classification and positioning capabilities. The setting of training rounds ensures that the model is fully learned with a sufficient number of iterations, while the early stopping mechanism prevents the model from overfitting and maintains its good generalization ability on unseen data. This training strategy ensures the efficiency and accuracy of the model in actual pest and disease monitoring.
[0161] After each round of training, an independent validation set is used to evaluate the model performance, including indicators such as accuracy, recall, F1 score, and mean average precision (mAP), to ensure that the model performs evenly on different types of pests and diseases.
[0162] Monitor the model's loss and various indicators on the validation set to ensure that the model performs evenly across different pest and disease types, and adjust the training strategy as needed.
[0163] According to the evaluation results of the validation set, adjust the model structure (such as the number of convolution kernels), learning rate, batch size and other hyperparameters to optimize the model performance. For example, increase the weight of certain pests and diseases categories to improve the model's ability to identify them.
[0164] The k-fold cross-validation method (such as 5-fold or 10-fold) is used to further verify the generalization ability and stability of the model and ensure the consistent performance of the model on different data subsets.
[0165] The optimal model parameters are selected based on the best performance of the validation set, and the model is saved for subsequent prediction and diagnosis to ensure that the model has the highest accuracy and robustness in practical applications.
[0166] Export the trained model to a deployable format Combined with agricultural domain knowledge, features highly relevant to pest and disease identification are selected and extracted, such as the shape of leaf spots, color distribution, pest path, etc., to improve the model's feature expression ability. Feature selection methods based on attention mechanisms can be used to automatically focus on key areas related to pests and diseases in the image, enhancing the model's ability to capture important features.
[0167] Regularization techniques such as L2 regularization and Dropout are used to prevent the model from overfitting and improve its generalization ability in practical applications. For example, a Dropout layer is applied between the fully connected layer and the point-by-point convolution layer to randomly discard some neurons, reduce the model's dependence on specific features, and improve the model's robustness.
[0168] Transfer learning is performed using models pre-trained on large-scale image datasets (such as ImageNet). By fine-tuning some layers, the model convergence is accelerated and the accuracy of pest and disease identification is improved. Transfer learning can take advantage of the pre-trained model's advantages in general feature extraction and enhance the model's ability to learn pest and disease features.
[0169] By processing the imbalance of categories, the model's ability to identify a few categories of pests and diseases is ensured, and the fairness and accuracy of the overall diagnosis are improved. Feature selection and extraction are combined with agricultural field knowledge to enhance the model's ability to capture key features of pests and diseases and improve recognition accuracy. Model regularization technology prevents overfitting and ensures the stability and reliability of the model in actual complex environments. The transfer learning method accelerates the model training process by utilizing existing knowledge and improves the model's performance in pest and disease identification tasks.
[0170] Specifically, in the present invention, the result O output by the model c is the probability value for each pest category. First, by setting the probability threshold T for each pest category i , when judging each category, the probability value P of the category is i The corresponding threshold T i When P i ≥T iWhen the number of confirmed diseases and insect pests is 1, the category of pests and diseases is considered to have been identified and confirmed. This processing step can effectively screen out pest and disease categories with high confidence, reduce false positives and false negatives, and thus provide more accurate pest and disease identification results.
[0171] Then, the pest identification results output by the model are associated with the geographical location information of the crops. In this way, a regional distribution map of pests and diseases can be generated to show the spatial distribution of different types of pests and diseases in the crop planting area. For agricultural workers, this spatial distribution map of pests and diseases can clearly show the high-incidence areas and distribution patterns of pests and diseases, thereby providing valuable reference information for crop planting and management. Combined with the geographical distribution of pests and diseases, agricultural workers can more accurately formulate targeted prevention and control strategies, reduce unnecessary waste of resources, and improve crop protection efficiency.
[0172] Based on the above pest and disease detection results and geographic location information, a pest and disease diagnosis report can be further generated. The report records in detail the type, distribution area and severity of each pest and disease in the crop. The report not only provides a graphical display method, but also includes the potential economic impact of pests and diseases, helping agricultural workers to intuitively understand the threat level of different pests and diseases. This diagnostic report is of great practical value to agricultural managers and can provide a scientific basis for subsequent prevention and control work.
[0173] Based on the information in the generated pest and disease diagnosis report, specific prevention and control measures can be further triggered. These prevention and control measures are accurately matched according to the type of pest and disease, the degree of damage, and the geographical location. For high-harm pests and diseases, timely prevention and control measures are recommended, such as the use of pesticides, traps or biological control methods; while for low-harm pests and diseases, more gentle and sustainable measures are recommended, such as physical protection or organic control. Through this process, agricultural workers can scientifically and rationally choose appropriate prevention and control methods based on the actual situation of pests and diseases, thereby improving prevention and control effects and reducing economic losses.
[0174] Embodiment 2, an embodiment of the present invention, which is different from the previous embodiment in that: If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0175] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0176] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0177] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0178] Example 3, an embodiment of the present invention, provides a pest and disease monitoring and diagnosis method based on a lightweight deep separation convolution model. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0179] This experiment was conducted in an agricultural laboratory with an ambient temperature of 22°C and a humidity of 60%. The same model of agricultural crop image acquisition equipment was used with an image resolution of 4000×3000, and image data was captured using autofocus and hyperspectral imaging technology. The dataset was provided by an agricultural research institute and contains about 5,000 images of different types of crops, covering a variety of pests and diseases, including powdery mildew, aphids, mites, etc. Image annotation was performed by experts, covering the location and type of pests and diseases.
[0180] The traditional method first performs basic image preprocessing on the collected agricultural crop images, including noise removal and contrast enhancement. Plant sprays containing hormones are used in combination with traditional denoising methods based on Gaussian filtering. In the preprocessing stage, the effect is tested by adjusting different hormone concentrations and formulations. After each image is treated with 5 rounds of sprays of different concentrations, the optimal solution is selected for contrast enhancement. Next, edge detection and segmentation are performed on the image to determine the area of pests and diseases. Finally, the pest and disease areas in the image are marked using manual methods, and the results are confirmed by visual inspection.
[0181] The method of the present invention also performs preprocessing after image acquisition, but adopts the adaptive Gaussian filtering denoising and contrast-limited adaptive histogram equalization processing designed by the present invention. The preprocessed image is converted into standardized input data by linear normalization. Then, the processed image is input into a lightweight deep separation convolution model for feature extraction. The model includes a deep convolution layer, a point-by-point convolution layer, a feature fusion module and a classification layer. The multi-level pest and disease features in the image are extracted by the deep convolution layer and the point-by-point convolution layer, and the feature fusion module is combined with the attention mechanism for weighted adjustment. Finally, the classification layer outputs the probability value of each type of pest and disease, and performs the final classification in combination with the set threshold. The whole process does not require manual intervention and relies entirely on the automatic feature extraction and classification capabilities of the model. The experimental results are shown in Table 1.
[0182] Table 1 Comparison of experimental results The experimental results show that the method of the present invention is improved in accuracy, processing time and diagnostic effect compared with the traditional method. Although the traditional method can complete the basic diagnosis of pests and diseases, it relies on manual marking and hormone treatment, resulting in a high misjudgment rate, cumbersome operation and low efficiency. The method of the present invention significantly improves the diagnostic accuracy of pests and diseases through automated feature extraction and classification, avoids the limitations of manual operation, and can output the type and distribution area of pests and diseases in real time.
[0183] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A pest monitoring and diagnosis method based on a lightweight deep separation convolution model, characterized in that: include: Collect agricultural crop image data through image acquisition equipment; Perform image preprocessing on the collected images; A lightweight deep separation convolution model is used to extract features from preprocessed images, and pest and disease features are extracted through deep convolution and point-by-point convolution operations; Based on the characteristics of pests and diseases, detect the pest and disease areas in the image, output the detection results of pests and diseases, and identify the types of pests and diseases; The image preprocessing comprises: Adaptive Gaussian filtering is applied to the collected images to remove noise. The standard deviation of the Gaussian kernel is dynamically adjusted according to the noise level in the local area of the image through the adaptive Gaussian filter. ; The image processed by adaptive Gaussian filtering is contrast enhanced using contrast-limited adaptive histogram equalization, and the image is divided into several blocks of size For each sub-block, the histogram is calculated and the threshold of contrast enhancement is limited, and the contrast enhancement is adjusted according to the edge detection result in combination with the edge enhancement coefficient; Convert the contrast-enhanced image from RGB color space to HSV color space to separate hue, saturation, and brightness information; Perform linear normalization on the converted HSV image to standardize the pixel values to a predetermined range; The Canny edge detection algorithm is applied to the normalized image to enhance edge information through Gaussian filtering, gradient calculation, non-maximum suppression and double threshold processing; Crop the image processed by Canny edge detection according to the preset region of interest method; A content-aware bilinear interpolation algorithm is used to scale the cropped image to the input size required by the lightweight depth-wise separable convolutional model.
2. The pest monitoring and diagnosis method based on a lightweight deep separation convolution model according to claim 1, characterized in that: The lightweight deep separation convolution model includes: Deep convolutional layer, point-by-point convolutional layer, feature fusion module, and classification layer; The depth convolution layer, each depth convolution layer includes K d The size is m m's independent convolution kernel D k , k=1,2...,K d , perform convolution operation on each input channel to generate an intermediate feature map; The point-by-point convolutional layers, each of which includes K P The size is 1 The convolution kernel P of 1 p , p=1, 2..., Kp, for the intermediate feature map F generated by the deep convolution d Perform point-by-point convolution operations to generate fused feature maps; The feature fusion module, Including, feature fusion layer and attention mechanism; The feature fusion layer weights and fuses the feature maps extracted by multiple convolution blocks to generate a fused feature map F f (x,y); The attention mechanism calculates the attention weight β(x, y) for the fused feature map F f Perform weighted adjustment to generate enhanced feature maps; The classification layer includes a fully connected layer, an activation layer and an output layer; The fully connected layer expands the enhanced feature map into a one-dimensional vector, and performs feature combination and weight calculation through the fully connected layer, and the fully connected layer includes a number of neurons for generating a multi-dimensional feature representation; The activation layer applies an activation function after the output of the fully connected layer to normalize multiple categories and generate a probability distribution for each pest type; The output layer determines the classification label of the pests and diseases according to the output result of the activation layer.
3. The pest monitoring and diagnosis method based on the lightweight deep separation convolution model according to claim 2, characterized in that: The intermediate feature map is expressed as, in, (x, y) represents the output value of the kth depth convolution kernel at position (x, y), k represents the index of the depth convolution kernel, (x, y) represents the position coordinates of the pixel in the image, (x+i, y+j) represents the pixel value at position (x+i, y+j) on the kth channel of the input image. k (i, j) represents the weight of the kth depth convolution kernel at position (i, j), and m represents the size of the depth convolution kernel; The fused feature map is expressed as: in, Represents the point-by-point convolution kernel P p The weight on the kth channel, (x, y) represents the pixel value of the fused feature map on the pth channel after point-by-point convolution, K P represents the number of point-by-point convolution kernels, corresponding to the number of channels of the output feature map, p represents the index of the point-by-point convolution kernel, K d Represents the total number of depth convolution kernels; The activation function is expressed as, in, (x, y) The output value of the pth channel at the position (x, y) after being processed by the ReLU activation function, p represents the index of the channel, and ReLU represents the ReLU activation function; the fused feature map is represented as, in, (x, y) represents the weights dynamically adjusted according to the characteristics of pests and diseases. (x, y) represents the output value of the fused feature map; The enhanced feature map is expressed as, Among them, β(x,y) represents the attention weight based on the characteristics of pests and diseases, (x, y) represents the enhanced feature map.
4. The pest monitoring and diagnosis method based on a lightweight deep separation convolution model according to claim 3, characterized in that: Before extracting the pest characteristics, the method further includes: Collect image data of different pest and disease types; Marking the image data with the types and locations of pests and diseases; Applying data enhancement technology to perform data enhancement operation on the annotated image data; Initialize the depth convolution kernel, point-by-point convolution kernel and fully connected layer weights in the classification layer in the lightweight depth separation convolution model, and initialize the biases of all convolution layers and fully connected layers to zero; Select a multi-class cross entropy loss function and combine it with a regression loss function as needed to optimize the prediction of pest and disease locations; Adopt Adam optimizer, set the initial learning rate, and dynamically adjust the learning rate according to the performance of the validation set; Perform model training and model validation.
5. The pest monitoring and diagnosis method based on a lightweight deep separation convolution model according to claim 4, characterized in that: The detecting of the pest and disease area in the image includes: Preprocess the pest and disease images to be predicted to generate standardized input images with appropriate sizes; The preprocessed image is input into the trained lightweight deep separation convolution model, and the pest and disease features are extracted through the deep convolution layer, point-by-point convolution layer and feature fusion module to generate an enhanced feature map. ; Enhance the feature map The data is input into the fully connected layer, and then the pest type is identified through the fully connected layer and the Softmax activation layer.
6. The pest monitoring and diagnosis method based on a lightweight deep separation convolution model according to claim 5, characterized in that: The output result of the activation layer is expressed as, in, Represents the output result of the classification layer, Softmax represents the Softmax activation function, represents the weight matrix of the classification layer, Represents the bias vector of the classification layer.
7. The pest monitoring and diagnosis method based on a lightweight deep separation convolution model according to claim 6, characterized in that: The identification of pest and disease types includes: Setting a probability threshold for pest and disease categories, and comparing the probability value of each pest and disease category in the output result with the preset threshold; The pest and disease categories with probability values higher than the threshold are taken as the final classification results; Combined with the geographical location information, the classification results output by the model are associated with the geographical location information of the crops to generate a regional distribution map of pests and diseases; Generate a diagnostic report, based on the classification results and the geographical location information, generate a diagnostic report including the type, distribution area and severity of the pests and diseases; Trigger control measures recommendations and recommend control measures based on the pest and disease types in the diagnostic report.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the pest monitoring and diagnosis method based on a lightweight deep separation convolution model described in any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the pest monitoring and diagnosis method based on a lightweight deep separation convolution model described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Crop disease and pest image recognition method and system based on deep learning
CN118262149A
Digital hair quantity scanning equipment
CN118749917A
Training method and device of safety equipment detection model, equipment and storage medium
CN119380261A
Cited By
Diagnosis and control method for diseases and insect pests of transplanted red beans
CN120564041A
Diagnosis and control method of pests and diseases of rock lily
CN120564041B
Disease and pest monitoring system and method based on AI vision and multi-parameter dynamic optimization
CN121000847A
Robust node classification and dynamic decision-making method for monitoring agricultural diseases and insect pests
CN121392417A