Leafy vegetable seed precision seedling raising sowing performance detection system and construction method thereof

By combining Raspberry Pi and the Qt cross-platform framework with deep learning and OpenCV contour algorithms, a leafy vegetable seed sowing performance detection system was built. This system solves the problems of empty holes and reseeding in existing seeders, and achieves high-accuracy sowing performance detection and intelligent identification.

CN115937686BActive Publication Date: 2026-02-03SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211681629.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2026-02-03
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

Existing leafy vegetable seed planters have issues with empty holes or double-seeding during the design process, which affects the pass rate of seed count per hole and the detection of empty hole rate. It is necessary to improve the accuracy of seeding performance detection and intelligent identification.

Method used

A deep learning network model based on the Raspberry Pi and Qt cross-platform framework, combined with the OpenCV contour algorithm, is used to realize seedling hole localization and seed detection, and a leafy vegetable seed sowing quantity detection model is constructed. Intelligent recognition is achieved through image processing and deep learning network framework.

Benefits of technology

It improves the accuracy of leafy vegetable seed sowing performance testing, effectively identifies missed sowing and double sowing, provides intelligent sowing performance research conditions, and improves sowing quality and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937686B_ABST
    Figure CN115937686B_ABST
Patent Text Reader

Abstract

The system and its construction method for detecting the seeding performance of leaf vegetable seeds include the following steps: designing a Qt cross-platform framework, deploying a trained deep learning network model and a key function module to the Bullseye system of Raspberry Pi 4B; using the Qt to control an industrial camera to collect images of different leaf vegetable seed seedling trays, realizing the capturing, saving, selecting, opening, graying, binarizing and seed detecting of the seedling tray images; positioning each seedling hole based on a contour algorithm, detecting the missed seedling holes and recording the position information; detecting and identifying different leaf vegetable seed seedling tray images based on a deep learning network framework, constructing a network model for classifying leaf vegetable seeds and detecting the seeding amount, and comparing the detection accuracy of the network model; selecting evaluation indexes to test the deep learning network model, and selecting the optimal network model. The present application has important significance for the research and application of leaf vegetable seeds, and belongs to the technical field of leaf vegetable seed seeding performance identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of leafy vegetable seed sowing performance identification technology, specifically to a method for constructing a precision seedling raising and sowing performance testing system for leafy vegetables, and also to a precision seedling raising and sowing performance testing system for leafy vegetables constructed using this method. Background Technology

[0002] my country is a major agricultural country, and leafy vegetable cultivation has developed rapidly, becoming an important pillar of leafy vegetable production. Through research and production practice, my country has basically mastered the technology of tray seedling raising and has successfully applied it to industrialized seedling production. Tray seedling raising has many advantages: (1) seeds are evenly distributed, resulting in a high seedling survival rate; (2) seedlings in the trays are relatively independent, which can effectively reduce the spread of pests and diseases; (3) the use of unified sowing and management methods ensures that seedlings grow and develop uniformly, which is conducive to improving the quality of leafy vegetable seeds and large-scale production. This method has important value and significance for studying the stable production of grain and ensuring high grain yields in my country.

[0003] With the development of agriculture and the implementation of my country's targeted poverty alleviation policy, the development of seedling tray sowing and detection systems in my country has ushered in a new opportunity. The country is paying more and more attention to the research and development of seedling sowing and detection equipment with high accuracy and high integration. Developing high-precision, low-cost seedling tray sowing and detection systems with independent intellectual property rights is also the only way for my country's agriculture to achieve modernization.

[0004] The performance of the precision seeder directly determines the sowing quality. Due to current design flaws, gaps or double-seeding may occur during the sowing process, affecting the detection of qualified seed count per hole, gap rate, and double-seeding rate. Therefore, further research on gap reseeding and intelligent control of the seeder is needed. When the double-seeding rate is high, adjustments to the seeder parameters are required.

[0005] In summary, this invention utilizes Raspberry Pi, contour algorithms, and deep learning for intelligent identification of leafy vegetable seeds, providing favorable conditions for subsequent research on leafy vegetable seed planting and sowing performance. This research achieves seedling hole location and empty seedling hole detection through contour detection algorithms, and constructs leafy vegetable seed sowing quantity detection models based on different deep learning network frameworks. The impact of different network models on the accuracy of leafy vegetable seed sowing quantity detection is compared, and the optimal leafy vegetable seed sowing performance identification model is constructed. Summary of the Invention

