Corn early-stage leaf identification method, device and equipment and storage medium

By improving the YOLOv8 model and integrating FasterNet and LSKNet networks, the problem of inaccurate early leaf recognition of corn is solved, and higher recognition accuracy and efficiency are achieved.

CN119600410APending Publication Date: 2025-03-11GANSU AGRI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411683583.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, early leaves of corn are inaccurate, relying on artificial naked eye observation, and are greatly affected by environmental factors, resulting in inconsistent and inaccurate identification results.

Method used

Improve the YOLOv8 model, integrate the FasterNet module and LSKNet network, and improve feature extraction efficiency and detection accuracy through partial convolution and dynamic receptive field adjustment.

Benefits of technology

It improves the accuracy of early leaf recognition of corn, reduces the amount of computing and memory access, and enhances the model's ability to identify targets of different scales and shapes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600410A_ABST
    Figure CN119600410A_ABST
Patent Text Reader

Abstract

The invention provides a corn early leaf recognition method, device and equipment and a storage medium, and belongs to the technical field of image recognition, and the method comprises the steps: integrating a FasterNet module in a C2F module of a backbone network of a YOLOv8 model, the FasterNet module comprising a partial convolution module, integrating an LSKNet network in a neck network, constructing an improved YOLOv8 model, and through a historical image data set comprising corn early leaves, carrying out the recognition of the corn early leaves. Training the improved YOLOv8 model to obtain a target detection network; and identifying the early leaf of the corn through the target detection network. According to the method, the Faster Net module is integrated in the C2F module of the backbone network of the YOLOv8 model, the LSKNet network is integrated in the neck network, and the backbone network and the neck network of the original YOLOv8 model are improved to identify the early corn leaves, so that the accuracy of identifying the early corn leaves is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image recognition, and in particular relates to a method, device, equipment and storage medium for recognizing early leaves of corn. Background Art

[0002] In the early stages of corn, monitoring the growth status of corn leaves is crucial. Accurate and efficient identification of corn leaves is crucial for evaluating planting density and growth conditions, which helps to improve agricultural production efficiency.

[0003] Traditional corn early leaf recognition often relies on human naked eye observation of corn leaf size and growth status to judge the health status of the crop. Human naked eye observation depends largely on the experience and subjective judgment of the observer. Different observers may have different recognition results for the same corn leaf due to personal experience, observation angle, and light conditions. In addition, human naked eye observation is sensitive to environmental factors such as light and temperature. Under unfavorable conditions such as insufficient light and high temperature, the observer's vision may be disturbed, resulting in inaccurate recognition results. Summary of the invention

[0004] In order to solve the problem of inaccurate recognition of early corn leaves in the prior art, the present invention provides a method, device, equipment and storage medium for recognizing early corn leaves.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A method for identifying early leaves of corn, comprising:

[0007] An improved YOLOv8 model is constructed. The improved YOLOv8 model includes an improved backbone network, an improved neck network and a head network. The C2F module of the improved backbone network is integrated with a FasterNet module. The FasterNet module includes a partial convolution module. The improved neck network includes an LSKNet network.

[0008] Obtain a historical image dataset containing early corn leaves, train the improved YOLOv8 model using the historical image dataset, and obtain a target detection network;

[0009] The image data to be identified is obtained, and the image data is input into the target detection network. The partial convolution module in the FasterNet module selects some channels from the number of channels of the input feature map for convolution operation, and the convolved feature map and the unconvolved channel are merged to obtain a new feature map. The new feature map is input into the improved neck network, and the LSKNet network is used to perform decomposition, fusion and selection operations in sequence to dynamically adjust the receptive field of the neck network to obtain the output feature map. The output feature map is input into the head network, and the early leaves of corn are identified based on the input feature map.

[0010] Optionally, a partial convolution module in the FasterNet module is used to select some channels from the number of channels of the input feature map for convolution operation, including:

[0011] Determine the number of channels to be convolved according to the number of channels of the input feature map and the preset segmentation parameters;

[0012] Perform standard convolution operation on the channels to be convolved.

[0013] Optionally, decomposition, fusion and selection operations are performed in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain an output feature map, including:

[0014] The input feature map is decomposed through two different large convolution kernels to obtain multi-level and multi-scale features in the image;

[0015] The two different convolution outputs are concatenated through channels, and a mixed pooling operation is performed on the concatenated feature map to enhance the feature map;

