Tomato leaf disease identification method, system and equipment and storage medium
Through the improvement of the YOLOv8n network, the SPD-Conv attention mechanism, visual centralized module and double-layer routing attention layer were introduced to build the SEB-YOLOv8n network, which solved the problem of inaccurate identification of YOLOv8 network under complex background and lighting conditions, and achieved higher detection accuracy and flexibility.
Patent Information
- Application Number
- CN202510820731.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-07-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing tomato leaf disease recognition model based on YOLOv8 network is difficult to accurately identify targets when facing the differences in complex background and lighting conditions, and the traditional centralized feature pyramid technology has limited receptive fields, which affects the detection results.
Improved the YOLOv8n network, introduced the SPD-Conv attention mechanism, visual centralized module and two-layer routing attention layer, and built the SEB-YOLOv8n network to optimize the model through training data sets to improve recognition accuracy.
The recognition ability of low-resolution tomato leaf images is enhanced, the detection ability of specific details is improved, and the detection accuracy is improved through flexible calculation allocation and content perception.
Smart Images

Figure CN120339734A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tomato leaf disease identification, and particularly relates to a tomato leaf disease identification method, system, device and storage medium. Background Art
[0002] Common tomato leaf diseases include leaf mold, Septoria leaf spot, yellow leaf curl disease, etc. Usually, the detection and treatment of agricultural diseases start from the leaf parts of crops. Feature information such as leaf color, lesion color, lesion shape and size can all reflect the category and degree of crop diseases. The traditional method for judging tomato leaf diseases is mainly manual identification. However, the causes of tomato diseases are complex and there are many types, making the identification difficult. The traditional method has obvious disadvantages such as being too subjective, lacking accuracy, being affected by experience, and consuming a lot of manpower. Therefore, the traditional disease identification method is not suitable for large-scale farming in modern agriculture and is only applicable to traditional small-scale planting.
[0003] For this reason, in recent years, many researchers have carried out research on applying deep learning technology to the identification of plant diseases and pests. However, in the actual field production situation, the background of tomato leaves is usually complex and may be accompanied by various different situations, resulting in a decline in the quality of the collected images. In this case, traditional convolutional neural networks usually cannot identify the images well.
[0004] Although in the traditional convolutional neural network, the recognition model based on the YOLOv8 network for tomato leaf disease identification shows excellent adaptability; however, the existing recognition models based on the YOLOv8 network still generally have the following defects: due to the differences in object size, distance, occlusion and lighting conditions, it is difficult for traditional recognition models to accurately identify all targets, affecting the detection results. And the traditional centralized feature pyramid technology has the problem of limited receptive field, which is likely to have an adverse effect on the detection results.
[0005] Based on this, those skilled in the art urgently need to improve the above-mentioned existing method for tomato leaf disease identification based on the YOLOv8 network to overcome the problems existing in the above-mentioned prior art. Summary of the Invention
[0006] Therefore, the technical problem to be solved by the present invention is to overcome the defects existing in the above-mentioned prior art, so as to provide a tomato leaf disease identification method, system, device and storage medium.
[0007] A tomato leaf disease identification method includes: Performing an initial improvement on the basic YOLOv8n network architecture: introducing the SPD-Conv attention mechanism into the backbone network to obtain the SPD-YOLOv8n network; The second improvement to the SPD-YOLOv8n network results in the SE-YOLOv8n network: a visual centering module is introduced into the neck network of the SPD-YOLOv8n network; the visual centering module is connected through the upsampling layer of the fourteenth layer and the spatial pyramid pooling layer of the backbone network to achieve global statistical distribution modeling of the input feature map; The third improvement to the SE-YOLOv8n network results in the SEB-YOLOv8n network: a double-layer routing attention layer is introduced into the neck network of the SE-YOLOv8n network; the input end of the double-layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double-layer routing attention layer is connected to the Conv layer of the twenty-second layer; Based on the SEB-YOLOv8n network, a tomato disease recognition model is pre-constructed and trained based on the pre-acquired training dataset until the target recognition model is obtained; Obtain the image to be recognized, input the image to be recognized into the target recognition model, and the target recognition model outputs the recognition result of tomato leaf diseases.
[0008] Preferably, the backbone network structure of the SEB-YOLOv8n network contains a total of fourteen layers; One output end of the SPPF layer of the thirteenth layer is connected to the upsampling layer of the fourteenth layer of the neck network; The other output end of the SPPF layer of the thirteenth layer is connected to the Concat layer of the twenty-sixth layer of the neck network.
[0009] Preferably, the neck network of the SEB-YOLOv8n network contains a total of fourteen layers, specifically the fourteenth to twenty-seventh layers in the overall network architecture; Among them, there are a total of four sets of Concat layer - C2f layer structures in the neck network of the SEB-YOLOv8n network; One input end of the first set of Concat layer - C2f layer structure is connected to the visual centering module, and the other input end is connected to the C2f layer of the ninth layer in the backbone network of the SEB-YOLOv8n network; One input end of the second set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure through the upsampling layer of the eighteenth layer, and the other input end is connected to the C2f layer of the sixth layer in the backbone network of the SEB-YOLOv8n network; One input end of the third set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure, and the other input end is connected to the output end of the second set of Concat layer - C2f layer structure through the double-layer routing attention layer and the Conv layer of the twenty-second layer; One input end of the fourth Concat layer - C2f layer structure is connected to the SPPF layer of the backbone network of the SEB - YOLOv8n network, and the other end is connected to the output end of the third Concat layer - C2f layer structure through the Conv layer of the twenty - fifth layer.
[0010] Preferably, the C2f layers in the second Concat layer - C2f layer structure, the third Concat layer - C2f layer structure, and the fourth Concat layer - C2f layer structure are respectively connected to three Detect layers in the detection head module.
[0011] Preferably, the training dataset is obtained by mixing tomato leaf disease images under laboratory conditions and tomato leaf disease images under field environment and adding noise.
[0012] Preferably, the recognition types of the target recognition model include: healthy leaves, Septoria leaf spot, yellow leaf curl disease, and leaf mold.
[0013] Preferably, the training parameters of the tomato disease recognition model are: image input size 640×640 pixels; the number of training epochs is 100; the initial learning rate is 0.01; the iou threshold is set to 0.7, the momentum is set to 0.937, the weight decay is 0.0005, and the batch size is 12 batches.
[0014] A tomato leaf disease recognition system includes: a collection module, a target recognition module, a model optimization module, and a model construction module; Among them, in the model optimization module: Make an initial improvement to the basic YOLOv8n network architecture: introduce the SPD - Conv attention mechanism in the backbone network to obtain the SPD - YOLOv8n network; Make a second improvement to the SPD - YOLOv8n network to obtain the SE - YOLOv8n network: introduce a visual centering module in the neck network of the SPD - YOLOv8n network; the visual centering module is connected to the spatial pyramid pooling layer of the backbone network through the upsampling layer of the fourteenth layer to realize global statistical distribution modeling of the input feature map; Make a third improvement to the SE - YOLOv8n network to obtain the SEB - YOLOv8n network: introduce a double - layer routing attention layer in the neck network of the SE - YOLOv8n network; the input end of the double - layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double - layer routing attention layer is connected to the Conv layer of the twenty - second layer; The model construction module: pre - construct a tomato disease recognition model based on the SEB - YOLOv8n network and train it based on the pre - obtained training dataset until the target recognition model is obtained; The acquisition module obtains the image to be recognized and inputs the image to be recognized into the target recognition model of the target recognition module, and the target recognition module outputs the recognition result of tomato leaf diseases.
[0015] A tomato leaf disease detection device, which includes: a memory, a processor, and a tomato leaf disease detection program stored on the memory and running on the processor. The tomato leaf disease detection program is configured to implement a tomato leaf disease recognition method.
[0016] A storage medium stores a tomato leaf disease detection program, and when the tomato leaf disease detection program is executed by a processor, it implements a tomato leaf disease recognition method.
[0017] The technical solution of the present invention has the following advantages: In this embodiment, a target recognition model based on the improved SEB-YOLOv8n network is proposed to detect the situation of tomato diseases. In this embodiment, a spatial-to-depth SPD-Conv attention mechanism is added, specifically an SPD layer + Conv layer, which reduces the loss of fine-grained features of the target and enhances the recognition ability for low-resolution tomato leaf images; by introducing an explicit visual center, specifically a visual centering module, it strengthens the detection ability for specific details of the target image, such as tomato leaf diseases in a certain corner; by introducing a new type of general visual transformer: a double-layer routing attention layer, it realizes more flexible calculation allocation and content awareness, and improves the detection accuracy. Description of the Drawings
[0018] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0019] Figure 1 It is the flowchart of a tomato leaf disease recognition method of the present invention; Figure 2 It is a schematic diagram of the change trend of the loss value of bounding box regression during the training process of the present invention; Figure 3 It is a schematic diagram of the change trend of the loss value of target detection during the training process of the present invention; Figure 4 It is a schematic diagram of the change trend of the loss value of classification during the training process of the present invention; Figure 5 It is a schematic diagram of the change trend of the precision rate of the present invention; Figure 6Schematic diagram of the recall rate change trend of the present invention; Figure 7 Schematic diagram of the change trend of the loss value of bounding box regression during the verification process of the present invention; Figure 8 Schematic diagram of the change trend of the loss value of object detection during the verification process of the present invention; Figure 9 Schematic diagram of the change trend of the loss value of classification during the verification process of the present invention; Figure 10 Performance change trend diagram of the present invention with mAP of 50%; Figure 11 Performance change trend diagram of the present invention with mAP from 50% to 95%. Detailed implementation mode
[0020] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0021] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the accompanying drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0022] In the description of the present invention, it should be noted that unless otherwise clearly defined and limited, the terms "installation", "connection", "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0023] In addition, the technical features involved in different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0024] Embodiment 1 This embodiment discloses a method for identifying tomato leaf diseases as Figure 1 , including: Initial improvement to the basic YOLOv8n network architecture: Introduce the SPD-Conv attention mechanism into the backbone network to obtain the SPD-YOLOv8n network; Second improvement to the SPD-YOLOv8n network to obtain the SE-YOLOv8n network: Introduce a visual centering module into the neck network of the SPD-YOLOv8n network; The visual centering module is connected through the upsampling layer of the fourteenth layer and the spatial pyramid pooling layer of the backbone network to achieve global statistical distribution modeling of the input feature map; Third improvement to the SE-YOLOv8n network to obtain the SEB-YOLOv8n network: Introduce a double-layer routing attention layer into the neck network of the SE-YOLOv8n network; The input end of the double-layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double-layer routing attention layer is connected to the Conv layer of the twenty-second layer; Pre-construct a tomato disease recognition model based on the SEB-YOLOv8n network and train it based on the pre-obtained training dataset until the target recognition model is obtained; Obtain the image to be recognized, input the image to be recognized into the target recognition model, and the target recognition model outputs the recognition result of tomato leaf diseases.
[0025] Specifically: 1) Construct the backbone network of the SEB-YOLOv8n network: In this embodiment, the backbone network structure of the SEB-YOLOv8n network after three improvements contains a total of fourteen layers, numbered from zero to thirteen. The layers from the zeroth layer to the thirteenth layer are: Conv layer, Conv layer, SPD layer, C2f layer, Conv layer, SPD layer, C2f layer, Conv layer, SPD layer, C2f layer, Conv layer, SPD layer, C2f layer, SPPF layer; Among them, one output end of the SPPF layer of the thirteenth layer is connected to the upsampling layer of the fourteenth layer of the neck network; The other output end of the SPPF layer of the thirteenth layer is connected to the Concat layer of the twenty-sixth layer of the neck network.
[0026] The neck network of the SEB-YOLOv8n network contains a total of fourteen layers, specifically the fourteenth to twenty-seventh layers in the overall network architecture; Among them, there are a total of four sets of Concat layer - C2f layer structures in the neck network of the SEB-YOLOv8n network; One input end of the first set of Concat layer - C2f layer structure is connected to the visual centering module, and the other input end is connected to the C2f layer of the ninth layer in the backbone network of the SEB-YOLOv8n network; One input end of the second set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure through the upsampling layer of the eighteenth layer, and the other input end is connected to the C2f layer of the sixth layer in the backbone network of the SEB - YOLOv8n network; One input end of the third set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure, and the other input end is connected to the output end of the second set of Concat layer - C2f layer structure through the double - layer routing attention layer and the Conv layer of the twenty - second layer; One input end of the fourth set of Concat layer - C2f layer structure is connected to the SPPF layer of the backbone network of the SEB - YOLOv8n network, and the other end is connected to the output end of the third set of Concat layer - C2f layer structure through the Conv layer of the twenty - fifth layer.
[0027] The C2f layers in the second set of Concat layer - C2f layer structure, the third set of Concat layer - C2f layer structure, and the fourth set of Concat layer - C2f layer structure are respectively connected to three Detect layers in the detection head module.
[0028] It should be noted that the traditional YOLOv8n network is mainly composed of three parts: the Backbone backbone network, the Neck neck network, and the Head detection head module. The Backbone backbone network mainly includes the CBS module, the C2f layer, and the SPPF layer. Among them, the C2f layer uses the Split operation and skip - layer connection to ensure that YOLOv8n obtains richer gradient flow information on the basis of lightweight design. The Neck neck network part draws on the design ideas of the FPN architecture and the PAN architecture to transfer the feature map information of the deep and shallow layers, realize multi - scale feature fusion, and enhance the expression ability of the model. The Head detection head module part uses the decoupled head structure to extract the position information and category information of the target respectively, and learns through different network branches, thus improving the accuracy of the model.
[0029] Regarding the SPD - Conv attention mechanism, the explicit visual center, and the general vision transformer: SPD - Conv attention mechanism: The SPD - Conv attention mechanism is composed of the SPD layer from space to depth and the Conv layer without cross - row convolution.
[0030] The SPD layer is a conversion layer that transforms the spatial dimension of the input image into the depth dimension, thereby avoiding the information loss caused by using strided convolution and pooling operations in traditional methods. The combination of the SPD layer and non-strided convolution can extract features without reducing the size of the feature map, effectively retaining the fine-grained information of the image. This structure is crucial for improving the recognition performance of low-resolution images because low-resolution images originally lack detailed information, and the SPD-Conv structure can effectively avoid information loss, thereby improving the recognition accuracy.
[0031] Explicit visual center: In this embodiment, it is specifically the visual centering module; The visual centering module focuses on capturing and emphasizing the key regions in the image, especially those local corner regions that are crucial for object detection. By combining the visual centering module, the overall model can not only understand the global information of the image but also pay attention to local details, such as the corner features of tomato diseases. This effectively makes up for the key information that may be ignored by traditional CNN models due to the limitation of the receptive field, thereby improving the overall performance of object detection.
[0032] General vision transformer: In this embodiment, it is specifically the double-layer routing attention layer, abbreviated as BiFormer in English; The double-layer routing attention layer realizes more flexible computing power allocation through the double-layer routing mechanism, thereby improving the efficiency and performance of the overall model. The double-layer routing mechanism of the double-layer routing attention layer is responsible for the extraction of global and local features respectively. The upper router interacts with all image patches through the global self-attention mechanism to generate a global image representation; while the lower router uses the local self-attention mechanism to interact with each image patch and its adjacent patches to generate a local image representation. This double-layer routing mechanism can adaptively focus on a small number of relevant tokens according to the query information, thereby achieving more flexible computing allocation and content awareness.
[0033] 2) Training of the tomato disease recognition model: Establishment of the training dataset: It should be noted that the training dataset is obtained by mixing tomato leaf disease images under laboratory conditions and tomato leaf disease images in the field environment and adding noise. Specifically: In this experiment, the publicly available dataset PlantVillage and network images were used. A total of 800 tomato leaf disease images in the field environment were constructed as the original dataset. The images in the original dataset were divided into four categories, namely healthy, Septoria leaf spot, Tomato yellow leaf curl virus (TYLCV), and leaf mold, which were used as the recognition types for the target recognition model. The original dataset was enhanced using image enhancement methods. By adding salt-and-pepper noise, the richness of the dataset was increased, and at the same time, the generalization and robustness of the target recognition model were strengthened. Finally, the original dataset was divided into a training dataset, a test dataset, and a validation dataset according to the ratio of 7:2:1. All image pixels in the original dataset were uniformly set to 640×640. Finally, 3360 training images, 960 test images, and 480 validation images were obtained. All images were annotated using LabelImg to form the original dataset.
[0034] Training and testing: The labeled images in the training dataset were input into the SEB-YOLOv8n network for training. First, feature extraction was mainly performed by the backbone network of the SEB-YOLOv8n network. Then, the neck network of the SEB-YOLOv8n network fused the multi-scale features output by the backbone network of the SEB-YOLOv8n network to enhance the overall model's detection ability for multi-scale targets. Then, the detection head module generated candidate prediction boxes for abnormal types. According to the loss function, the candidate prediction boxes were continuously optimized, and the overall model was trained to obtain weights closer to the labels. The loss function of the present invention is the same as that of the basic Yolov8n network, mainly including localization loss and classification loss. In the localization loss part, the CIoU strategy is mainly adopted. After constraining the center distance, aspect ratio, etc. of the bounding box, parameters such as the overlapping area and intersection over union (IoU) between the prediction box and the ground truth box are measured, and the corresponding matching degree is obtained.
[0035] The training parameters of the tomato disease recognition model are as follows: the image input size is 640×640 pixels; the number of training epochs is 100; the initial learning rate is 0.01; the IoU threshold is set to 0.7, the momentum is set to 0.937, the weight decay is 0.0005, and the batch size is 12 batches. As Figure 2 - 11 can be seen, the training loss value, recall rate, and detection accuracy of the overall model change with the continuous accumulation of the number of iterations during the training process. The training loss value begins to gradually converge from the 30th epoch. The detection accuracy has a relatively large increase at the beginning, the rising speed slows down at the 10th epoch, and tends to be stable after the 50th epoch. It can be seen that the target recognition model based on the SEB-YOLOv8n network does not have the problems of overfitting and gradient disappearance and can be applied to the detection of tomato diseases. Figure 2 It is a schematic diagram of the change trend of the loss value of bounding box regression during the training process; Figure 3Schematic diagram of the change trend of the loss value of object detection during the training process; Figure 4 Schematic diagram of the change trend of the loss value of classification during the training process; Figure 5 Schematic diagram of the change trend of precision; Figure 6 Schematic diagram of the change trend of recall; Figure 7 Schematic diagram of the change trend of the loss value of bounding box regression during the validation process; Figure 8 Schematic diagram of the change trend of the loss value of object detection during the validation process; Figure 9 Schematic diagram of the change trend of the loss value of classification during the validation process; Figure 10 Performance change trend diagram with mAP of 50%; Figure 11 Performance change trend diagram with mAP from 50% to 95%.
[0036] Experiment: In this experiment, the server running environment used is the Pytorch deep learning framework and the Windows 11 Home Chinese Edition system. The processor is the 13th Gen Intel (R) Core (TM) i7-13700kf 3.40GHz, the GPU is NVIDIA GeForce RTX 4080 SUPER, the running memory is 64GB, CUDA 12.3, OpenCV and other relevant existing libraries are used according to the actual situation to implement the training of the object recognition model.
[0037] Evaluation metrics: In this experiment, the main metrics of the object recognition model for detection are precision: Presion, recall: Recall, and mean average precision: mAP. The calculation formulas are as follows: ; ; ; ; Among them, TP represents the correctly detected bounding box, specifically that the predicted bounding box correctly matches the label bounding box; FP represents the misdetected bounding box, specifically that the background is predicted as an object; FN represents the missed detected bounding box, specifically the result that needs to be detected by the object recognition model but is not detected by the object recognition model. mAP is used to evaluate the quality of a model, specifically the average precision of multiple classes, AP refers to the detection precision of a class; Precision(R): the Precision value at a given Recall value R; N represents the total number of classes.
[0038] Comparison experiment: To verify the detection performance of the proposed SEB-YOLOv8n network of the present invention, experiments were carried out under the same test set and compared with four other mainstream object detection algorithms. The results are shown in Table 1. The proposed SEB-YOLOv8n network of the present invention achieved the best results in the metrics of mAP50% and mAP50%~95%, reaching 94.80% and 72.00 respectively, which are significantly higher than other traditional models. In terms of the metrics of precision and recall, it is also close to the optimal, and at the same time, it does not increase the number of parameters of the overall model too much.
[0039] Table 1 Comparison results of common models
[0040] 1. Ablation experiment After adding the SPD-Conv attention mechanism at the first improvement point, the accuracy rate increased by 0.9% compared with the traditional YOLOv8 network-based model, the recall rate increased by 4.4%, mAP50 increased by 5.4%, mAP50%95% increased by 3.6%, and the number of parameters only increased by 0.26M; after fusing the explicit visual center technology at the second improvement point, the accuracy rate increased by 3.4% compared with the traditional YOLOv8 network-based model, the recall rate increased by 8.7%, mAP50 increased by 6.7%, mAP50%~95% increased by 5.2%, and the number of parameters increased by 3.32M; after the third improvement point of the general vision transformer, the accuracy rate increased by 1.3% compared with the traditional YOLOv8 network-based model, the recall rate increased by 7.5%, mAP50 increased by 6.1%, mAP50%~95% increased by 3.8%, and the number of parameters increased by 0.02M. It can be seen that all three improvement points improved the basic performance of the model without increasing the number of parameters of the model too much, and the second and third improvement points increased the number of parameters of the basic model especially little. Based on this, the improvement points were combined in pairs to observe their influence on the results, and it can be seen that all indicators after pairwise mixing improved compared with the original model. Finally, when the three were combined together, the accuracy rate increased by 4.4% compared with the original model, the recall rate increased by 11.7%, mAP50 and mAP50-95 increased by 9.2% and 8.1% respectively, and the number of parameters increased by 3.57M compared with the original model. Without increasing the model complexity, the model performance was improved. The results are shown in Table 2.
[0041] Table 2 Ablation experiment results
[0042] Example 2 This embodiment discloses a tomato leaf disease recognition system, including: a collection module, an object recognition module, a model optimization module, and a model construction module; Among them, in the model optimization module: Initial improvement of the basic YOLOv8n network architecture: Introduce the SPD-Conv attention mechanism into the backbone network to obtain the SPD-YOLOv8n network; The second improvement of the SPD-YOLOv8n network to obtain the SE-YOLOv8n network: Introduce a visual centering module into the neck network of the SPD-YOLOv8n network; The visual centering module is connected through the upsampling layer of the fourteenth layer and the spatial pyramid pooling layer of the backbone network to realize the global statistical distribution modeling of the input feature map; The third improvement of the SE-YOLOv8n network to obtain the SEB-YOLOv8n network: Introduce a double-layer routing attention layer into the neck network of the SE-YOLOv8n network; The input end of the double-layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double-layer routing attention layer is connected to the Conv layer of the twenty-second layer; Model construction module: Pre-build a tomato disease recognition model based on the SEB-YOLOv8n network and train it based on the pre-obtained training data set until the target recognition model is obtained; The acquisition module acquires the image to be recognized and inputs the image to be recognized into the target recognition model of the target recognition module, and the target recognition module outputs the recognition result of the tomato leaf disease.
[0043] Example 3 A tomato leaf disease detection device, which includes: a memory, a processor, and a tomato leaf disease detection program stored on the memory and running on the processor. The tomato leaf disease detection program is configured to implement a tomato leaf disease recognition method according to Example 1.
[0044] Example 4 A storage medium stores a tomato leaf disease detection program. When the tomato leaf disease detection program is executed by a processor, it implements a tomato leaf disease recognition method according to Example 1.
[0045] Obviously, the above examples are only for clear illustration and not a limitation of the implementation. For those of ordinary skill in the art, other different forms of changes or variations can be made based on the above description. It is not necessary and impossible to list all the implementation manners here. And the obvious changes or variations derived therefrom are still within the protection scope of the present invention.
Claims
1. A method for identifying tomato leaf diseases, characterized in that, Including: Initial improvement to the basic YOLOv8n network architecture: Introduce the SPD-Conv attention mechanism into the backbone network to obtain the SPD-YOLOv8n network; Second improvement to the SPD-YOLOv8n network to obtain the SE-YOLOv8n network: Introduce a visual centering module into the neck network of the SPD-YOLOv8n network; The visual centering module is connected through the upsampling layer of the fourteenth layer and the spatial pyramid pooling layer of the backbone network to realize global statistical distribution modeling of the input feature map; Third improvement to the SE-YOLOv8n network to obtain the SEB-YOLOv8n network: Introduce a double-layer routing attention layer into the neck network of the SE-YOLOv8n network; The input end of the double-layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double-layer routing attention layer is connected to the Conv layer of the twenty-second layer; Pre-build a tomato disease recognition model based on the SEB-YOLOv8n network and train it based on the pre-acquired training dataset until the target recognition model is obtained; Obtain the image to be recognized, input the image to be recognized into the target recognition model, and the target recognition model outputs the recognition result of tomato leaf diseases.
2. The tomato leaf disease recognition method according to claim 1, wherein The backbone network structure of the SEB-YOLOv8n network contains a total of fourteen layers; Among them, one output end of the SPPF layer of the thirteenth layer is connected to the upsampling layer of the fourteenth layer of the neck network; The other output end of the SPPF layer of the thirteenth layer is connected to the Concat layer of the twenty-sixth layer of the neck network.
3. A tomato leaf disease recognition method according to claim 1, characterized in that, The neck network of the SEB-YOLOv8n network contains a total of fourteen layers, specifically the fourteenth to twenty-seventh layers in the overall network architecture; Among them, there are a total of four sets of Concat layer - C2f layer structures in the neck network of the SEB-YOLOv8n network; One input end of the first set of Concat layer - C2f layer structure is connected to the visual centering module, and the other input end is connected to the C2f layer of the ninth layer in the backbone network of the SEB-YOLOv8n network; One input end of the second set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure through the upsampling layer of the eighteenth layer, and the other input end is connected to the C2f layer of the sixth layer in the backbone network of the SEB-YOLOv8n network; One input end of the third set of Concat layer - C2f layer structure is connected to the output end of the first set of Concat layer - C2f layer structure, and the other input end is connected to the output end of the second set of Concat layer - C2f layer structure through the double-layer routing attention layer and the Conv layer of the twenty-second layer; One input end of the fourth set of Concat layer - C2f layer structure is connected to the SPPF layer of the backbone network of the SEB-YOLOv8n network, and the other end is connected to the output end of the third set of Concat layer - C2f layer structure through the Conv layer of the twenty-fifth layer.
4. The tomato leaf disease recognition method according to claim 3, characterized in that The C2f layers in the second Concat layer - C2f layer structure, the third Concat layer - C2f layer structure, and the fourth Concat layer - C2f layer structure are respectively connected to the three Detect layers in the detection head module.
5. A tomato leaf disease recognition method according to claim 1, characterized in that The training dataset is obtained by mixing tomato leaf disease images under laboratory conditions and tomato leaf disease images under field environment and adding noise.
6. The tomato leaf disease recognition method according to claim 1, characterized in that The recognition types of the target recognition model include: healthy leaves, Septoria leaf spot, yellow leaf curl disease, and leaf mold.
7. A tomato leaf disease recognition method according to claim 1, characterized in that The training parameters of the tomato disease recognition model are: image input size 640×640 pixels; the number of training epochs is 100; the initial learning rate is 0.01; the iou threshold is set to 0.7, the momentum is set to 0.937, the weight decay is 0.0005, and the batch size is 12 batches.
8. A tomato leaf disease recognition system, characterized in that, Including: An acquisition module, a target recognition module, a model optimization module, and a model construction module; Among them, in the model optimization module: Perform an initial improvement on the basic YOLOv8n network architecture: introduce the SPD-Conv attention mechanism in the backbone network to obtain the SPD-YOLOv8n network; Perform a second improvement on the SPD-YOLOv8n network to obtain the SE-YOLOv8n network: introduce a visual centering module in the neck network of the SPD-YOLOv8n network; the visual centering module is connected to the spatial pyramid pooling layer of the backbone network through the upsampling layer of the fourteenth layer to realize global statistical distribution modeling of the input feature map; Perform a third improvement on the SE-YOLOv8n network to obtain the SEB-YOLOv8n network: introduce a double-layer routing attention layer in the neck network of the SE-YOLOv8n network; the input end of the double-layer routing attention layer is connected to the C2f layer of the twentieth layer, and the output end of the double-layer routing attention layer is connected to the Conv layer of the twenty-second layer; Model construction module: pre-construct a tomato disease recognition model based on the SEB-YOLOv8n network and train it based on the pre-obtained training dataset until the target recognition model is obtained; The acquisition module obtains the image to be recognized, inputs the image to be recognized into the target recognition model of the target recognition module, and the target recognition module outputs the recognition result of tomato leaf diseases.
9. A tomato leaf disease detection device, characterized in that, The tomato leaf disease detection device includes: a memory, a processor, and a tomato leaf disease detection program stored on the memory and running on the processor, and the tomato leaf disease detection program is configured to implement a tomato leaf disease recognition method according to any one of claims 1 to 7.
10. A storage medium, characterized in that, A tomato leaf disease detection program is stored on the storage medium, and when the tomato leaf disease detection program is executed by the processor, it implements a tomato leaf disease recognition method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Tomato disease identification method based on improved YOLOV8
CN119251645A
Tomato leaf disease detection method based on SSP-DETR model
CN119785157A
Method for detecting maturity of greenhouse tomatoes based on improved YOLOv8n
CN120047938A