[0006] To address the technical problems existing in the prior art, the purpose of this invention is to provide a precision seedling raising and sowing performance testing system for leafy vegetables and its construction method, thereby providing favorable conditions for subsequent research on the planting and sowing performance of leafy vegetables.

[0007] To achieve the above objectives, the present invention adopts the following technical solution:

[0008] The method for building a precision seedling raising and sowing performance testing system for leafy vegetables includes the following steps:

[0009] S1, Design a Qt cross-platform framework to deploy the trained deep learning network model and key function module to the Bullseye system of Raspberry Pi 4B;

[0010] S2 uses Qt to control an industrial camera to acquire images of seedling trays for different leafy vegetables, realizing the functions of capturing, saving, selecting and opening, grayscale conversion, binarization, and seed detection of seedling tray images;

[0011] S3, based on the contour algorithm, locate the position of each seedling hole in the leafy vegetable seedling tray, detect the missed seedling holes, and record the position information of the missed seedling holes;

[0012] S4. Based on a deep learning network framework, different leafy vegetable seed tray images are detected and identified. A network model for leafy vegetable seed classification and sowing quantity detection is constructed, and the detection accuracy of different network models is compared.

[0013] S5. Evaluation metrics are selected to test the deep learning network model, thereby selecting the optimal network model for detecting the precision seedling raising and sowing performance of leafy vegetable seeds, which will serve as the precision seedling raising and sowing performance detection system for leafy vegetable seeds.

[0014] As a preferred embodiment, step S1, deploying the deep learning network model and each button function module to the Raspberry Pi 4B, includes the following two steps:

[0015] S11 integrates and develops various functional modules on a 64-bit Windows 10 system;

[0016] S12 utilizes Qt's Creator to complete the GUI interface design and migrates it to the Raspberry Pi system.

[0017] As a preferred option, in step S2, a graphical interface is created using PyQt, and the functions implemented include:

[0018] S21, Turn the camera on / off; Click the "Turn on camera" button to bring up the camera window and take pictures of different leafy vegetable seed trays. After taking pictures, click the "Turn off camera" button.

[0019] S22, Capture Image; Using a MER-1070-14U3C-L Mercury Generation 1 10-megapixel color industrial camera, capture images of different leafy vegetable seedling trays vertically at a distance of 50cm above the tray. Click the "Capture Image" button to capture the currently captured image of the seedling tray.

[0020] S23, Save Images; Select the captured images of different leafy vegetable seed trays, click the "Save Images" button, and the Raspberry Pi system will automatically pop up the saved file. Save it to the specified file as needed.

[0021] S24, Open Image; Clicking the "Open Image" button will allow you to obtain the desired images of different leafy vegetable seed trays from a specified file on the Raspberry Pi system.

[0022] S25, Grayscale; After capturing the seedling tray image, click the "Grayscale" button. The Qt graphical interface will display the grayscale images of different leafy vegetable seedling trays.

[0023] S26, Binarization; After converting the captured seedling tray image to grayscale, click the "Binarization" button. The Qt graphical interface will display the binarized images of seedling trays for different leafy vegetables.

[0024] S27, Seed Detection; Clicking the "Seed Detection" button will automatically pop up the saved files on the Raspberry Pi system. Select the seedling tray image from the specified file as needed, and the Qt graphical interface will display the seedling tray images of different leafy vegetable seeds after detection. To make the detection results clearer, a DETECTION interface is added to display the detection result image.

[0025] As a preferred embodiment, in step S3, the process of detecting the location of the seedling hole using the contour algorithm based on OpenCV includes:

[0026] S31, Read the color image of the leafy vegetable seedling tray and perform binarization;

[0027] S32, detect contour;

[0028] S33, Contour Classification;

[0029] S34, draw the outline; draw a red box to indicate the location of the seedling hole without leafy vegetable seeds, draw a green box to indicate the location of the seedling hole with leafy vegetable seeds, and green dots to indicate leafy vegetable seeds;

[0030] S35 records the coordinates of empty holes in the seedling tray, providing replanting location information for subsequent replanting devices.

[0031] As a preferred embodiment, step S32 includes:

[0032] S321, loop through the image of leafy vegetable seedling trays, and find the continuous contour regions with different pixel values ​​through the RGB array;