[0016] The weights of large convolution kernels are adjusted through the spatial selection mechanism to enhance the focus on the target area in the feature map; the Sigmoid function is used to generate a mask, and the mask is element-wise multiplied with the feature map to obtain the output feature map.

[0017] Optionally, train a modified YOLOv8 model, including:

[0018] The learning rate and weight parameters of the improved YOLOv8 model are initialized by the whale optimization algorithm to obtain multiple parameter combinations, each of which includes different learning rates and weight parameters;

[0019] The loss function of the improved YOLOv8 model is used as the objective function of the whale optimization algorithm to calculate the fitness value corresponding to each parameter combination;

[0020] The position update strategy based on the whale optimization algorithm updates the parameter combination and calculates the corresponding fitness value;

[0021] The process of iteratively updating parameter combinations and calculating fitness is repeated until the preset stop condition is reached, and the parameter combination with the smallest fitness value is used as the final learning rate and weight parameters of the improved YOLOv8 model.

[0022] Optionally, before inputting the image data into the target detection network, it also includes:

[0023] Segmentation of image data, including:

[0024] Get a fixed threshold value and convert the image data into a binary image by using the fixed threshold value; or,

[0025] Calculate the corresponding super green factor for each pixel in the image data, retain the pixels whose super green factor is greater than a preset threshold, and filter out the pixels whose super green factor is less than or equal to the preset threshold; or,

[0026] The target threshold is determined by the maximum inter-class variance, and the image data is binarized and segmented based on the target threshold.

[0027] Optionally, the target threshold is determined by the maximum inter-class variance, including:

[0028] Convert image data into grayscale image, calculate the histogram of grayscale image and normalize it;

[0029] For each candidate threshold, the image is segmented into foreground and background, and the inter-class variance between foreground and background is calculated;

[0030] The threshold that maximizes the inter-class variance is taken as the target threshold.

[0031] Optionally, after segmenting the image data, the method further includes:

[0032] The segmented images are denoised, contrast enhanced and cropped.

[0033] A corn early leaf recognition device, comprising:

[0034] A construction module is used to construct an improved YOLOv8 model. The improved YOLOv8 model includes an improved backbone network, an improved neck network and a head network. The C2F module of the improved backbone network is integrated with a FasterNet module. The FasterNet module includes a partial convolution module. The improved neck network includes an LSKNet network.

[0035] A training module is used to obtain a historical image dataset containing early corn leaves, and train the improved YOLOv8 model using the historical image dataset to obtain a target detection network;

[0036] The recognition module is used to obtain image data to be recognized, input the image data into the target detection network, select some channels from the number of channels of the input feature map for convolution operation through the partial convolution module in the FasterNet module, merge the convolved feature map and the unconvolved channel to obtain a new feature map, input the new feature map into the improved neck network, and perform decomposition, fusion and selection operations in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain an output feature map; input the output feature map into the head network, and recognize the early leaves of corn based on the input feature map.

[0037] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned corn early leaf recognition method when executing the program.

[0038] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned corn early leaf identification method is implemented.

[0039] The corn early leaf recognition method provided by the present invention has the following beneficial effects:

[0040] In the present invention, by improving the YOLOv8 model, a FasterNet module is integrated in the C2F module of the backbone network, and the FasterNet module includes a partial convolution module. The partial convolution module can selectively perform conventional convolution operations on specific input channels, thereby reducing unnecessary calculations. Since the partial convolution only performs convolution operations on a part of the channels of the input feature map, the part of the input that is considered to be redundant is ignored, thereby reducing redundant calculations and memory accesses, and improving the efficiency of feature extraction. At the same time, the partial convolution allows the network to focus more on important feature channels and ignore those channels that do not contain useful information, which helps the network to better learn discriminative features, thereby improving detection accuracy; an LSKNet network is added to the neck network, and the receptive field of the neck network is dynamically adjusted by the LSKNet network. By dynamically adjusting the receptive field, the model can adaptively adjust its ability to process information according to targets of different scales and shapes, thereby improving the recognition accuracy of early corn leaves of different heights; therefore, the present invention improves the accuracy of early corn leaf recognition by improving the backbone network and the neck network of the original YOLOv8 model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiment of the present invention and its design scheme, the following briefly introduces the drawings required for this embodiment. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 A schematic flow chart of a method for identifying early leaves of corn provided by an embodiment of the present invention;

[0043] Figure 2 A schematic diagram of a partial structure of an original YOLOv8 model provided in an embodiment of the present invention;

[0044] Figure 3 A partial structural diagram of an improved YOLOv8 model provided by an embodiment of the present invention;

