Early warning method for analyzing insect pest situation based on deep learning
Through the combination of the deep learning model YOLOv5 and the insect situation measurement and reporting lamp, early warning of orchard pests is achieved, the problems of pest identification and resource waste in traditional orchard planting are solved, and the pest risk in agricultural production is reduced.
Patent Information
- Application Number
- CN202510593330.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-09-02
AI Technical Summary
There are problems of chemical pesticides and water resources in traditional orchard planting, and pest identification and early warning cannot be effectively carried out.
The deep learning model YOLOv5 is used for pest identification, combined with the insect information light to obtain image data, and trigger early warning alarms through statistical analysis.
Early warning of orchard pests has been achieved, pest risks in agricultural production have been reduced, chemical pesticide use and water waste.
Smart Images

Figure CN120580718A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of fruit tree planting, and in particular to an early warning method for insect analysis based on deep learning. Background Art
[0002] Traditional orchard cultivation models have certain negative environmental impacts. Excessive use of chemical pesticides and fertilizers can lead to soil and water pollution, damaging the ecological environment. Furthermore, traditional water resource management methods can be wasteful and inappropriate, necessitating more environmentally friendly and sustainable cultivation methods.
[0003] In the related technology, the fruit quality is classified and quickly monitored, but it is impossible to identify pests, let alone combine them with pest warning.
[0004] Therefore, it is necessary to improve one or more problems existing in the above-mentioned related technical solutions.
[0005] It should be noted that this section is intended to provide background or context for the technical solutions of the present invention as stated in the claims. The description herein is not admitted to be prior art by virtue of being included in this section. Summary of the Invention
[0006] The purpose of the present invention is to provide an early warning method for insect situation analysis based on deep learning, thereby solving one or more problems caused by the limitations and defects of the above-mentioned related technologies at least to a certain extent.
[0007] The present invention provides an early warning method for insect situation analysis based on deep learning, comprising:
[0008] Obtain image data of insect pests around fruit trees;
[0009] performing pest identification on the image data according to a deep learning model;
[0010] Conduct statistical analysis on identified pests and obtain statistical data;
[0011] When the statistical data reaches a preset condition, an early warning alarm is issued; wherein, the preset condition is that the number of corresponding insects identified within a set time range reaches above a preset threshold.
[0012] Optionally, the step of obtaining image data of insect pests around fruit trees includes:
[0013] Capture image data of pests at designated locations and organize the collected image data.
[0014] Optionally, the step of obtaining image data of insect pests around fruit trees includes:
[0015] Pest monitoring lights are used to capture pest images at preset time intervals to obtain image data of pests around fruit trees.
[0016] Optionally, the step of performing pest identification on the image data according to the deep learning model includes:
[0017] The image data is input into the trained YOLOv5 model, and the detection results output by the YOLOv5 model include the pest type and the number of pests corresponding to each pest type.
[0018] Optionally, the step of performing pest identification on the image data according to the deep learning model includes:
[0019] The backbone network of the YOLOv5 model uses the CSPDarknet structure to extract image features; the output end uses a multi-scale prediction head to classify and locate pests.
[0020] Optionally, the step of performing pest identification on the image data according to the deep learning model includes:
[0021] During the training process, the training images are input into the YOLOv5 model, which calculates the difference between the pest classification results and the correct classification according to the loss function and updates the parameters of the model through the back-propagation algorithm.
[0022] Optionally, the step of performing statistical analysis on the identified pests and obtaining statistical data includes:
[0023] The pest types identified by all the image data within a set time range and the number of pests corresponding to each pest type are sorted out, and statistical analysis is performed based on the time range.
[0024] Optionally, the step of issuing an early warning alarm when the statistical data reaches a preset condition includes:
[0025] Acquire real-time environmental factor data, and adjust the preset conditions according to the real-time environmental factor data.
[0026] Optionally, the step of obtaining real-time environmental factor data includes:
[0027] Environmental factor data are collected by various environmental detection devices and stored in a database, and the environmental factor data in the database are cyclically stored according to a set time cycle.
[0028] The technical solution provided by the present invention can have the following beneficial effects:
[0029] In the present invention, pests are identified to achieve a combination of pest early warning and early warning of pests in fruit trees and orchards, thereby reducing the risk of pests in agricultural production. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present invention, and together with the description, serve to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and it is clear that those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0031] Figure 1 A schematic diagram illustrating a process of an early warning method for insect situation analysis based on deep learning in an exemplary embodiment of the present invention is shown;
[0032] Figure 2 A schematic diagram showing an overall system for insect situation analysis in an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0034] In addition, the accompanying drawings are merely schematic illustrations of embodiments of the present invention and are not necessarily drawn to scale. Identical reference numerals in the drawings represent identical or similar parts, and thus repeated descriptions thereof will be omitted. Some of the blocks shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically separate entities.
[0035] The present invention provides an early warning method for insect analysis based on deep learning, referring to Figure 1 As shown in , including:
[0036] Step S100: Acquire image data of insect pests around fruit trees.
[0037] Step S200: performing pest identification on the image data according to a deep learning model.
[0038] Step S300: performing statistical analysis on the identified pests and obtaining statistical data.
[0039] Step S400: When the statistical data reaches a preset condition, an early warning alarm is issued, wherein the preset condition is that the number of corresponding insects identified within a set time range reaches or exceeds a preset threshold.
[0040] It should be understood that an alarm line is set in the system. When the number of insects of a certain category captured by the equipment within a fixed time range reaches the upper limit of the specified threshold, the apple leaf pest early warning system can trigger an early warning alarm for pest occurrence and send the warning information to plant protection personnel in a timely manner.
[0041] It should also be understood that the fruit tree may specifically be an apple tree.
[0042] It should also be understood that step S100 is the starting step of the entire system, and its purpose is to collect images that can reflect the pest situation around the fruit trees and provide basic data for subsequent pest identification.
[0043] Image acquisition can be performed using a variety of devices, including surveillance cameras installed in orchards, drone-mounted cameras, and handheld digital cameras. Surveillance cameras can capture long-term, real-time images of specific areas in an orchard; drones are suitable for rapid inspections of large orchards, capturing images from various locations; and handheld cameras can precisely capture images of specific fruit trees or areas suspected of being infested by pests.
[0044] In an orchard, images should be collected from different positions and angles to ensure comprehensive coverage of all parts of the fruit trees. For example, images should be taken from the top, middle, and bottom of the tree canopy, as well as from the front, side, and back of the fruit tree. This will more accurately capture pests hidden in different locations.
[0045] Choosing the right time to collect images is also crucial. Typically, images should be collected during daylight hours to avoid blurry images caused by insufficient light. Also, consider the activity patterns of certain pests, such as those that are most active in the early morning or evening. Focus on collecting images during these times.
[0046] The captured images should be clear, free of significant blur and obstructions, and have a high enough resolution to allow for clear identification of pest features. Additionally, avoid overexposure or underexposure, and adjust the camera parameters based on actual lighting conditions.
[0047] It is also important to understand that after acquiring the image data, a deep learning model is used to identify and classify the pests in the image.
[0048] You can use common convolutional neural network (CNN) models, such as ResNet, VGG, and YOLO. These models excel in image recognition and have powerful feature extraction and classification capabilities. Choose an appropriate model for training and optimization based on your actual needs and data characteristics.
[0049] Before using the model for identification, it needs to be trained with a large amount of labeled pest image data. The labeled data should clearly indicate the pest type and location in the image. Through training, the model learns the characteristic patterns of different pests, improving recognition accuracy.
[0050] Before inputting an image into a model, it needs to be preprocessed. Common preprocessing operations include image scaling, normalization, and cropping. These operations can make the image data conform to the model's input requirements, improving the model's processing efficiency and recognition accuracy.
[0051] The preprocessed image is fed into a trained deep learning model, which analyzes and extracts features from the image. The model then uses the learned patterns to determine the presence and type of pest. The output is typically a pest category label and a corresponding confidence score.
[0052] It is also necessary to understand that the results of identified pests should be statistically analyzed to understand the distribution and severity of pests in the orchard.
[0053] Indicators that can be counted include the number of different pest species, the distribution of each pest across different fruit trees or orchard areas, and the frequency of pest occurrence. These indicators can help fruit farmers fully understand the pest situation and provide a basis for formulating prevention and control measures.
[0054] The identification results are sorted according to certain rules, such as classification by pest type, fruit tree number, collection time, etc. The sorted data is then stored in a database or file for subsequent query and analysis.
[0055] To present statistical results more intuitively, visual displays can be made using charts (such as bar charts, line charts, pie charts, etc.) or maps. Through visual displays, fruit farmers can quickly understand the overall situation and changing trends of insect pests.
[0056] It is also necessary to understand that based on statistical data and preset conditions, it is determined whether it is necessary to issue an early warning alarm to remind fruit farmers to take timely prevention and control measures.
[0057] The pre-set condition is typically when the number of identified insects exceeds a preset threshold within a set timeframe. For example, if the number of a particular pest in a certain area exceeds 100 within a week, an alert is triggered. The pre-set threshold can be appropriately set based on factors such as the orchard's historical data, the severity of the pest damage, and pest control experience.
[0058] Early warning can be provided in a variety of ways, such as SMS notifications, mobile app push notifications, sound and light alarms, etc. Different early warning methods are suitable for different scenarios and user needs, ensuring that fruit farmers can receive early warning information in a timely manner.
[0059] When an early warning alert is issued, fruit farmers should promptly take appropriate preventive measures based on the warning information, such as spraying pesticides, releasing natural enemies, and pruning infested branches. At the same time, the effectiveness of prevention and control measures should be tracked and evaluated to adjust subsequent prevention and control strategies.
[0060] It is also important to understand that professional knowledge data on apple leaf disease incidence is collected, including literature, disease images, expert knowledge, and agricultural research reports. This data can include information such as disease name, symptom description, transmission route, and cause of the disease. Choose an ontology modeling tool such as OWL to define basic categories in the ontology, such as "apple tree," "disease," and "symptoms." Create classes and subclasses to represent different types of apple leaf diseases. Create attributes to describe disease characteristics, such as "symptoms," "transmission route," and "cause of the disease." Establish relationships to connect different classes and instances, such as "cause" and "result." Based on the data and ontology definition, represent the actual knowledge as instances of the ontology. Create instances for each apple leaf disease, providing detailed information, including name, symptoms, and cause of the disease. Use the ontology's attributes and relationships to link instances and describe the relationships between them. After the ontology modeling is completed, store the data in RDF format and ultimately load it into the knowledge base.
[0061] The above-mentioned early warning method for insect analysis based on deep learning is adopted to identify insect pests and combine them with early warning. Early warning of insect pests in fruit trees and orchards can be used to reduce the risk of insect pests in agricultural production.
[0062] Below, each step of the above-mentioned early warning method for insect situation analysis based on deep learning in this example embodiment will be described in more detail.
[0063] In some embodiments, step S100 includes:
[0064] Capture image data of pests at designated locations and organize the collected image data.
[0065] It is important to understand that by modifying the insect monitoring lamp, using an insect-attracting light source to attract pests, capturing pest images, and organizing the collected image data, it is ensured that the images cover a variety of common pest species, such as aphids, locusts, and borers, as well as their morphologies at different growth stages (eggs, larvae, adults, etc.).
[0066] In some embodiments, reference Figure 2 As shown in , step S100 includes:
[0067] Pest monitoring lights are used to capture pest images at preset time intervals to obtain image data of pests around fruit trees.
[0068] It's important to understand that model training is performed based on collected image data. The model is deployed in the embedded device of the insect monitoring light. The embedded device regularly captures pest images, uses a deep learning model to identify them, and uploads the results to the monitoring server database.
[0069] In modern orchard management, using insect monitoring lights to capture pest images at preset intervals is an efficient and accurate way to obtain pest data around fruit trees. Selecting an appropriate insect monitoring light depends on the size of the orchard, the types of crops grown, and the local pest characteristics. For example, for large orchards, a light with wide-angle imaging and large storage capacity can be selected; for smaller orchards, a standard high-precision, low-energy light may be more suitable. Install the light in a representative location within the orchard, such as the center of the orchard, at the junction of different varieties of fruit trees, or in areas with frequent pests. The installation height should generally be maintained at 1.5-2 meters above the ground to ensure effective insect attraction while facilitating comprehensive image capture. Ensure that the installation location is clear of tall obstacles that could obstruct the light's insect attraction range and field of view.
[0070] When setting the preset interval, many factors need to be considered. For example, in warm and humid seasons, pest activity is high and reproduction is rapid. In these situations, the recording interval can be shortened, perhaps to once an hour. In cold and dry seasons, pest activity decreases, so the interval can be extended to every 2-3 hours. Furthermore, the growth stage of the fruit tree must be considered. During the flowering and fruiting periods, pest monitoring requires closer monitoring, and the interval should be shortened accordingly. The interval can be set using the Pest Monitoring Light's built-in program settings or through a connected management system. Once configured, the system automatically triggers recording at the preset interval.
[0071] Pest monitoring lights exploit the phototaxis of insects by emitting light of a specific wavelength at night, attracting nearby pests toward the light. When pests approach the light, they are captured by a fan or other device inside the light and drawn into a collection box. At the preset capture time, the high-definition camera inside the light automatically activates. The camera captures the pests in the collection box from multiple angles to ensure clear identification of their features. The captured images are typically high-resolution, meeting the needs of subsequent pest identification. To ensure optimal capture, the light is equipped with a specialized fill light to provide uniform illumination in low-light conditions. After capturing images, the light transmits the image data in real time to a cloud server or a local database within the orchard management system via a built-in wireless transmission module (such as Wi-Fi, 4G, or 5G). A certain number of image backups are also stored within the light to prevent data loss during transmission. Based on the actual capture, the camera's focal length, aperture, and other parameters are adjusted appropriately to suit varying lighting conditions and pest density. The brightness and color of the fill light are also fine-tuned to enhance image contrast and color reproduction.
[0072] In some embodiments, step S200 includes:
[0073] The image data is input into the trained YOLOv5 model, and the detection results output by the YOLOv5 model include the pest type and the number of pests corresponding to each pest type.
[0074] It's important to understand that YOLOv5 is a real-time object detection model based on deep learning. It introduces an adaptive anchor point adjustment mechanism, which automatically adjusts the size and proportion of anchor points based on the training dataset. This allows the model to better adapt to objects of varying shapes and sizes, improving detection efficiency and accuracy on specific datasets. Collect images containing a variety of pests, covering different pest species, growth stages, and shooting environments. Use image annotation tools to draw bounding boxes for the pests in the images and label their categories. For clusters of pests, use polygonal annotations and record the number. Save the annotations in a specific format for the model to read.
[0075] Before inputting image data into the YOLOv5 model, a series of preprocessing operations are required to ensure that the data meets the input requirements of the model.
[0076] Images captured by insect monitoring lights may exist in various formats, such as JPEG, PNG, etc. First, all images need to be converted to a standard format supported by the YOLOv5 model, generally JPEG.
[0077] The YOLOv5 model typically has specific input image size requirements. To ensure the model's detection effectiveness and efficiency, all images must be resized to a uniform size, such as 640×640 pixels. When resizing, be sure to maintain the image's aspect ratio to avoid distortion that could lead to loss of pest features. All images should be resized to the fixed size required by the model input, such as 416×416 or 512×512. Scaling methods such as bilinear interpolation can be used.
[0078] Normalize the pixel values of the image, scaling the pixel values from the range of [0, 255] to the range of [0, 1]. This can speed up the training and inference of the model and improve the stability of the model.
[0079] Normalized image pixel value x norm The calculation formula is:
[0080]
[0081] Among them, x is the original pixel value, x min and x max are the minimum and maximum values of the image pixels, respectively.
[0082] After completing the image data preprocessing, you need to load the trained YOLOv5 model.
[0083] Depending on your needs and scenarios, you can choose different versions of the YOLOv5 model, such as YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. These models vary in accuracy and speed. For example, the YOLOv5s model is smaller and has faster inference speed, but relatively lower accuracy; while the YOLOv5x model is larger and has higher accuracy, but slower inference speed.
[0084] A trained YOLOv5 model is typically saved as a weights file with a .pt file extension. Use the corresponding library functions in your code to load the weights file and initialize the model's parameters to the trained values.
[0085] Input the preprocessed image data into the loaded YOLOv5 model for inference.
[0086] To improve processing efficiency, you can batch multiple images and input them into the model for inference. In the code, use the corresponding function to organize the image data into a tensor format suitable for model input.
[0087] The model's inference function is called to process the input image data. The model detects possible pest targets in the image and outputs the bounding box information for each target, including the coordinates of the top-left and bottom-right corners of the bounding box.
[0088] The parsed test results are output and displayed for users to view and analyze.
[0089] Output each pest type and its corresponding number in text format, for example: "Aphids: 20, Spider Mites: 15, Borer: 5." The results can be saved to a log file for later review and analysis.
[0090] The detection results are visualized using an image processing library. Bounding boxes for each pest target are drawn on the original image, and the pest type and number are annotated. This visually demonstrates the distribution of pests in the image, helping users better understand the infestation situation.
[0091] In some embodiments, step S200 includes:
[0092] The backbone network of the YOLOv5 model uses the CSPDarknet structure to extract image features; the output end uses a multi-scale prediction head to classify and locate pests.
[0093] It is important to understand that its network structure includes an image preprocessing module at the input end, such as Mosaic data enhancement and adaptive anchor box calculation; the backbone network adopts the CSPDarknet structure, which can efficiently extract image features; the neck uses the FPN+PAN structure to achieve the fusion of features at different scales; and the output end uses a multi-scale prediction head to classify and locate pests.
[0094] CSPDarknet (Cross Stage Partial Darknet) is the backbone network for extracting image features in the YOLOv5 model. It improves upon the Darknet architecture and introduces the Cross Stage Partial Connection (CSP) concept, aiming to improve the network's learning ability and inference speed while reducing the number of parameters.
[0095] Convolutional layers, the initial layer of the network, perform convolution operations on the input pest image using convolution kernels of varying sizes (e.g., 3x3, 1x1). The convolution kernels slide across the image, extracting local features such as edges and textures. For example, a 3x3 convolution kernel can capture the relationship between adjacent pixels in an image, thereby detecting the outline of the pest.
[0096] The convolutional layer also applies batch normalization and activation function (Leaky ReLU). Batch normalization can accelerate network convergence and improve model stability; Leaky ReLU introduces a small negative slope to avoid the problem of gradient vanishing during the back propagation process of neurons.
[0097] CSPDarknet includes multiple residual blocks, designed to address the vanishing and exploding gradient problems in deep neural networks. Residual blocks use skip connections to add the input directly to the output after convolution, allowing the network to learn the residual information between the input and output. For example, in a residual block, the input is processed through a series of convolutional layers to obtain the output, which is then added together and passed through an activation function to obtain the final output. This allows the network to more easily learn the deep features of the image.
[0098] The CSP module (Cross Stage Partial Module) is the core innovation of CSPDarknet. It splits the feature map along the channel dimension. Part of the feature map is directly passed to the module output via shortcut connections, while the remaining feature map is processed through a series of convolutional layers and then concatenated with the feature map from the shortcut connection. This not only reduces the number of parameters but also enhances gradient propagation, enabling the network to better learn features at different scales. For example, when processing insect pest images, the CSP module can simultaneously capture both the global characteristics and local details of the pest.
[0099] When an insect pest image is input into CSPDarknet, the network gradually downsamples the image, continuously reducing the size of the feature map through convolutional layers and pooling layers (in some cases), while increasing the number of channels of the feature map.
[0100] During this process, the network extracts features at different levels. Shallow features contain more image details, such as the texture and color of the pests, while deep features contain more semantic information, such as the type and shape of the pests. These features are then passed to the subsequent output for further processing.
[0101] The multi-scale prediction head is a crucial component of the YOLOv5 model's output. By making predictions based on feature maps at different scales, it can detect pest targets of varying sizes. Because orchard pests vary widely in size, from small insects like aphids to relatively large insects like beetles, multi-scale prediction improves the model's ability to detect pests of varying sizes.
[0102] CSPDarknet outputs feature maps of different scales at different network layers. Generally, three feature maps of different scales are selected, corresponding to the detection of large, medium, and small objects. For example, shallower network layers output larger feature maps that contain more detailed information, making them suitable for detecting small pests. Deeper network layers output smaller feature maps that contain more semantic information, making them suitable for detecting large pests.
[0103] Each feature map at each scale is connected to a separate prediction head, which consists of a series of convolutional layers. The prediction head processes the feature map and outputs information about each detection box, including the bounding box's location (center coordinates, width, and height), class confidence, and object confidence. The bounding box's location information is used to pinpoint the specific location of the pest in the image; the class confidence indicates the probability that the object within the detection box belongs to a particular pest class; and the object confidence indicates the probability of the object being present within the detection box.
[0104] In each prediction head, the feature map is processed through a convolution operation to obtain the prediction information of each detection box. Then, the non-maximum suppression (NMS) algorithm is used to remove the detection boxes with high overlap, retaining only the detection boxes with the highest confidence.
[0105] Finally, the objects within the detection frame are classified according to the category confidence, the type of pest is determined, and the pest is located according to the position information of the bounding box. In this way, each type of pest in the image and its corresponding number and location information can be accurately output.
[0106] In some embodiments, step S200 includes:
[0107] During the training process, the training images are input into the YOLOv5 model, which calculates the difference between the pest classification results and the correct classification according to the loss function and updates the parameters of the model through the back-propagation algorithm.
[0108] It is important to understand that the YOLOv5 loss function consists of three main parts: the bounding box loss (Box Loss), the objectness loss (Objectness Loss) and the classification loss (Classification Loss).
[0109] Bounding box loss: This measures the difference between the bounding box position predicted by the model and the ground-truth bounding box position. It is typically calculated using the Generalized Intersection over Union (GIoU) loss or the Complete Intersection over Union (CIoU) loss. These loss functions consider not only the degree of overlap between the predicted and ground-truth boxes, but also factors such as the distance between their center points and aspect ratio, enabling a more accurate assessment of bounding box prediction accuracy.
[0110] Target Confidence Loss: Target confidence indicates the probability of the presence of an object within the predicted box. Target confidence loss is calculated using Binary Cross-Entropy Loss, which measures the difference between the model's predicted target confidence and the actual presence of the object.
[0111] Classification loss: Classification loss measures the difference between the model's predicted pest class and the true class. It is also calculated using binary cross-entropy loss. For multi-class classification problems, the loss is calculated for each class separately and summed.
[0112] When a training image is input into the YOLOv5 model, the model outputs predictions, including the predicted bounding box location, object confidence, and class probability. These predictions are then compared with the actual annotation information to calculate the bounding box loss, object confidence loss, and classification loss, respectively. Finally, these three losses are weighted together to obtain the total loss. For example, in YOLOv5, the weights for bounding box loss, object confidence loss, and classification loss can be adjusted based on the actual situation; the default weights are usually 0.05, 1.0, and 0.5, respectively.
[0113] After obtaining the total loss value, the backpropagation algorithm is used to calculate the gradient of the loss function with respect to each parameter in the model. Backpropagation is based on the chain rule, starting from the loss function and calculating the gradient backward layer by layer. By calculating the gradient, we can understand the influence of each parameter on the loss function, that is, how a small change in the parameter affects the magnitude of the loss value.
[0114] Based on the calculated gradient, an optimizer (such as stochastic gradient descent (SGD) or Adam) is used to update the model's parameters. The optimizer adjusts the parameters according to the magnitude and direction of the gradient, using a specific learning rate. The learning rate controls the step size of each parameter update. Excessively large learning rates can prevent the model from converging, while excessively small ones can slow the training process. For example, the Adam optimizer adaptively adjusts the learning rate of each parameter, enabling the model to converge more quickly.
[0115] The above process is repeated over multiple training epochs. Each epoch iterates over all training images, processing one batch of data at a time. As training progresses, the model parameters are continuously updated, the loss value gradually decreases, and the model performance continues to improve. During training, the model performance can also be evaluated using a validation set to prevent overfitting. When the loss value no longer decreases significantly or the performance on the validation set no longer improves, the training process can be considered basically complete.
[0116] In some embodiments, reference Figure 2 As shown in , step S300 includes:
[0117] The pest types identified by all the image data within a set time range and the number of pests corresponding to each pest type are sorted out, and statistical analysis is performed based on the time range.
[0118] It's important to understand that statistical analysis of the detected pest types and quantities is performed and displayed in charts. The time range can be set based on actual needs, such as a day, a week, a month, or even a growing season. The start and end time points of the time range are determined as the basis for filtering image data.
[0119] Filter all stored image data to select those that fall within a specified time range. This may require access to image metadata, such as the capture timestamp. This filtering can be accomplished through database queries or file system time attributes. For example, if a database is used to store image data and related information, SQL queries can be used to filter records that fall within a specified time range based on the time field.
[0120] For the filtered image data, extract the pest type and the number of pests corresponding to each type from the previous YOLOv5 model's recognition results. The recognition results may be stored as files (such as JSON files) or database records, and these results must be read and parsed according to a specific format. For example, a JSON file may contain the pest recognition results for each image.
[0121] Combine the recognition results of all filtered image data. Create a summary data structure (such as a dictionary) to store each pest type and its cumulative number over the entire time range. Iterate through the recognition results of all images and accumulate the number of the same pest type.
[0122] Calculate the total number of all pests within the set time range, that is, sum the number of all pest types in the summary data structure. This can intuitively reflect the overall severity of pests in the orchard during that time period. Calculate the proportion of each pest count to the total number of pests. The proportion can be used to understand the relative importance of different pests in the overall pest count, which helps to determine the types of pests that need to be focused on. For example, if the number of aphids accounts for a high proportion, it means that aphids may be the main pests in that time period. If the set time range is long (such as one month), the time range can be further subdivided into smaller time periods (such as daily) to analyze the changing trends of the number of each pest in these small time periods. Visual tools such as line charts can be used to display this changing trend so that the increase or decrease in the number of pests can be more intuitively observed.
[0123] If historical pest statistics for the same timeframe are available, current results can be compared with these. This comparison includes changes in the total number of pests, the number of each pest species, and the percentage of each species. This comparison can help determine whether the current pest situation is worsening, decreasing, or remaining stable, providing a reference for developing control strategies. For example, if the number of a particular pest has increased significantly compared to the same period in history, it may be necessary to strengthen control measures for that pest.
[0124] If the image data also includes shooting location information (e.g., different areas of the orchard), spatial distribution analysis of pests can be performed. The number and proportion of each pest species in different areas can be counted to understand their distribution within the orchard. This helps identify areas with the most severe pests, allowing for targeted prevention and control measures, such as increasing pesticide spraying or implementing other control measures in severely infested areas.
[0125] It's possible to analyze correlations between the abundance of different pest types. For example, some pests may coexist or interact with each other, and by calculating correlation coefficients and other methods, potential relationships between them can be discovered. This is crucial for developing integrated pest control strategies. For example, if a positive correlation is found between two pests, simultaneous measures can be considered to control their abundance.
[0126] In some embodiments, reference Figure 2 As shown in , step S400 includes:
[0127] Acquire real-time environmental factor data, and adjust the preset conditions according to the real-time environmental factor data.
[0128] It should be understood that, specifically, when the number of insects identified within a set time range reaches or exceeds a preset threshold, the preset condition automatically adjusts the preset threshold used to adjust the number of insects based on real-time environmental factor data.
[0129] In some embodiments, reference Figure 2 As shown in , the step of obtaining real-time environmental factor data includes:
[0130] Environmental factor data are collected by various environmental detection devices and stored in a database, and the environmental factor data in the database are cyclically stored according to a set time cycle.
[0131] It's important to understand that this project first collects real-time data on multiple environmental factors, including soil conditions and climate, using equipment such as soil moisture sensors, soil tension sensors, and weather stations. This data is stored in a database every hour. Subsequently, the collected data undergoes data cleaning, missing value interpolation, and time series smoothing to ensure data quality and integrity. The collected data is divided into training, validation, and test sets for feature extraction. After data preparation, the project further develops an environmental factor feature mining model to explore the temporal and spatial variations of these environmental factors. Using a recurrent neural network (RNN), temporal and meteorological features are extracted. Temporal features include date, time, season, and weekdays / non-workdays, while meteorological features include temperature, humidity, wind speed, and precipitation. A neural network model is constructed to analyze these environmental factors, combining the extracted features with disease patterns from an apple disease knowledge base to predict the probability of apple leaf disease. Based on the disease patterns in the apple disease knowledge base, an alarm threshold is determined for each disease or pest. When the predicted probability of a particular apple leaf disease exceeds the threshold, an alarm is triggered, notifying the relevant plant protection personnel.
[0132] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine different embodiments or examples described in this specification.
[0133] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the appended claims.
Claims
1. An early warning method for insect analysis based on deep learning, characterized in that: include: Obtain image data of insect pests around fruit trees; performing pest identification on the image data according to a deep learning model; Conduct statistical analysis on identified pests and obtain statistical data; When the statistical data reaches a preset condition, an early warning alarm is issued; wherein, the preset condition is that the number of corresponding insects identified within a set time range reaches above a preset threshold.
2. The early warning method for insect situation analysis based on deep learning according to claim 1, characterized in that: The step of obtaining image data of insect pests around fruit trees comprises: Capture image data of pests at designated locations and organize the collected image data.
3. The early warning method for insect situation analysis based on deep learning according to claim 2 is characterized in that: The step of obtaining image data of insect pests around fruit trees comprises: Pest monitoring lights are used to capture pest images at preset time intervals to obtain image data of pests around fruit trees.
4. The early warning method for insect situation analysis based on deep learning according to claim 1, characterized in that: The step of performing pest identification on the image data according to the deep learning model includes: The image data is input into the trained YOLOv5 model, and the detection results output by the YOLOv5 model include the pest type and the number of pests corresponding to each pest type.
5. The early warning method for insect situation analysis based on deep learning according to claim 4 is characterized in that: The step of performing pest identification on the image data according to the deep learning model includes: The backbone network of the YOLOv5 model uses the CSPDarknet structure to extract image features; the output end uses a multi-scale prediction head to classify and locate pests.
6. The early warning method for insect situation analysis based on deep learning according to claim 5, characterized in that: The step of performing pest identification on the image data according to the deep learning model includes: During the training process, the training images are input into the YOLOv5 model, which calculates the difference between the pest classification results and the correct classification according to the loss function and updates the parameters of the model through the back-propagation algorithm.
7. The early warning method for insect situation analysis based on deep learning according to claim 1, characterized in that: The step of performing statistical analysis on the identified pests and obtaining statistical data comprises: The pest types identified by all the image data within a set time range and the number of pests corresponding to each pest type are sorted out, and statistical analysis is performed based on the time range.
8. The early warning method for insect situation analysis based on deep learning according to any one of claims 1 to 7, characterized in that: The step of issuing an early warning alarm when the statistical data reaches a preset condition includes: Acquire real-time environmental factor data, and adjust the preset conditions according to the real-time environmental factor data.
9. The early warning method for insect situation analysis based on deep learning according to claim 8, characterized in that: The step of obtaining real-time environmental factor data includes: Environmental factor data are collected by various environmental detection devices and stored in a database, and the environmental factor data in the database are cyclically stored according to a set time cycle.
Citation Information
Cited By
Intelligent insect pest situation monitoring and analyzing method and system based on Internet of Things
CN120853114A