[0033] S322, starting from the outline start point, mark along the boundary pixels;

[0034] S323, after processing the contour, continue traversing from the previous position until a new contour is found, and finally scan to detect all contour positions;

[0035] S324, store the structure of a list of all detected contours, including seedling holes containing leafy vegetable seeds, seedling holes without leafy vegetable seeds, and leafy vegetable seeds.

[0036] As a preferred embodiment, step S33 includes:

[0037] S331, leafy vegetable seeds are generally small, and the outline of the seedling hole is larger than the outline of the seed. Therefore, a threshold n is selected. When the pixel value of the outline list is greater than n, it is the outline of the seedling hole; when the pixel value of the outline list is less than n, it is the outline of the seed.

[0038] S332, when the outline of a leafy vegetable seed is detected, the coordinate position information of the leafy vegetable seed is recorded, and a ray is drawn with the coordinate as the endpoint, without generating it in detail;

[0039] S333, iteratively take the two coordinate positions of the seedling hole outline, and form two vectors with the coordinates of the leafy vegetable seed. If the outer product of the two vectors is zero and the inner product is less than or equal to zero, then the leafy vegetable seed is located on the seedling hole outline.

[0040] S334, readjust the two vectors. If the cross product of the two vectors is positive and the endpoints of the two vectors are located on both sides of the ray, then the leafy vegetable seeds are contained within the outline of the seedling hole.

[0041] As a preferred embodiment, step S4 includes:

[0042] S41, Construct a dataset of different leafy vegetable seed sowing amounts;

[0043] S42, Select a deep learning network and input the training set into the deep learning network for training;

[0044] S43. Input the validation set and test set into the trained seeding detection model, evaluate the model, and select the optimal detection model.

[0045] S44. Input the collected leafy vegetable seed sowing images into the sowing amount detection model to obtain the leafy vegetable seed sowing amount for each seedling hole.

[0046] As a preferred embodiment, step S41 includes:

[0047] S411, Collect images of seedling trays for different leafy vegetables;

[0048] S412, label the seeds in the leafy vegetable seedling tray image, and use different colored label boxes to identify different leafy vegetable seeds and quantities;

[0049] S413 divides the training set, validation set, and test set into a 6:2:2 ratio.

[0050] As a preferred option, in step S5, evaluation metrics are selected to test the deep learning network model, using the following three metrics: accuracy, precision, and recall:

[0051]

[0052]

[0053]

[0054] In the formula: TP represents the number of correctly detected leafy vegetable seed classifications and sowing quantities, FP represents the number of incorrectly detected leafy vegetable seed classifications and sowing quantities, FN represents the number of incorrectly detected non-leafy vegetable seed classifications and sowing quantities, and TN represents the number of correctly detected non-leafy vegetable seed classifications and sowing quantities.

[0055] The precision seedling raising and sowing performance testing system for leafy vegetables is constructed using the same method as the precision seedling raising and sowing performance testing system for leafy vegetables.

[0056] The present invention has the following advantages over the prior art:

[0057] This invention utilizes the Qt cross-platform framework to control an industrial camera to capture images of seedling trays. Contour detection is performed using OpenCV. First, the acquired color images of seedling trays for different leafy vegetable seeds are converted to grayscale and binarized. Then, dilation and closing operations are performed on the seedling tray images to filter out noise, identify empty locations, and output the coordinates of these empty locations. Deep learning is used to directly train the system on a dataset of seedling tray images of different leafy vegetable seeds. The results of different algorithms are analyzed, and the optimal algorithm is determined through comparison to construct the most suitable intelligent recognition system for leafy vegetable seed sowing performance. Commonly used detection methods include photoelectric sensing and high-speed photography. Photoelectric sensing is difficult to detect small-diameter seeds in high-speed continuous particle streams, and even more difficult to adapt to the detection of the number of seeds sown in multiple precision holes. High-speed photography is generally used in mechanical or pneumatic seeders, and can obtain all the details of the seed sowing process, but it fails to accurately detect the sowing quantity in the seedling tray. Based on this, in-depth research can be conducted on different types of leafy vegetable seeds and different deep learning network model detection methods, and corresponding intelligent detection systems can be formed. If these systems can be applied to the production of leafy vegetable seeds, it will greatly improve yields and is of great significance to the research and application of leafy vegetable seeds. Attached Figure Description