[0045] Figure 4 A schematic diagram of a flow chart for optimizing a learning rate and weight parameters in a model training process provided by an embodiment of the present invention;

[0046] Figure 5 A schematic diagram of early corn leaf recognition results provided by an embodiment of the present invention;

[0047] Figure 6 A schematic diagram of an image preprocessing process provided by an embodiment of the present invention;

[0048] Figure 7 A schematic flow chart of another method for identifying early leaves of corn provided by an embodiment of the present invention;

[0049] Figure 8 A schematic structural diagram of a device for identifying early leaves of corn provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.

[0051] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “axial”, “radial”, “circumferential”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the technical solutions of the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0052] In addition, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance. In the description of the present invention, it should be noted that, unless otherwise clearly specified or limited, the terms "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. In the description of the present invention, unless otherwise specified, "plurality" means two or more, which will not be described in detail here.

[0053] Based on the problem that the accuracy of corn early leaf recognition is not high at present, the embodiment of the present invention provides a corn early leaf recognition method, such as Figure 1 As shown, the method comprises the following steps:

[0054] S1, build an improved YOLOv8 model.

[0055] The network structure of the YOLOv8 model is mainly composed of three parts. Figure 2 As shown, Figure 2 A partial structural diagram of an original YOLOv8 model provided for an embodiment of the present invention mainly includes Backbone, Neck and Head. The Backbone network is the main network in YOLOv8 for extracting image features. It refers to the structure of CSPDarkNet-53, but has made many improvements, the most notable of which is the introduction of the C2F (Cross-convolution with 2Filters) structure; the Neck part is responsible for fusing feature maps of different scales to enhance the multi-scale detection capability of the model; the Head part is responsible for converting the fused feature map into the final detection result.

[0056] The present invention improves on the original YOLOv8 model. Figure 3 As shown, Figure 3A partial structural diagram of an improved YOLOv8 model provided by an embodiment of the present invention; the improved YOLOv8 model includes an improved Backbone, an improved Neck and a Head. The present invention integrates a FasterNet module into a C2F module in the original Backbone to form an improved Backbone, and integrates a Large Selective Kernel Network (LSKNet) into the original Neck to form an improved Neck.

[0057] The FasterNet module is a neural network architecture that reduces computation, improves computational efficiency and detection accuracy by introducing the concepts of partial convolution and directional convolution.

[0058] Partial convolution reduces the amount of computation by selectively performing conventional convolution operations on specific input channels and ignoring those channels that do not contain useful information. At the same time, partial convolution allows the network to focus more on important feature channels and ignore those channels that do not contain useful information, which helps the network better learn discriminative features and thus improve detection accuracy.

[0059] Directed convolution is a special convolution operation that takes into account the spatial directionality of features. In the FasterNet module, directed convolution is integrated into partial convolution to maximize the information utilization of all channels. This means that the network not only reduces the amount of calculation, but also makes more effective use of feature information, thereby improving the detection accuracy of the network.

[0060] In actual application, partial convolution is used to convolve certain channels of the input feature map. After the partial convolution, directional convolution is applied to further extract and enhance the directional information in the feature map, and then the output features of the partial convolution and directional convolution are fused to form a richer feature representation.

[0061] It should be understood that since the background of the early corn pictures is very complex and contains a variety of non-target objects, if the original YOLOv8 model is used, a large number of redundant features and noise will often be introduced each time image feature extraction is performed, which reduces the accuracy of the model in recognizing early corn leaves. Therefore, by improving the Backbone of the original YOLOv8 model, it is possible to focus more on important feature channels in the feature extraction stage and ignore those channels that do not contain useful information. This helps the network to better learn discriminative features and improve detection accuracy while reducing the amount of calculation.

[0062] Large Selective Kernel Network (LSKNet) is a network architecture designed for remote sensing target detection. Its core advantage is that it can dynamically adjust its large spatial receptive field to better capture the range context of different objects in remote sensing scenes. LSKNet is introduced in the YOLOv8 model mainly to enhance the model's ability to capture target context information by using its ability to dynamically adjust the receptive field. By capturing the target's context information, the model can better understand the target's environment, thereby improving the accuracy of detection.

[0063] It should be understood that the receptive field is the size of the input image area that each neuron in a convolutional neural network can "see". By dynamically adjusting the receptive field, the model can adaptively adjust its ability to process information based on objects of different scales and shapes. This is particularly important for object detection tasks with complex backgrounds such as early corn leaves at different heights.

