Greenhouse strawberry disease real-time detection method based on YOLOv8

Through the real-time detection method of greenhouse strawberry diseases based on YOLOv8, the problem of difficult identification of strawberry diseases and high cost of manual investigation is solved, and the rapid identification and real-time monitoring of strawberry diseases is achieved, reducing human resource consumption and improving governance efficiency.

CN119723286APending Publication Date: 2025-03-28ANHUI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411797086.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

Strawberry diseases are difficult to identify, and manual inspection is costly and difficult, resulting in lagging disease control.

Method used

The real-time detection method of greenhouse strawberry disease based on YOLOv8 is adopted, and the strawberry disease images are obtained for preprocessing and data enhancement, and a feature enhancement module and identification classification model are built to achieve rapid identification and real-time monitoring of strawberry disease.

Benefits of technology

It realizes rapid identification and real-time monitoring of strawberry diseases, reduces human resource consumption, and improves the efficiency and accuracy of disease management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723286A_ABST
    Figure CN119723286A_ABST
Patent Text Reader

Abstract

The invention relates to a greenhouse strawberry disease real-time detection method based on YOLOv8. The method comprises the steps that strawberry disease images are acquired and preprocessed; dividing the strawberry disease image data set; constructing a strawberry disease identification and classification model; a trained strawberry disease identification and classification model is obtained; and obtaining a to-be-detected strawberry image, performing preprocessing, and inputting the preprocessed to-be-detected strawberry image into the trained strawberry disease identification and classification model to obtain a detection result. According to the invention, based on YOLOv8 feature enhancement, strawberry disease images are processed by using data enhancement, a feature enhancement module is provided, strawberry diseases are identified in combination with a YOLOv8 backbone network, and the detection speed and the accuracy are high; the strawberry disease condition information is monitored and acquired by detecting pictures in real time, and the strawberry address and disease degree information of the disease condition are uploaded to the memory, so that the manpower resource consumption of troubleshooting is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of disease recognition technology and the technical field of Internet of Things systems, and in particular to a real-time detection method for greenhouse strawberry diseases based on YOLOv8. Background Art

[0002] As a high-end fruit, strawberry has high economic value and development prospects. At the same time, strawberry is a crop that has high requirements for the environment. If the disease is not discovered in time and its type is not identified and treated, the strawberry yield can be reduced by more than 50%, and the strawberry yield will be greatly impacted. Therefore, the timely discovery and treatment of strawberry diseases is an important basis for the prevention and control of strawberry diseases.

[0003] In traditional greenhouse agricultural work, crop production workers, especially workers of strawberry crops, often encounter some problems:

[0004] First, due to the lack of professional knowledge about strawberry diseases, they are at a loss when the disease is discovered, which leads to missing the best time for treatment or using the wrong treatment method;

[0005] Second, the manpower and time costs of manual screening are too high, and the identification environment of strawberry diseases is complex, making manual identification very difficult.

[0006] Therefore, how to design a method for identifying the types of strawberry diseases and promptly providing the location of the greenhouse to which the disease belongs and control measures has become a technical problem that needs to be solved urgently. Summary of the invention

[0007] In order to solve the problems in the prior art that strawberry diseases are difficult to identify and the cost of manual investigation is too high, the purpose of the present invention is to provide a real-time detection method for greenhouse strawberry diseases based on YOLOv8, which has a faster detection speed and high accuracy and reduces the human resource consumption for investigation.

[0008] To achieve the above object, the present invention adopts the following technical scheme: a real-time detection method for greenhouse strawberry diseases based on YOLOv8, the method comprising the following steps in order:

[0009] (1) Obtaining strawberry disease images and preprocessing them: collecting strawberry disease images on site, preprocessing the collected strawberry disease images, and obtaining a strawberry disease image dataset;

[0010] (2) Divide the strawberry disease image dataset into a training set, a test set, and a validation set;

[0011] (3) Construct a strawberry disease recognition and classification model: add a feature enhancement module based on the YOLOv8 model; modify the pixel detection layer of the YOLOv8 model, and replace the fixed pooling layer in the SPPF layer of the YOLOv8 model with an adaptive pooling layer;

[0012] (4) inputting the training set into the strawberry disease recognition classification model for training to obtain a trained strawberry disease recognition classification model;

[0013] (5) Obtaining a strawberry image to be detected and preprocessing it, inputting the preprocessed strawberry image to be detected into a trained strawberry disease recognition and classification model to obtain a detection result.

[0014] The step (1) specifically comprises the following steps in order:

[0015] (1a) Enhance the contrast and intensity of the original image of strawberry disease, and expand the data quantity by flipping;