[0058] Figure 1 This is a flowchart of the present invention.

[0059] Figure 2a This is a schematic diagram of the Qt software interface displayed after successful initialization of the present invention.

[0060] Figure 2b This is a schematic diagram showing the result of the seedling tray image capture according to the present invention.

[0061] Figure 2c This is a schematic diagram illustrating the results of grayscale display of images of different leafy vegetable seedling trays collected according to the present invention.

[0062] Figure 2d This is a schematic diagram showing the results of binarizing images of different leafy vegetable seedling trays collected according to the present invention.

[0063] Figure 3a This is a schematic diagram of the initial image results of capturing different leafy vegetable seedling trays according to the present invention.

[0064] Figure 3b This is a schematic diagram showing the result of performing a closing operation on the leafy vegetable seedling tray image of the present invention.

[0065] Figure 3c This is a schematic diagram of the seed detection results of the present invention.

[0066] Figure 4 This is a schematic diagram showing the coordinates of the cavity center point according to the present invention. Detailed Implementation

[0067] The present invention will now be described in further detail with reference to specific embodiments.

[0068] The method for constructing a precision seedling raising and sowing performance testing system for leafy vegetable seeds of this invention is based on the Raspberry Pi system and the Qt cross-platform framework. This embodiment uses five different leafy vegetable seeds: bok choy, Italian lettuce, butter lettuce, ice lettuce, and sprouts. A network model for intelligent identification of leafy vegetable seed sowing performance is constructed using OpenCV contour detection and deep learning technology, and can be used to build an intelligent testing system for leafy vegetable seed sowing performance.

[0069] The method for building a precision seedling raising and sowing performance testing system for leafy vegetables includes the following steps:

[0070] S1, Design a Qt cross-platform framework to deploy the trained deep learning network model and key function module to the Bullseye system of Raspberry Pi 4B;

[0071] S2 utilizes the Qt cross-platform C++ graphical user interface application development framework to control an industrial camera to acquire images of seedling trays for different leafy vegetables, realizing the functions of capturing, saving, selecting and opening, grayscale conversion, binarization, and seed detection of seedling tray images.

[0072] S3, based on the contour algorithm, locate the position of each seedling hole in the leafy vegetable seedling tray, detect the missed seedling holes, and record the position information of the missed seedling holes;

[0073] S4. Based on a deep learning network framework, different leafy vegetable seed tray images are detected and identified. A network model for leafy vegetable seed classification and sowing quantity detection is constructed, and the detection accuracy of different network models is compared.

[0074] S5. Evaluation metrics are selected to test the deep learning network model, thereby selecting the optimal network model for detecting the precision seedling raising and sowing performance of leafy vegetable seeds, which will serve as the precision seedling raising and sowing performance detection system for leafy vegetable seeds.

[0075] The specific steps are as follows:

[0076] (1) Step S1

[0077] Step S1 mainly includes the following two steps:

[0078] S11 integrates and develops various functional modules on a 64-bit Windows 10 system;

[0079] S12 utilizes Qt's Creator to complete the GUI interface design and migrates it to the Raspberry Pi system.

[0080] The Raspberry Pi uses a 64-bit, 1.5GHz quad-core, 2GB RAM 4th generation B-type ARM-based microcontroller, featuring small size, programmability, and connectivity. The Qt framework offers high compatibility and portability.

[0081] In terms of application deployment, the development of each button function module was first completed on a 64-bit Windows 10 system using the PyCharm integrated development environment. Then, it was migrated to the Bullseye system on a Raspberry Pi 4B, where Qt Creator was used to complete the GUI interface design and button function development, including the use of third-party libraries such as OpenCV and PyQt5. Figure 2a This is a schematic diagram of the Qt software interface displayed after successful initialization of the present invention.

[0082] In step S1, the Qt cross-platform framework is used to design a graphical interface, the generated .ui file is converted into a .py file, and the .py file is compiled and packaged using the PyCharm integrated environment.

[0083] In step S1, the latest Bullseye system is burned into the Raspberry Pi using Raspberry Pi Imager, the driver for the industrial camera is installed on the Raspberry Pi 4B system, and the function modules of each button are migrated to the Raspberry Pi 4B system.

[0084] (2) Step S2

[0085] S21. Turn the camera on / off. Click the "Turn on camera" button to open the camera window and take pictures of different leafy vegetable seed trays. After taking pictures, click the "Turn off camera" button.