[0064] LSKNet is mainly divided into three parts: decomposition, fusion and selection.

[0065] Decomposition is the first step for LSKNet to deal with complex background targets. In this step, the original input will be decomposed by a large kernel. Specifically, two different large convolution kernels (Large K) are used to process the input to capture spatial information of different scales. This design helps the model better adapt to early corn leaves of different heights.

[0066] Through decomposition, LSKNet is able to extract multi-level and multi-scale features in early corn leaf images, providing rich feature information for subsequent steps.

[0067] Fusion is the key link for LSKNet to effectively integrate the features extracted from decomposition. In this step, the following operations are mainly performed:

[0068] Channel splicing: Two different convolution outputs are combined through channel splicing, so that different spatial features can be used simultaneously in subsequent steps. This splicing method helps the model capture more comprehensive contextual information.

[0069] Hybrid pooling: The concatenated feature maps are subjected to a combination of average pooling and maximum pooling to further strengthen the key areas of the feature maps. Hybrid pooling can retain important features in the image while reducing noise and redundant information.

[0070] The selection step is the core of LSKNet to dynamically adjust the receptive field and optimize the detection effect. In this step, the following operations are mainly performed:

[0071] Spatial selection mechanism: A new feature map is generated through convolution operation and self-attention (SA) mechanism, and then the focus on the target area is further enhanced through the spatial selection mechanism. The spatial selection mechanism can dynamically adjust the weight of the large kernel according to the input data to adapt to the contextual features of different target types.

[0072] Weighted feature map: Use the Sigmoid function to generate a mask, and then perform an element-wise product operation on the mask and the feature map to obtain the final output feature map. This step is used to weight the more important areas in the feature map to enhance the network's ability to detect early corn leaves.

[0073] S2, obtain a historical image dataset containing early corn leaves, train the improved YOLOv8 model through the historical image dataset, and obtain a target detection network.

[0074] An improved YOLOv8 model is constructed through S1. If you want to use the improved YOLOv8 model to identify early corn leaves, you need to train the model.

[0075] Exemplarily, a large number of historical image data sets containing early leaves of corn are obtained to ensure high image quality and cover various angles, lighting conditions, sizes, and occlusions. Use annotation tools (such as LabelImg, CVAT, etc.) to create a bounding box annotation in the image for each early leaf of corn. The annotation information usually includes the coordinates of the bounding box and the category label (for example, early leaves of corn). Then the historical image data set is segmented into a training set, a validation set, and a test set.

[0076] The improved YOLOv8 model is trained using the training set. During the training process, the hyperparameters of the model are continuously adjusted according to the difference between the model's prediction results and the actual labels until the model achieves the expected performance on the validation set, thereby obtaining the target detection network.

[0077] It should be understood that during the model training process, as the loss of the training set gradually decreases, the loss value sometimes oscillates within a certain range. This phenomenon may be caused by improper learning rate setting. When the learning rate is too high, the model may not be able to converge stably; when the learning rate is too low, the training process may be too slow and easily fall into a local optimum, thereby consuming and wasting training resources and affecting the accuracy of the model.

[0078] Therefore, the present invention adopts the Whale Optimization Algorithm (WOA) in the Neck part of the model. During the model training process, the WOA algorithm is used to optimize the learning rate and weight parameters, which helps the model avoid falling into the local optimal solution and improves the accuracy and stability of the model.

[0079] Next, combine Figure 4 Introduce the optimization process of the model's learning rate and weight parameters. Figure 4 A schematic diagram of a process for optimizing learning rate and weight parameters in a model training process provided by an embodiment of the present invention.

[0080] For example, Figure 4 As shown, the process includes:

[0081] S41, initialize the learning rate and weight parameters of the improved YOLOv8 model through the whale optimization algorithm to obtain multiple parameter combinations.

[0082] It should be understood that before S41, the target optimization function is first defined. In the embodiment of the present invention, the loss function of the model is set as the target optimization function, and the mean square error and cross entropy are used as the loss function. The formula is as follows:

[0083]

[0084] Among them, L1 is the mean square error function, L2 is the cross entropy function, and y i is the true label, is the model prediction value, and n is the number of samples.

[0085] Furthermore, the whale population is initialized. The whale optimization algorithm first randomly generates a set of solutions (individual whale positions). Each solution is a parameter combination of different learning rates and weight parameters of the model. The initialization formula is:

[0086] X i =X min +rand(0,1)·(X max -X min );

