Green manure and other crop seed counting and size measuring method and system based on AI algorithm
Through convolutional neural networks and clustering algorithms based on AI algorithms, green manure seeds and impurities are automatically identified and an adaptive sample library is built, which solves the problem of low efficiency of manual operation in existing technologies and achieves efficient and accurate seed counting and size measurement.
Patent Information
- Application Number
- CN202510708405.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-19
AI Technical Summary
In the existing technology, the size measurement of crop seeds such as green manure requires frequent manual operations, which is inefficient. In addition, the equipment on the market is expensive, making it difficult to achieve efficient and accurate seed counting and size measurement.
Using an AI algorithm-based method, the convolutional neural network model is used to extract the multi-scale features of seeds. Combined with clustering algorithms and similarity comparison, seeds and impurities are automatically identified, size measurement and counting are performed, and an adaptive typical posture seed sample library is constructed to achieve efficient measurement without human intervention.
It achieves efficient and accurate seed counting and size measurement without human intervention, improves measurement accuracy and automation level, enhances the versatility of the system, and can adapt to different types and batches of seeds.
Smart Images

Figure CN120673075A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of size measurement of green manure and other crop seeds, and in particular to a method and system for counting and measuring the size of green manure and other crop seeds based on an AI algorithm. Background Art
[0002] The parameter measurement and statistics of green manure and other crop seeds are particularly important in seed evaluation operations. In particular, when measuring green manure seeds such as milk vetch and sesbania, the small size of the seeds makes both technical and dimensional measurement very difficult. While there are technical seed counters available on the market, they are expensive. In the prior art, the applicant's prior application CN114623781A discloses an image-based method and system for measuring the external dimensions of green manure and other agricultural crop seeds. This method captures images of the seeds and a scale, scales the images in software based on the scale, and then measures the size of the seeds. This method can accurately determine the seed size. However, this method requires frequent manual operation and is inefficient. For hundreds or thousands of seeds, manual measurement and statistics are required in software, which is labor-intensive and unsuitable for measuring seed size. Summary of the Invention
[0003] Purpose of the invention: In order to overcome the deficiencies in the prior art, the present invention provides a method and system for counting and sizing green manure and other crop seeds based on an AI algorithm, which can eliminate impurities and efficiently and accurately count and measure the size of seeds without human intervention, thereby promoting the application of AI in the field of agricultural production.
[0004] Technical solution: To achieve the above purpose, the present invention provides a method for counting and measuring the size of green manure and other crop seeds based on an AI algorithm, the method comprising:
[0005] Acquire a captured image, wherein the image includes images of a plurality of seeds and an image of a size reference object, and the size of the size reference object is known;
[0006] The method also includes:
[0007] Based on the image, a convolutional neural network model is used to learn the seed shape and extract multi-scale features of the seed, including outline, major axis, minor axis, edge texture, and color distribution;
[0008] For each target area in the image, the AI model is used to perform multi-feature comprehensive discrimination based on the multi-scale features to identify typical posture seeds. The seeds with atypical postures are identified and impurities are removed by referring to the color and detail features of the typical posture seeds.
[0009] Based on the size reference, the size parameters of the identified seeds are measured, and the effective size of the seeds with atypical postures is measured;
[0010] Statistical analysis is performed on the size data of all seeds to calculate preset indicators, including average size and size distribution.
[0011] Furthermore, for each target area in the image, a multi-feature comprehensive discrimination is performed using an AI model based on the multi-scale features, specifically including:
[0012] Extract multidimensional feature vectors of all candidate target areas in the image. The features include geometric structure, color distribution, and texture. The geometric structure includes contour shape, major and minor axis lengths, aspect ratio, and texture direction information.
[0013] A similarity matrix is constructed based on all the eigenvectors, and a clustering algorithm is used to perform cluster analysis on all candidate regions;
[0014] Extract several typical sample areas from the largest cluster or mean center class to form a typical posture seed sample library of the current image;
[0015] The feature vectors of the remaining target areas are compared with the samples in the typical posture seed sample library for similarity. If the maximum similarity is higher than the preset threshold, it is determined to be an atypical posture seed; otherwise, it is identified as impurity and removed.
[0016] Furthermore, the step of extracting multidimensional feature vectors of all candidate target regions in the image includes:
[0017] Perform principal component analysis on the candidate region to obtain the main axis direction and secondary axis direction of the region;
[0018] Calculate the major axis length, minor axis length and contour area according to the directions of the major axis and minor axis;
[0019] The image gradient analysis method is used to extract the edge texture direction features;
[0020] The color space conversion method is used to convert the RGB image into an HSV image, and the Hue channel histogram of the pixels in the area is counted as part of the color feature vector.
[0021] Furthermore, the clustering analysis of all candidate regions using a clustering algorithm is based on an improved K-means algorithm, specifically including:
[0022] The number of clusters is dynamically determined according to the geometric structure characteristics of the candidate target area, and color distribution similarity is introduced as an additional constraint term of the distance metric function to perform cluster analysis on all candidate areas.
[0023] When processing multiple images of the same batch continuously, the mean feature vectors of the largest clusters of each image are weighted fused to update the typical posture seed sample library. At the same time, the preset threshold in the above step S204 is dynamically adjusted according to the feature distribution of historical data. The adjustment rule is: T i+1 =T i ×(1+α×log1+N, where α is an adaptive coefficient of 0.01-0.03, Ti+1 and Ti are the preset thresholds before and after the update, respectively, and N is the number of processed images.
[0024] Furthermore, after acquiring the collected image, the method further includes:
[0025] Adjusting the image based on the edge of the size reference object to correct shooting distortion;
[0026] The image is scaled based on the scale of the size reference object so that the measured size of the size reference object in the computer is consistent with its actual size.
[0027] Furthermore, the size data of all seeds are statistically analyzed to calculate preset indicators, and then the following steps are further included:
[0028] Generate a seed quality assessment report based on seed size distribution, which includes: the number and position coordinates of seeds with abnormal size marked based on the 3σ principle, the size uniformity index, and the size distribution histogram.
[0029] Furthermore, the size data of all seeds are statistically analyzed to calculate preset indicators, and then the following steps are further included:
[0030] Calculate or obtain one or more of the following indicators: seed qualification rate, deviation of size parameters from variety standard values, impurity type and impurity content, and image slices of seeds with atypical postures.
[0031] A system for counting and measuring seeds of green manure and other crops based on an AI algorithm, which is used to implement the above-mentioned method for counting and measuring seeds of green manure and other crops based on an AI algorithm, comprises:
[0032] An acquisition module is used to acquire a captured image, wherein the image includes images of multiple seeds and an image of a size reference object, and the size of the size reference object is known;
[0033] A feature extraction module is used to learn the seed shape based on the image using a convolutional neural network model to extract multi-scale features of the seed, including contour, major axis, minor axis, edge texture, and color distribution;
[0034] The recognition module is used to perform multi-feature comprehensive discrimination based on the multi-scale features using the AI model for each target area in the image, identify typical posture seeds, and refer to the color and detail features of the typical posture seeds to identify atypical posture seeds and remove impurities;
[0035] A measurement module is used to measure the size parameters of the identified seeds based on the size reference object, and to measure the effective size of seeds with atypical postures;
[0036] The statistical module is used to perform statistical analysis on the size data of all seeds and calculate preset indicators, which include average size and size distribution.
[0037] Beneficial effects: The AI algorithm-based method and system for counting and measuring seeds of crops such as green manure have the following beneficial effects:
[0038] (1) The technology and size measurement method of the present invention can automatically perform feature extraction, seed and impurity distinction, and seed technology and size measurement operations based on the collected images, avoiding human intervention, and can automatically exclude impurities and avoid seeds with atypical postures being treated as impurities and excluded, thereby improving measurement accuracy and automation level.
[0039] (2) In the above method, the typical posture seed sample library is adaptively constructed based on the objects inside the current image, and other target areas are judged to be seeds or impurities based on the typical posture seed sample library. There is no need to rely on an external database, so that the system has the ability to fully self-adapt when processing different types of seeds or different batches of materials, which greatly enhances the versatility of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a flowchart of a method for counting and measuring the seeds of green manure and other crops based on an AI algorithm;
[0041] Figure 2 This is a schematic diagram of the system structure of the seed counting and size measurement system for green manure and other crops based on AI algorithms. DETAILED DESCRIPTION
[0042] The present invention will be further described below with reference to the accompanying drawings.
[0043] like Figure 1 The method for counting and measuring the size of green manure and other crop seeds based on the AI algorithm shown includes the following steps S101-S105:
[0044] Step S101, acquiring a captured image, wherein the image includes images of multiple seeds and images of size reference objects, and the size of the size reference objects is known;
[0045] In this step, when collecting images, spread green manure seeds and other materials flat on a clean white paper or a solid-color background board, ensuring that there is no overlap or connection between the seed particles, and place a ruler on the edge as a size reference; use a smartphone or camera to shoot above the seeds to obtain an image with a clean background and clear outlines; the image obtained in this step can be one image or multiple images.
[0046] Step S102: Based on the image, a convolutional neural network model is used to learn the seed shape and extract multi-scale features of the seed, including outline, major axis, minor axis, edge texture, and color distribution;
[0047] Step S103: For each target area in the image, a multi-feature comprehensive discrimination is performed using an AI model based on the multi-scale features to identify typical posture seeds, and referring to the color and detail features of the typical posture seeds, atypical posture seeds are identified and impurities are removed;
[0048] Step S104, measuring size parameters of the identified seeds based on the size reference, and measuring the effective size of the seeds with atypical postures;
[0049] Step S105 , performing statistical analysis on the size data of all seeds and calculating preset indicators, which include average size and size distribution.
[0050] The technology and size measurement method in the present invention can automatically perform feature extraction, seed and impurity distinction, and seed technology and size measurement operations based on the collected images, avoiding manual intervention, and can automatically exclude impurities and avoid seeds with atypical postures being excluded as impurities, thereby improving measurement accuracy and automation level.
[0051] Preferably, the step S103 described above performs multi-feature comprehensive discrimination on each target area in the image based on the multi-scale features using an AI model, specifically including the following steps S201-S204:
[0052] Step S201: extracting multidimensional feature vectors of all candidate target regions in the image, where the features include geometric structure, color distribution, and texture; the geometric structure includes outline shape, major axis and minor axis lengths, aspect ratio, and texture direction information;
[0053] Step S202: construct a similarity matrix based on all the feature vectors, and perform cluster analysis on all candidate regions using a clustering algorithm;
[0054] Step S203: extracting several typical sample areas from the largest cluster or the mean center class to form a typical posture seed sample library of the current image;
[0055] In step S204 , the feature vectors of the remaining target areas are compared with the samples in the typical posture seed sample library for similarity. If the maximum similarity is higher than a preset threshold, it is determined to be an atypical posture seed; otherwise, it is identified as impurity and removed.
[0056] In the above method, the typical posture seed sample library is adaptively constructed based on the objects inside the current image, and other target areas are judged as seeds or impurities based on the typical posture seed sample library. There is no need to rely on an external database, so that the system has the ability to fully self-adapt when processing different types of seeds or different batches of materials, which greatly enhances the versatility of the system.
[0057] Preferably, the step S201 of extracting multi-dimensional feature vectors of all candidate target regions in the image includes the following steps S301-S304:
[0058] Step S301, performing principal component analysis on the candidate region to obtain the major axis direction and minor axis direction of the region;
[0059] Step S302, calculating the major axis length, minor axis length and contour area according to the major axis and minor axis directions;
[0060] Step S303, extracting edge texture directional features using an image gradient analysis method;
[0061] In step S304, the RGB image is converted into an HSV image using a color space conversion method, and the Hue channel histogram of the pixels in the area is counted as part of the color feature vector.
[0062] In the above steps, through structured, multi-channel feature extraction methods, the AI model's ability to recognize complex and diverse seed targets in images can be enhanced, and the accuracy of distinguishing seeds from impurities can be improved.
[0063] Preferably, the clustering analysis of all candidate regions using a clustering algorithm in step S202 is performed based on an improved K-means algorithm, specifically including:
[0064] The number of clusters is dynamically determined based on the geometric structure of the candidate target regions. Color distribution similarity is introduced as an additional constraint in the distance metric function to perform cluster analysis on all candidate regions. During the clustering process, the feature vectors are normalized, with a weight of 0.6-0.8 for geometric structure features and 0.2-0.4 for color distribution.
[0065] When processing multiple images of the same batch continuously, the mean feature vectors of the largest clusters of each image are weighted fused to update the typical posture seed sample library. At the same time, the preset threshold in the above step S204 is dynamically adjusted according to the feature distribution of historical data. The adjustment rule is: T i+1=T i ×(1+α×log1+N, where α is an adaptive coefficient of 0.01-0.03, Ti+1 and Ti are the preset thresholds before and after the update, respectively, and N is the number of processed images. By dynamically updating the typical posture seed sample library and adaptively adjusting the judgment threshold, the system is continuously optimized for batch differences and environmental changes: multi-image feature vectors are integrated in continuous processing to enhance the model's robustness to illumination changes and slight differences in seed varieties; the threshold adaptively increases with the amount of processed data, avoiding impurity misjudgment caused by initial overfitting while maintaining high accuracy in long-term operation, enabling the system to maintain cross-batch stability without manual calibration, significantly reducing maintenance frequency and false rejection rate.
[0066] Preferably, after obtaining the collected image in step S101, the method further includes the following steps S401-S402:
[0067] Step S401, adjusting the image based on the edge of the size reference object to correct shooting distortion;
[0068] Step S402: scaling the image based on the scale of the size reference object so that the measured size of the size reference object in the computer is consistent with its actual size.
[0069] In actual use, you can place scales around the background and place the seed in the middle of all the scales to facilitate the algorithm to perform distortion correction and image scaling.
[0070] Preferably, the step S105 described above performs statistical analysis on the size data of all seeds and calculates the preset index, and then further includes:
[0071] Generate a seed quality assessment report based on seed size distribution, which includes: the number and position coordinates of seeds with abnormal size marked based on the 3σ principle, the size uniformity index, and the size distribution histogram.
[0072] Preferably, the step S105 described above performs statistical analysis on the size data of all seeds and calculates the preset index, and then further includes:
[0073] Calculate or obtain one or more of the following indicators: seed qualification rate, deviation of size parameters from variety standard values, impurity type and impurity content, and image slices of seeds with atypical postures.
[0074] The present invention also provides a system for counting and measuring the size of green manure and other crop seeds based on AI algorithm, which is used to implement the above-mentioned method for counting and measuring the size of green manure and other crop seeds based on AI algorithm, such as Figure 2 As shown, it includes:
[0075] An acquisition module 510 is configured to acquire an acquired image, wherein the image includes images of multiple seeds and an image of a size reference object, and the size of the size reference object is known;
[0076] A feature extraction module 520 is configured to perform seed shape learning based on the image using a convolutional neural network model to extract multi-scale features of the seed, including outline, major axis, minor axis, edge texture, and color distribution;
[0077] The recognition module 530 is used to perform multi-feature comprehensive discrimination on each target area in the image using the AI model based on the multi-scale features, identify typical posture seeds, and refer to the color and detail features of the typical posture seeds to identify seeds with atypical postures and remove impurities;
[0078] The measurement module 540 is configured to measure the size parameters of the identified seeds based on the size reference object, and measure the effective size of the seeds with atypical postures;
[0079] The statistics module 550 is used to perform statistical analysis on the size data of all seeds and calculate preset indicators, which include average size and size distribution.
[0080] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for counting and measuring the seeds of green manure and other crops based on an AI algorithm, the method comprising: Acquire a captured image, wherein the image includes images of a plurality of seeds and an image of a size reference object, and the size of the size reference object is known; Characterized in that the method further comprises: Based on the image, a convolutional neural network model is used to learn the seed shape and extract multi-scale features of the seed, including outline, major axis, minor axis, edge texture, and color distribution; For each target area in the image, the AI model is used to perform multi-feature comprehensive discrimination based on the multi-scale features to identify typical posture seeds. The seeds with atypical postures are identified and impurities are removed by referring to the color and detail features of the typical posture seeds. Based on the size reference, the size parameters of the identified seeds are measured, and the effective size of the seeds with atypical postures is measured; Statistical analysis is performed on the size data of all seeds to calculate preset indicators, including average size and size distribution.
2. The method for counting and measuring the seeds of crops such as green manure based on AI algorithm according to claim 1 is characterized in that: For each target area in the image, the multi-feature comprehensive discrimination is performed using the AI model based on the multi-scale features, specifically including: Extract multidimensional feature vectors of all candidate target areas in the image, including geometric structure, color distribution, and texture; A similarity matrix is constructed based on all the eigenvectors, and a clustering algorithm is used to perform cluster analysis on all candidate regions; Extract several typical sample areas from the largest cluster or mean center class to form a typical posture seed sample library of the current image; The feature vectors of the remaining target areas are compared with the samples in the typical posture seed sample library for similarity. If the maximum similarity is higher than the preset threshold, it is determined to be an atypical posture seed; otherwise, it is identified as impurity and removed.
3. The method for counting and measuring the size of green manure and other crop seeds based on AI algorithm according to claim 2 is characterized in that: The multidimensional feature vectors of all candidate target areas in the image are extracted as follows: Perform principal component analysis on the candidate region to obtain the main axis direction and secondary axis direction of the region; Calculate the major axis length, minor axis length and contour area according to the directions of the major axis and minor axis; The image gradient analysis method is used to extract the edge texture direction features; The color space conversion method is used to convert the RGB image into an HSV image, and the Hue channel histogram of the pixels in the area is counted as part of the color feature vector.
4. The method for counting and measuring the size of green manure and other crop seeds based on AI algorithm according to claim 1 is characterized in that: The clustering analysis of all candidate regions using a clustering algorithm is based on an improved K-means algorithm, specifically including: The number of clusters is dynamically determined according to the geometric structure characteristics of the candidate target area, and color distribution similarity is introduced as an additional constraint term of the distance metric function to perform cluster analysis on all candidate areas.
5. The method for counting and measuring the seeds of green manure and other crops based on AI algorithm according to claim 1 is characterized in that: After acquiring the collected image, the method further includes: Adjusting the image based on the edge of the size reference object to correct shooting distortion; The image is scaled based on the scale of the size reference object so that the measured size of the size reference object in the computer is consistent with its actual size.
6. The method for counting and measuring the size of green manure and other crop seeds based on AI algorithm according to claim 1 is characterized in that: The statistical analysis of the size data of all seeds and calculation of preset indicators also include: Generate a seed quality assessment report based on seed size distribution, which includes: the number and position coordinates of seeds with abnormal size marked based on the 3σ principle, the size uniformity index, and the size distribution histogram.
7. The method for counting and measuring the size of green manure and other crop seeds based on AI algorithm according to claim 1 is characterized in that: The statistical analysis of the size data of all seeds and calculation of preset indicators also include: Calculate or obtain one or more of the following indicators: seed qualification rate, deviation of size parameters from variety standard values, impurity type and impurity content, and image slices of seeds with atypical postures.
8. A system for counting and measuring seeds of green manure and other crops based on an AI algorithm, used to implement the method for counting and measuring seeds of green manure and other crops based on an AI algorithm according to any one of claims 1 to 7, characterized in that: It includes: An acquisition module is used to acquire a captured image, wherein the image includes images of multiple seeds and an image of a size reference object, and the size of the size reference object is known; A feature extraction module is used to learn the seed shape based on the image using a convolutional neural network model to extract multi-scale features of the seed, including contour, major axis, minor axis, edge texture, and color distribution; The recognition module is used to perform multi-feature comprehensive discrimination based on the multi-scale features using the AI model for each target area in the image, identify typical posture seeds, and refer to the color and detail features of the typical posture seeds to identify atypical posture seeds and remove impurities; A measurement module is used to measure the size parameters of the identified seeds based on the size reference object, and to measure the effective size of seeds with atypical postures; The statistical module is used to perform statistical analysis on the size data of all seeds and calculate preset indicators, which include average size and size distribution.