Corn yield estimation method and device
Through the deep neural network and target detection algorithm, combined with the YOLOv8n model and VFL Loss, the problem of low efficiency and low accuracy of traditional corn yield estimation methods is solved, achieving efficient and accurate estimation of corn yield, and providing better decisions for agriculture. support.
Patent Information
- Application Number
- CN202410605064.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-05-16
AI Technical Summary
Traditional corn yield estimation methods rely on manual sampling and simple statistical analysis, which are inefficient and inaccurate.
Deep neural network is used to train corn image data. Through the corn individual recognition model, cross-section recognition model and frontal corn kernel recognition model, combined with the YOLOv8n model and OBB detection algorithm, the VFL Loss optimization model is used to automatically identify and count corn kernels and improve estimation. Accuracy.
It improves the precision and accuracy of corn yield estimation, provides more comprehensive data support, provides more accurate decision-making support for agricultural production, and improves the performance and efficiency of the target detection model.
Smart Images

Figure CN118196639B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of corn planting. Background Art
[0002] Traditional corn yield estimation methods mainly rely on manual sampling and simple statistical analysis, which have problems of low efficiency and low accuracy. Summary of the invention
[0003] In order to solve the technical problems existing in the prior art, that the traditional corn yield estimation method mainly relies on manual sampling and simple statistical analysis, and has low efficiency and low precision, the technical solution provided by the present invention is:
[0004] A method for estimating corn yield, the method comprising:
[0005] Steps for collecting preset corn image data;
[0006] Steps for collecting preset corn yield estimation models;
[0007] Collect the steps of the preset optimization algorithm;
[0008] The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model;
[0009] Steps for collecting pictures to be tested;
[0010] A step of preprocessing the image to be tested;
[0011] The step of obtaining the total number of corn kernels according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, as well as the pre-processed test picture.
[0012] Furthermore, a preferred embodiment is provided, in which each corn is read separately by the corn individual recognition model, and then the number of columns of each corn is obtained by the corn cross-section recognition model. Finally, the number of corn kernels in a single column obtained by the front corn kernel recognition model is multiplied by the number of columns of the corn to obtain the number of kernels of each corn.
[0013] Furthermore, a preferred embodiment is provided, wherein the brightness and clarity of the preset corn image data both meet a preset threshold range.
[0014] Furthermore, a preferred embodiment is provided, wherein the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model adopt a Task-Aligned Assigner matching strategy.
[0015] Furthermore, a preferred embodiment is provided, wherein the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model are implemented using the YOLOv8n model.
[0016] Furthermore, a preferred embodiment is provided, wherein the positive corn kernel recognition model is implemented by using an OBB detection algorithm in combination with a YOLOv8n model.
[0017] Furthermore, a preferred implementation is provided, wherein the optimization algorithm is VFL Loss.
[0018] A corn yield estimation device, comprising:
[0019] A module for collecting preset corn image data;
[0020] Module for collecting preset corn yield estimation models;
[0021] Module for collecting preset optimization algorithms;
[0022] The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain modules of a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model respectively;
[0023] A module for collecting images to be tested;
[0024] A module for preprocessing the image to be tested;
[0025] A module for the total number of corn kernels is obtained according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, as well as the pre-processed image to be tested.
[0026] A computer storage medium is used to store a computer program. When the computer program is read by a computer, the computer executes the method.
[0027] A computer includes a processor and a storage medium. When the processor reads a computer program stored in the storage medium, the computer executes the method described.
[0028] Compared with the prior art, the technical solution provided by the present invention is beneficial in that:
[0029] The corn yield estimation method provided by the present invention uses large-scale corn plant image data to train a deep neural network to accurately detect and locate corn plants, provide more comprehensive data support, and thus improve the precision and accuracy of corn yield estimation. Compared with traditional methods, the target detection algorithm based on deep learning can better mine the characteristics of corn plants, realize automatic recognition and counting of corn kernels, and estimate yield based on the number of kernels.
[0030] Compared with the traditional target detection algorithm, the corn yield estimation method provided by the present invention optimizes the YOLOv8 algorithm in the backbone network and the Neck part, thereby improving the performance and accuracy of the model. The Anchor-Free method is also adopted to make the model simpler and more efficient, and better performance can be achieved in the target detection task.
[0031] The corn yield estimation method provided by the present invention adopts VFL Loss to perform model optimization, reduces the loss contribution of negative examples by adjusting the loss scaling factor, retains more learning information, and improves the performance and efficiency of the target detection model.
[0032] The corn yield estimation method provided by the present invention performs segmentation processing on the input photo to reduce the interference of other objects on the recognition result. The image is processed by an edge detection operator to connect the edge points into continuous line segments to improve the accuracy and stability of the recognition result.
[0033] The corn yield estimation method provided by the present invention screens the collected data for brightness and clarity, excludes photos of poor quality, and improves the reliability and accuracy of the data. At the same time, the data is marked in detail to accurately capture the location and characteristics of each corn plant, providing a reliable data basis for model training.
[0034] The corn yield estimation method provided by the present invention can improve the precision and accuracy of corn yield estimation and provide more accurate decision support for agricultural production.
[0035] Compared with traditional corn yield estimation methods, the corn yield estimation method provided by the present invention utilizes deep learning technology and target detection algorithms to better mine the characteristics of corn plants, realize automatic recognition and counting of corn kernels, and estimate the yield based on the number of kernels.
[0036] Compared with the existing research status, the corn yield estimation method provided by the present invention adopts the YOLOv8 algorithm and VFL Loss for model optimization, thereby improving the performance and efficiency of target detection. At the same time, through image segmentation processing and data screening and marking, the accuracy and stability of the recognition result are improved.
[0037] The corn yield estimation method provided by the present invention can be applied to corn yield estimation work in agricultural production. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a flow chart of the corn yield estimation method;
[0039] Figure 2 is a simplified vector representation;
[0040] Figure 3 Schematic diagram of the quantitative relationship between the number of visible columns and the total number of columns of corn when there are 20 columns;
[0041] Figure 4 Schematic diagram of the quantitative relationship between the number of visible columns and the total number of columns of corn when there are 18 columns;
[0042] Figure 5 Schematic diagram of the relationship between the number of visible columns and the total number of columns of corn when there are 16 columns;
[0043] Figure 6 Schematic diagram of the quantitative relationship between the number of visible columns and the total number of columns of corn when there are 14 columns;
[0044] Figure 7 Schematic diagram of the quantitative relationship between the number of visible columns and the total number of columns of corn when there are 12 columns;
[0045] Figure 8 - Fig.10 Schematic diagram for corn placement;
[0046] Fig.11 for Figure 8 Schematic diagram of the results of corn identification;
[0047] Fig.12 for Fig. 9 Schematic diagram of the results of corn identification;
[0048] Fig.13 for Fig.10 Schematic diagram of corn identification results.
[0049] Wherein, A represents a reference object having a standard value for diameter. DETAILED DESCRIPTION
[0050] In order to make the advantages and benefits of the technical solution provided by the present invention more clearly reflected, the technical solution provided by the present invention is now further described in detail with reference to the accompanying drawings, specifically:
[0051] Embodiment 1: This embodiment provides a method for estimating corn yield, the method comprising:
[0052] Steps for collecting preset corn image data;
[0053] Steps for collecting preset corn yield estimation models;
[0054] Collect the steps of the preset optimization algorithm;
[0055] The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model;
[0056] Steps for collecting pictures to be tested;
[0057] A step of preprocessing the image to be tested;
[0058] The step of obtaining the total number of corn kernels according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, as well as the pre-processed test picture.
[0059] Implementation method 2. This implementation method further limits the corn yield estimation method provided in implementation method 1. Each corn is read separately by the corn individual recognition model, and then the number of columns of each corn is obtained by the corn cross-section recognition model. Finally, the number of corn kernels in a single column obtained by the front corn kernel recognition model is multiplied by the number of columns of the corn to obtain the number of kernels of each corn.
[0060] Implementation method three: This implementation method further limits the corn yield estimation method provided in implementation method one, and the brightness and clarity of the preset corn image data both meet the preset threshold range.
[0061] Implementation method 4: This implementation method further limits the corn yield estimation method provided in implementation method 1. The corn individual recognition model, corn cross-section recognition model and front corn kernel recognition model adopt a Task-Aligned Assigner matching strategy.
[0062] Implementation method five: This implementation method further limits the corn yield estimation method provided in implementation method one. The corn individual recognition model, corn cross-section recognition model and front corn kernel recognition model are implemented using the YOLOv8n model.
[0063] Implementation method six: This implementation method further limits the corn yield estimation method provided in implementation method one. The positive corn kernel recognition model is implemented using the OBB detection algorithm in combination with the YOLOv8n model.
[0064] Implementation method seven: This implementation method further limits the corn yield estimation method provided in implementation method one, and the optimization algorithm is VFL Loss.
[0065] Embodiment 8: This embodiment provides a corn yield estimation device, the device comprising:
[0066] A module for collecting preset corn image data;
[0067] Module for collecting preset corn yield estimation models;
[0068] Module for collecting preset optimization algorithms;
[0069] The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain modules of a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model respectively;
[0070] A module for collecting images to be tested;
[0071] A module for preprocessing the image to be tested;
[0072] A module for the total number of corn kernels is obtained according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, as well as the pre-processed image to be tested.
[0073] Embodiment 9: This embodiment provides a computer storage medium for storing a computer program. When the computer program is read by a computer, the computer executes the method provided in embodiment 1.
[0074] Embodiment 10: This embodiment provides a computer, including a processor and a storage medium. When the processor reads a computer program stored in the storage medium, the computer executes the method provided in embodiment 1.
[0075] Implementation Method XI: Combination Figure 1-7 This embodiment is described in detail and completely through specific examples. Specifically:
[0076] This implementation first uses YOLOv8 for training to detect and identify corn and reference objects, thereby obtaining the length and width information of corn. Then, the obb model of YOLOv8 is trained to detect and identify the number of corn kernels and the number of cross-section kernels (representing the number of columns). Figure 3-7 , the relationship between the number of columns and the number of visible columns on the front of the photo and the number of visible grains on the front, and the total number of grains are estimated. Finally, the yield of corn is calculated using the yield estimation formula. Through this series of steps, the present embodiment can efficiently and quickly evaluate the yield of corn in the farmland without threshing and counting, and provide scientific decision support for agricultural production.
[0077] Filter the collected data. When filtering the data, use the OpenCV library to process the collected photos to ensure the reliability of the data source. First, filter according to the brightness level of the photos. Through the image processing function provided by the OpenCV library, calculate the brightness value of each photo, and set a threshold to exclude photos with insufficient brightness or overexposure, so as to ensure that the selected photos have appropriate brightness and ensure the accuracy of subsequent processing. Secondly, evaluate and filter the clarity of the photos. Using the image processing algorithm provided by the OpenCV library, calculate the clarity indicators of the photos, such as the contrast of the image and the clarity of the outline. Then, set a clarity threshold to exclude photos with clarity below this threshold to ensure that the selected photos have sufficient clarity and can provide reliable data support. By filtering the brightness and clarity of the collected photos, exclude photos of poor quality, and improve the reliability and accuracy of the data. Such a data screening process can provide a more reliable basis for subsequent data analysis and processing.
[0078] Comparison of object detection training models. Compared with YOLOv5, YOLOv8 provides a brand new SOTA model. Like YOLOv5, it also provides models of different sizes of N / S / M / L / X scales based on the scaling factor, supporting image classification, object detection, instance segmentation and posture detection tasks. In the backbone network and Neck part, the C3 structure of YOLOv5 is replaced with the C2f structure with richer gradient flow, and the number of channels is adjusted for different scale models, which greatly improves the model performance; the Head part is replaced with the current mainstream decoupled head structure, separating the classification and detection heads, and also replaced from Anchor-Based to Anchor-Free. The TaskAlignedAssigner positive sample allocation strategy is used in Loss calculation, and Distribution Focal Loss is introduced. A method called Anchor-Free is used instead of the traditional Anchor-Based method. In YOLOv8, the Anchor-Free method abandons the predefined anchors and locates the target by predicting the center point of the target and the width and height of the bounding box. The advantage of this method is that it does not require a set of anchor points to be defined in advance, making the model simpler and more flexible, and better able to adapt to target objects of various scales and shapes. The basic idea of the Anchor-Free method is to predict the center point coordinates of the target object and the width and height of the bounding box in each grid cell through regression, rather than predicting the offset relative to the predefined anchor point. This method has better adaptability than the traditional Anchor-Based method, can more accurately detect target objects of various scales and shapes, and also reduces the complexity and computation of the model. Therefore, YOLOv8 adopts the Anchor-Free method, which makes the model simpler and more efficient, and can achieve better performance in target detection tasks.
[0079] Selection of target detection algorithm optimization. The matching strategy of Task-Aligned Assigner in YOLOv8 can be summarized as selecting positive samples based on the weighted combination of classification score and IoU value. The formula is as follows:
[0080] ,
[0081] Among them, the classification score (s) represents the model's confidence in the object category in the prior box, and the IoU value (u) represents the degree of overlap between the predicted box and the real box. and Represents the weight hyperparameter, which is sorted according to the matching degree and then optimized and verified multiple times to obtain the best value. Take 1.0, Take 0.6. By weighted combination of these two indicators, high-quality prior boxes can be better selected as positive samples, thereby improving the performance and accuracy of the target detection model. In general, the role of Task-AlignedAssigner is to dynamically select high-quality positive samples based on the comprehensive situation of classification scores and IoU values to achieve task alignment and guide the network to focus on high-quality prior boxes, thereby improving the performance of target detection.
[0082] In this embodiment, the YOLOv8n model is used for training. First, the parameter nc: 1 # number of classes is modified as the identification type, and names: 0: corn1: icon is used as the identification category, so as to obtain the corn individual recognition model.
[0083] YOLOv8-obb is trained to detect rotating targets of corn kernels. The shape of corn kernels is irregular. Therefore, the obb rotating target detection method is adopted, and the OBB detection algorithm (Oriented bounding box) is a directional bounding box. It is a technology based on SAT (Separating Axis Theorem) that is used to determine the directional bounding box of an object. Unlike only being used for rectangular collision detection, OBB is a more general algorithm model. A bounding box is a simple geometric shape that can completely surround an object, while the separating axis theorem is a method for determining whether two geometric shapes intersect. In this implementation, only the case of rectangles needs to be considered, and a vector method is used to determine whether two objects collide. Simplified to a vector representation as follows Figure 2 As shown:
[0084] Assume that the unit vector on the X-axis is (1, 0). Then the dot product of vector P and the unit vector on the X-axis has the following formula:
[0085] ,
[0086] in p is a vector, x is the axis unit vector. The coordinates of point P are (px, py), where x represents the x-axis coordinate value of point p, and y represents the y-axis coordinate value of point p. cospx is the cosine value of the angle between p and x, Figure 2 In the example, Q is the angle of p on the x-axis, and cospx can also be cospQ, which is the cosine value of the angle between p and Q. In this embodiment, the YOLOv8-obb model is used as the basic model for training. Thus, a rotating target detection model of corn kernels is obtained.
[0087] YOLOv8 is trained to detect the number of corn columns. Modify the parameters nc: 1 # number of classes as the identification type and names: 0: icon as the identification category to obtain the model of the number of visible columns in the front photo.
[0088] YOLOv8 is trained to detect the number of columns in the cross section of corn. The corn is split from the middle, and the cross section is taken as the recognition target. The number of kernels is obtained as the total number of columns of corn, and the YOLOv8n model is used for training. Modify the parameters nc: 1 # number of classes as the recognition type and names: 0: column as the recognition category to obtain the corn cross section column number recognition model.
[0089] YOLOv8 is trained to detect the number of corn rows. The corn is split from the middle, and the cross section is taken as the recognition target. The number of kernels is obtained as the total number of corn rows, and the YOLOv8n model is used for training. Thus, a corn row number recognition model is obtained.
[0090] Select multiple algorithms to optimize the model. VFL Loss is designed to address the problem of severe imbalance between foreground and background in dense object detection training, and is inspired by Focal Loss. Focal Loss adjusts the loss function by introducing a modulation factor, reducing the loss contribution of simple samples and increasing attention to misclassified samples. However, the positive and negative samples processed by FocalLoss are symmetrical. In contrast, VFL Loss adopts an asymmetric weighting strategy that only reduces the loss contribution of negative samples, while retaining more learning information for rare positive samples. Specifically, VFL Loss sets the ground truth category score of the foreground point to the IoU between the generated bounding box and the ground truth according to the target score, while for background points, the scores of all classes are set to 0. In this way, VFL Loss has better performance and efficiency when dealing with unbalanced samples in dense object detection tasks. The formula is as follows:
[0091]
[0092] According to the formula, VFL Loss mainly reduces the loss contribution of negative examples (q=0) by adjusting the loss scaling factor γ, while relatively less reducing the weight of positive examples (q>0).
[0093] Before inputting the photo for recognition, the photo is segmented to reduce the interference of other objects on the recognition results. First, each pixel in the image is processed by the edge detection operator, and then the output of the operator is evaluated according to the pre-set criteria to determine whether it is an edge point. Next, some edge points may be removed or filled to eliminate the discontinuity of the edge and connect them into continuous line segments. The goal of edge detection is to find places where the grayscale or structure changes suddenly in the image, which mark the end of one area and the beginning of another. This sudden change is called an edge, which appears as a discontinuity in the pixel grayscale value in the image and can usually be detected by performing derivative operations on the image. The Sobel operator is used for calculation. The Sobel operator weights the values corresponding to the current row or column, and then averages and differs them, which is also called weighted average difference. The horizontal and vertical gradient templates are:
[0094] .
[0095] The total number of corn kernels is calculated based on the identified corn kernel counts on the front and cross sections. The following formula is used to calculate the total number of corn kernels.
[0096] ,
[0097] in, x 1 represents the number of visible particles, c 1 represents the number of visible columns, c 2 represents the total number of columns, so the total number of kernels on a cob can be calculated. z .
[0098] Use the following formula to estimate corn yield:
[0099] ,
[0100] in, x represents the effective number of ears, y represents the number of particles per stick (when there are multiple sticks, take the average), w Represents the weight of a single grain in grams (g). z Represents moisture content. Using empirical data as input, the commonly used constants are: effective ear number: 4000, single grain weight: 0.36, moisture content: 0.25. According to the formula c (yield per mu), unit: kilogram (kg).
[0101] Implementation Method 12: Combination Figure 3-13 This embodiment is described. This embodiment is a specific example provided according to the eleventh embodiment, and is used to demonstrate the benefits of the technical solution provided above. Specifically:
[0102] Step 1: Data collection and preprocessing:
[0103] In order to train and optimize the corn yield estimation algorithm, a large amount of corn image data is collected and strictly screened to ensure that only qualified corn data is included in the training set. These data include single-cob corn photos and corn cross-section photos to fully reflect the growth status and characteristics of corn plants. Through such data collection and screening, a more accurate and reliable model is established to provide more precise decision-making support for agricultural production. At the same time, the data set is continuously updated and improved to adapt to the corn growth conditions in different seasons and regions. The data includes single-cob corn photos and corn cross-section photos.
[0104] Step 2: Data labeling:
[0105] Two different types of corn data will be marked in detail. For corn individuals and cross-sectional photos, target detection will be used to mark them to accurately capture the location and characteristics of each corn plant. For front-facing corn photos, target detection will also be used to mark them to identify and annotate the shape and state of the corn. For cross-sectional corn kernels, rotation detection will be used to mark them to ensure accurate detection of the location and quantity of each corn kernel. Through this detailed marking method, key information in corn data can be effectively extracted and analyzed, providing a reliable data foundation for subsequent model training.
[0106] Step 3: Divide the data set and process the data:
[0107] After the collected data is screened for brightness and clarity through the opencv library, the data set is subdivided into training set, validation set and test set to ensure the effectiveness and generalization ability of model training. At the same time, for obb training, the labeling file is modified to meet the needs of rotation detection. The training set will be used for training and optimization of model parameters, the validation set will be used for hyperparameter adjustment and model performance evaluation, and finally, the test set will be used for evaluation of the final model and generalization ability test. The data set is divided strictly according to the division ratio and standard to ensure the consistency of data distribution and features between each data set.
[0108] Step 4: Training with YOLOv8:
[0109] Through training on a large number of data sets, four dedicated model files were successfully obtained for the recognition and analysis of different corn characteristics. The individual corn recognition model can accurately identify individual plants in a corn field and accurately locate and classify them. Its corn cross-section recognition model is specifically used to detect corn cross-sections and perform particle detection and counting. And the positive corn kernel recognition model is dedicated to identifying kernels in corn photos to provide farmers with an accurate assessment of corn yields.
[0110] Step 5: Test verification and model optimization:
[0111] In order to verify the recognition results of the model, we need to pay attention to some possible situations, such as the cross-section corn kernel misidentifying the white area inside the husk as corn kernels, or the individual recognition results of cropped corn are quite different from those of uncropped corn. In response to these problems, a series of optimization measures are taken. First, increase the diversity of the data set, including images of various lighting conditions, angles, and corn varieties to cover more possible situations. Second, relabel the training data to ensure the accuracy and consistency of the annotations and reduce the possibility of misjudgment of the model. In addition, the parameters and architecture of the model can be adjusted to increase its sensitivity to details and features, thereby improving the accuracy and stability of the recognition results. Through these optimization measures, the performance of the model is continuously improved, so that it can better cope with various complex situations and improve the reliability and practicality of the recognition results.
[0112] Step 6: Segment and identify the input image:
[0113] Figure 8 , 9 and 10 are the input pictures, Fig.11 , 12 and 13 are respectively Figure 8 , 9 And 10 are used for identification to obtain the recognition result.
[0114] in, Figure 8-13 In this embodiment, the reference object A having a standard diameter has a diameter of 4 cm; Fig.11 In the sentence, “corn” means corn, and the number indicates the confidence level, that is, the similarity.
[0115] Step 7: Calculation of total grain count and estimated yield:
[0116] By substituting the number of columns represented by the identified front corn kernels and cross-sectional kernels into the formula for calculation, more comprehensive information can be obtained. This calculation can help evaluate the planting density of corn fields and the growth of corn plants. By analyzing these data, farmers can better adjust planting strategies and optimize field management, thereby improving yield and quality.
[0117] Obtain the total number of grains and the yield.
[0118] The technical solution provided by the present invention is further described in detail above through several specific implementation modes in order to highlight the advantages and benefits of the technical solution provided by the present invention. However, the several specific implementation modes described above are not intended to be used as limitations on the present invention. Any reasonable modification and improvement of the present invention, combination of implementation modes and equivalent substitution within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0119] In the description of this specification, only the preferred embodiments of the present invention are provided, and the scope of the rights of the present invention cannot be limited by this. In addition, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "N" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. Any process or method description in the flowchart or otherwise described herein can be understood to represent a module, fragment or portion of code including one or more executable instructions for implementing the steps of a custom logic function or process, and the scope of the preferred embodiment of the present invention includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a person skilled in the art of the art to which the embodiments of the present invention belong. The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logic function, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, device or device and execute instructions), or in combination with these instruction execution systems, devices or devices. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or device or in combination with these instruction execution systems, devices or devices. More specific examples (a non-exhaustive list) of computer readable media include the following: an electrical connection having one or N wirings (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM).In addition, the computer-readable medium may even be paper or other suitable medium on which the program may be printed, because the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or processing in other suitable ways as necessary, and then stored in a computer memory. It should be understood that the various parts of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiment, the N steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof may be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0120] A person of ordinary skill in the art can understand that all or part of the steps carried by the method of the above-mentioned embodiment can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the program, when executed, includes one or a combination of the steps of the method embodiment. In addition, each functional unit in each embodiment of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
Claims
1. Corn yield estimation method, It is characterized in that The method comprises: Steps for collecting preset corn image data; Steps for collecting preset corn yield estimation models; Collect the steps of the preset optimization algorithm; The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model; Steps for collecting pictures to be tested; A step of preprocessing the image to be tested; The step of obtaining the total number of corn kernels according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, and the pre-processed image to be tested; The step of estimating the corn yield according to the total number of corn kernels; Among them, the corn individual recognition model selects positive samples according to the weighted combination of classification score and IoU value, through the formula: ; Among them, the classification score s represents the model's confidence in the object category in the prior box, and the IoU value u represents the degree of overlap between the predicted box and the real box. and represents the weight hyperparameter, Take 1.0, Take 0.6; The optimization algorithm uses the formula: , To achieve, p is a vector, q is the true label, represents the weight hyperparameter, and the scaling factor γ of the adjustment loss is reduced to q = 0, the loss contribution of negative examples is reduced to q >0, the weight of the positive example; The calculation formula for the total number of corn kernels is: , Among them, x 1 represents the number of visible kernels, obtained by the positive corn kernel recognition model, c 1 represents the number of visible columns, obtained by the corn cross-section recognition model, c 2 represents the total number of columns, and the total number of kernels y on a single cob is obtained; By formula: , The corn yield is estimated, wherein x represents the number of effective ears, y represents the number of kernels per cob, w represents the weight of a single kernel in grams, and z represents the water content.
2. The corn yield estimation method according to claim 1, It is characterized in that Each corn is read separately by the corn individual recognition model, and then the number of columns of each corn is obtained by the corn cross-section recognition model. Finally, the number of single-column corn kernels obtained by the front corn kernel recognition model is multiplied by the number of columns of the corn to obtain the number of kernels of each corn.
3. The corn yield estimation method according to claim 1, It is characterized in that The brightness and clarity of the preset corn image data both meet the preset threshold range.
4. The corn yield estimation method according to claim 1, It is characterized in that The corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model adopt a Task-Aligned Assigner matching strategy.
5. The corn yield estimation method according to claim 1, It is characterized in that The corn individual recognition model, corn cross-section recognition model and front corn kernel recognition model are implemented using the YOLOv8n model.
6. The corn yield estimation method according to claim 1, It is characterized in that The positive corn kernel recognition model is implemented using the OBB detection algorithm in conjunction with the YOLOv8n model.
7. Corn yield estimation device, It is characterized in that The device comprises: A module for collecting preset corn image data; Module for collecting preset corn yield estimation models; Module for collecting preset optimization algorithms; The corn yield estimation model is trained according to the corn image data and the optimization algorithm to obtain modules of a corn individual recognition model, a corn cross-section recognition model and a front corn kernel recognition model respectively; A module for collecting images to be tested; A module for preprocessing the image to be tested; A module for obtaining the total number of corn kernels according to the corn individual recognition model, the corn cross-section recognition model and the front corn kernel recognition model, and the pre-processed image to be tested; A module for estimating corn yield based on the total number of kernels of the corn; Among them, the corn individual recognition model selects positive samples according to the weighted combination of classification score and IoU value, through the formula: ; Among them, the classification score s represents the model's confidence in the object category in the prior box, and the IoU value u represents the degree of overlap between the predicted box and the real box. and represents the weight hyperparameter, Take 1.0, Take 0.6; The optimization algorithm uses the formula: , To achieve, p is a vector, q is the true label, represents the weight hyperparameter, and the scaling factor γ of the adjustment loss is reduced to q = 0, the loss contribution of negative examples is reduced to q >0, the weight of the positive example; The calculation formula for the total number of corn kernels is: , Among them, x 1 Represents the number of visible particles, c 1 Represents the number of visible columns, c 2 represents the total number of columns, and the total number of kernels y on a single cob is obtained; By formula: , The corn yield is estimated, wherein x represents the number of effective ears, y represents the number of kernels per cob, w represents the weight of a single kernel in grams, and z represents the water content.
8. Computer storage media for storing computer programs, It is characterized in that When the computer program is read by a computer, the computer executes the method according to any one of claims 1 to 6.
9. A computer, including a processor and a storage medium, It is characterized in that When the processor reads the computer program stored in the storage medium, the computer executes the method according to any one of claims 1 to 6.