[0087] Among them, X i is the position of the i-th whale individual, X max and X min are the minimum and maximum values ​​of the solution respectively, and rand(0,1) is a random number between 0 and 1.

[0088] S42, using the loss function of the improved YOLOv8 model as the target optimization function of the whale optimization algorithm to calculate the fitness value corresponding to each parameter combination.

[0089] Specifically, the initialized parameter combination is assigned to the improved YOLOv8 model, the training set is input into the YOLOv8 model, the prediction result is obtained through forward propagation, the loss value is calculated based on the prediction result and the true label through the loss function, and the loss value is used as the fitness value.

[0090] S43, updating the parameter combination based on the position update strategy of the whale optimization algorithm and calculating the corresponding fitness value.

[0091] Position updating strategies include surrounding the prey, spiral updating of position, and random search.

[0092] The position update formula corresponding to the surrounded prey is as follows:

[0093]

[0094] A=2a·rand(0,1)-a,C=2·rand(0,1);

[0095] in, is the current whale position, is the position of the current optimal solution, A and C are the coefficients for controlling the behavior of the whale, and a will gradually decrease with the number of iterations and is used to control the balance between exploration and development.

[0096] The spiral update position updates the position by orbiting the prey, and the formula is:

[0097]

[0098] Where D' is the current distance between the whale and its prey, b is a constant, and l is a random number used to determine the shape of the spiral path.

[0099] In order to avoid local optimal solutions, whales sometimes choose random solutions to update their positions. The formula is as follows:

[0100]

[0101] A=2·a·ra

[0102] C=2·r'

[0103] in, is the current whale's position, is the position of the whale that is randomly selected. A and C are coefficient vectors, usually used to control the search range, a is a parameter that gradually decreases from 2 to 0, and r and r' are random numbers in the interval [0,1].

[0104] Furthermore, after the position is updated, that is, after the parameter combination is updated, the updated parameter combination is assigned to the improved YOLOv8 model again, and the fitness value is calculated through the loss function.

[0105] It should be understood that after each iteration, the generated learning rate and weight parameters are used to adjust the training process of the model. The update formula can be defined as:

[0106]

[0107] Among them, n t is the current learning rate and weight parameter, a is the update step size, The gradient of the objective optimization function with respect to the parameters θ.

[0108] S44, iteratively updating the parameter combination and calculating the fitness until the preset stop condition is reached, and the parameter combination with the smallest fitness value is used as the final learning rate and weight parameters of the improved YOLOv8 model.

[0109] That is, the process of updating parameter combinations and calculating fitness is repeated until the preset stop condition is reached, such as reaching the preset maximum number of iterations or the loss function is less than a certain threshold, and the parameter combination with the smallest fitness value is used as the final learning rate and weight parameters of the improved YOLOv8 model.

[0110] Through the above steps, the whale optimization algorithm can dynamically adjust the model parameters and improve the detection accuracy of the model.

[0111] S3, obtain the image data to be identified, input the image data into the target detection network, select some channels from the number of channels of the input feature map for convolution operation through the partial convolution module in the FasterNet module, merge the convolved feature map and the unconvolved channels to obtain a new feature map, input the new feature map into the improved neck network, and perform decomposition, fusion and selection operations in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain the output feature map; input the output feature map into the head network, and identify the early leaves of corn based on the input feature map.

[0112] Optionally, there are three ways to obtain the image data to be identified. The first is to collect image data of corn fields by drones. The camera sensor is 4 / 3CMOS and the image pixel resolution is 5280×2970. The second is to collect image data of corn fields by ground mobile shooting equipment. The sensor is 4 / 3CMOS and the image pixel resolution is 3072×4096. The third is to collect by fixed cameras with a static resolution of 2560×1440.

[0113] Further, the image data to be recognized is input into the target detection network, and the number of channels to be convolved is determined by partial convolution according to the number of channels of the input feature map and the preset segmentation parameters, and the segmented channels to be convolved are subjected to standard convolution operations, and the convolved feature map and the unconvolved channel are merged to obtain a new feature map, and the new feature map is input into the improved neck network, and the decomposition, fusion and selection operations are performed in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain the output feature map. It should be understood that the decomposition, fusion and selection operations are described in detail in S1 and will not be repeated here. The head network converts the input feature map into the final recognition result, including the bounding box, category and confidence of the early corn leaf, such as Figure 5 shown.

[0114] After identifying the early leaves of corn, the leaves can be counted and analyzed to calculate the emergence rate, identify pests and diseases, and evaluate the growth status of corn.