[0086] S22, Capture Image. Using a MER-1070-14U3C-L Mercury Generation 1 10-megapixel color industrial camera without an I / O port, capture images of different leafy vegetable seedling trays vertically at a distance of 50cm above the trays. Click the "Capture Image" button to capture the currently captured image of the seedling tray. Figure 2b This is a schematic diagram showing the result of the seedling tray image capture according to the present invention.

[0087] In step S2, before capturing images of seedling trays for different leafy vegetables, a light box is installed above the shooting area. High-brightness LED ring lights are installed on the four panels of the light box, and the industrial camera is fixed on the light box bracket at a height of 50cm from the seedling tray. The size of the seedling tray image is approximately 40*50cm.

[0088] In step S2, during the process of capturing images of seedling trays for different leafy vegetables, when the seedling trays on the production line are detected to have reached the shooting area, Qt controls the industrial camera to capture images of the seedling trays every 3 seconds. Two images are captured for each seedling tray, and the non-overlapping areas of the two seedling tray images are taken respectively.

[0089] S23, Save Images. Select the captured images of different leafy vegetable seed trays, click the "Save Images" button, and the Raspberry Pi system will automatically pop up the save file. Save it to the specified file as needed.

[0090] S24, Open Image. Clicking the "Open Image" button will allow you to obtain the desired images of different leafy vegetable seed trays from a specified file on the Raspberry Pi system.

[0091] S25, Grayscale Conversion. After capturing the seedling tray image, click the "Grayscale Conversion" button. The Qt graphical interface will display grayscale images of different leafy vegetable seedling trays. Figure 2c This is a schematic diagram illustrating the results of grayscale display of images of different leafy vegetable seedling trays collected according to the present invention.

[0092] S26, Binarization. After converting the captured seedling tray image to grayscale, click the "Binarize" button. The Qt graphical interface will display the binarized images of different leafy vegetable seedling trays. Figure 2d This is a schematic diagram showing the results of binarizing images of different leafy vegetable seedling trays collected according to the present invention.

[0093] S27, Seed Detection. Clicking the "Detect Seeds" button will automatically pop up the saved files on the Raspberry Pi system. Select the seedling tray image from the specified file as needed, and the Qt graphical interface will display the detected seedling tray images of different leafy vegetable seeds. To make the detection results clearer, a DETECTION interface is added to display the detection result image.

[0094] (3) Step S3

[0095] S31. In OpenCV, contours can only be extracted from binarized images. First, a QT-controlled industrial camera acquires color images of leafy vegetable seed trays. The image resolution is 3840×2748 pixels, and the image is stored in JPG format. The seed tray images are then converted to grayscale, and finally binarized using a thresholding method. Figure 3a This is a schematic diagram of the initial image results of capturing different leafy vegetable seedling trays according to the present invention.

[0096] S32, obtain the convolution kernel, perform dilation and closing operations on the collected seedling tray images of different leafy vegetable seeds to filter and eliminate noise, fill in some holes in the seedling tray images of leafy vegetable seeds and eliminate small particle noise contained in the seedling tray images of leafy vegetable seeds. Figure 3b This is a schematic diagram showing the result of performing a closing operation on the leafy vegetable seedling tray image of the present invention.

[0097] In S33, when extracting contours using OpenCV, the contour is defined as the boundary of a set of white pixels on a black background. The process iterates through the image of a leafy vegetable seedling tray, using the RGB array to find consecutive contour regions with different pixel values. Starting from the contour's origin, the boundary pixels are marked. After processing the contour, the process continues from the previous position until a new contour is found. Finally, all contour positions are scanned and detected.