[0016] (1b) Data enhancement is performed using the CutMix data enhancement method;

[0017] (1c) Fusion enhancement is then performed. The two images are used as calculation parameters, and the mixing coefficient λ is calculated through Beta distribution. The strawberry disease images are divided into multiple batches. Two batches are randomly selected for fusion calculation. The mixing coefficients of the strawberry disease samples in these two batches are λ and 1-λ respectively. After mixing, the fused and enhanced strawberry disease images are obtained. The fused and enhanced strawberry disease images constitute the strawberry disease image dataset.

[0018] In step (3), adding a feature enhancement module based on the YOLOv8 model specifically means that: the feature enhancement module includes a fast feature extraction module and a context capture module, the fast feature extraction module consists of a 1×1 convolution layer, two 3×3 partial convolution layers and a 3×3 convolution layer, and a residual connection is added after the 3×3 convolution layer; wherein, the 1×1 convolution layer is responsible for preliminary feature extraction, and the subsequent two 3×3 partial convolution layers improve efficiency by reducing computational redundancy and memory access; the 3×3 convolution layer is responsible for further feature extraction, and the residual connection enhances the dimension of the output feature, reduces the loss of useful features, and alleviates the feature attenuation caused by network deepening;

[0019] The context capture module consists of three convolutional layers, a Softmax layer and a layer normalization. The expression of the context capture module is as follows:

[0020]

[0021]

[0022] in, N represents the global features related to position j obtained after global context modeling; p is the total number of spatial locations, N p =H×W, where H and W are the height and width of the input feature map respectively; X j is the feature vector of the input feature map at position j; W k and W v is the learnable weight matrix, W k Used to generate attention scores, W v For linear transformation, the context capture module contains W v1 With W v2 Two linear transformation matrices; Represents X j By W k After the linear transformation of , the attention score is calculated; is the normalization factor, which is used to normalize the scores of all positions into a probability distribution; Z i is the output feature, X i is the input feature, ReLU is the activation function, and LN is the normalization layer; To generate a global context feature by weighted summing of all context features; X m Represents the feature vector located at position m in the input feature map.

[0023] In step (3), modifying the pixel detection layer of the YOLOv8 model specifically refers to: adding a 320×320 pixel detection layer and a 160×160 pixel detection layer;

[0024] Among them, the specific operation of adding a 160×160 pixel detection layer is as follows: define four groups of C2f layers and convolutional layers in the backbone network of the YOLOv8 network model, one C2f layer and one convolutional layer form a group, and the first to fourth groups are respectively from the input feature map to the SPPF layer, delete the fourth group of C2f layers and convolutional layers connected to the SPPF layer in the YOLOv8 network model, connect the third group of C2f layers and convolutional layers to the SPPF layer, and modify the number of bottleneck layers in the first, second, and third groups of C2f layers to two, so as to better identify small target features; connect the first group of C2f layers and the second group of C2f layers to the splicing layer;

[0025] The specific operation of adding a 320×320 pixel detection layer is as follows: the feature map extracted by the above-mentioned 160×160 pixel detection layer is enhanced to a 320×320 feature map by deconvolution; a detection head adapted to 320×320 is added; a detection head adapted to 320×320 is added;

[0026] The fixed pooling layer in the SPPF layer of the YOLOv8 model is replaced with an adaptive pooling layer, and the size of the pooling window is dynamically adjusted according to the content of the input feature map. The formula for adaptive pooling is as follows:

[0027] Y contact =Contact(Y 1 ,Y 2 ,Y 3 ,…,Y n )

[0028] Among them, Y 1 ,Y 2 ,Y 3 ,…,Y n is the pooling output at different scales, Contact is the splicing operation, which splices multiple pooled feature maps in the channel direction, and Y contact It is the concatenated output after the pooling operation.

[0029] The step (4) specifically comprises the following steps in order:

[0030] (4a) inputting the training set into the strawberry disease recognition and classification model for training to obtain strawberry disease information;

[0031] (4b) Compare the trained strawberry disease information with the correct strawberry disease classification information, and then use the gradient back propagation algorithm to adjust the model weights;

[0032] (4c) The loss function L of the strawberry disease recognition and classification model is defined as:

[0033]

[0034] Among them, x is the real strawberry disease classification information, It is the predicted classification information of strawberry diseases.