[0115] Optionally, before the image is input into the target detection network, the image to be identified is preprocessed, including segmentation, denoising, contrast enhancement and cropping.

[0116] Next, combine Figure 6 The process of image preprocessing is introduced, for example, Figure 6 As shown in the figure, after obtaining the image to be recognized, the image can be segmented in the following three ways:

[0117] The first method is fixed threshold segmentation, which directly uses a pre-set fixed threshold to convert the image into a binary image. Assuming the threshold is T, the specific formula is as follows:

[0118]

[0119] Among them, f(x,y) represents the grayscale value of the pixel at the position (x,y) of the input image, T represents the set threshold, and g(x,y) represents the output binary image pixel value, which is usually 0 and 1. 0 represents the background and 1 represents the foreground. By setting a suitable threshold T, the grayscale image can be effectively converted into a binary image.

[0120] The second method is super green factor segmentation, which is a technique for extracting green parts from images and is widely used in agriculture and vegetation monitoring. The specific formula is as follows:

[0121] ExG = 2·GRB;

[0122] Among them, G, R, and B represent the pixel values ​​of the green, red, and blue channels in the image respectively. ExG is the super green factor, which is used to highlight the green part of the image.

[0123] The specific operation steps are as follows: First, calculate the ExG value of each pixel; second, if the ExG value is greater than a certain threshold, the pixel is retained. Otherwise, the pixel is filtered out or marked as background. This segmentation method can effectively segment the green part of the early corn leaves.

[0124] The third method is to find the threshold using the maximum inter-class variance. The main idea is to find a threshold that maximizes the inter-class variance between foreground and background pixels, thereby achieving the best image binarization effect.

[0125] The process is as follows: convert the image data into a grayscale image, calculate the histogram of the grayscale image and normalize it; for each candidate threshold, segment the image into foreground and background, and calculate the inter-class variance between the foreground and background; and take the threshold that maximizes the inter-class variance as the target threshold.

[0126] Among them, the formula for between-class variance is:

[0127]

[0128] Where T is the threshold, ω1(T) is the probability of background pixels (the proportion of pixels with grayscale values ​​less than threshold T to the total pixels), ω2(T) is the probability of foreground pixels (the proportion of pixels with grayscale values ​​greater than threshold T to the total pixels); u1(T) represents the average grayscale value of background pixels at threshold T, and u2(T) represents the average grayscale value of foreground pixels at threshold T.

[0129] The calculation formulas for ω1(T) and ω2(T) are:

[0130]

[0131] Among them, P(i) is the probability of a pixel with gray value i, and L represents the maximum gray level (ranging from 0 to 255)

[0132] The calculation formulas for u1(T) and u2(T) are:

[0133]

[0134] Among them, L is the gray level of the image. Through the above calculation, the maximum inter-class variance can be obtained. Finding the maximum threshold T can achieve the best foreground and background plant phenotype segmentation effect in the image.

[0135] Furthermore, the segmented image is subjected to denoising, contrast enhancement, cropping, etc. The purpose of denoising is to reduce the noise in the image so as to make the target features clearer. Optionally, Gaussian filtering and median filtering are used for denoising. Gaussian filtering is a linear filter that performs smoothing based on the Gaussian distribution around the image pixels. The specific formula is:

[0136]

[0137] Where G(x,y) represents, (x,y) represents the relative position of the pixel, σ is the standard deviation, and controls the width of the Gaussian distribution. exp(·) represents the exponential function. The Gaussian filter convolves the image with the Gaussian kernel to obtain the denoised image.

[0138] Median filtering is a nonlinear filtering that sorts the pixels in the window and uses the median as the output value of the pixel to isolate the noise. For a window W, the median filtering formula is as shown below:

[0139] g(x,y)=Median{f(i,j)|(i,j)∈W};

[0140] Among them, f(i,j) represents the pixel value in the window, and g(x,y) is the pixel value after noise removal.

[0141] Optionally, the contrast is enhanced by histogram equalization, and the image contrast is made clearer by adjusting the grayscale distribution of the image. Assuming that the grayscale level of the input image is L and the probability distribution of the pixel grayscale value is p(x), the histogram equalization formula is:

[0142]

[0143] Among them, p(i) is the normalized probability pixel of gray level i, and T(x) is the new pixel gray value. Through this transformation, the gray distribution is more uniform, thereby enhancing the contrast.