[0098] S34 stores the structure of all detected contour lists, including seedling holes containing leafy vegetable seeds, seedling holes without leafy vegetable seeds, and leafy vegetable seeds. Leafy vegetable seeds are generally small, and the contour of the seedling hole is larger than that of the seed. Therefore, a threshold n is selected: when the pixel value in the contour list is greater than n, it is a seedling hole contour; when the pixel value in the contour list is less than n, it is a seed contour. A double loop iterates through the leafy vegetable seedling tray image. When a continuous contour region with different pixel values ​​is found, the starting point coordinates of the contour pixels are recorded and stored. Starting from this contour, marking continues along the boundary pixels, and it is determined whether the current contour pixel value is the same as the pixel value before scanning. If they are the same, the traversal continues; otherwise, the coordinates of the pixel point of the previous contour boundary are recorded and stored. After processing this contour, the traversal continues from the previous position until a new contour is found. The coordinates of the contour pixels are recorded and stored. Finally, all detected contour positions are scanned and stored, and the coordinate position information of the seedling hole is recorded. When the outline of a leafy vegetable seed is detected, its coordinate position is recorded. A ray is drawn with these coordinates as endpoints. This ray is not actually generated; it's primarily implemented using the following algorithm: Iteratively, two coordinate positions of adjacent seedling hole outlines are taken, forming two vectors with the leafy vegetable seed coordinates. If the outer product of these two vectors is zero, and the inner product is less than or equal to zero, then the leafy vegetable seed is located on the seedling hole outline, and a green box is drawn to indicate the seedling hole location containing the leafy vegetable seed. The two vectors are readjusted. If the outer product of the two vectors is positive, and the endpoints of the two vectors are located on opposite sides of the ray, then the leafy vegetable seed is contained within the seedling hole outline. A green box is drawn to indicate the seedling hole location containing the leafy vegetable seed, and green dots represent the leafy vegetable seed. After the traversal is complete, a red box is drawn to indicate the other seedling hole locations that do not contain leafy vegetable seeds. Figure 3c This is a schematic diagram of the seed detection results of the present invention.

[0099] S35 records the coordinates of empty seedling tray holes, providing replanting location information for subsequent replanting devices. Red boxes indicate the locations of seedling tray holes without leafy vegetable seeds. The image of the leafy vegetable seedling tray is traversed. When a continuous contour region with pixel values ​​R=255, G=0, and B=0 is detected, the starting point coordinates of the empty hole contour pixels are recorded and stored. Starting from this contour, markers are made along the boundary pixels. When the current contour pixel value differs from the previous pixel value, the pixel coordinates of the previous empty hole contour boundary are recorded and stored, and the coordinates of the empty hole contour are calculated using the averaging method. New contours are scanned continuously, and the coordinates of the contour pixels are recorded and stored. Finally, all detected contour positions are stored, and the coordinates of the center point of each empty hole contour are returned. Figure 4 This is a schematic diagram showing the coordinates of the cavity center point according to the present invention.

[0100] (4) Step S4

[0101] S41, construct a dataset of different leafy vegetable seed sowing amounts; collect images of different leafy vegetable seedling trays, label the seeds in the leafy vegetable seedling tray images, and use different colored label boxes to identify different leafy vegetable seeds and quantities, and divide the dataset into training set, validation set and test set in a 6:2:2 ratio.

[0102] S42. Select three deep learning network models and input the training set into the three different deep learning models YOLOv3, VGG16, and ResNet-50 for training.

[0103] S43. Input the validation set and test set into the trained seeding rate detection model, evaluate the model, and select the optimal deep learning network model to construct an intelligent system for leafy vegetable seed sowing performance by comparing the accuracy of the three deep learning network models.

[0104] S44. Input the collected leafy vegetable seed sowing images into the sowing amount detection model to obtain the sowing amount of seeds in each seedling hole.

[0105] In step S4, 1000 normalized 224×224 pixel images captured by an industrial camera controlled by Qt are used as a dataset based on Python deep learning. The dataset contains seeds of five different leafy vegetables and their sowing amounts: bok choy, Italian lettuce, butter lettuce, ice lettuce, and sprouts. Bok choy with one seed is marked with a red box, bok choy with two seeds with a blue box, Italian lettuce with one seed with a black box, Italian lettuce with two seeds with a white box, butter lettuce with one seed with a green box, butter lettuce with two seeds with a yellow box, ice lettuce with one seed with a purple box, ice lettuce with two seeds with a brown box, sprouts with one seed with an orange box, and sprouts with two seeds with a cyan box.

[0106] In step S4, a deep learning network model is constructed based on convolutional neural networks to detect different leafy vegetable seeds and sowing rates. The convolutional neural networks used include YOLOv3, VGG16, and ResNet-50, which are described in detail below:

