Tomato leaf disease detection method, device, equipment, storage medium and product
The video surveillance system collects tomato leaf pictures processed by the target tomato leaf disease detection model in real time, and uses characteristic pyramid structure and data enhancement technology for detection, solving the problem of low detection accuracy of small tomato leaf in the background of complex farmland, and achieving high accuracy and high efficiency disease detection.
Patent Information
- Application Number
- CN202411567713.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-03-11
AI Technical Summary
The detection accuracy and robustness of the prior art for small and densely distributed tomato leaves in the context of complex farmland still need to be improved, resulting in low accuracy of small target detection.
The video surveillance system collects tomato leaf pictures in real time and inputs them into the target tomato leaf disease detection model. The characteristic pyramid structure and data enhancement technology are used for target detection and disease characteristic recognition, and the disease category of tomato leaf to be detected is determined.
It significantly improves the accuracy and robustness of small-objective detection, realizes timely disease monitoring and diagnosis, and enhances the generalization ability and detection efficiency of the model.
Smart Images

Figure CN119600590A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to tomato leaf disease detection methods, devices, equipment, storage media and products. Background Art
[0002] As the global agriculture accelerates its transformation to intelligentization, automated monitoring and management play a very important role in increasing crop yields, rationally allocating resources, and reducing manpower. Under this trend, crop monitoring and identification has become one of the key technologies in the field of agricultural automation, especially in the tomato planting industry, where its direct impact on leaf quality is related to tomato fruit yield. However, tomato leaf detection faces many challenges, including but not limited to dense distribution of leaves, color changes, complex lighting conditions, and occlusion problems.
[0003] Although image recognition technology has made significant progress in recent years, it still has limitations in the specific task of tomato leaf detection. Especially in the complex farmland background, the detection accuracy and robustness of small and densely distributed tomato leaves still need to be improved.
[0004] Therefore, how to improve the accuracy of small target detection is a problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of this application is to provide a tomato leaf disease detection method, device, equipment, storage medium and product, aiming to solve the technical problem of low accuracy in small target detection.
[0006] To achieve the above objectives, the present application proposes a method for detecting tomato leaf diseases, the method comprising:
[0007] The tomato leaf images to be tested are collected in real time through the video monitoring system;
[0008] Inputting the tomato leaf image to be detected into a target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result, wherein the target tomato leaf disease detection model is used to identify disease characteristics of tomato leaves through data enhancement;
[0009] Based on the target detection result, the disease category of the tomato leaf to be detected is determined.
[0010] In one embodiment, the target tomato leaf disease detection model includes an image edge detection sub-model, a feature extraction sub-model, a feature fusion sub-model and a detection head sub-model. The step of inputting the tomato leaf image to be detected into the target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result includes:
[0011] Inputting the tomato leaf image to be detected into the image edge detection sub-model to obtain tomato leaf edge information, wherein the edge detection sub-model is used to enhance the edge information of the tomato leaf image to be detected through data enhancement;
[0012] Inputting the tomato leaf image to be detected containing the tomato leaf edge information into the feature extraction sub-model for feature extraction to obtain global semantic features and enhanced disease features;
[0013] Inputting the global semantic features and the enhanced disease features into the feature fusion sub-model for information fusion to obtain fusion features;
[0014] The fused features are input into the detection head sub-model to obtain the target detection result.
[0015] In one embodiment, the step of inputting the tomato leaf image to be detected containing the tomato leaf edge information into the feature extraction submodel for feature extraction to obtain global semantic features and enhanced disease features includes:
[0016] Inputting the tomato leaf image to be detected containing the tomato leaf edge information into the backbone network, performing preliminary spatial downsampling and channel expansion through the embedding layer to obtain global semantic features;
[0017] By introducing depthwise separable convolution and grouped convolution in each layer of the backbone network, enhanced disease features are obtained.
[0018] In one embodiment, the feature fusion sub-model includes a channel sparse convolution module, and the step of inputting the global semantic features and the enhanced disease features into the feature fusion sub-model for information fusion to obtain fused features includes:
[0019] Inputting the global semantic features and enhanced disease features into the channel sparse convolution module to optimize feature extraction efficiency and obtain initial fusion features;
[0020] The initial fusion feature set is fused with feature layers of other scales through upsampling and concatenation operations to obtain fusion features.
[0021] In one embodiment, before the step of inputting the tomato leaf image to be detected into the target tomato leaf disease detection model, the step includes:
[0022] Preprocessing a tomato diseased leaf dataset and dividing the preprocessed tomato diseased leaf dataset into a training set and a test set, wherein the preprocessing is used to identify areas where grayscale values in tomato leaf disease images change dramatically;
[0023] Inputting the training set into the initial tomato leaf disease detection model for model training to obtain test results;
[0024] Evaluate the test results according to preset evaluation indicators to generate evaluation results;
[0025] The model parameters were optimized based on the evaluation results to obtain the target tomato leaf disease detection model.
[0026] In one embodiment, the preset evaluation index includes precision, recall rate and average precision mean, and the precision is expressed as:
[0027]
[0028] Among them, P represents precision, TP represents the number of positive classes predicted as positive classes, and FP represents the number of positive classes predicted as negative classes.
[0029] The recall rate is expressed as:
[0030]
[0031] Among them, R represents the recall rate, TP represents the number of positive classes that are actually predicted to be positive, and FN represents the number of negative classes that are actually predicted to be positive.
[0032] The average precision value is expressed as:
[0033]
[0034] Among them, map represents the average precision, AP i represents the average precision, and k represents the existence of k types of tomato leaf diseases in the test results.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a tomato leaf disease detection device, the tomato leaf disease detection device comprising:
[0036] The image acquisition module is used to acquire the images of tomato leaves to be detected in real time through the video monitoring system;
[0037] a target detection module, for inputting the tomato leaf image to be detected into a target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result, wherein the target tomato leaf disease detection model is used to identify disease characteristics of tomato leaves through data enhancement;
[0038] The result judgment module is used to determine the disease category of the tomato leaf to be detected based on the target detection result.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a tomato leaf disease detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the tomato leaf disease detection method described above.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the tomato leaf disease detection method described above are implemented.
[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the tomato leaf disease detection method described above are implemented.
[0042] One or more technical solutions proposed in this application have at least the following technical effects:
[0043] The tomato leaf images to be detected are collected in real time through the video surveillance system; the tomato leaf images to be detected are input into the target tomato leaf disease detection model, and the target detection results are obtained by introducing the feature pyramid structure to perform target detection on the tomato leaf images to be detected. The target tomato leaf disease detection model is used to identify the disease characteristics of tomato leaves through data enhancement; based on the target detection results, the disease category of the tomato leaves to be detected is determined. Real-time acquisition through the video surveillance system can achieve timely disease monitoring and diagnosis. By introducing the feature pyramid structure, the model can effectively handle targets of different scales and significantly improve the detection accuracy of small targets. At the same time, the use of adaptive data enhancement technology can improve the diversity in the training process, thereby enhancing the generalization ability of the model, and significantly improving the detection efficiency while ensuring the accuracy of small target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 This is a flow chart of the first embodiment of the tomato leaf disease detection method of the present application;
[0047] Figure 2 This is a flow chart of the second embodiment of the tomato leaf disease detection method of the present application;
[0048] Figure 3 This is a schematic diagram of the DilFasterBlock structure in the embodiment of this application;
[0049] Figure 4 This is a schematic diagram of the Slim-Neck structure in the embodiment of the present application;
[0050] Figure 5 This is a flow chart of the third embodiment of the tomato leaf disease detection method of the present application;
[0051] Figure 6 This is a schematic diagram of the structure of the target tomato leaf disease detection model in the implementation manner of this application;
[0052] Figure 7 This is a schematic diagram of the module structure of the tomato leaf disease detection device according to an embodiment of the present application;
[0053] Figure 8 Schematic diagram of the device structure of the hardware operating environment involved in the tomato leaf disease detection method in the embodiment of the present application.
[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] The use of computer recognition technology in complex outdoor farmland environments brings a series of challenges: such as different weather conditions, different light angles on crop leaves, and leaves being blocked by branches or fruits. Although previous tomato leaf detection technologies were mostly based on carefully designed features, recent research has gradually turned to the use of deep learning algorithms, which have shown great potential in deep learning feature recognition. However, progress in this field is still subject to two key obstacles: first, there is no recognized unified dataset to support model training and evaluation, and second, the specific quantitative evaluation criteria for detection accuracy in precision agriculture have not been fully established, which limits the ability to directly apply these advanced technologies for effective detection. Especially in the tomato planting industry, its direct impact on leaf quality is related to the tomato fruit yield. However, tomato leaf detection faces many challenges, including but not limited to the dense distribution of leaves, color changes, complex lighting conditions, and occlusion problems, which are particularly prominent in farmland environments. Although image recognition technology has made significant progress in recent years, it still has limitations in the specific task of tomato leaf detection. Although traditional algorithms have performed well on multiple datasets, their detection accuracy and robustness still need to be improved in complex farmland backgrounds, especially for small and densely distributed tomato leaves.
[0058] The present application provides a solution, which collects tomato leaf images to be detected in real time through a video surveillance system; inputs the tomato leaf images to be detected into a target tomato leaf disease detection model, performs target detection on the tomato leaf images to be detected by introducing a feature pyramid structure, and obtains a target detection result. The target tomato leaf disease detection model is used to identify the disease characteristics of tomato leaves through data enhancement; based on the target detection result, the disease category of the tomato leaves to be detected is determined. Real-time acquisition through a video surveillance system can achieve timely disease monitoring and diagnosis. By introducing a feature pyramid structure, the model can effectively handle targets of different scales and significantly improve the detection accuracy of small targets. At the same time, adaptive data enhancement technology is used to improve the diversity in the training process, enhance the generalization ability of the model, and significantly improve the detection efficiency while ensuring the accuracy of small target detection.
[0059] Based on this, the present application embodiment provides a method for detecting tomato leaf diseases, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the tomato leaf disease detection method of the present application.
[0060] In this embodiment, the tomato leaf disease detection method includes steps S10 to S30:
[0061] Step S10, collecting images of tomato leaves to be inspected in real time through a video monitoring system.
[0062] It should be noted that the tomato leaf images to be detected can be understood as image data of tomato leaves that need to be detected for diseases, and these images are obtained through a video monitoring system. Exemplarily, images or video streams are obtained through a camera to facilitate observation and analysis of the growth of crops such as tomatoes.
[0063] Step S20, inputting the tomato leaf image to be detected into the target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result.
[0064] It should be noted that the target tomato leaf disease detection model can be a specially designed machine learning or deep learning model, which can be used to identify and classify disease features on tomato leaves through data enhancement. The feature pyramid structure can be a neural network structure, which enables the model to better handle multi-scale targets by extracting features at different scales. Target detection is used to identify and locate specific objects (such as diseases) in an image. The corresponding target detection result can be understood as the target tomato leaf disease detection model processing the input tomato leaf image to be detected, and outputting the result on whether there is a disease and its location. Exemplarily, data enhancement can increase the diversity of data by performing various transformations (such as rotation, scaling, cropping, etc.) on the training data, thereby improving the generalization ability of the model. The target tomato leaf disease detection model can be an improved YOLO v8 model.
[0065] Step S30, determining the disease category of the tomato leaf to be detected based on the target detection result.
[0066] For example, specific signs or symptoms on tomato leaves, such as color changes, spots or morphological changes, can be used to identify whether the plant is affected by a disease. After testing, the result of determining whether the tomato leaf to be tested is affected by a disease usually includes a "yes" or "no" judgment.
[0067] In this embodiment, the tomato leaf images to be detected are collected in real time through the video monitoring system; the tomato leaf images to be detected are input into the target tomato leaf disease detection model, and the tomato leaf images to be detected are subjected to target detection by introducing a feature pyramid structure to obtain a target detection result. The target tomato leaf disease detection model is used to identify the disease characteristics of tomato leaves through data enhancement; based on the target detection result, the disease category of the tomato leaves to be detected is determined. Real-time collection through the video monitoring system can achieve timely disease monitoring and diagnosis. By introducing the feature pyramid structure, the model can effectively handle targets of different scales and significantly improve the detection accuracy of small targets. At the same time, the adaptive data enhancement technology is used to improve the diversity in the training process, enhance the generalization ability of the model, and significantly improve the detection efficiency while ensuring the accuracy of small target detection.
[0068] Reference Figure 2 , Figure 2 This is a flow chart of the second embodiment of the tomato leaf disease detection method of the present application. Figure 1 The first embodiment shown is a second embodiment of the tomato leaf disease detection method of the present application.
[0069] In the second embodiment, the step S20 includes:
[0070] Step S201, input the tomato leaf image to be detected into the image edge detection sub-model to obtain the tomato leaf edge information, and the edge detection sub-model is used to enhance the edge information of the tomato leaf image to be detected through data enhancement.
[0071] It should be noted that the image edge detection sub-model can be understood as a model specifically used to detect the edges of objects in an image. By identifying areas with significant color changes, it helps to extract the contour and shape information of the target object. The tomato leaf edge information can be understood as the detailed data about the tomato leaf contour obtained through edge detection, which can include the position and shape characteristics of the edge.
[0072] Step S202: input the tomato leaf image to be detected containing the tomato leaf edge information into the feature extraction sub-model for feature extraction to obtain global semantic features and enhanced disease features.
[0073] It should be noted that the feature extraction sub-model can be a model for extracting important features from an input image, which can identify and extract global semantic features and disease features that affect target detection. Global semantic features can represent the features of the overall content and semantic information of an image, and are usually used to understand the overall context of an image, which helps to identify the health status of tomato leaves. Enhanced disease features can be understood as features extracted through data enhancement technology that can more effectively reflect the disease situation, and can help the model better identify and classify diseases.
[0074] Step S203: input the global semantic features and the enhanced disease features into the feature fusion sub-model for information fusion to obtain fused features.
[0075] It should be noted that the feature fusion sub-model can be understood as a model that integrates features from different sources or different types. For example, a richer representation is generated by combining global semantic features and enhanced disease features.
[0076] Step S204, input the fused features into the detection head sub-model to obtain the target detection result.
[0077] It should be noted that the fused feature can be understood as a feature set obtained after feature fusion processing, which contains comprehensive information from different models. The detection head sub-model can be the final part of the model, which is used to process the fused features and output the target detection results, which usually involve the prediction of the location and category of the target.
[0078] In this embodiment, the edge information of tomato leaves is extracted by the image edge detection sub-model, which can strengthen the contour features of the target and make the subsequent feature extraction more accurate. The feature extraction sub-model extracts global semantic features and enhanced disease features at the same time, comprehensively considers the overall morphology and disease characteristics of the leaves, and improves the ability to identify diseases. The feature fusion sub-model effectively integrates features from different sources to generate fused features, enhances the adaptability of the model to complex scenes, and reduces information loss. Through the detection head sub-model, the fused features are converted into specific target detection results, and the presence and type of diseases in the tomato leaves to be detected are quickly determined, thereby improving the accuracy of disease detection.
[0079] Since the image passes through the backbone feature extraction network, the original feature fusion module will stretch the feature maps of multiple scales into a long vector, which will lead to a lot of computational redundancy and computational time, resulting in a very large number of model detection parameters. In addition, while reducing the amount of calculation, there is a situation where boundary feature values are lost, resulting in reduced detection accuracy. Based on this, the following implementation method is proposed.
[0080] In one embodiment, step S202 includes: inputting a tomato leaf image to be detected containing tomato leaf edge information into a backbone network, performing preliminary spatial downsampling and channel expansion through an embedding layer to obtain global semantic features; and obtaining enhanced disease features by introducing depthwise separable convolution and grouped convolution in each layer of the backbone network.
[0081] It should be noted that in deep learning models, the backbone network refers to the basic network structure used to extract features, which is usually composed of multiple convolutional layers and pooling layers, and is used to extract hierarchical features from the input image. In a neural network, an embedding layer refers to a layer used to convert input data into a high-dimensional feature space, reducing the size of the feature map through spatial downsampling and channel expansion, while increasing the number of channels to capture richer feature information. Spatial downsampling can be used to reduce the amount of computation by reducing the spatial resolution (such as width and height) of the feature map during feature extraction, and to enable the model to focus more on higher-level semantic information. Channel expansion can be understood as increasing the number of channels in the feature map to enhance the expressiveness of the features, so that the model can capture more details and information. Depthwise separable convolution can be a special convolution operation, which first performs depthwise convolution on the input (i.e., convolution is performed independently on each channel), and then integrates the features of these channels through pointwise convolution (1x1 convolution). Grouped convolution is a convolution method that divides the input channels into multiple groups, and performs convolution operations on each group separately. Grouped convolution can reduce computational complexity and improve the flexibility and performance of the model.
[0082] For example, Figure 3 As shown in the figure, the DilFasterNet module can be added to the YOLO v8 model. Specifically, the image passes through the backbone feature extraction network. In each Fasternet block, a PConv layer is followed by two PWConv layers. A point convolution (PWConv) is attached to PConv. It has four hierarchical stages, each of which is preceded by an embedding layer (a regular Conv 4×4, stride 4) or a merging layer (a regular Conv 2×2, stride 2) for spatial downsampling and channel number expansion. There is a stack of FasterNet blocks in each stage. Each FasterNet block has a PConv layer followed by two PWConv (or Conv 1×1) layers. Together, they are presented as an inverted residual block, where the intermediate layer has an expanded number of channels and shortcut connections are placed to reuse input features. Depth-separable convolutions are introduced in the embedding layer, and the output of the depth convolution is linearly combined using a 1x1 convolution kernel to integrate the information of each channel. The feature extraction performance is improved without increasing the number of parameters, and grouped convolutions are introduced in the merging layer to reduce the size of the model while maintaining performance. Finally, three features P3, P4, and P5 are generated.
[0083] In this embodiment, the spatial downsampling and channel expansion of the embedding layer enable the model to obtain global semantic features at a lower computational cost, which helps to speed up the processing speed of the model and improve the operating efficiency. By introducing deep separable convolution and grouped convolution, the amount of calculation can be reduced and the accuracy of feature extraction can be improved. The obtained global semantic features and enhanced disease features provide a basis for subsequent feature fusion, making the final detection results more accurate and reliable. Furthermore, by optimizing the feature extraction process, the model can better adapt to different input data, improve its ability to recognize unknown diseases, and enhance the generalization of the model.
[0084] In the backbone network of CNN, the input image almost always undergoes a similar conversion process: spatial information is gradually transferred to the channel, and each spatial (width and height) compression and channel expansion of the feature map will lead to partial loss of semantic information. In addition, there is a speed problem of prediction calculation in the convolutional neural network (CNN). Based on this, the following implementation method is proposed.
[0085] In one embodiment, step S203 includes: inputting the global semantic features and enhanced disease features into a channel sparse convolution module to optimize the feature extraction efficiency to obtain initial fused features; fusing the initial fused feature set with feature layers of other scales through upsampling and splicing operations to obtain fused features.
[0086] It should be noted that the channel sparse convolution module can optimize the feature extraction efficiency by reducing the number of channels involved in the convolution. The initial fusion feature can be a feature set obtained by processing the global semantic features and enhanced disease features through the channel sparse convolution module. Upsampling can restore the size of the image by increasing the spatial resolution of the feature map. It is usually used to enhance the details of the low-resolution feature map for comparison or fusion with the high-resolution feature map. Multiple feature maps are connected in the channel dimension to form a new feature map. The splicing operation can effectively integrate information from different scales or different feature extraction paths and enhance the feature expression ability of the model.
[0087] For example, Figure 4As shown, an optimized Slim-Neck module can be added to process feature maps of different scales (P3, P4, P5) through the global sparse convolution GSConv module, and then fused with feature layers of other scales through upsampling and concatenation operations. The processed feature maps are then passed through the GSConv module, and finally the variant grouped sparse convolution module (VoV-GSCSP) is used to further extract and fuse features. Finally, the fused feature maps are input into the detection head for detection. It should be noted that channel-intensive convolution calculation (SC) maximizes the retention of implicit connections between each channel, while channel-sparse convolution (DSC) completely cuts off these connections. GSConv maintains these connections as much as possible and has a lower time complexity. The time complexity is usually defined by the number of floating-point operations per second, so the time complexity of SC, DSC, and GSConv is expressed as:
[0088] GSConv: O(W·H·K1·K2·C1·C2)
[0089] DSC: O(W·H·K1·K2·C1)
[0090] SC: O([W·H·K1·K2·C1·C2] / 2·(C1+1))
[0091] Among them, W is the width of the output feature map, H is the height, R1 and R2 are the sizes of the convolution kernels, C is the number of channels of each convolution kernel, which is also the number of channels of the input feature map, and C2 is the number of channels of the output feature map. Therefore, the Slim-Neck module constructed by using GSConv, GS bottleneck and VoV-GSCSP modules as the neck of the neural network makes data processing more efficient.
[0092] In this embodiment, the channel sparse convolution module is used to reduce unnecessary calculations and improve the efficiency of feature extraction, making the model faster and lighter in processing. By upsampling and splicing operations, the initial fusion features are fused with feature layers of other scales, which can integrate feature information of different scales and improve the model's detection ability for targets of different sizes. Furthermore, the fusion features provide a rich information basis, which helps to enhance the performance of the model in complex scenes, especially when identifying small or similar disease features, and improve the accuracy of detection.
[0093] Reference Figure 5 , Figure 5 This is a flow chart of the third embodiment of the tomato leaf disease detection method of the present application. Figure 2 The second embodiment shown is a third embodiment of the tomato leaf disease detection method of the present application.
[0094] In the third embodiment, before step S10, the following steps are included:
[0095] Step S010, preprocessing the tomato diseased leaf dataset, and dividing the preprocessed tomato diseased leaf dataset into a training set and a test set.
[0096] It should be noted that the preprocessing is used to identify the area where the grayscale value changes sharply in the tomato leaf disease image. The tomato disease leaf dataset may include a collection of tomato leaf images of different disease types, which is usually used to train and test machine learning or deep learning models to identify and classify tomato leaf diseases. The training set may be a part of the data extracted from the dataset, which is used to train the machine learning model. The test set may be another part of the dataset, which is independent of the training set and is used to evaluate the performance of the model. Exemplarily, before inputting the data into the model, the data is cleaned and formatted for preprocessing, which can improve the data quality and model training effect. Exemplarily, a dataset for tomato leaf diseases in complex farmland is constructed, including multiple diseases, different shooting angles, and different occlusion categories, and the required number of images containing leaves at multiple scales are collected. The dataset is preprocessed and divided into a training set and a test set; the dataset is used for training and testing at 70% and 30%, respectively. The preprocessing uses image edge detection preprocessing technology, which is mainly used to identify the area where the grayscale value changes sharply in the image, that is, the boundary of the object. Edges usually contain rich information such as shape and texture, and play a key role in tasks such as object recognition, target detection, and image segmentation.
[0097] Step S020, inputting the training set into the initial tomato leaf disease detection model for model training to obtain test results.
[0098] It should be noted that the test result may be the output of the model on the test set, indicating the prediction result of the model on the test data. Exemplarily, the test result may include the identified disease type and the corresponding confidence level.
[0099] Step S030, evaluating the test results according to preset evaluation indicators to generate evaluation results.
[0100] It should be noted that the preset evaluation indicators are used to evaluate the standards or indicators of model performance, which may include precision, recall rate and average precision mean. The precision is expressed as:
[0101]
[0102] Among them, P represents precision, TP represents the number of positive classes predicted as positive classes, and FP represents the number of positive classes predicted as negative classes. The recall rate is expressed as:
[0103]
[0104] Among them, R represents the recall rate, TP represents the number of positive classes that are actually predicted to be positive, and FN represents the number of negative classes that are actually predicted to be positive. The average precision value is expressed as:
[0105]
[0106] Among them, map represents the average precision, AP i represents the average precision, and k represents the presence of k types of tomato leaf diseases in the test results. i It is expressed as:
[0107]
[0108] Among them, r represents the recall rate under the preset threshold, n represents the index of sampling different points in the PR curve, P(r i+1 ) represents the recall rate r i+1 The corresponding accuracy.
[0109] Step S040, optimizing the model parameters based on the evaluation results to obtain a target tomato leaf disease detection model.
[0110] Exemplarily, based on the evaluation results generated in step S030, the insufficient performance of the model on different disease types or specific data set features is identified, such as low precision, low recall rate, or unsatisfactory mean average precision (mAP). The hyperparameters of the model (such as learning rate, batch size, etc.) can be adjusted according to the evaluation results, or the model architecture can be modified (such as increasing the number of layers, modifying the activation function, etc.) to improve the model's ability to recognize specific diseases. It is understandable that after the parameters are adjusted, the model is retrained using the training set so that the model adapts to the new parameter settings and improves its performance on the test set. After the model is retrained, the test set is used again for evaluation to confirm whether the optimization is effective. This feedback loop can continue until the performance of the model reaches the expected standard, that is, the target tomato leaf disease detection model. Based on the above embodiments and implementation methods, the target tomato leaf disease detection model is such as Figure 6 shown.
[0111] In this embodiment, the tomato disease leaf data set is systematically preprocessed and divided into a training set and a test set to ensure data quality, and then the initial model is trained and its performance is evaluated. Through the preset evaluation indicators, the deficiencies of the model are identified, and the model parameters are optimized according to the evaluation results, and the hyperparameters or model architecture are adjusted, and finally an optimized target tomato leaf disease detection model is obtained. This process effectively improves the model's ability to identify different diseases and enhances its practicality and accuracy.
[0112] In one embodiment, in order to further illustrate the advantages of the target tomato leaf disease detection model in the embodiment of the present application, a comparative experiment is conducted between the target tomato leaf disease detection model and the YOLOV8 model. In the experiment, the number of GPUs (NVIDIA4060ti 16G) is set to 1, the number of training rounds is set to 200, 16 images are loaded on each GPU, and the image size input during training is 640×640, and the data in Table 1 is obtained.
[0113] Table 1
[0114]
[0115] By analyzing the data in Table 1, we can conclude that the various indicators of the target tomato leaf disease detection model in the embodiment of the present application are significantly improved compared with the original YOLOv8 model, reflecting that the target tomato leaf disease detection model in the embodiment of the present application has obvious advantages in detecting tomato leaf disease areas.
[0116] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the tomato leaf disease detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0117] This application also provides a tomato leaf disease detection device, please refer to Figure 7 , the tomato leaf disease detection device comprises:
[0118] The image acquisition module 10 is used to acquire the image of the tomato leaves to be detected in real time through the video monitoring system;
[0119] A target detection module 20 is used to input the tomato leaf image to be detected into a target tomato leaf disease detection model, perform target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtain a target detection result. The target tomato leaf disease detection model is used to identify the disease characteristics of tomato leaves through data enhancement;
[0120] The result judgment module 30 is used to determine the disease category of the tomato leaf to be detected based on the target detection result.
[0121] The tomato leaf disease detection device provided by the present application adopts the tomato leaf disease detection method in the above embodiment, which can solve the technical problem of low accuracy in small target detection. Compared with the prior art, the beneficial effects of the tomato leaf disease detection device provided by the present application are the same as the beneficial effects of the tomato leaf disease detection method provided by the above embodiment, and other technical features in the tomato leaf disease detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0122] The present application provides a tomato leaf disease detection device, which includes: 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the tomato leaf disease detection method in the above-mentioned embodiment one.
[0123] Reference below Figure 8 , which shows a schematic diagram of the structure of a tomato leaf disease detection device suitable for implementing the embodiment of the present application. The tomato leaf disease detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The tomato leaf disease detection device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0124] like Figure 8 As shown, the tomato leaf disease detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM) 1004. Various programs and data required for the operation of the tomato leaf disease detection device are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the tomato leaf disease detection device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8A tomato leaf disease detection device having various systems is shown, but it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented or have instead.
[0125] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0126] The tomato leaf disease detection device provided by the present application adopts the tomato leaf disease detection method in the above embodiment, which can solve the technical problem of low accuracy in small target detection. Compared with the prior art, the beneficial effects of the tomato leaf disease detection device provided by the present application are the same as the beneficial effects of the tomato leaf disease detection method provided by the above embodiment, and the other technical features of the tomato leaf disease detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0127] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0128] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0129] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the tomato leaf disease detection method in the above-mentioned embodiment.
[0130] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0131] The computer-readable storage medium may be included in the tomato leaf disease detection device; or may exist independently without being assembled into the tomato leaf disease detection device.
[0132] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the tomato leaf disease detection device, the tomato leaf disease detection device: collects tomato leaf images to be detected in real time through a video monitoring system; inputs the tomato leaf images to be detected into a target tomato leaf disease detection model, performs target detection on the tomato leaf images to be detected by introducing a feature pyramid structure, and obtains a target detection result. The target tomato leaf disease detection model is used to identify the disease characteristics of tomato leaves through data enhancement; and determines the disease category of the tomato leaves to be detected based on the target detection result.
[0133] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0136] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned tomato leaf disease detection method, and can solve the technical problem of low accuracy in small target detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the tomato leaf disease detection method provided in the above-mentioned embodiment, and will not be described in detail here.
[0137] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned tomato leaf disease detection method when executed by a processor.
[0138] The computer program product provided in this application can solve the technical problem of low accuracy in small target detection. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the tomato leaf disease detection method provided in the above embodiment, which will not be repeated here.
[0139] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for detecting tomato leaf diseases, characterized in that: The method includes: The tomato leaf images to be tested are collected in real time through the video monitoring system; Inputting the tomato leaf image to be detected into a target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result, wherein the target tomato leaf disease detection model is used to identify disease characteristics of tomato leaves through data enhancement; Based on the target detection result, the disease category of the tomato leaf to be detected is determined.
2. The method according to claim 1, characterized in that The target tomato leaf disease detection model includes an image edge detection sub-model, a feature extraction sub-model, a feature fusion sub-model and a detection head sub-model. The step of inputting the tomato leaf image to be detected into the target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result includes: Inputting the tomato leaf image to be detected into the image edge detection sub-model to obtain tomato leaf edge information, wherein the edge detection sub-model is used to enhance the edge information of the tomato leaf image to be detected through data enhancement; Inputting the tomato leaf image to be detected containing the tomato leaf edge information into the feature extraction sub-model for feature extraction to obtain global semantic features and enhanced disease features; Inputting the global semantic features and the enhanced disease features into the feature fusion sub-model for information fusion to obtain fusion features; The fused features are input into the detection head sub-model to obtain the target detection result.
3. The method according to claim 2, characterized in that The step of inputting the tomato leaf image to be detected containing the tomato leaf edge information into the feature extraction sub-model for feature extraction to obtain global semantic features and enhanced disease features comprises: Inputting the tomato leaf image to be detected containing the tomato leaf edge information into the backbone network, performing preliminary spatial downsampling and channel expansion through the embedding layer to obtain global semantic features; By introducing depthwise separable convolution and grouped convolution in each layer of the backbone network, enhanced disease features are obtained.
4. The method according to claim 2, characterized in that The feature fusion sub-model includes a channel sparse convolution module, and the step of inputting the global semantic features and the enhanced disease features into the feature fusion sub-model for information fusion to obtain fusion features includes: Inputting the global semantic features and enhanced disease features into the channel sparse convolution module to optimize feature extraction efficiency and obtain initial fusion features; The initial fusion feature set is fused with feature layers of other scales through upsampling and concatenation operations to obtain fusion features.
5. The method according to any one of claims 1 to 4, characterized in that: Before the step of inputting the tomato leaf image to be detected into the target tomato leaf disease detection model, the method includes: Preprocessing a tomato diseased leaf dataset and dividing the preprocessed tomato diseased leaf dataset into a training set and a test set, wherein the preprocessing is used to identify areas where grayscale values in tomato leaf disease images change dramatically; Inputting the training set into the initial tomato leaf disease detection model for model training to obtain test results; Evaluate the test results according to preset evaluation indicators to generate evaluation results; The model parameters were optimized based on the evaluation results to obtain the target tomato leaf disease detection model.
6. The method according to claim 5, characterized in that The preset evaluation indicators include precision, recall rate and average precision mean, and the precision is expressed as: Among them, P represents precision, TP represents the number of positive classes predicted as positive classes, and FP represents the number of positive classes predicted as negative classes. The recall rate is expressed as: Among them, R represents the recall rate, TP represents the number of positive classes that are actually predicted to be positive, and FN represents the number of negative classes that are actually predicted to be positive. The average precision value is expressed as: Among them, map represents the average precision, AP i represents the average precision, and k represents the existence of k types of tomato leaf diseases in the test results.
7. A tomato leaf disease detection device, characterized in that: The device comprises: The image acquisition module is used to acquire the images of tomato leaves to be detected in real time through the video monitoring system; a target detection module, for inputting the tomato leaf image to be detected into a target tomato leaf disease detection model, performing target detection on the tomato leaf image to be detected by introducing a feature pyramid structure, and obtaining a target detection result, wherein the target tomato leaf disease detection model is used to identify disease characteristics of tomato leaves through data enhancement; The result judgment module is used to determine the disease category of the tomato leaf to be detected based on the target detection result.
8. A tomato leaf disease detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the tomato leaf disease detection method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the tomato leaf disease detection method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the tomato leaf disease detection method according to any one of claims 1 to 6 are implemented.