[0144] Image cropping removes irrelevant parts by cutting out specific areas of the image, leaving only the area of ​​interest. Assume that the original size of the image is W×H, and the image is to be cropped into an area of ​​size ω×h. Assuming that the upper left corner of the cropped area is (x0, y0), the cropped image can be expressed as:

[0145] I crop (x',y') = I(x0+x',y0+y');

[0146] Where I(x,y) is the pixel value of the original image. crop(x', y') is the pixel value of the cropped image, x'∈[0,ω-1] and y'∈[0,h-1]. The optimal area of ​​the target is obtained by selecting reasonable (x0, y0) and (ω,h).

[0147] The above image preprocessing steps can help optimize the input of the target detection model and improve the detection accuracy and efficiency of early corn leaves.

[0148] Figure 7 A schematic flow chart of another method for identifying early leaves of corn provided by an embodiment of the present invention.

[0149] For example, Figure 7 As shown, the following steps are included:

[0150] S71, collects image data of corn fields using equipment such as drones, ground mobile devices and fixed cameras.

[0151] Among them, image data contains multi-dimensional information such as shape, color, texture and size.

[0152] S72, pre-processing the collected image data.

[0153] The image preprocessing process may refer to the steps in the above embodiment and will not be described in detail here.

[0154] S73, using the improved YOLOv8 model to identify early leaves of corn from the preprocessed images.

[0155] Among them, the process of identifying early leaves of corn by using the improved YOLOv8 model can refer to the above S1-S3 process, which will not be repeated here.

[0156] S74 counts the identified early corn leaves and performs data analysis; calculates the emergence rate, evaluates the growth status, and makes agricultural management decisions such as irrigation and fertilization.

[0157] Based on the same inventive concept, the embodiment of the present invention also provides a device for identifying early leaves of corn, such as Figure 8 As shown, the device comprises:

[0158] The construction module 81 is used to construct an improved YOLOv8 model. The improved YOLOv8 model includes an improved backbone network, an improved neck network and a head network. The C2F module of the improved backbone network is integrated with a FasterNet module. The FasterNet module includes a partial convolution module. The improved neck network includes an LSKNet network.

[0159] The training module 82 is used to obtain a historical image dataset containing early corn leaves, and train the improved YOLOv8 model using the historical image dataset to obtain a target detection network.

[0160] The recognition module 83 is used to obtain image data to be recognized, input the image data into the target detection network, select some channels from the number of channels of the input feature map through the partial convolution module in the FasterNet module for convolution operation, merge the convolved feature map and the unconvolved channels to obtain a new feature map, input the new feature map into the improved neck network, and perform decomposition, fusion and selection operations in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain an output feature map; input the output feature map into the head network, and identify early corn leaves based on the input feature map.

[0161] Each module in the above-mentioned corn early leaf recognition device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0162] The present invention also provides a computer device, including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps in the embodiment of the method for identifying early leaves of corn. The specific implementation method can be found in the method embodiment, which will not be repeated here.

[0163] Furthermore, the present invention also provides a non-temporary computer-readable storage medium containing instructions, and a computer program is stored on the storage medium. For example, a memory containing instructions, the above instructions can be executed by a processor of a computer device to complete the above method. For example, a non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. When the computer program is executed by the processor, the steps in the embodiment of the corn early leaf identification method can be implemented. The specific implementation method can be found in the method embodiment, which will not be repeated here.

[0164] It will be appreciated by those skilled in the art that embodiments of the present invention may provide methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0165] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0166] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0167] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0168] It should be pointed out that the specific implementation methods described above can enable those skilled in the art to understand the invention more comprehensively, but do not limit the invention in any way. Therefore, although the invention has been described in detail in this specification and embodiments, those skilled in the art should understand that the invention can still be modified or replaced by equivalents; and all technical solutions and improvements that do not deviate from the spirit and scope of the invention are included in the protection scope of the invention. Any figure mark in the claims should not be regarded as limiting the claims involved. Any simple change or equivalent replacement of the technical solution that can be obviously obtained by any technician familiar with the field within the technical scope disclosed in the present invention belongs to the protection scope of the present invention.

Claims

