Tomato leaf disease detection method based on SSP-DETR model
By using the improved SSP-DETR model, the problem of low accuracy in tomato leaf disease detection under complex backgrounds was solved, and efficient and accurate disease identification was achieved by utilizing the StarNet network module and SIoU loss function.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGXI TEACHERS EDUCATION UNIV
- Filing Date
- 2024-12-16
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies struggle to accurately identify tomato leaf diseases, especially those with small spots and complex shapes, in complex environments, resulting in low detection accuracy and high costs.
A tomato leaf disease detection method based on the SSP-DETR model was adopted. Multi-layer feature extraction was performed through the StarNet network module, combined with the attention feature extraction module and the multi-scale fusion module, and the SIoU loss optimization model was used to achieve accurate detection of diseased areas.
It improves the accuracy and efficiency of disease detection in complex backgrounds, can accurately identify small targets and complex-shaped diseases, and reduces the complexity and number of parameters of the model.
Smart Images

Figure CN119785157B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition. More specifically, this invention relates to a method for detecting tomato leaf diseases based on the SSP-DETR model. Background Technology
[0002] In tomato cultivation, leaf diseases are one of the main factors affecting crop health and yield. Common tomato leaf diseases include bacterial spot, early blight, late blight, and leaf spot. These diseases not only cause symptoms such as spots, yellowing, and curling on the leaves, but also affect the growth of the entire plant, thereby reducing fruit yield and quality. Because the symptoms of these diseases can be very similar, such as small spots and slight color changes, it is difficult to achieve accurate early identification by visual observation in field or greenhouse cultivation. Once the disease spreads, control costs are high and the effect is poor. Therefore, timely and accurate detection of tomato leaf diseases is crucial for improving crop yield and ensuring quality.
[0003] In recent years, with the rapid development of artificial intelligence and computer vision technology, image recognition-based disease detection methods have gradually become a research hotspot. These methods can detect early diseases by analyzing image data of tomato leaves, helping growers to take timely prevention and control measures, thereby reducing economic losses.
[0004] The detection of defects becomes more complex due to factors such as occlusion, lighting, and shadows in complex backgrounds. Existing technologies, such as YOLO, while offering high real-time performance, have limited capabilities in handling complex backgrounds, and their detection is based on a fixed grid size, resulting in low accuracy for small targets. Summary of the Invention
[0005] One object of the present invention is to provide a method for detecting tomato leaf diseases based on the SSP-DETR model, so as to at least solve the above-mentioned problems.
[0006] To achieve the objectives and other advantages of this invention, a method for detecting tomato leaf diseases based on the SSP-DETR model is provided. The tomato leaf disease detection process is implemented using the SSP-DETR model, which is an improvement on the RT-DETR model. The SSP-DETR model includes a StarNet network module, an attention feature extraction module, a multi-scale fusion module, and a decoder. Specific steps include: S1, acquiring a dataset of tomato leaf disease images and classifying the diseased regions in the images; S2, inputting the tomato leaf disease images into the StarNet network module for multi-layer feature extraction, outputting four feature maps of different dimensions, from low to high dimensions. The steps are as follows: S2, P3, P4, P5; S3, input P5 into the attention feature extraction module for attention feature extraction, and output F5; S4, input P2, P3, P4, F5 into the multi-scale fusion module for multi-scale feature fusion; S5, input the feature map after multi-scale fusion into the decoder, and output the predicted bounding box of tomato leaf disease area; S6, obtain the predicted bounding box of tomato leaf disease area and the corresponding disease area classification in the tomato leaf disease image, calculate the total loss using classification loss, location loss, and SIoU loss, and backpropagate to optimize the model; S7, input the actual obtained tomato leaf disease image into the optimized SSP-DETR model to obtain the tomato leaf disease detection results.
[0007] Preferably, the StarNet network module includes a StemLayer layer and multiple stage layers; the StemLayer layer contains a ConvBN convolution and an activation function ReLU6, and the StemLayer layer is used to convert the number of channels of the tomato leaf disease image from 3 to 32; each stage layer includes a convolutional downsampling layer and a residual block, and the multiple stage layers are used to extract features from the 32-channel tomato leaf disease image layer by layer to generate feature maps of four different dimensions.
[0008] Preferably, the attention feature extraction module adopts the AIFI module in the RT-DETR model.
[0009] Preferably, the multi-scale fusion module (SOEP module) includes an SPDConv convolution, a CSPOmniKernel module, and multiple KanC3 modules. The SPDConv module is used to acquire the feature map of P2 and divide it into four small regions. Then, the four small regions are concatenated along the channel dimension to achieve downsampling and feature information enhancement. The CSPOmniKernel module is used to acquire the concatenated P2, P3, P4, and F5 feature maps along the channel dimension. First, the number of channels is adjusted by a 1×1 convolution. Then, the channels are separated proportionally. Some channels are input into the OmniKernel module to enhance the features. Finally, the output is merged and adjusted to enhance the ability to identify diseases at different scales. The KanC3 module introduces a KANs network architecture to replace the RepC3 module in the RT-DETR model. It is used to reconstruct the network parameters of the concatenated feature map along the channel dimension to reduce the number of parameters.
[0010] Furthermore, the OmniKernel module includes three branches. The first branch uses a 1×1 convolution with a stride of 1 and padding of 0 to independently adjust the features of each channel, enhancing the fine-grained feature representation within the channel without changing the spatial dimension. The second branch uses three depthwise convolutions: DW_13, DW_31, and DW_33, to capture features of different directions and sizes. The third branch includes FCA and SCA modules to enhance the global information representation capability of the feature map. Finally, the outputs of the three branches are concatenated along the channel dimension, processed by a ReLU activation function, and integrated by another 1×1 convolution to obtain the result.
[0011] Preferably, the total loss function L total =L cls +λ1L box +λ2L SIoU In the formula, L cls For classification loss, L box For position loss, L SIoU λ1 and λ2 are the weighting coefficients of the position loss and the SIoU loss, balancing the contributions of different losses.
[0012] Preferably, the tomato leaf diseases tested include bacterial spot, early blight, late blight, and leaf spot.
[0013] The present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method as described in any one of claims 1 to 7.
[0014] The present invention also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of claims 1 to 7.
[0015] The present invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, perform the method as described in any one of claims 1 to 7.
[0016] The present invention has at least the following beneficial effects:
[0017] The SSP-DETR model of this invention is an improvement on the RT-DETR model. It uses the StarNet network module as the backbone, replaces the CCFF module in the RT-DETR model with the SEOP module, replaces the RepC3 module with the KanC3 module, and replaces the GIoU loss with the SIoU loss. In the entire tomato leaf disease detection task, these modules work together to improve the ability to handle complex backgrounds, ensuring the efficiency and accuracy of the detection process. Specifically, the StarNet network module provides basic feature extraction, covering diseases from small to large; the AIFI and SOEP modules aggregate high and low resolution features and perform multi-scale fusion, improving the detection accuracy for lesions of different sizes; the SPDConv and CSPOmniKernel in the SOEP module enhance feature information through feature downsampling and multi-scale convolution, ensuring a balance between detection speed and accuracy; the addition of SIoU loss optimizes the shape matching of lesion edges, enabling the model to more accurately capture complex diseases; and the decoder decodes feature information into clear disease areas, ultimately achieving comprehensive detection of tomato leaf diseases.
[0018] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the overall structure of the SSP-DETR model of the present invention;
[0020] Figure 2 This is a schematic diagram of the SOEP module of the present invention;
[0021] Figure 3 This is a schematic diagram of the CSPOmniKernel module of the present invention;
[0022] Figure 4 This is a schematic diagram of the structure of the OmniKernel module of the present invention. Detailed Implementation
[0023] The present invention will now be described in further detail with reference to the embodiments and accompanying drawings, so that those skilled in the art can implement it based on the description.
[0024] It should be understood that terms such as “having,” “comprising,” and “including” as used herein do not exclude the presence or addition of one or more other elements or combinations thereof.
[0025] It should be noted that, unless otherwise specified, the experimental methods described in the following implementation plan are all conventional methods, and the reagents and materials described are all commercially available unless otherwise specified.
[0026] The training platform used in this example is Ubuntu 20.04 operating system, with an Intel(R) Core™ i7-10700F CPU @ 2.90GHz (8 cores, 16 threads) CPU and an NVIDIA GeForce RTX 3090 GPU with 24GB of video memory. The software environment primarily includes Python 3.9.10 and CUDA 12.1. The experimental data used is the Tomato Leaf Disease Computer Vision Project public dataset from the Roboflow official platform, divided into training and validation datasets in a 4:1 ratio.
[0027] Example 1: Methods for detecting leaf diseases in tomatoes
[0028] The detection process for tomato leaf diseases is implemented using the SSP-DETR network model. The SSP-DETR network model is an improvement upon the RT-DETR model, comprising a StarNet network module, an attention feature extraction module (AIFI module), a multi-scale fusion module (SEOP module), and a decoder. The overall structure of the SSP-DETR network model is as follows: Figure 1 As shown.
[0029] The specific steps include:
[0030] S1. Obtain a dataset of tomato leaf disease images and classify the diseased areas in the tomato leaf disease images.
[0031] Specifically, the tomato leaf disease image dataset is the Tomato Leaf Disease Computer Vision Project public dataset from the Roboflow official platform, divided into training and validation datasets in a 4:1 ratio. Tomato leaf diseases include bacterial spot, early blight, late blight, and leaf spot.
[0032] S2. Input the tomato leaf disease images into the StarNet network module for multi-layer feature extraction, and output four feature maps of different dimensions, namely P2, P3, P4 and P5 from low dimension to high dimension.
[0033] StarNet is a simple yet effective network architecture for extracting multi-scale features from input images. It uses stacked convolutional layers to form a star-shaped structure, obtaining feature maps from low to high dimensions. Features are extracted through convolutional layers of varying depths, outputting four feature maps of different dimensions: P2, P3, P4, and P5. P2 and P3 are high-resolution feature maps, primarily used for detecting sparse and small spots; P4 is a medium-resolution feature map, used for detecting large clusters of lesions on leaves; and P5 is a low-resolution feature map, used for detecting the condition of the entire leaf. In this way, StarNet can adapt to the detection needs of both small and large diseases, improving the comprehensiveness of detection.
[0034] Specifically, the StarNet network module includes a StemLayer layer and multiple stage layers.
[0035] The StemLayer layer typically contains a ConvBN convolution and a ReLU6 activation function. The ConvBN consists of a 3x3 convolution with a stride of 2, padding of 1, 3 input channels, and self.in_channel output, plus a batch normalization layer. The StemLayer layer changes the number of input image channels from 3 (RGB) to self.in_channel, resulting in 32 channels. The StemLayer layer extracts preliminary features from the input image, helping the model recognize and capture basic shape, edge, and texture information, providing richer feature representations for subsequent deeper networks.
[0036] Each stage layer consists of a convolutional downsampling layer and a residual block. The convolutional downsampling layer contains a 3x3 convolution with a stride of 2, padding of 1, input channels of self.in_channel, and output channels of embed_dim. This layer reduces the spatial dimensions (width and height) of the feature map while potentially increasing its expressive power. The residual block consists of two depthwise separable convolutional layers (DWConv) using ConvBN. These layers have an input and output dimension of dim, a convolution size of 7, a stride of 1, padding of 3, and a grouping number equal to the dimension. They also include batch normalization, three 1x1 convolutional layers (also using ConvBN, controlling the number of channels, but without batch normalization), a ReLU6 activation function to introduce non-linearity, enabling the network to learn and fit complex non-linear relationships, and a DropPath layer to randomly drop certain paths in the network. The stage layer first performs a downsampling operation on the input tensor. The downsampled tensor is then passed as input to the residual block, and the final output is the result processed by the residual block.
[0037] S3. Input P5 into the AIFI module for attention feature extraction and output F5.
[0038] The AIFI module focuses on processing high-level image features through a self-attention mechanism, thereby improving the model's performance in object detection and recognition while reducing unnecessary computational costs.
[0039] S4. Input P2, P3, P4, and F5 into the SEOP module for multi-scale feature fusion. The structure of the SEOP module is as follows: Figure 2 As shown.
[0040] Specifically, the SEOP module includes an SPDConv convolution, a CSPOmniKernel module, and multiple KanC3 modules, which are used to perform deep feature fusion between different channels of the P2, P3, P4, and F5 feature maps. This allows information from the feature maps at different resolutions to interact and be integrated, enhancing the expressive power of the features. This enables the model to effectively capture the detailed features of diseases at different scales, especially providing accurate responses to tiny spots on leaves and large lesion areas.
[0041] When performing multi-scale feature fusion, the SEOP module first receives the F5 feature map output by the AIFI module, upsamples the F5 feature map to adjust its tensor width and height, and convolves it with the P4 feature map to obtain the feature map. Figure 1The tensor is copied twice, one as a Q tensor. The other tensor is merged with the convolutional P4 feature map along the channel direction. The merged tensor is then processed by the KANC3 module and a convolutional module, and then copied twice more, one as an R tensor. The other tensor is upsampled to increase its width and height to match the P3 feature map. Figure 1 The P2 feature map is adjusted in width and height by SPDConv to match the P3 feature map. The three feature maps are then merged along the channel direction. The merged tensor enters the CSPOmniKernel module. In CSPOmniKernel, the tensor is first adjusted by convolution, dividing it into two parts along the channel direction at a 1:3 ratio. The part with fewer channels is processed by the OmniKernel module, while the part with more channels remains unchanged. Subsequently, the two tensors are merged and adjusted by convolution to have the same number of channels as the input. The output tensor is then processed by the KANC3 module and copied into two copies. One copy is directly input into the Decoder, and the other copy is merged with the R tensor through convolution. This copy is then processed by another KANC3 module to create two more copies of the tensor. One copy is directly input into the Decoder, and the other copy is merged with the Q tensor through convolution and then input into the Decoder via the KANC3 module.
[0042] The SPDConv module is used to acquire the feature map of P2 and divide it into four small regions (top left, top right, bottom left, and bottom right). These four regions are then concatenated along the channel dimension. This concatenation achieves downsampling and feature enhancement, providing a more compact feature representation for subsequent convolutional operations. The SPDConv module enhances feature extraction capabilities through special spatial rearrangement and convolution operations, while reducing resolution and improving computational efficiency. Specifically…
[0043] Y=Conv(concat(X[...,::2,::2],X[...,1::2,::2],X[...,::2,1::2],X[...,1::2,1::2]))
[0044] In the formula, x[...,::2,::2] and the other three parts represent small blocks taken from different positions of P2, respectively representing pixels extracted from the four regions of upper left, upper right, lower left, and lower right. X is the input tensor, and Y is the tensor after "stacking". After passing through the SPDConv module, the output tensor size is: (batch, channels*4, height / 2, width / 2), that is, the number of channels is 4 times that of the input tensor, and the height and width of the image are 1 / 2 of the input tensor.
[0045] The structure of the CSPOmniKernel module is as follows: Figure 3As shown, the CSPOmniKernel convolutional neural network module enhances multi-scale features through multi-scale convolution, frequency domain attention (FCA), and spatial attention (SCA), while reducing computational and memory consumption and improving network efficiency. CSPOmniKernel first adjusts the number of channels using a 1x1 convolution with a stride of 1 and zero padding. Then, it proportionally splits the input tensor into channels at a ratio of 0.25 and inputs this tensor into the OmniKernel module to enhance features. The tensor containing the remaining channels at a ratio of 0.75 (preserving the original features) is concatenated with the tensor processed by the OmniKernel along the channel dimension. Finally, a 1x1 convolution with a stride of 1 and zero padding is used to adjust the number of channels, ensuring that the number of input and output channels is the same. CSPOmniKernel enhances the ability to recognize diseases at different scales. When detecting diseases with complex shapes and distributions on leaves, CSPOmniKernel provides powerful feature enhancement capabilities, enabling the model to more accurately capture subtle features of different lesions while maintaining high computational efficiency.
[0046] The structure of OmniKernel is as follows: Figure 4 As shown, the algorithm comprises three branches, each capturing features at different scales to achieve multi-scale feature enhancement. The first branch (Local Branch) uses a 1×1 convolution with a stride of 1 and zero padding to independently adjust the features of each channel, enhancing fine-grained feature representation within each channel without altering the spatial dimension. This is suitable for extracting local information and detecting small, sparse lesions. The second branch (Large Branch) uses three depthwise convolutions: DW_13, DW_31, and DW_33, capturing features of different directions and sizes. This is suitable for extracting wide-area feature information, especially for modeling the overall contour of larger lesions. The third branch (Global Branch) includes FCA and SCA modules to enhance the global information representation capability of the feature map, suitable for detecting unevenly distributed or complex-shaped lesions. Finally, the outputs of the three branches are concatenated along the channel dimension, processed through a ReLU activation function, and integrated using another 1×1 convolution to obtain the final result. Specifically…
[0047] The DW_13 convolution has a size of 1×31, meaning it captures long-range features only in the horizontal (width) direction, while the kernel size in the vertical direction is 1. It is padded with 15 in the width direction to ensure the output width matches the input. DW_13 focuses on capturing long-range features in the horizontal direction, helping the model acquire contextual information in the width direction. The DW_31 convolution has a size of 31×1, meaning it captures long-range features only in the vertical (height) direction, while the kernel size in the horizontal direction is 1. It is padded with 15 in the height direction to ensure the output height matches the input. DW_31 focuses on capturing long-range features in the vertical direction, helping the model acquire contextual information in the height direction. The DW_33 convolution has a size of 31×31, providing a large receptive field in both the width and height directions. It is padded with 15 to maintain consistent spatial dimensions between the input and output. DW_33 can capture a wide range of contextual information in space, acquiring more global spatial features. FCA is mainly based on a frequency domain attention mechanism, using the frequency domain information of the input features to adjust the weights of the feature channels, applying AdaptiveAvgPool2 to the input features. The first step, SCA, is to perform an AdaptiveAvgPool2d operation on the input features to obtain global channel statistics. Then, a 1×1 convolution (fac_conv) generates channel attention weights. A 2D Fourier transform is applied to the input feature *out* to convert it to the frequency domain. The generated channel weights *x_att* are then applied to the frequency domain features to emphasize or suppress specific channels. The adjusted frequency domain features are then returned to the spatial domain via an inverse Fourier transform, and their amplitudes are taken to obtain the enhanced features. The second step, SCA, first performs an AdaptiveAvgPool2d operation on the input features to obtain global spatial statistics. Then, a 1×1 convolution (conv) generates weights for each channel. The generated weights *x_att* are applied to the input feature *x_fca*, thus weighting the features of each channel. The SCA result is further processed by the FGM module (a frequency-domain-based convolution mechanism) to further enhance the features. FGM achieves feature enhancement under frequency domain guidance. First, a Fourier transform is performed on feature *x2*, then the transformed feature is multiplied element-wise with *x1*. Finally, an inverse Fourier transform is performed to return it to the spatial domain, completing the adjustment of the input features.
[0048] The KanC3 module introduces the KANs network architecture to replace the RepC3 module in the RT-DETR model. This module uses spline functions to parameterize the activation function, reducing the dependence on linear weights, thereby reducing the number of model parameters and improving the overall efficiency of model training and inference.
[0049] S5. Input the feature map after multi-scale fusion into the Decoder layer to output the predicted bounding box of tomato leaf disease area.
[0050] The decoder layer uses the existing decoder layer in the RT-DETR model, which will not be elaborated here.
[0051] S6. Obtain the predicted bounding boxes of diseased areas on tomato leaves and the corresponding diseased area classifications (ground truth boxes) in the tomato leaf disease images. Calculate the total loss using classification loss, location loss, and SIoU loss, and then backpropagate to optimize the model.
[0052] Specifically, the total loss function L total =L cls +λ1L box +λ2L SIoU In the formula, L cls For classification loss, L box For position loss, L SIoU For SIoU loss, λ1 and λ2 are weighting coefficients for position loss and SIoU loss, balancing the contributions of different losses; SIoU loss L SIoU =1-IoU+distance shape +0.5×Ω shape In the formula, IoU (Intersection over Union) is the intersection-over-union ratio of the predicted bounding box and the ground truth bounding box, measuring the proportion of their overlapping area, and distance... shape For shape distance, the distance between the center points of the predicted bounding box and the ground truth bounding box is considered, and a weighted calculation is performed based on the shape of the ground truth bounding box. Ω shape The shape difference term measures the degree of difference between the predicted bounding box and the ground truth bounding box in width and height.
[0053] SIoU loss is used to replace GIoU loss in the RT-DETR model for shape matching in object detection. SIoU not only considers the overlapping area but also incorporates the shape and scale factors of the bounding box itself, enabling better matching of irregularly shaped targets. SLoU optimizes the accuracy of lesion edges and shapes, effectively reducing matching errors caused by irregular shapes or complex boundaries, allowing the model to maintain good geometric shape and boundary predictions even with high IoU. In tomato leaf disease detection, SIoU helps the model better handle disease areas with complex boundaries, making the predicted bounding box more closely match the actual shape of the lesion, thus improving the overall detection accuracy and robustness.
[0054] S7. Input the actual obtained tomato leaf disease images into the optimized SSP-DETR model to obtain the tomato leaf disease detection results.
[0055] To further demonstrate the effectiveness of this method, related ablation experiments were conducted. A is the RT-DETR model, B uses the KanC3 module based on model A, C uses the Starnet network module for the backbone based on model A, D uses the SOEP module based on model A, and E is the SSP-DETR model.
[0056] As shown in Table 1, using the KanC3 and Starnet modules significantly reduces the training parameters and computational complexity of the model, and also partially improves mAP50. Using the SOEP module improves mAP50 by 2.0% and reduces the number of model parameters by 51.61%. Compared to RT-DETR, SSP-DETR reduces the number of model parameters by 54.35%, reduces model complexity by 72.38%, and improves mAP50 by 2.2%. This further demonstrates that the SOEP and Starnet modules are effective at extracting and fusing small target features, while the KanC3 module effectively reduces the overall network parameter count and model complexity.
[0057] Table 1: Ablation experiments of SSP-DETR
[0058]
[0059] Meanwhile, Table 2 compares the proposed SSP-DETR with the current mainstream one-stage, two-stage, and DETR-based object detection networks.
[0060] Compared to the YOLOv5-L / YOLOv8-L / YOLOv10-L series, the SSP-DETR shows mAP50 improvements of 2.4%, 0.8%, and 1.1%, respectively, while reducing the number of network parameters by 57.83%, 55.21%, and 19.92%, respectively.
[0061] Table 2: Comparison Experiment of Mainstream Models
[0062]
[0063] Table 3 presents the differences between the SIoU (Shape-aware Intersection over Union) loss function and several commonly used loss functions. The SSP-DETR model uses GIoU (Generalized Intersection over Union) as the F model, the F model uses DIoU (Distance Intersection over Union) as the J model, the F model uses EIoU (Efficient Intersection over Union) as the H model, the F model uses CIoU (Polar Intersection over Union) as the I model, and the F model uses SIoU (Shape-aware Intersection over Union) as the G model.
[0064] Table 3: Comparison Experiment of Commonly Used Loss Functions
[0065]
[0066] Because tomato leaf lesions are typically small, traditional GIoU is not stable enough when handling small targets. Table 3 shows that SIoU is more suitable for detecting small targets in natural scenes. SIoU incorporates a shape-aware mechanism, resulting in good shape alignment, and is particularly suitable for detecting irregularly shaped lesions on tomato leaves.
[0067] Based on the characteristics of tomato leaf disease detection tasks, this invention proposes a lightweight, real-time object detection model, the SSP-DETR network model, for small object detection. Using the Starnet network module and an optimized SOEP network module improves the model's detection accuracy for small objects and reduces the number of network parameters. Experiments show that the SSP-DETR network is more suitable for detecting small objects compared to mainstream object detection networks.
[0068] The tomato leaf disease detection method proposed in this invention effectively addresses the shortcomings of existing technologies, such as high model complexity and low detection accuracy.
[0069] Furthermore, the present invention also provides an electronic device, which includes a processor (CPU / MCU / SOC) and a memory (ROM / RAM), such as a drone, a portable computer, or a smart camera. Specifically, the memory stores a computer program, and when the processor loads and executes the computer program, it implements all or part of the steps of the aforementioned tomato leaf disease detection method based on the SSP-DETR model.
[0070] The present invention also provides a computer-readable medium, which includes various media capable of storing program code, such as ROM, RAM, magnetic disk, or optical disk, wherein a computer program is stored, and when the computer program is loaded and executed by a processor, it implements all or part of the steps of the above-described method for detecting tomato leaf diseases based on the SSP-DETR model.
[0071] The present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements all or part of the steps of the above-described method for detecting tomato leaf diseases based on the SSP-DETR model.
[0072] The number of devices and processing scale described herein are for simplification of the invention. Applications, modifications, and variations of the tomato leaf disease detection method based on the SSP-DETR model of this invention will be readily apparent to those skilled in the art.
[0073] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.
Claims
1. A method for detecting tomato leaf diseases based on the SSP-DETR model, characterized in that, The detection process for tomato leaf diseases is implemented using the SSP-DETR model, which is an improvement on the RT-DETR model. The SSP-DETR model includes a StarNet network module, an attention feature extraction module, a multi-scale fusion module, and a decoder. Specific steps include: S1. Obtain a dataset of tomato leaf disease images and classify the diseased areas in the tomato leaf disease images. S2. Input the tomato leaf disease images into the StarNet network module for multi-layer feature extraction, and output four feature maps of different dimensions, from low dimension to high dimension, namely P2, P3, P4, and P5. S3. Input P5 into the attention feature extraction module to extract attention features, and output F5. S4. Input P2, P3, P4, and F5 into the multi-scale fusion module for multi-scale feature fusion; S5. Input the feature map after multi-scale fusion into the Decoder and output the predicted box of tomato leaf disease area. S6. Obtain the predicted bounding box of tomato leaf disease area and the corresponding disease area classification in the tomato leaf disease image. Calculate the total loss using classification loss, location loss and SIoU loss, and backpropagate to optimize the model. S7. Input the actual obtained tomato leaf disease images into the optimized SSP-DETR model to obtain the tomato leaf disease detection results. The multi-scale fusion module includes an SPDConv convolution, a CSPOmniKernel module, and multiple KanC3 modules. The SPDConv convolution is used to obtain the feature map of P2 and divide it into four small regions. Then, the four small regions are concatenated along the channel dimension to achieve downsampling and feature information enhancement. The CSPOmniKernel module is used to obtain the concatenated P2, P3, P4, and F5 feature maps along the channel dimension. First, the number of channels is adjusted through a 1×1 convolution. Then, the channels are separated proportionally, and some channels are input into the OmniKernel module to enhance the features. Finally, the output is merged and adjusted to enhance the ability to identify diseases at different scales. The KanC3 module introduces a KANs network architecture to replace the RepC3 module in the RT-DETR model. It is used to reconstruct the network parameters of the concatenated feature map along the channel dimension, reducing the number of parameters.
2. The method for detecting tomato leaf diseases based on the SSP-DETR model as described in claim 1, characterized in that, The StarNet network module includes a StemLayer layer and multiple stage layers. The StemLayer layer contains a ConvBN convolution and an activation function ReLU6. The StemLayer layer is used to convert the number of channels of the tomato leaf disease image from 3 to 32. Each stage layer includes a convolutional downsampling layer and a residual block. The multiple stage layers are used to extract features from the 32-channel tomato leaf disease image layer by layer to generate feature maps of four different dimensions.
3. The method for detecting tomato leaf diseases based on the SSP-DETR model as described in claim 1, characterized in that, The attention feature extraction module adopts the AIFI module in the RT-DETR model.
4. The method for detecting tomato leaf diseases based on the SSP-DETR model as described in claim 1, characterized in that, The OmniKernel module comprises three branches. The first branch uses a 1×1 convolution with a stride of 1 and padding of 0 to independently adjust the features of each channel, enhancing the fine-grained feature representation within the channel without changing the spatial dimension. The second branch uses three depthwise convolutions: DW_13, DW_31, and DW_33, to capture features of different directions and sizes. The third branch includes FCA and SCA modules to enhance the global information representation capability of the feature map. Finally, the outputs of the three branches are concatenated along the channel dimension, processed by a ReLU activation function, and integrated by another 1×1 convolution to obtain the result.
5. The method for detecting tomato leaf diseases based on the SSP-DETR model as described in claim 1, characterized in that, Total loss function L total = L cls +λ1 L box +λ2 L SIoU In the formula, L cls For classifying losses, L box For position loss, L SIoU The SIoU loss is represented by λ1 and λ2, which are the weighting coefficients of the position loss and SIoU loss, balancing the contributions of different losses.
6. The method for detecting tomato leaf diseases based on the SSP-DETR model as described in claim 1, characterized in that, The tomato leaf diseases tested included bacterial spot, early blight, late blight, and leaf spot.
7. An electronic device, characterized in that, include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method as described in any one of claims 1 to 6.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 6.
9. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it is performed according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for detecting plant diseases and insect pests of tomato leaves based on improved YOLOv5s
CN116994056A
Grape leaf disease detection method
CN118864401A