[0107] S45, YOLOv3: Composed of three main components. (1) Backbone: A convolutional neural network that aggregates and forms image features at different fine-grained levels. (2) Neck: A series of network layers that mix and combine image features and pass the image features to the prediction layer. (3) Head: Predicts the image features, generates bounding boxes, and predicts the category. YOLOv3 uses the Darknet53 backbone network, which has better feature extraction capabilities, enhances the detection capability for small objects, and is more conducive to the detection of different leafy vegetable seeds in this study. It also sets three different specifications of anchors and scales, each with three different scales of anchors, to fuse features at different scales and increase the model's detection capability for different leafy vegetable seeds.

[0108] S46, VGG16: Composed of 5 VGG blocks and 3 fully connected layers, each convolutional block consists of 1 to 4 convolutional layers and pooling layers. To ensure that the output and input of the convolutional layers maintain spatial consistency, the padding of the convolutional layers is 1. The convolutional layers use a 2x2 maxpooling window with a stride of 2, and all hidden layers use the ReLU activation function. In VGG, three 3x3 convolutional kernels are used instead of 7x7 convolutional kernels, and two 3x3 convolutional kernels are used instead of 5x5 convolutional kernels. The aim is to increase the depth of the network and the performance of the convolutional neural network while maintaining the same receptive field, thereby improving the detection accuracy of different leafy vegetable seed tray images.

[0109] S47, ResNet-50: Composed of a building block and a bottleneck. The building block contains a residual branch and a short-cut branch, used to pass low-level information, enabling the network to be trained very deep. The bottleneck reduces the number of channels through a 1x1 convolution. After the intermediate ordinary convolution, the output channel count equals the input channel count. A third convolution is used to increase and restore the channel count. These two 1x1 convolutions effectively reduce the number of parameters and computational cost. The ResNet-50 model introduces a residual module; 50 indicates that the network has 50 layers. This effectively solves the gradient vanishing, gradient explosion, and degradation problems caused by increasing the number of neural network layers. The accuracy and efficiency of detecting different leafy vegetable seed tray images are higher than the VGG16 network model.

[0110] In step S4, the collected leafy vegetable seed sowing images are input into the sowing amount detection model to obtain the sowing amount of seeds in each seedling hole. The specific process is as follows: the leafy vegetable sowing tray image is input into the trained deep learning model, the deep learning model outputs the leafy vegetable sowing tray image with the sowing amount and seed classification labeled, and the cumulative value of the number of seeds in each seedling hole is calculated as the sowing amount of that seedling hole, and finally the sowing amount of seeds in each seedling hole is output.

[0111] (5) Step S5

[0112] In step S5, evaluation metrics are selected to test the deep learning network model, using the following formulas for accuracy, precision, and recall:

[0113]

[0114]

[0115]

[0116] In the formula: TP represents the number of correctly detected leafy vegetable seed classifications and sowing quantities, FP represents the number of incorrectly detected leafy vegetable seed classifications and sowing quantities, FN represents the number of incorrectly detected non-leafy vegetable seed classifications and sowing quantities, and TN represents the number of correctly detected non-leafy vegetable seed classifications and sowing quantities.

[0117] In step S5, evaluation metrics are selected to test the deep learning network models. The tests show that the deep learning network models have high detection accuracy. Specifically, YOLOv3 has an accuracy of 96.83%, VGG16 has an accuracy of 98.75%, and ResNet-50 has an accuracy of 99.58%. The accuracy, precision, and recall of the test set are calculated, and based on the evaluation metrics, the optimal deep learning network model is selected.

