Hybrid rice seeding into strip evaluation method, device, equipment and medium
Through the improved YOLOv8n model and image preprocessing algorithm, an objective evaluation of the strip formation of hybrid rice sowing was achieved, the subjectivity of manual visual inspection was solved, the detection accuracy and robustness were improved, and the sowing quality was ensured.
Patent Information
- Application Number
- CN202411402829.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-10-09
AI Technical Summary
In the existing technology, the evaluation of strip formation of mechanized hybrid rice seedling raising and sowing mainly adopts manual visual inspection, which is highly subjective and urgently needs objective evaluation and data support.
An improved YOLOv8n model was used for target detection. By replacing the Conv module with the PConv module and adding the ECA channel attention mechanism in the neck network, an improved YOLOv8n model was constructed. Combined with the image preprocessing algorithm, the seeding area image of the seedling tray was adjusted and segmented, and the qualified rate of seeding strips in the seeding tray was calculated.
The detection accuracy and robustness of seeding strip formation are improved, and the qualified strip areas can be accurately identified, thereby reducing detection errors and providing reliable seeding quality control.
Smart Images

Figure CN119295940B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of agricultural production, and in particular to a method for evaluating the striping of hybrid rice sowing, a corresponding device, an electronic device and a computer-readable storage medium. Background Art
[0002] Hybrid rice is an important food crop, accounting for more than 50% of China's rice-cultivated area. Mechanized blanket transplanting of hybrid rice seedlings is an important method of mechanized hybrid rice production.
[0003] Hybrid rice seedling cultivation using low-seeding drills is a seedling tray raising technology based on a production line. It is a key research topic in addressing the challenges of mechanized hybrid rice transplanting. Low-seeding drills cultivate strong seedlings using a reduced seeding rate, consistent with hybrid rice agronomic requirements. The goal of low-seeding drills is to achieve uniform strip arrangement of hybrid rice seedlings within the seedling trays. Strip formation is a key indicator of mechanized seeding quality.
[0004] Currently, the evaluation of strip formation during mechanized hybrid rice seedling raising mainly relies on manual visual inspection, which is highly subjective. There is an urgent need to objectively evaluate strip formation and promptly provide data support for seeding machine performance control systems. Therefore, research on strip formation evaluation technology is of great significance.
[0005] In summary, the existing technology for evaluating the strip formation of mechanized hybrid rice seedlings is mainly based on manual visual inspection, which is highly subjective. The applicant has made corresponding explorations to solve this problem. Summary of the Invention
[0006] The purpose of this application is to solve the above problems and provide a method for evaluating the strip formation of hybrid rice sowing, a corresponding device, an electronic device and a computer-readable storage medium.
[0007] In order to meet the various objectives of this application, this application adopts the following technical solutions:
[0008] A method for evaluating the strip formation of hybrid rice sown in response to one of the purposes of this application comprises:
[0009] In response to a hybrid rice sowing strip assessment instruction, an image of a seedling tray sowing area containing rice sprouts is acquired;
[0010] In the C2f structure in the backbone network of the original YOLOv8n model, which contains multiple Bottleneck structures, the Conv module in the Bottleneck structure is replaced with the PConv module to determine the PConv_C2f structure, and the ECA channel attention mechanism is added before the upsampling operation of the neck network to build an improved YOLOv8n model;
[0011] Using an improved YOLOv8n model that has been trained to a convergent state to perform target detection on the seedling tray sowing area image to determine coordinate information and categories of rice sprouts in the seedling tray sowing area, and determining the number of rice sprouts corresponding to qualified strips in the seedling tray sowing area image based on the coordinate information;
[0012] The ratio between the number of rice sprouts corresponding to the qualified strip-forming area and the total number of rice sprouts in the seeding tray sowing area is calculated and determined, and the ratio is used as the qualified rate of seeding tray sowing strips to complete the evaluation of hybrid rice sowing strips.
[0013] Optionally, the backbone network in the improved YOLOv8n model includes 5 Conv modules, 4 PConv_C2f structures and 1 SPPF structure;
[0014] The neck network in the improved YOLOv8n model includes 3 Concat operations, 2 Upsample upsampling operations, 4 PConv_C2f structures, 2 Conv modules and 2 ECA attention mechanism modules;
[0015] The head network in the improved YOLOv8n model adopts a decoupled head structure.
[0016] Optionally, the ECA channel attention mechanism calculates the weight values of different channels by one-dimensional convolution, multiplies the weight values by the input feature map, and assigns different weights to the input feature map channels, so that the network can focus on key channel information.
[0017] Optionally, the improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprouts in the seedling tray sowing area, and the step of determining the number of rice sprouts corresponding to the qualified strips in the seedling tray sowing area image according to the coordinate information includes:
[0018] The pre-processed seedling tray sowing area image is input into the improved YOLOv8n model that has been trained to convergence. After multiple convolutions and PConv_C2f structures in the backbone network, multi-level feature maps are extracted.
[0019] Different levels of feature maps are spliced by a Concat operation to combine high-level semantic information and low-level detail information, and an ECA channel attention mechanism is applied to the spliced feature maps to enhance the model's response to important features and suppress noise and irrelevant features;
[0020] The processed feature map is input into a decoupling head structure, and the model classifies and locates the rice seedlings, and outputs the category and bounding box coordinates of each detected rice seedling;
[0021] The coordinate information of the rice seedlings is extracted from the model output, wherein the coordinate information represents the specific position of the rice seedlings in the seedling tray sowing area;
[0022] According to the coordinate information of the rice seedlings and the preset strip-eligible area, the number of rice seedlings in the strip-eligible area is counted.
[0023] Optionally, the improved YOLOv8n model trained to a convergent state is used to detect the target in the seedling tray sowing area image to determine the coordinate information and category of the rice seedlings in the seedling tray sowing area, and the step of determining the number of rice seedlings corresponding to the strip-eligible area in the seedling tray sowing area image according to the coordinate information comprises:
[0024] The seedling tray bottom soil corresponding to the seedling tray sowing area is equally divided into 18 rows, wherein the center line of each row is the seed furrow center line;
[0025] In each row of the sowing area, the seed furrow center line is taken as the reference, and the area on both sides of the seed furrow center line covering two-thirds is selected as the strip-eligible area;
[0026] If two-thirds of the volume of a certain rice seedling falls within the strip-eligible area, the rice seedling is considered to fall within the strip-eligible area, and the number of rice seedlings falling within the strip-eligible area is counted according to the demarcated strip-eligible area to determine the number of rice seedlings corresponding to the strip-eligible area;
[0027] The total number of all rice seedlings in the seedling tray sowing area is counted to determine the total number of rice seedlings in the seedling tray sowing area.
[0028] Optionally, the step of training the improved YOLOv8n model comprises:
[0029] Collect the seedling tray sowing area image containing rice seedlings in the sowing test, and adjust and segment the seedling tray sowing area image by using an image preprocessing algorithm to determine the training sample sub-area image, wherein the image preprocessing algorithm comprises an edge detection algorithm, a vertical projection algorithm and a sliding window algorithm;
[0030] The training sample sub-region images are annotated to construct an image dataset of seedling tray sowing areas containing rice sprout seeds, and the dataset is further expanded using data augmentation, and the dataset is randomly divided into a training set, a validation set, and a test set in proportion.
[0031] The training set is input into a preset improved YOLOv8n model for training to determine an improved YOLOv8n model that has been trained to a converged state.
[0032] Optionally, the step of calculating and determining the ratio between the number of rice sprout seeds corresponding to the qualified strip-forming area and the total number of rice sprout seeds in the seeding tray sowing area, and using the ratio as the qualified rate of seeding tray sowing strips, comprises:
[0033] It is detected whether the qualified rate of sowing strips of the seedling tray exceeds a preset qualified rate threshold. If it exceeds, the seedling tray corresponding to the sowing area of the seedling tray is used as a qualified sowing seedling tray to complete the evaluation of the sowing strips of hybrid rice.
[0034] A hybrid rice striping evaluation device provided for another purpose of the present application includes:
[0035] An image acquisition module is configured to respond to a hybrid rice sowing strip evaluation instruction and acquire an image of a seedling tray sowing area containing rice sprouts;
[0036] Model building module, in the C2f structure in the backbone network of the original YOLOv8n model, which contains multiple Bottleneck structures, replaces the Conv module in the Bottleneck structure with the PConv module to determine the PConv_C2f structure, and adds the ECA channel attention mechanism before the upsampling operation of the neck network to build an improved YOLOv8n model;
[0037] a bud seed quantity determination module configured to perform target detection on the seedling tray sowing area image using an improved YOLOv8n model that has been trained to a convergence state to determine coordinate information and categories of rice bud seeds in the seedling tray sowing area, and determine the number of rice bud seeds corresponding to the qualified strips in the seedling tray sowing area image based on the coordinate information;
[0038] The strip formation evaluation module is configured to calculate and determine the ratio between the number of rice sprouts corresponding to the qualified strip formation area and the total number of rice sprouts in the seedling tray sowing area, and use the ratio as the qualified rate of strip formation of seedling tray sowing to complete the evaluation of hybrid rice sowing strip formation.
[0039] An electronic device provided to meet another purpose of the present application includes a central processing unit and a memory, wherein the central processing unit is used to call and run a computer program stored in the memory to execute the steps of the hybrid rice sowing strip evaluation method described in the present application.
[0040] A computer-readable storage medium is provided to meet another purpose of the present application, which stores a computer program implemented according to the hybrid rice sowing strip evaluation method in the form of computer-readable instructions. When the computer program is called and executed by a computer, the steps included in the corresponding method are executed.
[0041] Compared with the existing technology, the present application addresses the problem that the evaluation of strip formation of mechanized hybrid rice seedling raising and sowing in the existing technology mainly adopts manual visual inspection, which is highly subjective. The present application includes but is not limited to the following beneficial effects:
[0042] First, the image preprocessing algorithm used in this application rotates and positions the collected image of the seedling tray sowing area containing rice sprout seeds through edge detection and vertical projection algorithms, thereby solving the problem of the seedling tray border being non-parallel to the image edge line and the difficulty in positioning the detection area.
[0043] Secondly, this application uses a sliding window algorithm to segment the training sample image using a fixed-size window, obtains sub-region images of the detection area and annotates them, thus solving the problem of dataset preparation;
[0044] Third, the improved YOLOv8n model achieves higher accuracy in rice bud detection, particularly when dealing with partially occluded or complex backgrounds. The PConv module effectively improves the recognition rate of rice buds. The ECA channel attention mechanism enhances the model's sensitivity to important features, thereby improving the accuracy of rice bud location. This is particularly important for assessing sowing strip integrity, which relies on accurate bud location and classification. Replacing the Conv module with the PConv module improves the model's robustness, effectively adapting to environmental changes and sample diversity, and reducing detection errors caused by data inconsistencies. By accurately determining the coordinates of rice buds, the improved model can better identify qualified strip areas and more accurately calculate the number of rice buds that meet the standards. This is crucial for sowing quality control.
[0045] Furthermore, by replacing the Conv module in the YOLOv8n model with a PConv module and introducing the ECA channel attention mechanism in the neck network, the accuracy and robustness of rice bud detection in the seeding area of the seedling tray were significantly improved. These improvements help to more accurately assess the strip formation of rice seeding, ensure seeding quality, and provide more reliable technical support for agricultural production. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0047] Figure 1 This is a flow chart of a method for evaluating the strip formation of hybrid rice sowing in an embodiment of the present application;
[0048] Figure 2 This is a schematic diagram of an image of a seedling tray sowing area containing rice sprout seeds collected in a sowing experiment in an embodiment of the present application;
[0049] Figure 3 Schematic diagram of the improved YOLOv8n model structure in the embodiment of the present application;
[0050] Figure 4 Schematic diagram of the PConv_C2f structure in an embodiment of the present application;
[0051] Figure 5 A schematic diagram of the PC_Bottleneck structure in an embodiment of the present application;
[0052] Figure 6 Schematic diagram of the improved YOLOv8n model training results in the embodiment of the present application;
[0053] Figure 7 This is a principle block diagram of the hybrid rice sowing strip evaluation device in an embodiment of the present application;
[0054] Figure 8 Schematic diagram of the structure of the computer device in the embodiment of the present application. DETAILED DESCRIPTION
[0055] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and are not to be construed as limiting the present application.
[0056] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0057] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with their meanings in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0058] It will be understood by those skilled in the art that the terms "client," "terminal," and "terminal device" as used herein include both devices that are wireless signal receivers, i.e., devices that only have wireless signal receivers without transmission capabilities, and devices that have receiving and transmitting hardware capable of two-way communication over a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers and tablet computers, which have single-line displays, multi-line displays, or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service), which may combine voice, data processing, fax, and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, Internet / Intranet access, a web browser, a notepad, a calendar, and / or a GPS (Global Positioning System) receiver; and conventional laptop and / or palmtop computers or other devices, which have and / or include a radio frequency receiver. As used herein, the terms "client," "terminal," or "terminal device" may be portable, transportable, or installed in a vehicle (air, sea, and / or land), or may be adapted and / or configured to operate locally and / or in a distributed manner at any other location on Earth and / or in space. As used herein, the terms "client," "terminal," or "terminal device" may also refer to a communication terminal, an Internet terminal, or a music / video playback terminal, such as a PDA, an MID (Mobile Internet Device), and / or a mobile phone with music / video playback capabilities, or may include a smart TV, a set-top box, or other device.
[0059] The hardware referred to by names such as "server", "client", and "service node" in this application is essentially an electronic device with capabilities equivalent to those of a personal computer. It is a hardware device that has the necessary components revealed by the von Neumann principle, such as a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. Computer programs are stored in its memory, and the central processing unit loads the program stored in the external memory into the internal memory for execution, executes the instructions in the program, and interacts with the input and output devices to complete specific functions.
[0060] It should be noted that the concept of "server" referred to in this application can also be extended to server clusters. Based on the network deployment principles understood by those skilled in the art, the servers described should be logically divided. In physical space, these servers can be independent of each other but callable through interfaces, or integrated into a single physical computer or a computer cluster. Those skilled in the art should understand this flexibility and should not use it to constrain the implementation of the network deployment method of this application.
[0061] Unless expressly specified, one or more technical features of the present application can be deployed on a server for implementation and accessed by a client through a remote call to obtain an online service interface provided by the server, or can be directly deployed and run on a client for implementation.
[0062] Unless expressly specified otherwise, the neural network models referenced or may be referenced in this application may be deployed on a remote server and remotely called on the client, or may be deployed and directly called on a client with sufficient device capabilities. In some embodiments, when it runs on the client, its corresponding intelligence may be obtained through transfer learning to reduce the requirements for the client's hardware operating resources and avoid excessive occupation of the client's hardware operating resources.
[0063] Unless explicitly specified, the various data involved in this application can be stored remotely on a server or on a local terminal device, as long as they are suitable for being called by the technical solution of this application.
[0064] Those skilled in the art should be aware that although the various methods of this application are described based on the same concept and thus exhibit commonality, unless otherwise specified, these methods can be independently executed. Similarly, the various embodiments disclosed in this application are all based on the same inventive concept. Therefore, concepts with the same expression, as well as concepts that are appropriately transformed for convenience despite different expression, should be understood as equivalent.
[0065] Unless expressly stated to be mutually exclusive, the various embodiments disclosed in this application may be cross-combined with the relevant technical features of the various embodiments to flexibly construct new embodiments, as long as such combination does not deviate from the creative spirit of this application and can meet the needs of the prior art or resolve certain deficiencies in the prior art. Those skilled in the art should be aware of such flexibility.
[0066] See also Figure 1 as well as Figure 2 In one embodiment, the hybrid rice sowing strip evaluation method of the present application comprises:
[0067] Step S10, responding to the hybrid rice sowing strip evaluation instruction, acquiring an image of the seedling tray sowing area containing rice sprouts;
[0068] The hybrid rice sowing strip evaluation system in the terminal device can respond to the hybrid rice sowing strip evaluation instruction and obtain an image of the seedling tray sowing area containing rice sprouts;
[0069] The type and source of the seedling tray sowing area image depends on the actual application scenario. For example, in the application scenario of seedling tray sowing, the seedling tray sowing area image can be a static picture specified by the user, or it can be the seedling tray sowing area image submitted by the onboard camera of the drone to the hybrid rice sowing strip evaluation system in the terminal device. Depending on the specific application scenario, the seedling tray sowing area image can be determined as needed.
[0070] In some embodiments, the qualified strip area refers to the area within the seedling tray sowing area that has been inspected and evaluated and meets specific standards and requirements. Only the area that meets these standards is recognized as the qualified strip area.
[0071] In some embodiments, seeding in seedling trays is a commonly used seedling raising technique, widely used in various crops, especially rice, vegetables, and flowers. Seeding in seedling trays can effectively increase the success rate of seedling raising, reduce labor costs, and improve plant growth.
[0072] Step S20: In the C2f structure in the backbone network of the original YOLOv8n model, which includes multiple Bottleneck structures, the Conv module in the Bottleneck structure is replaced with a PConv module to determine the PConv_C2f structure, and the ECA channel attention mechanism is added before the upsampling operation of the neck network to construct an improved YOLOv8n model;
[0073] After obtaining an image of the seedling tray sowing area containing rice sprouts, the C2f structure in the backbone network of the original YOLOv8n model, which contains multiple Bottleneck structures, replaces the Conv module in the Bottleneck structure with a PConv module to determine the PConv_C2f structure. An ECA channel attention mechanism is added before the upsampling operation of the neck network to construct an improved YOLOv8n model.
[0074] Furthermore, the backbone network in the improved YOLOv8n model includes five Conv modules, four PConv_C2f structures, and one SPPF structure. The neck network in the improved YOLOv8n model includes three Concat operations, two Upsample operations, four PConv_C2f structures, two Conv modules, and two ECA attention mechanism modules. The head network in the improved YOLOv8n model adopts a decoupled head structure. The ECA channel attention mechanism calculates the weight values of different channels through one-dimensional convolution, multiplies the weight values with the input feature map, and assigns different weights to the input feature map channels, so that the network can focus on key channel information.
[0075] The steps for training the improved YOLOv8n model include:
[0076] Step S201: collecting an image of a seedling tray sowing area containing rice sprout seeds in a sowing experiment, and adjusting and segmenting the image of the seedling tray sowing area using an image preprocessing algorithm to determine training sample sub-area images, wherein the image preprocessing algorithm includes an edge detection algorithm, a vertical projection algorithm, and a sliding window algorithm;
[0077] Step S202: annotating the training sample sub-region images to construct an image dataset of seedling tray sowing regions containing rice sprout seeds, further expanding the dataset using data augmentation, and randomly dividing the dataset into a training set, a validation set, and a test set in proportion;
[0078] Step S203: input the training set into a preset improved YOLOv8n model for training to determine an improved YOLOv8n model that has been trained to a converged state.
[0079] Through sowing experiments, images of the seedling tray sowing area containing rice sprouts were collected, and images of poor quality were removed. The training samples were adjusted and segmented using an image preprocessing algorithm, and divided into training samples and application samples. The segmented sub-images were annotated to construct a rice sprout area image dataset, and the dataset was further expanded using a data enhancement method. The dataset was randomly divided into training set, validation set, and test set in proportion. The dataset of rice sprout area images of the seedling tray sowing area containing rice sprouts was input into the improved YOLOv8n model, and a model with optimal performance was obtained after training. The test set in the dataset was input into the model with optimal performance to test the detection performance of the network and determine whether the improved YOLOv8n model has been trained to a convergent state.
[0080] For further information, see Figure 6The model test is inputting 1042 sub-area images into the optimal model for testing, using multiple indexes such as precision (P), recall rate (R), parameter quantity (Parameters), floating point operation quantity (FLOPs), model size (Model Size), average precision mean (mAP) and frame per second (FPS) to comprehensively evaluate the performance of the model, and ensure the reliability of the identification result.
[0081] The model test result is shown in Table 1. Compared with the YOLOv8n model, the improved YOLOv8n model has an increase of 3.2 percentage points in precision, an increase of 3.1 percentage points in recall rate, a reduction of 0.89M in parameter quantity, a reduction of 2.2G in floating point operation quantity, a reduction of 1.78MB in model size, an increase of 1.5 percentage points in mAP, and an increase of 8 frames / s in FPS. -1 .
[0082] Table 1 Comparison of model test results
[0083]
[0084] Further, the seeding and strip evaluation of the application sample is to divide 90 application sample seedling tray seeding area images into sub-area images through a sliding window with a size of 244x281, detect the sub-area images using the optimal model, and according to the rice bud seed detection coordinate information given by the model, if the given rice bud seed center coordinate falls into the strip qualified area, it means that the rice bud seed belongs to the strip qualified area. According to the above requirements, all sub-area images are traversed, the total number of rice bud seeds meeting the requirements is counted, and then the number of rice bud seeds in the strip qualified area in each frame of seedling tray seeding area image is obtained. According to the number of rice bud seeds in the strip qualified area and the total number of rice bud seeds in the seedling tray seeding area image, the seedling tray seeding strip qualified rate is calculated.
[0085] In some embodiments, the seeding test uses hybrid rice Taifengyou 208, and a 2ZSB-500 type rice seedling tray breeding precision seeding breeding assembly line developed by a certain university is used for seeding test. The seeding test includes three seeding methods of scattering, strip seeding and ditch strip seeding, three seeding amounts of 50g, 60g and 70g, a total of nine seeding types, a total of 2680 seedling tray seeding area images containing rice bud seeds are collected, including 2590 training samples and 90 application samples, and the image resolution size is 2268x4032.
[0086] In some embodiments, the image preprocessing algorithm adjusts and segments the training samples and the application samples, and the image preprocessing algorithms used include an edge detection algorithm, a vertical projection algorithm, and a sliding window algorithm. The edge detection algorithm comprises the Hough and Cannoy algorithms and is used to detect the edges of the rice seedling tray border. The vertical projection method binarizes the image of the rice seedling tray sowing area containing the rice sprout seeds to obtain a binary image. Based on the distribution of the grayscale values of the binary image, the detection area is located, and the resolution of the detection area image is adjusted to 4500×2200 to obtain a detection area image. In order to adapt the model to sub-area images of different resolutions and improve the model's generalization ability, the sliding window algorithm is designed to traverse the training sample images with windows of different sizes, with window sizes of 123×113, 184×161, and 244×281, respectively, resulting in a total of (720+336+144)*3=3600 training sample sub-area images.
[0087] In some embodiments, LabelImg standard software is used to label rice sprouts in sub-region images of training samples, and the labels are named 'seed' to generate corresponding txt label files; a data enhancement method is used to expand the training sample data set, and the data enhancement method mainly includes counterclockwise rotation, clockwise rotation, noise addition, horizontal flipping, vertical flipping, deformation scaling, and random scaling of the width and height of the sub-region images within a reasonable range. After expansion, the data set is randomly divided into 7:2:1, that is, 7294 training sets, 2085 validation sets, and 1042 test sets.
[0088] In some embodiments, see Figures 3 to 5 , Figure 3 Schematic diagram of the improved YOLOv8n model structure in the embodiment; Figure 4 Schematic diagram of the PConv_C2f structure in this embodiment; Figure 5 Schematic diagram of the PC_Bottleneck structure in this embodiment;
[0089] The improved YOLOv8n model includes an input, a backbone network, a neck network, and a head network, specifically including:
[0090] 1) Input: Mosaic data augmentation technology is used to stitch together different regions of multiple sub-region images. An adaptive anchor box calculation method is used to dynamically adjust the anchor box according to the shape and size of the target. Image quality is optimized by adjusting the grayscale padding.
[0091] 2) Backbone Network: The backbone network primarily extracts image features and transmits feature information at different scales to the Neck network. It consists of five Conv modules, four PConv_C2f structures, and one SPPF structure. The Conv modules in the C2f structure of the original YOLOv8n model are replaced with PConv modules, resulting in the PConv_C2f structure. The PConv_C2f structure replaces the Conv modules with PConv modules. The floating-point operation (FLOPs) of the PConv module is h×w×k²×cp², where h and w are the width and height of the feature map, k is the size of the convolution kernel, and cp is the number of channels affected by the convolution. Because PConv has only one-fourth the number of cp channels as Conv, the floating-point operation (FLOP) of the PConv module is one-fourth that of the Conv module. Replacing the C2f structure with the PConv_C2f structure reduces redundant computation in the network.
[0092] 3) Neck Network: The neck network is mainly used to fuse features of different depths and scales to enhance the expressiveness of features. It includes three Concat operations, two Upsample upsampling operations, four PConv_C2f structures, two Conv modules, and two ECA attention mechanism modules. ECA is a channel attention mechanism, which is added before the upsampling operation and serves as the input of the upsampling operation. The ECA channel attention mechanism calculates the weight values of different channels through one-dimensional convolution, multiplies the weight value by the input feature map, and assigns different weights to the input feature map channels, enabling the network to focus on key channel information. Its formula is as follows:
[0093] ω=σ(C1Dk(y)),
[0094] Among them, C1D represents one-dimensional convolution, k represents the size of the convolution kernel, σ represents the Sigmoid activation function, and ω represents the weight value.
[0095] 4) Head Network: The head network uses a decoupled head structure to separate the classification and detection tasks. The loss function includes regression loss and classification loss. The classification loss is calculated using BCE Loss, while the regression loss is calculated using DFLoss and CIoU Loss.
[0096] The CIoU calculation formula is as follows:
[0097]
[0098] Among them, (x,y) represents the center coordinates, (x gt ,y gt ) represents the center coordinate of the real box, W g 、H gRepresent the width and height of the minimum bounding rectangle of the real box and the predicted box respectively, α represents the weight function, which is used to balance the parameters, and v is the aspect ratio, which is used to measure the consistency of the height ratio.
[0099] In some embodiments, the model training environment is a Windows 10 operating system, and training is performed under the deep learning framework PyTorch. YOLOv8n.pt is selected as the pre-trained weights, and the training parameters are set to 200 epochs and 12 batch size. The constructed rice sprout dataset is input into the improved YOLOv8n model. After 200 epochs of training, the loss function converges, and the model achieves the highest accuracy in detecting rice sprouts. The training weights of the optimal model are saved.
[0100] Step S30: performing target detection on the seedling tray sowing area image using the improved YOLOv8n model that has been trained to a convergence state to determine coordinate information and categories of rice sprouts in the seedling tray sowing area, and determining the number of rice sprouts corresponding to the qualified strips in the seedling tray sowing area image based on the coordinate information;
[0101] After constructing the improved YOLOv8n model, the improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprout seeds in the seedling tray sowing area, and determine the number of rice sprout seeds corresponding to the qualified strips in the seedling tray sowing area image based on the coordinate information;
[0102] Furthermore, the improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprouts in the seedling tray sowing area, and the step of determining the number of rice sprouts corresponding to the qualified strips in the seedling tray sowing area image according to the coordinate information includes:
[0103] Step S301, dividing the soil under the seedling tray corresponding to the seeding area of the seedling tray into 18 equal rows, wherein the center line of each row is the center line of the seed furrow;
[0104] Step S302: In the sowing area of each row, with the center line of the seed furrow as a reference, select two-thirds of the area on both sides of the center line of the seed furrow as qualified strip areas;
[0105] Step S303: If two-thirds of the volume of a certain rice sprout is within the qualified strip forming area, the rice sprout is deemed to be within the qualified strip forming area. Based on the defined qualified strip forming area, the number of rice sprouts within the qualified strip forming area is counted to determine the number of rice sprouts corresponding to the qualified strip forming area.
[0106] Step S304: Count the total number of all rice sprout seeds in the seedling tray sowing area to determine the total number of rice sprout seeds in the seedling tray sowing area.
[0107] Furthermore, the improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprouts in the seedling tray sowing area, and the step of determining the number of rice sprouts corresponding to the qualified strips in the seedling tray sowing area image based on the coordinate information includes:
[0108] Step S3001: Input the pre-processed seedling tray sowing area image into the improved YOLOv8n model that has been trained to convergence, and extract a multi-level feature map through multiple convolutions and PConv_C2f structures of the backbone network;
[0109] Step S3002: Concatenate feature maps at different levels through a Concat operation to merge high-level semantic information with low-level detail information. Apply the ECA channel attention mechanism to the concatenated feature maps to enhance the model's response to important features and suppress noise and irrelevant features.
[0110] Step S3003: The processed feature map is input into the decoupling head structure, and the model classifies and locates rice sprouts, outputting the category and bounding box coordinates of each detected rice sprout;
[0111] Step S3004: extracting coordinate information of the rice sprout from the model output, wherein the coordinate information represents the specific position of the rice sprout in the seeding tray sowing area;
[0112] Step S3005: Counting the number of rice sprouts in the qualified strip area according to the coordinate information of the rice sprouts and the preset qualified strip area.
[0113] From the above steps, we can see that the improved YOLOv8n model can effectively detect the number of rice sprouts in qualified areas and achieve efficient agricultural production monitoring. It not only improves the accuracy of target detection, but also enhances the model's adaptability to complex scenarios through the introduction of the ECA attention mechanism and PConv module, providing reliable technical support for intelligent management in the agricultural field.
[0114] Step S40, calculating and determining the ratio between the number of rice sprouts corresponding to the qualified strip-forming area and the total number of rice sprouts in the seeding tray sowing area, and using the ratio as the seeding tray sowing strip-forming qualified rate to complete the hybrid rice sowing strip-forming quality evaluation.
[0115] The improved YOLOv8n model trained to a convergent state is used for target detection on the seedling tray seeding area image to determine the coordinate information and category of the rice seedlings in the seedling tray seeding area. After determining the number of rice seedlings corresponding to the qualified strip area in the seedling tray seeding area image according to the coordinate information, the ratio between the number of rice seedlings corresponding to the qualified strip area and the total number of rice seedlings in the seedling tray seeding area is calculated, and the ratio is taken as the seedling tray seeding strip qualification rate to complete the evaluation of the hybrid rice seeding strip qualification.
[0116] Further, the step of calculating the ratio between the number of rice seedlings corresponding to the qualified strip area and the total number of rice seedlings in the seedling tray seeding area and taking the ratio as the seedling tray seeding strip qualification rate comprises:
[0117] The seedling tray corresponding to the seedling tray seeding area is determined as a qualified seeding tray if the seedling tray seeding strip qualification rate exceeds the preset qualification threshold, thereby completing the evaluation of the hybrid rice seeding strip qualification.
[0118] Compared with the prior art, the present application is directed to the problem in the prior art that the evaluation of the hybrid rice mechanized seedling seeding strip qualification mainly adopts a manual visual inspection method and has strong subjectivity, and the present application includes but is not limited to the following beneficial effects:
[0119] Firstly, the image preprocessing algorithm used in the present application solves the problems of non-parallelism between the seedling tray frame and the image edge line and difficult detection area positioning by performing rotation and positioning operations on the collected seedling tray seeding area image containing rice seedlings through edge detection and vertical projection algorithms.
[0120] Secondly, the present application solves the data set production problem by using a fixed-size window to segment the training sample image through a sliding window algorithm, obtaining a sub-region image of the detection region and performing labeling.
[0121] Thirdly, the improved YOLOv8n model has higher accuracy in the detection of rice seedlings, especially in the case of partial occlusion or complex background, the application of the PConv module can effectively improve the recognition rate of rice seedlings, and the ECA channel attention mechanism can improve the sensitivity of the model to important features, thereby improving the positioning accuracy of rice seedlings. This is particularly important for evaluating the seeding strip qualification, because the evaluation of the strip qualification depends on the accurate location and classification of the seedlings. Replacing the Conv module with the PConv module improves the robustness of the model, which can effectively cope with environmental changes and sample diversity, and reduce detection errors caused by inconsistent data. By accurately determining the coordinates of the rice seedlings, the improved model can better identify the qualified strip area, thereby more accurately calculating the number of rice seedlings that meet the standard. This is crucial for seeding quality control.
[0122] Furthermore, by replacing the Conv module in the YOLOv8n model with a PConv module and introducing the ECA channel attention mechanism in the neck network, the accuracy and robustness of rice bud detection in the seeding area of the seedling tray were significantly improved. These improvements help to more accurately assess the strip formation of rice seeding, ensure seeding quality, and provide more reliable technical support for agricultural production.
[0123] See also Figure 7 , a hybrid rice sowing strip assessment device provided to meet one of the purposes of the present application includes an image acquisition module 1100, a model construction module 1200, a bud seed quantity determination module 1300 and a strip assessment module 1400. Among them, the image acquisition module 1100 is configured to respond to a hybrid rice sowing strip assessment instruction and obtain an image of the seedling tray sowing area containing rice bud seeds; the model construction module 1200 is configured to be in the C2f structure in the backbone network of the original YOLOv8n model, which includes multiple Bottleneck structures, and replace the Conv module in the Bottleneck structure with a PConv module to determine the PConv_C2f structure, and add an ECA channel attention mechanism before the upsampling operation of the neck network to construct an improved YOLOv8n model; the bud seed quantity determination module 1300 is configured to receive the seedling quantity information of the seedling tray and the rice bud seed. Module 1300 is configured to use the improved YOLOv8n model that has been trained to a convergent state to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprouts in the seedling tray sowing area, and determine the number of rice sprouts corresponding to the qualified strip area in the seedling tray sowing area image based on the coordinate information; the strip evaluation module 1400 is configured to calculate and determine the ratio between the number of rice sprouts corresponding to the qualified strip area and the total number of rice sprouts in the seedling tray sowing area, and use the ratio as the seedling tray sowing strip qualification rate to complete the evaluation of hybrid rice sowing strips.
[0124] Based on any embodiment of this application, please refer to Figure 8 Another embodiment of the present application further provides an electronic device, which can be implemented by a computer device, such as Figure 8As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions, and the database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor may implement a hybrid rice sowing strip evaluation method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor may execute the hybrid rice sowing strip evaluation method of the present application. The network interface of the computer device is used to connect and communicate with the terminal. Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0125] In this embodiment, the processor is used to execute Figure 7 The memory stores the program code and various data required to execute the modules and submodules. The network interface is used to transmit data between user terminals or servers. The memory in this embodiment stores the program code and data required to execute all modules / submodules in the hybrid rice sowing stripe evaluation device of the present application. The server can call the server's program code and data to execute the functions of all submodules.
[0126] The present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the hybrid rice sowing strip evaluation method described in any embodiment of the present application.
[0127] The present application also provides a computer program product, including a computer program / instruction, which, when executed by one or more processors, implements the steps of the hybrid rice sowing strip evaluation method described in any embodiment of the present application.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the method of the present application can be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of the method. The storage medium can be a computer readable storage medium such as a magnetic disc, an optical disc, a read-only memory (ROM), or a random access memory (RAM).
[0129] The above only describes some embodiments of the present application. It should be pointed out that those skilled in the art can make some improvements and refinements without departing from the principles of the present application. These improvements and refinements should also be considered within the scope of protection of the present application.
[0130] In summary, by replacing the Conv module in the YOLOv8n model with the PConv module and introducing the ECA channel attention mechanism in the neck network, the detection accuracy and robustness of rice seedlings in the seedling tray sowing area can be significantly improved. These improvements help to more accurately assess the straightness of rice sowing, ensure the quality of sowing, and provide more reliable technical support for agricultural production.
Claims
1. A method for evaluating the strip formation of hybrid rice, characterized in that: include: In response to a hybrid rice sowing strip assessment instruction, an image of a seedling tray sowing area containing rice sprouts is acquired; In the C2f structure in the backbone network of the original YOLOv8n model, it contains multiple Bottleneck structures, the Conv module in the Bottleneck structure is replaced with a PConv module to determine the PConv_C2f structure, and the ECA channel attention mechanism is added before the upsampling operation of the neck network to construct an improved YOLOv8n model, wherein the backbone network in the improved YOLOv8n model includes 5 Conv modules, 4 PConv_C2f structures and 1 SPPF structure; the neck network in the improved YOLOv8n model includes 3 Concat operations, 2 Upsample upsampling operations, 4 PConv_C2f structures, 2 Conv modules and 2 ECA attention mechanism modules; the head network in the improved YOLOv8n model adopts a decoupled head structure, and ECA is a channel attention mechanism, which is added before the upsampling operation as the input of the upsampling operation; Using an improved YOLOv8n model that has been trained to a convergent state to perform target detection on the seedling tray sowing area image to determine coordinate information and categories of rice sprouts in the seedling tray sowing area, and determining the number of rice sprouts corresponding to qualified strips in the seedling tray sowing area image based on the coordinate information; The ratio between the number of rice sprouts corresponding to the qualified strip-forming area and the total number of rice sprouts in the seeding tray sowing area is calculated and determined, and the ratio is used as the qualified rate of seeding tray sowing strips to complete the evaluation of hybrid rice sowing strips.
2. The hybrid rice sowing strip evaluation method according to claim 1, characterized in that: The ECA channel attention mechanism calculates the weight values of different channels by one-dimensional convolution, multiplies the weight values by the input feature map, and assigns different weights to the input feature map channels, so that the network can focus on key channel information.
3. The hybrid rice sowing strip evaluation method according to claim 1, characterized in that: The improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprout seeds in the seedling tray sowing area, and the step of determining the number of rice sprout seeds corresponding to the qualified strips in the seedling tray sowing area image according to the coordinate information includes: The pre-processed seedling tray sowing area image is input into the improved YOLOv8n model that has been trained to convergence. After multiple convolutions and PConv_C2f structures in the backbone network, multi-level feature maps are extracted. Through the Concat operation, feature maps at different levels are spliced together to merge high-level semantic information with low-level detail information. The ECA channel attention mechanism is applied to the spliced feature maps to enhance the model's response to important features and suppress noise and irrelevant features. The processed feature map is input into the decoupling head structure, and the model classifies and locates rice sprouts, outputting the category and bounding box coordinates of each detected rice sprout; Extracting coordinate information of the rice sprout from the model output, wherein the coordinate information represents a specific position of the rice sprout in the seeding tray sowing area; The number of rice sprouts in the qualified strip forming area is counted according to the coordinate information of the rice sprouts and the preset qualified strip forming area.
4. The hybrid rice sowing strip evaluation method according to claim 1, characterized in that: The improved YOLOv8n model that has been trained to a convergent state is used to perform target detection on the seedling tray sowing area image to determine the coordinate information and category of the rice sprout seeds in the seedling tray sowing area, and the step of determining the number of rice sprout seeds corresponding to the qualified strips in the seedling tray sowing area image according to the coordinate information includes: Divide the soil of the seedling tray corresponding to the seeding area into 18 equal rows, wherein the center line of each row is the center line of the seed furrow; In the sowing area of each row, taking the center line of the seed furrow as the reference, select the area covering two-thirds on both sides of the center line of the seed furrow as the qualified strip area; If two-thirds of the volume of a certain rice sprout seed falls within the qualified strip forming area, the rice sprout seed is deemed to fall within the qualified strip forming area, and the number of rice sprout seeds falling within the qualified strip forming area is counted based on the defined qualified strip forming area to determine the number of rice sprout seeds corresponding to the qualified strip forming area; The total number of all rice sprout seeds in the seedling tray sowing area is counted to determine the total number of rice sprout seeds in the seedling tray sowing area.
5. The hybrid rice sowing strip evaluation method according to claim 1, characterized in that: The steps for training the improved YOLOv8n model include: Collecting images of seedling tray sowing areas containing rice sprout seeds in a sowing experiment, and adjusting and segmenting the seedling tray sowing area images using an image preprocessing algorithm to determine training sample sub-area images, wherein the image preprocessing algorithm includes an edge detection algorithm, a vertical projection algorithm, and a sliding window algorithm; The training sample sub-region images are annotated to construct an image dataset of seedling tray sowing areas containing rice sprout seeds, and the dataset is further expanded using data augmentation, and the dataset is randomly divided into a training set, a validation set, and a test set in proportion. The training set is input into a preset improved YOLOv8n model for training to determine an improved YOLOv8n model that has been trained to a converged state.
6. The method for evaluating the strip formation of hybrid rice according to any one of claims 1 to 5, wherein: The step of calculating and determining the ratio between the number of rice sprout seeds corresponding to the qualified strip-forming area and the total number of rice sprout seeds in the seeding tray sowing area, and taking the ratio as the qualified rate of seeding tray sowing strips, comprises: It is detected whether the qualified rate of sowing strips of the seedling tray exceeds a preset qualified rate threshold. If it exceeds, the seedling tray corresponding to the sowing area of the seedling tray is used as a qualified sowing seedling tray to complete the evaluation of the sowing strips of hybrid rice.
7. A hybrid rice sowing strip evaluation device, characterized in that: include: An image acquisition module is configured to respond to a hybrid rice sowing strip evaluation instruction and acquire an image of a seedling tray sowing area containing rice sprouts; A model construction module is set to be in the C2f structure in the backbone network of the original YOLOv8n model, which includes multiple Bottleneck structures, replacing the Conv module in the Bottleneck structure with a PConv module to determine the PConv_C2f structure, and adding an ECA channel attention mechanism before the upsampling operation of the neck network to construct an improved YOLOv8n model, wherein the backbone network in the improved YOLOv8n model includes 5 Conv modules, 4 PConv_C2f structures and 1 SPPF structure; the neck network in the improved YOLOv8n model includes 3 Concat operations, 2 Upsample upsampling operations, 4 PConv_C2f structures, 2 Conv modules and 2 ECA attention mechanism modules; the head network in the improved YOLOv8n model adopts a decoupled head structure, and ECA is a channel attention mechanism, which is added before the upsampling operation as the input of the upsampling operation; a bud seed quantity determination module configured to perform target detection on the seedling tray sowing area image using an improved YOLOv8n model that has been trained to a convergence state to determine coordinate information and categories of rice bud seeds in the seedling tray sowing area, and determine the number of rice bud seeds corresponding to the qualified strips in the seedling tray sowing area image based on the coordinate information; The strip formation evaluation module is configured to calculate and determine the ratio between the number of rice sprouts corresponding to the qualified strip formation area and the total number of rice sprouts in the seedling tray sowing area, and use the ratio as the qualified rate of strip formation of seedling tray sowing to complete the evaluation of hybrid rice sowing strip formation.
8. An electronic device comprising a central processing unit and a memory, characterized in that: The central processing unit is configured to call and run a computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that It stores a computer program implemented according to the method described in any one of claims 1 to 6 in the form of computer-readable instructions, and when the computer program is called and executed by a computer, the steps included in the corresponding method are executed.
Citation Information
Patent Citations
Dense target detection model training method based on attention mechanism
CN115272828A
Improved Yolov5-crowps northeast crop disease identification method
CN117437541A