[0035] It can be seen from the above technical scheme that the beneficial effects of the present invention are as follows: first, based on YOLOv8 feature enhancement, the present invention uses data enhancement to process strawberry disease images, proposes a feature enhancement module, and combines the YOLOv8 backbone network to identify strawberry diseases, with faster detection speed and high accuracy; second, through real-time detection of the screen to monitor and obtain strawberry disease information, the strawberry address and disease degree information of the disease situation are uploaded to the memory, reducing the human resource consumption of the investigation; through the obtained detection information, the planter is provided with governance opinions, and the governance opinions are uploaded to the memory together with the detection information. After the planter logs in to the system, the disease location and degree information can be directly obtained, and corresponding governance measures can be taken according to the governance opinions provided by the inspector, which reduces the planting pressure of the planter and facilitates the rapid acquisition of professional planting governance opinions; third, the present invention can open interfaces to local management departments at all levels, so that the management agency can grasp the local real-time strawberry yield and health status information. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a flow chart of the method of the present invention;

[0037] Figure 2 It is a structural schematic diagram of the feature enhancement module in the present invention;

[0038] Figure 3 Flowchart for inspectors and planters to log in to the WEB terminal. DETAILED DESCRIPTION

[0039] like Figure 1 As shown, a real-time detection method for greenhouse strawberry diseases based on YOLOv8 includes the following steps in order:

[0040] (1) Obtaining strawberry disease images and preprocessing them: collecting strawberry disease images on site, preprocessing the collected strawberry disease images, and obtaining a strawberry disease image dataset;

[0041] (2) Divide the strawberry disease image dataset into a training set, a test set, and a validation set;

[0042] (3) Construct a strawberry disease recognition and classification model: add a feature enhancement module based on the YOLOv8 model; modify the pixel detection layer of the YOLOv8 model, and replace the fixed pooling layer in the SPPF layer of the YOLOv8 model with an adaptive pooling layer;

[0043] (4) inputting the training set into the strawberry disease recognition classification model for training to obtain a trained strawberry disease recognition classification model;

[0044] (5) Obtaining a strawberry image to be detected and preprocessing it, inputting the preprocessed strawberry image to be detected into a trained strawberry disease recognition and classification model to obtain a detection result.

[0045] The step (1) specifically comprises the following steps in order:

[0046] (1a) Enhance the contrast and intensity of the original image of strawberry disease, and expand the data quantity by flipping;

[0047] (1b) The CutMix data enhancement method is used for data enhancement, that is, a square area in the strawberry disease image is randomly filled with regional pixel values ​​of other data in the training set to achieve random occlusion, and then the randomly occluded strawberry disease image is subjected to a center normalization operation to eliminate the influence of random filling on training;

[0048] (1c) Fusion enhancement is then performed. The two images are used as calculation parameters, and the mixing coefficient λ is calculated through Beta distribution. The strawberry disease images are divided into multiple batches. Two batches are randomly selected for fusion calculation. The mixing coefficients of the strawberry disease samples in these two batches are λ and 1-λ respectively. After mixing, the fused and enhanced strawberry disease images are obtained. The fused and enhanced strawberry disease images constitute the strawberry disease image dataset.

[0049] like Figure 2 As shown, in step (3), adding a feature enhancement module based on the YOLOv8 model specifically means that: the feature enhancement module includes a fast feature extraction module and a context capture module, the fast feature extraction module consists of a 1×1 convolution layer, two 3×3 partial convolution layers and a 3×3 convolution layer, and a residual connection is added after the 3×3 convolution layer; wherein, the 1×1 convolution layer is responsible for preliminary feature extraction, and the subsequent two 3×3 partial convolution layers improve efficiency by reducing computational redundancy and memory access; the 3×3 convolution layer is responsible for further feature extraction, and the residual connection enhances the dimension of the output feature, reduces the loss of useful features, and alleviates the feature attenuation caused by the deepening of the network;

[0050] The context capture module consists of three convolutional layers, a Softmax layer and a layer normalization. The expression of the context capture module is as follows:

[0051]

[0052]

[0053] in, N represents the global features related to position j obtained after global context modeling; p is the total number of spatial locations, Np =H×W, where H and W are the height and width of the input feature map respectively; X j is the feature vector of the input feature map at position j; W k and W v is the learnable weight matrix, W k Used to generate attention scores, W v For linear transformation, the context capture module contains W v1 With W v2 Two linear transformation matrices; Represents X j By W k After the linear transformation of , the attention score is calculated; is the normalization factor, which is used to normalize the scores of all positions into a probability distribution; Z i is the output feature, X i is the input feature, ReLU is the activation function, and LN is the normalization layer; To generate a global context feature by weighted summing of all context features; X m Represents the feature vector located at position m in the input feature map.