[0118] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A method for constructing a precision seedling raising and sowing performance testing system for leafy vegetables, characterized in that, Includes the following steps: S1, Design a Qt cross-platform framework to deploy the trained deep learning network model and key function module to the Bullseye system of Raspberry Pi 4B; S2 uses Qt to control an industrial camera to acquire images of seedling trays for different leafy vegetables, realizing the functions of capturing, saving, selecting and opening, grayscale conversion, binarization, and seed detection of seedling tray images; S3. Based on the contour algorithm, the position of each seedling hole in the leafy vegetable seedling tray is located, the missed seedling holes are detected, and the position information of the missed seedling holes is recorded. S4. Based on a deep learning network framework, different leafy vegetable seed tray images are detected and identified. A network model for leafy vegetable seed classification and sowing quantity detection is constructed, and the detection accuracy of different network models is compared. S5. Evaluation metrics are selected to test the deep learning network model, thereby selecting the optimal network model for constructing the precision seedling raising and sowing performance detection system for leafy vegetable seeds. In step S3, the process of detecting the location of the seedling hole using the contour algorithm based on OpenCV includes: S31, Read the color image of the leafy vegetable seedling tray and perform binarization; S32, detect contour; S33, Contour Classification; S34, draw the outline; draw a red box to indicate the location of the seedling hole without leafy vegetable seeds, draw a green box to indicate the location of the seedling hole with leafy vegetable seeds, and green dots to indicate leafy vegetable seeds; S35 records the coordinates of the empty holes in the seedling tray, providing replanting location information for the subsequent replanting device; Step S33 includes: S331, leafy vegetable seeds are generally small, and the outline of the seedling hole is larger than the outline of the seed. Therefore, a threshold n is selected. When the pixel value of the outline list is greater than n, it is the outline of the seedling hole; when the pixel value of the outline list is less than n, it is the outline of the seed. S332, when the outline of a leafy vegetable seed is detected, the coordinate position information of the leafy vegetable seed is recorded, and a ray is drawn with the coordinate as the endpoint, without generating it in detail; S333, iteratively take the two coordinate positions of the seedling hole outline, and form two vectors with the coordinates of the leafy vegetable seed. If the outer product of the two vectors is zero and the inner product is less than or equal to zero, then the leafy vegetable seed is located on the seedling hole outline. S334, readjust the two vectors. If the cross product of the two vectors is positive and the endpoints of the two vectors are located on both sides of the ray, then the leafy vegetable seeds are contained within the outline of the seedling hole.

2. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 1, characterized in that, In step S1, deploying the deep learning network model and each button function module to the Raspberry Pi 4B includes the following two steps: S11 integrates and develops various functional modules on a 64-bit Windows 10 system; S12 utilizes Qt's Creator to complete the GUI interface design and migrates it to the Raspberry Pi system.

3. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 1, characterized in that, In step S2, a graphical interface is created using PyQt, and the functions implemented include: S21, turn the camera on / off; S22, capture image; S23, Save image; S24, Open the image; S25, grayscale; S26, binarization; S27, Detect seeds.

4. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 1, characterized in that, Step S32 includes: S321, loop through the image of leafy vegetable seedling trays, and find the continuous contour regions with different pixel values ​​through the RGB array; S322, starting from the outline start point, mark along the boundary pixels; S323, after processing the contour, continue traversing from the previous position until a new contour is found, and finally scan to detect all contour positions; S324, store the structure of a list of all detected contours, including seedling holes containing leafy vegetable seeds, seedling holes without leafy vegetable seeds, and leafy vegetable seeds.

5. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 1, characterized in that, Step S4 includes: S41, Construct a dataset of different leafy vegetable seed sowing amounts; S42, Select a deep learning network and input the training set into the deep learning network for training; S43. Input the validation set and test set into the trained seeding detection model, evaluate the model, and select the optimal detection model. S44. Input the collected leafy vegetable seed sowing images into the sowing amount detection model to obtain the leafy vegetable seed sowing amount for each seedling hole.

6. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 5, characterized in that, Step S41 includes: S411, Collect images of seedling trays for different leafy vegetables; S412, label the seeds in the leafy vegetable seedling tray image, and use different colored label boxes to identify different leafy vegetable seeds and quantities; S413 divides the training set, validation set, and test set into a 6:2:2 ratio.

7. The method for constructing the precision seedling raising and sowing performance testing system for leafy vegetable seeds according to claim 1, characterized in that: In step S5, evaluation metrics are selected to test the deep learning network model, using the following formulas for accuracy, precision, and recall: In the formula: TP represents the number of correctly detected leafy vegetable seed classifications and sowing quantities, FP represents the number of incorrectly detected leafy vegetable seed classifications and sowing quantities, FN represents the number of incorrectly detected non-leafy vegetable seed classifications and sowing quantities, and TN represents the number of correctly detected non-leafy vegetable seed classifications and sowing quantities.

8. A precision seedling raising and sowing performance testing system for leafy vegetables, characterized in that: The system is constructed using the method described in any one of claims 1-7 for constructing a precision seedling raising and sowing performance testing system for leafy vegetables.

Citation Information

Patent Citations

  • Sweet corn seed recognition method and device for plug seedling

    CN112907516A

  • Crop seed automatic counting method based on machine vision

    CN115187788A