1. A method for identifying early leaves of corn, characterized in that: include: An improved YOLOv8 model is constructed. The improved YOLOv8 model includes an improved backbone network, an improved neck network and a head network. The C2F module of the improved backbone network is integrated with a FasterNet module. The FasterNet module includes a partial convolution module. The improved neck network includes an LSKNet network. Obtain a historical image dataset containing early corn leaves, train the improved YOLOv8 model using the historical image dataset, and obtain a target detection network; The image data to be identified is obtained, and the image data is input into the target detection network. The partial convolution module in the FasterNet module selects some channels from the number of channels of the input feature map for convolution operation, and the convolved feature map and the unconvolved channel are merged to obtain a new feature map. The new feature map is input into the improved neck network, and the LSKNet network is used to perform decomposition, fusion and selection operations in sequence to dynamically adjust the receptive field of the neck network to obtain the output feature map. The output feature map is input into the head network, and the early leaves of corn are identified based on the input feature map.

2. The method for identifying early leaves of corn according to claim 1, characterized in that: Through the partial convolution module in the FasterNet module, some channels are selected from the number of channels of the input feature map for convolution operation, including: Perform channel segmentation according to the number of channels of the input feature map and the preset segmentation parameters; Perform standard convolution operation on the separated channels that need to be convolved.

3. The method for identifying early leaves of corn according to claim 1 or 2, characterized in that: The LSKNet network is used to perform decomposition, fusion and selection operations in sequence to dynamically adjust the receptive field of the neck network and obtain the output feature map, including: The input feature map is decomposed through two different large convolution kernels to obtain multi-level and multi-scale features in the image; The two different convolution outputs are concatenated through channels, and a mixed pooling operation is performed on the concatenated feature map to enhance the feature map; The weights of large convolution kernels are adjusted through the spatial selection mechanism to enhance the focus on the target area in the feature map; the Sigmoid function is used to generate a mask, and the mask is element-wise multiplied with the feature map to obtain the output feature map.

4. The method for identifying early leaves of corn according to claim 1 or 2, characterized in that: Train the improved YOLOv8 model, including: The learning rate and weight parameters of the improved YOLOv8 model are initialized by the whale optimization algorithm to obtain multiple parameter combinations, each of which includes different learning rates and weight parameters; The loss function of the improved YOLOv8 model is used as the objective function of the whale optimization algorithm to calculate the fitness value corresponding to each parameter combination; The position update strategy based on the whale optimization algorithm updates the parameter combination and calculates the corresponding fitness value; The process of iteratively updating parameter combinations and calculating fitness is repeated until the preset stop condition is reached, and the parameter combination with the smallest fitness value is used as the final learning rate and weight parameters of the improved YOLOv8 model.

5. The method for identifying early leaves of corn according to claim 1 or 2, characterized in that: Before the image data is fed into the target detection network, it also includes: Segmentation of image data, including: Get a fixed threshold value and convert the image data into a binary image by using the fixed threshold value; or, Calculate the corresponding super green factor for each pixel in the image data, retain the pixels whose super green factor is greater than a preset threshold, and filter out the pixels whose super green factor is less than or equal to the preset threshold; or, The target threshold is determined by the maximum inter-class variance, and the image data is binarized and segmented based on the target threshold.

6. The method for identifying early leaves of corn according to claim 5, characterized in that: The target threshold is determined by the maximum inter-class variance, including: Convert image data into grayscale image, calculate the histogram of grayscale image and normalize it; For each candidate threshold, the image is segmented into foreground and background, and the inter-class variance between foreground and background is calculated; The threshold that maximizes the inter-class variance is taken as the target threshold.

7. The method for identifying early leaves of corn according to claim 5, characterized in that: After the image data is segmented, it also includes: The segmented images are denoised, contrast enhanced and cropped.

8. A corn early leaf recognition device, characterized in that: include: A construction module is used to construct an improved YOLOv8 model. The improved YOLOv8 model includes an improved backbone network, an improved neck network and a head network. The C2F module of the improved backbone network is integrated with a FasterNet module. The FasterNet module includes a partial convolution module. The improved neck network includes an LSKNet network. A training module is used to obtain a historical image dataset containing early corn leaves, and train the improved YOLOv8 model using the historical image dataset to obtain a target detection network; The recognition module is used to obtain image data to be recognized, input the image data into the target detection network, select some channels from the number of channels of the input feature map for convolution operation through the partial convolution module in the FasterNet module, merge the convolved feature map and the unconvolved channel to obtain a new feature map, input the new feature map into the improved neck network, and perform decomposition, fusion and selection operations in sequence through the LSKNet network to dynamically adjust the receptive field of the neck network to obtain an output feature map; input the output feature map into the head network, and recognize the early leaves of corn based on the input feature map.

9. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the corn early leaf recognition method as claimed in any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method for identifying early leaves of corn according to any one of claims 1 to 7 is implemented.