[0054] In step (3), modifying the pixel detection layer of the YOLOv8 model specifically refers to: adding a 320×320 pixel detection layer and a 160×160 pixel detection layer;

[0055] Among them, the specific operation of adding a 160×160 pixel detection layer is as follows: define four groups of C2f layers and convolutional layers in the backbone network of the YOLOv8 network model, one C2f layer and one convolutional layer form a group, and the first to fourth groups are respectively from the input feature map to the SPPF layer, delete the fourth group of C2f layers and convolutional layers connected to the SPPF layer in the YOLOv8 network model, connect the third group of C2f layers and convolutional layers to the SPPF layer, and modify the number of bottleneck layers in the first, second, and third groups of C2f layers to two, so as to better identify small target features; connect the first group of C2f layers and the second group of C2f layers to the splicing layer;

[0056] The specific operation of adding a 320×320 pixel detection layer is as follows: the feature map extracted by the above-mentioned 160×160 pixel detection layer is upgraded to a 320×320 feature map through deconvolution; a new detection head adapted to 320×320 is added;

[0057] The fixed pooling layer in the SPPF layer of the YOLOv8 model is replaced with an adaptive pooling layer. The size of the pooling window is dynamically adjusted according to the content of the input feature map to extract more effective multi-scale information. The formula for adaptive pooling is as follows:

[0058] Ycontact =Contact(Y 1 ,Y 2 ,Y 3 ,…,Y n )

[0059] Among them, Y 1 ,Y 2 ,Y 3 ,…,Y n Y is the pooling output at different scales, and Contact is the splicing operation, which splices multiple pooled feature maps in the channel direction. contact It is the concatenated output after the pooling operation.

[0060] The step (4) specifically comprises the following steps in order:

[0061] (4a) inputting the training set into the strawberry disease recognition and classification model for training to obtain strawberry disease information;

[0062] (4b) Compare the trained strawberry disease information with the correct strawberry disease classification information, and then use the gradient back propagation algorithm to adjust the model weights;

[0063] (4c) The loss function L of the strawberry disease recognition and classification model is defined as:

[0064]

[0065] Among them, x is the real strawberry disease classification information, It is the predicted classification information of strawberry diseases.

[0066] like Figure 3 As shown, the planter client applies for login, and the user login management module of the station management system authenticates the user. If the authentication is successful, the user client goes online and can perform operations with corresponding permissions.

[0067] The inspector client applies for login. After successful identity authentication, the inspector client goes online and can perform operations with corresponding permissions.

[0068] At the same time, all data of the grower client and the inspector client are packaged in BSON format, transmitted to the cloud storage submodule of the cloud platform server module for storage, and saved in the MongoDB database. The growers and inspectors can also browse the data within their respective permissions through the client.

[0069] In summary, the present invention is based on YOLOv8 feature enhancement, uses data enhancement to process strawberry disease images, proposes a feature enhancement module, combines the YOLOv8 backbone network to identify strawberry diseases, and has a faster detection speed and high accuracy; through real-time detection of the screen to monitor and obtain strawberry disease situation information, the strawberry address and disease degree information of the disease situation are uploaded to the memory, thereby reducing the human resource consumption of the investigation; through the obtained detection information, the planter is provided with governance opinions, and the governance opinions are uploaded to the memory together with the detection information. After the planter logs in to the system, the disease location and degree information can be directly obtained, and corresponding governance measures can be taken according to the governance opinions provided by the detector, thereby reducing the planting pressure of the planter and facilitating the rapid acquisition of professional planting governance opinions; the present invention can open interfaces to local management departments at all levels, so that the management agency can grasp the local real-time strawberry yield and health status information.

Claims

1. A real-time detection method for greenhouse strawberry diseases based on YOLOv8, characterized in that: The method comprises the following steps in order: (1) Obtaining strawberry disease images and preprocessing them: collecting strawberry disease images on site, preprocessing the collected strawberry disease images, and obtaining a strawberry disease image dataset; (2) Divide the strawberry disease image dataset into a training set, a test set, and a validation set; (3) Construct a strawberry disease recognition and classification model: add a feature enhancement module based on the YOLOv8 model; modify the pixel detection layer of the YOLOv8 model, and replace the fixed pooling layer in the SPPF layer of the YOLOv8 model with an adaptive pooling layer; (4) inputting the training set into the strawberry disease recognition classification model for training to obtain a trained strawberry disease recognition classification model; (5) Obtaining a strawberry image to be detected and preprocessing it, inputting the preprocessed strawberry image to be detected into a trained strawberry disease recognition and classification model to obtain a detection result.

2. The real-time detection method for greenhouse strawberry diseases based on YOLOv8 according to claim 1, characterized in that: The step (1) specifically comprises the following steps in order: (1a) Enhance the contrast and intensity of the original image of strawberry disease, and expand the data quantity by flipping; (1b) Data enhancement is performed using the CutMix data enhancement method; (1c) Fusion enhancement is then performed. The two images are used as calculation parameters, and the mixing coefficient λ is calculated through Beta distribution. The strawberry disease images are divided into multiple batches. Two batches are randomly selected for fusion calculation. The mixing coefficients of the strawberry disease samples in these two batches are λ and 1-λ respectively. After mixing, the fused and enhanced strawberry disease images are obtained. The fused and enhanced strawberry disease images constitute the strawberry disease image dataset.

3. The real-time detection method for greenhouse strawberry diseases based on YOLOv8 according to claim 1, characterized in that: In step (3), adding a feature enhancement module based on the YOLOv8 model specifically means that: the feature enhancement module includes a fast feature extraction module and a context capture module, the fast feature extraction module consists of a 1×1 convolution layer, two 3×3 partial convolution layers and a 3×3 convolution layer, and a residual connection is added after the 3×3 convolution layer; wherein, the 1×1 convolution layer is responsible for preliminary feature extraction, and the subsequent two 3×3 partial convolution layers improve efficiency by reducing computational redundancy and memory access; the 3×3 convolution layer is responsible for further feature extraction, and the residual connection enhances the dimension of the output feature, reduces the loss of useful features, and alleviates the feature attenuation caused by network deepening; The context capture module consists of three convolutional layers, a Softmax layer and a layer normalization. The expression of the context capture module is as follows: in, N represents the global features related to position j obtained after global context modeling; p is the total number of spatial positions, n p =H×W, where H and W are the height and width of the input feature map respectively; X j is the feature vector of the input feature map at position j; W k and W v is the learnable weight matrix, W k Used to generate attention scores, W v For linear transformation, the context capture module contains W v1 With W v2 Two linear transformation matrices; Represents X j By W k After the linear transformation of , the attention score is calculated; is the normalization factor, which is used to normalize the scores of all positions into a probability distribution; Z i is the output feature, X i is the input feature, ReLU is the activation function, and LN is the normalization layer; To generate a global context feature by weighted summing of all context features; X m Represents the feature vector located at position m in the input feature map.

4. The real-time detection method for greenhouse strawberry diseases based on YOLOv8 according to claim 1, characterized in that: In step (3), modifying the pixel detection layer of the YOLOv8 model specifically refers to: adding a 320×320 pixel detection layer and a 160×160 pixel detection layer; Among them, the specific operation of adding a 160×160 pixel detection layer is as follows: define four groups of C2f layers and convolutional layers in the backbone network of the YOLOv8 network model, one C2f layer and one convolutional layer form a group, and the first to fourth groups are respectively from the input feature map to the SPPF layer, delete the fourth group of C2f layers and convolutional layers connected to the SPPF layer in the YOLOv8 network model, connect the third group of C2f layers and convolutional layers to the SPPF layer, and modify the number of bottleneck layers in the first, second, and third groups of C2f layers to two, so as to better identify small target features; connect the first group of C2f layers and the second group of C2f layers to the splicing layer; The specific operation of adding a 320×320 pixel detection layer is as follows: the feature map extracted by the above-mentioned 160×160 pixel detection layer is upgraded to a 320×320 feature map through deconvolution; a new detection head adapted to 320×320 is added; The fixed pooling layer in the SPPF layer of the YOLOv8 model is replaced with an adaptive pooling layer, and the size of the pooling window is dynamically adjusted according to the content of the input feature map. The formula for adaptive pooling is as follows: Y contact =Contact(Y1,Y2,Y3,…,Y n ) Among them, Y1,Y2,Y3,…,Y n is the pooling output at different scales, Contact is the splicing operation, which splices multiple pooled feature maps in the channel direction, and Y contact It is the concatenated output after the pooling operation.

5. The real-time detection method for greenhouse strawberry diseases based on YOLOv8 according to claim 1, characterized in that: The step (4) specifically comprises the following steps in order: (4a) inputting the training set into the strawberry disease recognition and classification model for training to obtain strawberry disease information; (4b) Compare the trained strawberry disease information with the correct strawberry disease classification information, and then use the gradient back propagation algorithm to adjust the model weights; (4c) The loss function L of the strawberry disease recognition and classification model is defined as: Among them, x is the real strawberry disease classification information, It is the predicted classification information of strawberry diseases.