A high-precision identification method and system for grain particles in an aggregated image

CN123016040APending Publication Date: 2026-10-30GUANGZHOU DONGDONG INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610705914.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-05-22
Filing Date
2026-05-21
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

在探索进程中,由于谷类作物品种的不断增多,再加上图像识别领域存在的遮挡和相似性问题,例如混杂谷物米粒干扰识别效果、复杂光照与背景干扰下图像识别的鲁棒性不足以及小目标与破碎颗粒谷物的漏检率高等等,导致如何通过烹饪器具准确识别谷粒,即识别去壳后的谷类作物品种,为米粒烹饪提供适合的米水比例已成为非常棘手的挑战

Benefits of technology

[0016]本发明提供的一种在聚集图像中谷物颗粒的高精度识别方法及系统,所述识别方法包括以下步骤:S1、获取谷类作物的米粒原始图像并对其预处理,输出聚类米粒图像数据集;S2、对所述聚类米粒图像数据集执行分割处理,获取米粒掩模图像,随后标准化所述米粒掩模图像,生成具有标准尺寸大小的第一米粒图像数据集;S3、对所述第一米粒图像数据集开展第一筛分,剔除不满足形态学特征要求的米粒图像,得到第二米粒图像数据集;S4、将所述第二米粒图像数据集输入预训练的神经网络分类模型中,对第二米粒图像数据集中的米粒掩模图像进行二分类,将图像分为完整米粒掩模图像以及不完整米粒掩模图像,随后输出所述完整米粒掩模图像,得到第三米粒图像数据集;S5、基于所述第三米粒图像数据集,溯源定位并提取与所述第三米粒图像数据集对应的米粒原始图像,构建包含所述米粒原始图像的第四米粒图像数据集;S6、根据所述神经网络分类模型,对所述第四米粒图像数据集中的米粒原始图像执行类型识别,输出米粒品种的识别结果。对于本发明公开的所述在聚集图像中谷物颗粒的高精度识别方法,其采用先进的图像处理和机器学习算法来对谷类作物米粒进行识别和分类,能够显著提高谷物米粒的识别准确性和采集效率;其中,所述聚集图像中谷物颗粒的高精度识别方法主要包括六个步骤:第一步获取谷类作物的米粒原始图像,在获取米粒原始图像后需要对图像进行预处理,对图像特征进行增强,提高图像的识别效率,获取包含丰富米粒图像的聚类米粒图像数据集;第二步则分割所述米粒原始图像,运用图像分割模型提取独立米粒轮廓图像,实现谷物米粒图像的零样本分割,显著提高米粒轮廓分割的效率;由于分割后得到的米粒掩模图像尺寸,并不支持后续图像筛分算法,因此步骤S2后续则根据标准尺寸大小,对米粒掩模图像进行标准化处理,消除算法输出差异带来的数据偏差,得到所述第一米粒图像数据集,为后续算法提供统一的尺寸输入;第三步、第四步则通过深度学习算法对米粒掩模图像进行筛分,其中步骤S3利用神经网络分类算法,对米粒掩模图像进行形态学特征参数比例分析,实现对图像的第一筛分,去除不满足形态学特征要求的米粒图像,获取所述第二米粒图像数据集;由于在经过初步筛选后,任然会存在形状不规则或异常的掩模,需要进一步细化,因此第四步结合米粒的完整度差异进行二分类,具体为基于经过第一筛分之后的第二米粒图像数据集,对米粒掩模图像进行第二筛分处理,实现对米粒掩模图像的两次过滤处理,确保最终图像分割结果的质量;接下来对于第五步,则是对筛分处理后的第三米粒图像数据集进行溯源,获取与第三米粒图像数据集相对应的米粒原始图像,以此构建第四米粒图像数据集,利用所述米粒原始图像进行品种识别,既保留完整米粒图像特征信息,使模型兼具高精度和强泛化能力,又能规避直接使用米粒掩模图像进行识别,可能存在图像失真、影响识别结果的风险;最后一步则是进行米粒品种的识别,通过神经网络分类模型对溯源后的米粒原始图像进行识别,输出米粒的品种识别结果,便可实现谷物米粒准确识别。由此可见,本发明涉及的技术方案,相较于现有技术而言,其能够精准识别谷物米粒的品种,为谷物米粒智能烹饪的米水比例提供数值参考。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123016040A_ABST
    Figure CN123016040A_ABST
Patent Text Reader

Abstract

The application discloses a high-precision identification method and system for grain particles in an aggregated image, and the method comprises the following steps: acquiring a rice particle original image and performing pretreatment, and acquiring a clustering rice particle image dataset; segmenting and standardizing the clustering rice particle image to acquire a first rice particle image dataset; performing first screening and second screening on the first rice particle image dataset to respectively acquire a second rice particle image dataset and a third rice particle image dataset; tracing and extracting the rice particle original image data corresponding to the third rice particle image dataset to form a fourth rice particle image dataset containing the rice particle original image data; combining a pre-trained neural network to perform type identification on the rice particle original image in the fourth rice particle image dataset, and outputting a rice particle variety. The technical scheme disclosed by the application can accurately identify the variety of grain rice particles and provide numerical reference for the rice-water ratio of intelligent cooking of grain rice particles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and grain recognition technology, and more specifically, to a high-precision method and system for identifying grain particles in aggregated images. Background Technology

[0002] Cereal foods, made from cereal crops, occupy a central position in the human diet. Cereal crops refer to agricultural products whose core is starchy grains, providing humans with basic energy and nutrition. The cooking and processing of cereal crops are influenced by various parameters and factors, including: cereal variety, rice-to-water ratio, cooking time, and cooking utensils. For example, different varieties of cereal crops differ in starch content, grain size, and shape, requiring vastly different cooking methods to achieve optimal results. The rice-to-water ratio is a key factor affecting the taste and texture of cereal foods. For example, a rice-to-water ratio of approximately 1:1.2 to 1:1.5 is generally suitable for rice. Too little water results in hard, even undercooked, rice; too much water makes it overly soft and mushy. The effects of cooking time and utensils on the cooking results are self-evident based on existing life experience. It is evident that changes in any parameter or factor can have a profound impact on the cooking outcome of cereal foods.

[0003] Currently, existing technologies have achieved relatively mature solutions for cooking time and cooking appliance factors. However, breakthroughs are still being made in identifying grain varieties and adjusting the rice-to-water ratio using cooking appliances. In this process, the increasing variety of cereal crops, coupled with occlusion and similarity issues in image recognition (such as interference from mixed grains, insufficient robustness of image recognition under complex lighting and background interference, and high false negative rates for small targets and broken grains), have made accurately identifying grains—specifically, identifying the variety of hulled cereal crops—through cooking appliances to provide the appropriate rice-to-water ratio for rice cooking a very challenging task.

[0004] Therefore, how to provide a high-precision identification method and system for grain particles in aggregated images, which can accurately identify the variety of grains and provide a numerical reference for the rice-water ratio in intelligent cooking of grains, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] To address the aforementioned technical problems, this invention provides a high-precision identification method and system for grain particles in aggregated images, which can accurately identify the variety of grains and provide a numerical reference for the rice-to-water ratio in intelligent grain cooking.

[0006] The technical solution provided by this invention is as follows: This invention provides a high-precision method and system for identifying grain particles in clustered images, comprising the following steps: S1, acquiring original images of rice grains of cereal crops and preprocessing them to output a clustered rice grain image dataset; S2, performing segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images, and then standardizing the rice grain mask images to generate a first rice grain image dataset with a standard size; S3, performing a first screening on the first rice grain image dataset to remove rice grain images that do not meet the morphological feature requirements, obtaining a second rice grain image dataset; S4, inputting the second rice grain image dataset into a pre-trained... In the neural network classification model, the rice grain mask images in the second rice grain image dataset are classified into complete rice grain mask images and incomplete rice grain mask images. Then, the complete rice grain mask images are output to obtain the third rice grain image dataset. S5. Based on the third rice grain image dataset, the original rice grain images corresponding to the third rice grain image dataset are located and extracted to construct a fourth rice grain image dataset containing the original rice grain images. S6. According to the neural network classification model, type recognition is performed on the original rice grain images in the fourth rice grain image dataset, and the rice grain variety recognition result is output.

[0007] Furthermore, in a preferred embodiment of the present invention, the specific steps for outputting the clustered rice grain image dataset in step S1 include: S101, Multi-scale Retinex enhancement: Normalize the original image of the rice grains and process it using multiple Gaussian filters of different scales to generate corresponding filtered images; Based on the differences between the original image of the rice grain and each filtered image, the multi-scale Retinex enhancement result is calculated and normalized output. S102, Color Space Correction: Convert the enhanced image to the LAB color space, correct the mean of the color channels by offset, and then convert it back to the RGB space. S103, Global White Balance and CLAHE Enhancement: White balance gain is adjusted based on the global mean of the RGB channels, and block adaptive histogram equalization is performed on each channel to generate the final enhanced image.

[0008] Furthermore, in a preferred embodiment of the present invention, the specific steps for obtaining the rice grain mask image in step S2 include: S201. Construct the RICESAM model by inputting the clustered rice grain image dataset into the RICESAM model and obtaining the image embedding through the model's image encoder. S202. Determine the segmentation cue information of the image, extract its spatial features through a convolutional layer, and then encode the spatial features as a cue embedding aligned with the image embedding using a model-based cue encoder. S203. Based on the mask decoder of the RICESAM model, the image embedding and cue embedding are interactively combined to generate a segmentation mask for the image. S204. Perform morphological filtering on the segmentation mask to obtain the final mask output of the rice grains, and obtain the rice grain mask image in which the rice grains are separated from the black background.

[0009] Furthermore, in a preferred embodiment of the present invention, the specific steps for generating a first rice grain image dataset with a standard size in step S2 include: S205. Obtain the numerical dimensions of the rice grain mask image and the standard dimensions of the standard image; S206. Determine the geometric center position of the rice grain outline in the rice grain mask image, and align the geometric center with the center coordinates of its rice grain mask image; S207. Obtain the scaling ratio, scale the outline of the rice grain to a standard size black background to obtain a single rice grain image, and then output the single rice grain image dataset, i.e., the first rice grain image dataset.

[0010] Furthermore, in a preferred embodiment of the present invention, step S3 specifically includes: S301. Using a complete rice grain image, define the morphological feature parameters of the complete rice grain, including: rice grain area. Circumference of a rice grain Area to perimeter ratio Length of the major axis of the fitted ellipse Length of the minor axis of the fitted ellipse Area of ​​fitted ellipse Fitted ellipse perimeter Area difference Aspect Ratio and ellipticity ; S302. Based on the morphological feature parameters, construct a Filter-I algorithm based on morphological quantization; S303. Obtain the rice grain mask image from the second rice grain image dataset, and then input the rice grain mask image into the Filter-I algorithm to extract the morphological feature parameters of each rice grain in the image; S304. Preset parameter threshold, compare and analyze the morphological feature parameters of rice grains with the parameter threshold, and filter out rice grain mask images that do not meet the parameter threshold requirements; S305. Output the filtered rice grain mask images and merge them to obtain the second rice grain image dataset.

[0011] Furthermore, in a preferred embodiment of the present invention, step S304, the method for comparing and analyzing the morphological characteristic parameters of rice grains with the parameter thresholds, includes: Based on the morphological feature parameter category, a threshold range is set to determine whether the morphological feature parameter of the rice grain is within the threshold range, and samples with obviously abnormal values ​​are screened out. Based on the characteristics of the complete rice grain outline and the actual rice grain outline, a similarity analysis is performed to screen out samples that do not meet the similarity requirements. The method steps of the similarity analysis include: Obtain the actual rice grain outline point set And calculate the centroid of the actual rice grain profile. ; Based on the centroid of the actual rice grain profile and the centroid of the fitted ellipse, the center distance of the actual rice grain profile is calculated. and normalized matrix The formula is as follows: , ; Subsequently, based on the normalized matrix, the Hu matrix of the actual rice grain outline is obtained. ; An ellipse is fitted based on the actual rice grain contour, generating a set of points for the fitted ellipse. The centroid of the fitted ellipse contour is then calculated. The above steps are repeated to obtain the Hu matrix of the fitted ellipse. ; By combining the Hu matrix of the actual rice grain outline and the Hu matrix of the fitted ellipse, a similarity calculation is performed to evaluate the degree of matching between the rice grain outline and the fitted ellipse outline. The formula is as follows: .

[0012] Furthermore, in a preferred embodiment of the present invention, the similarity analysis method further includes: calculating the similarity using a W-shaped algorithm, that is, converting the outline edges of rice grains into a waveform diagram with digital description, and then performing wave analysis to determine the degree of similarity; specifically including the following steps: Obtain the centroid coordinates of the complete rice grain outline : , ; in, The first grain of rice on the outline boundary The coordinates of the points For the first The weight of each point This represents the total number of boundary points of the rice grain outline. Then, the distance from the boundary point of the rice grain profile to the centroid was calculated using the Euclidean distance formula. : ; Calculate adjacent points on the rice grain profile and The segment length is used to obtain the cumulative arc length. : ; Among them, the initial cumulative arc length Spacing between adjacent points Calculated by the following formula: ; Then, the distance from the boundary point of the rice grain outline to the centroid is used. The vertical axis represents the cumulative arc length. Establish a coordinate system for the horizontal axis and generate a W-shaped curve from the complete rice grain outline, i.e., a waveform diagram of the complete rice grain outline; Based on the above steps, an actual rice grain outline waveform is obtained. Wave analysis is then performed on the complete rice grain outline waveform and the actual rice grain outline waveform to quantify the rice grain outline features and assess the degree of similarity.

[0013] Further, in a preferred embodiment of the present invention, step S4, the step of binary classification of the rice grain mask images in the second rice grain image dataset, includes: S401. Construct a neural network classification model and pre-train the neural network classification model; S402. Input the rice grain mask image into the neural network classification model. The image is first passed through a 32-channel convolutional layer with a stride of 2 to extract shallow features and output a feature map with halved resolution and expanded channel number. S403. Based on the inverted residual structure, multiple sets of bottleneck modules are stacked, and deep features of the feature map are extracted step by step through multiple bottleneck modules; S404. Then, the feature map is expanded by 1×1 convolution, followed by average pooling to compress the feature map size. Finally, the number of image channels is mapped to the number of classification categories k by 1×1 convolution, and the image classification result is output.

[0014] Furthermore, in a preferred embodiment of the present invention, the neural network classification model is trained by D-FTL stepwise transfer learning based on a preset neural network model, and the specific steps include: Set initial parameters: Pre-train a neural network model based on the ImageNet dataset, and then obtain the weights of the neural network model to initialize the model; Training of the clustered rice grain image dataset: Based on the clustered rice grain image dataset and data augmentation technology, the initialization model is trained, all convolutional layers and fully connected layers are trained, and the weights of the clustered rice grain model are obtained by normalization through the mean and variance of the original rice grain image dataset, and the number of neurons in the last fully connected layer is adjusted according to the number of rice grain categories. Training on a single grain of rice image dataset: Based on the weights of the clustered rice grain model, the model training on the single grain of rice image dataset is initialized. During training, the network parameters of the shallower layers of the neural network model are frozen, and only the deep network and fully connected layers are trained. The number of neurons in the last fully connected layer is kept unchanged. The model is optimized based on the single grain of rice image dataset to obtain a neural network classification model for identifying rice grains.

[0015] This invention also provides another technical method: This invention provides a method for high-precision identification of grain particles in aggregated images, comprising: The image acquisition module is used to acquire raw images of rice grains from cereal crops; The image processing module is connected to the image acquisition module; The image processing module includes: an image preprocessing unit for enhancing the original rice grain image to obtain a clustered rice grain image dataset; an image segmentation unit connected to the image preprocessing unit for segmenting the image to achieve rice grain granularity segmentation; and an image normalization unit connected to the image segmentation unit for adjusting the image size. An image screening module connected to the image processing module; The image screening module includes: a first screening unit, used to perform a first screening of rice grain images based on rice grain morphological feature parameters; and a second screening unit connected to the first screening unit, used to perform a second screening of the rice grain images after the first screening based on integrity requirements. An image tracing module connected to the image screening module is used to perform tracing processing on the output image of the second screening unit to obtain the original image of the rice grain corresponding to the output image of the second screening unit. A rice grain image recognition module connected to the image tracing module is used to identify and output the category of rice grains in the image based on a neural network classification model. The model training module is used to build and pre-train the neural network classification model.

[0016] This invention provides a high-precision identification method and system for grain particles in clustered images. The identification method includes the following steps: S1, acquiring original images of rice grains of cereal crops and preprocessing them to output a clustered rice grain image dataset; S2, performing segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images, and then standardizing the rice grain mask images to generate a first rice grain image dataset with a standard size; S3, performing a first screening on the first rice grain image dataset to remove rice grain images that do not meet the morphological feature requirements, obtaining a second rice grain image dataset; S4, inputting the second rice grain image dataset into... In the pre-trained neural network classification model, the rice grain mask images in the second rice grain image dataset are classified into complete rice grain mask images and incomplete rice grain mask images. Then, the complete rice grain mask images are output to obtain the third rice grain image dataset. S5. Based on the third rice grain image dataset, the original rice grain images corresponding to the third rice grain image dataset are located and extracted to construct a fourth rice grain image dataset containing the original rice grain images. S6. According to the neural network classification model, the type recognition of the original rice grain images in the fourth rice grain image dataset is performed, and the rice grain variety recognition result is output.The high-precision identification method for grain grains in clustered images disclosed in this invention employs advanced image processing and machine learning algorithms to identify and classify cereal grains, significantly improving the accuracy and efficiency of grain grain identification. The method mainly includes six steps: First, acquiring original images of cereal grains. After acquiring the original images, preprocessing is performed to enhance image features, improving recognition efficiency and obtaining a clustered grain image dataset containing abundant grain images. Second, segmenting the original grain images... The initial image is used to extract individual rice grain contour images using an image segmentation model, achieving zero-sample segmentation of the grain image and significantly improving the efficiency of rice grain contour segmentation. Since the size of the segmented rice grain mask image does not support subsequent image screening algorithms, step S2 then standardizes the rice grain mask image according to a standard size to eliminate data deviations caused by differences in algorithm outputs, obtaining the first rice grain image dataset, providing a unified size input for subsequent algorithms. Steps three and four then use deep learning algorithms to screen the rice grain mask images, with step S3 utilizing a neural network classification algorithm to... The rice grain mask images undergo morphological feature parameter ratio analysis to achieve the first screening of the images, removing rice grain images that do not meet the morphological feature requirements, and obtaining the second rice grain image dataset. Since irregularly shaped or abnormal masks may still exist after the initial screening, further refinement is needed. Therefore, the fourth step combines the differences in rice grain integrity for binary classification. Specifically, based on the second rice grain image dataset after the first screening, the rice grain mask images undergo a second screening process, achieving two filtering processes for the rice grain mask images to ensure the quality of the final image segmentation result. The fifth step then involves further analysis of the screening... The processed third rice grain image dataset is traced back to its source to obtain the original rice grain images corresponding to the third dataset, thus constructing a fourth rice grain image dataset. These original images are then used for variety identification, preserving complete rice grain image feature information, giving the model both high accuracy and strong generalization ability, while avoiding the risk of image distortion and affecting recognition results from directly using rice grain mask images. The final step is to identify the rice grain variety by using a neural network classification model to identify the original traced rice grain images and output the rice grain variety identification result, thereby achieving accurate identification of grains. Therefore, the technical solution of this invention, compared to existing technologies, can accurately identify the variety of grains, providing a numerical reference for the rice-to-water ratio in intelligent grain cooking. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the steps of the high-precision identification method and system for grain particles in aggregated images according to an embodiment of the present invention. Figure 2 This is a flowchart illustrating the steps involved in this invention: acquiring raw images of rice grains from cereal crops, preprocessing them, and outputting a clustered rice grain image dataset. Figure 3 This is a flowchart illustrating the steps of performing segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images according to an embodiment of the present invention; Figure 4 This is a flowchart illustrating the steps involved in generating a first rice grain image dataset with a standard size, based on the standardized rice grain mask image described in this embodiment of the invention. Figure 5 This is a flowchart illustrating the steps involved in this embodiment of the invention to perform a first screening of the first rice grain image dataset, remove rice grain images that do not meet the morphological feature requirements, and obtain a second rice grain image dataset. Figure 6 This is a flowchart illustrating the steps involved in an embodiment of the present invention: inputting the second rice grain image dataset into a pre-trained neural network classification model to perform binary classification of the rice grain mask images in the second rice grain image dataset; Figure 7 This is a schematic diagram of a clustered rice grain image after image feature enhancement, according to an embodiment of the present invention. Figure 8 This is a schematic diagram illustrating the stages and steps of segmenting the clustered rice grain image dataset according to an embodiment of the present invention; Figure 9 This is a schematic diagram of some of the morphological feature parameters involved in the embodiments of the present invention; Figure 10 This is a schematic diagram illustrating the conversion of the outline edge of a rice grain into a digital description according to an embodiment of the present invention; Figure 11 This is a system architecture diagram of the high-precision grain particle identification system in aggregated images according to an embodiment of the present invention. Detailed Implementation

[0019] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0020] It should be noted that when a component is referred to as being "fixed to" or "set on" another component, it can be directly on or indirectly set on the other component; when a component is referred to as being "connected to" another component, it can be directly connected to or indirectly connected to the other component.

[0021] It should be understood that the terms "length", "width", "upper", "lower", "front", "rear", "first", "second", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the present invention.

[0022] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" or "several" means two or more, unless otherwise explicitly specified.

[0023] It should be noted that the structures, proportions, sizes, etc., shown in the accompanying drawings of this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed in the specification, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0024] Please Figures 1 to 11As shown, this invention provides a high-precision identification method and system for grain particles in clustered images. It employs advanced image processing and machine learning algorithms to identify and classify crops such as rice grains, solving the challenges of rice variety identification and optimal cooking parameter matching. It can be applied to various types of cooking utensils, providing users with a high-quality cooking experience by offering accurate rice-to-water ratio references. The method specifically includes the following steps: S1, acquiring and preprocessing the original images of rice grains to output a clustered rice grain image dataset; S2, performing segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images, then standardizing the rice grain mask images to generate a first rice grain image dataset with a standard size; S3, performing a second... S4. The second rice grain image dataset is obtained by filtering out rice grain images that do not meet the morphological feature requirements. S5. The second rice grain image dataset is input into a pre-trained neural network classification model to perform binary classification on the rice grain mask images in the second rice grain image dataset, dividing the images into complete rice grain mask images and incomplete rice grain mask images. The complete rice grain mask images are then output to obtain a third rice grain image dataset. S6. Based on the third rice grain image dataset, the original rice grain images corresponding to the third rice grain image dataset are located and extracted to construct a fourth rice grain image dataset containing the original rice grain images. S7. According to the neural network classification model, type recognition is performed on the original rice grain images in the fourth rice grain image dataset, and the rice grain variety recognition result is output. The technical solution of this invention can accurately identify the variety of grains, providing a numerical reference for the rice-to-water ratio in intelligent grain cooking.

[0025] The high-precision identification method and system for grain particles in aggregated images disclosed in this invention will be specifically described below with reference to specific embodiments. The high-precision identification method and system for grain particles in aggregated images specifically includes the following steps: S1. Obtain the original images of rice grains from cereal crops and preprocess them to output a clustered rice grain image dataset.

[0026] In this embodiment of the invention, the application scenario of the high-precision identification method and system for grain particles in aggregated images is cooking appliances such as rice cookers. The following uses rice as an example to illustrate and analyze the method. The method for identifying grain particles first requires acquiring the original image of rice grains. For this purpose, a high-precision image acquisition device needs to be set in the cooking appliance. Through the grain grain image acquisition device, high-resolution, high-quality rice images are captured, providing a solid foundation for subsequent image analysis.

[0027] In the image recognition process, factors such as transparency, uniformity of morphological features, and external lighting increase complexity. Furthermore, the similarity in transparency and morphological features of rice grains makes edge detection and morphological analysis difficult. Moreover, external influences such as lighting and reflection further weaken the generalization ability of recognition models based on color and shape features. Therefore, step S1 requires preprocessing the acquired raw rice grain image. In this embodiment of the invention, the preprocessing is an image feature enhancement method to improve image recognition efficiency.

[0028] Specifically, in a specific embodiment of the present invention, the specific steps for outputting the clustered rice grain image dataset in step S1 include: S101, multi-scale Retinex enhancement: normalizing the original rice grain image and processing it using multiple Gaussian filters of different scales to generate corresponding filtered images; calculating the multi-scale Retinex enhancement result based on the difference between the original rice grain image and each filtered image, and outputting it after normalization; S102, color space correction: converting the enhanced image to the LAB color space, correcting the mean of the color channels by offset, and then converting it back to the RGB space; S103, global white balance and CLAHE enhancement: adjusting the white balance gain based on the global mean of the RGB channels, and performing block adaptive histogram equalization processing on each channel to generate the final enhanced image.

[0029] In this embodiment, for step S1, a Gaussian scale is set. CLAHE sub-region M=5, comparison limit threshold The original image of the rice grain Preprocessing is performed to obtain a clustered rice grain image dataset, specifically including the following steps: S101, Multi-scale Retinex enhancement: the original rice grain images are... Normalization: and initialize the multi-scale Retinex augmentation results. ; use standard deviation respectively Gaussian filter pair Filtering is performed to obtain ; Calculate the Retinex components at each scale: ; After accumulation Perform linear normalization to the range [0, 255]; S102, Color Space Correction: [This will...] Convert to LAB color space and calculate the global mean of channels a and b. , Then, offset correction is performed on the a and b channel values ​​of each pixel:

[0030] ; The image is then corrected and converted back to RGB space. ; S103, Global White Balance and CLAHE Enhancement: Computational Image RGB three-channel average Calculate the global mean And adjust the gain of each channel:

[0031] ; Subsequently, for each channel Divide the region into M×M, or 5×5 sub-regions, apply the CLAHE algorithm, and compare against the limiting threshold. Finally, an enhanced image E(x,y) is synthesized.

[0032] In this embodiment of the invention, image enhancement includes three stages: multi-scale Retinex enhancement, color space correction, and global white balance and CLAHE enhancement. First, multi-scale Retinex enhancement aims to eliminate uneven illumination and enhance the dynamic range of the image. It integrates local and global illumination information using different Gaussian scales, avoiding over-enhancement or loss of detail caused by a single scale. Second, color space correction, based on mean shift adjustment, is simple and efficient, suitable for real-time processing, and aims to correct color cast and optimize color balance. Finally, global white balance and CLAHE enhancement are performed. CLAHE block optimization is used, combined with global white balance and local contrast enhancement, balancing natural tones and detail clarity to optimize global tone and enhance local contrast.

[0033] S2. Perform segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images, and then standardize the rice grain mask images to generate a first rice grain image dataset with a standard size.

[0034] In this embodiment of the invention, the RICESAM model is used for clustering and segmenting rice images. The RICESAM model is trained using a rice grain segmentation dataset, adjusting the mask adapter of the decoding module, and based on a fine-tuned neural network model using SAM. Through the RICESAM model, zero-shot segmentation of rice images can be achieved, which significantly improves the efficiency of rice contour segmentation.

[0035] Specifically, in a specific embodiment of the present invention, the specific steps for obtaining the rice grain mask image in step S2 include: S201, constructing a RICESAM model, inputting the clustered rice grain image dataset into the RICESAM model, and obtaining image embeddings through the model's image encoder; S202, determining the segmentation cue information of the image, extracting its spatial features through a convolutional layer, and then encoding the spatial features as cue embeddings aligned with the image embeddings based on the model's cue encoder; S203, combining the image embeddings and cue embeddings interactively according to the RICESAM model's mask decoder to generate a segmentation mask for the image; S204, performing morphological filtering on the segmentation mask to obtain the final mask output of the rice grains, resulting in a rice grain mask image in which the rice grains are separated from the black background.

[0036] In this embodiment of the invention, the RICESAM model consists of three core components: an image encoder, a cue encoder, and a mask decoder. During the application phase, the parameters of the encoder and decoder are frozen. The clustered rice grain image set is first feature-encoded by the image encoder to obtain image embeddings. The cue encoder processes various cue information, including points, boxes, and text. This information, along with mask information processed by convolutional layers, is input into the mask decoder to produce the final segmentation output, i.e., the image segmentation mask. To further improve the mask output quality, morphological operations are performed on the segmentation mask after acquisition. By changing the mask's shape, connectivity, and boundary structure, its geometric features are optimized to better suit subsequent image processing tasks. Finally, based on the final mask, a rice grain mask image is obtained, as shown below. Figure 8 As shown.

[0037] Step S2 is also used to adjust the image size data. Since the size of the rice grain mask image output by the RICESAM model segmentation is 1280*720, while the standard size supported by the subsequent screening algorithm is different, the size of the rice grain mask image in the first rice grain image dataset does not support the subsequent image screening algorithm. Therefore, step S2 standardizes the rice grain mask image according to the standard size to eliminate the data deviation caused by the difference in algorithm output and provide a unified size input for the subsequent algorithm.

[0038] Specifically, in a specific embodiment of the present invention, the specific steps for generating a first rice grain image dataset with a standard size in step S2 include: S205, obtaining the numerical size of the rice grain mask image and the standard size of the standard image; S206, determining the geometric center position of the rice grain outline in the rice grain mask image, and aligning the geometric center with the center coordinates of its rice grain mask image; S207, obtaining the scaling ratio, scaling the rice grain outline to a black background of a standard size to obtain a single rice grain image, and then outputting the single rice grain image dataset, i.e., the first rice grain image dataset.

[0039] In this embodiment, for the 1280×720 pixel mask image and the discrete rice grain images, a scaling factor of f = 2.08 is used to scale the rice grain outlines to a 250×250 pixel black background, as shown below. Figure 8 As shown in (e), a standard size of 250×250 pixels is chosen. This is suitable for neural networks with different input size requirements, such as VGG-16 (input size 299×299 pixels) and MobileNetV2 (input size 224×224 pixels). The size of 250×25 pixels is a compromise between 299×299 and 224×224, which facilitates resizing operations.

[0040] S3. Perform a first screening on the first rice grain image dataset to remove rice grain images that do not meet the morphological feature requirements, and obtain a second rice grain image dataset.

[0041] Since image segmentation generates a large number of rice grain mask images, and manually selecting from these images is time-consuming and laborious, this embodiment develops an automatic selection tool, Filter-I, based on rice grain morphological features. This significantly improves efficiency and saves resources. Specifically, step S5 automates the processing of the large amount of mask data. Filter-I uses the morphological features of rice grains for initial screening, avoiding the tedious process of manually checking each mask image one by one. Furthermore, it uses rice grain morphological parameter ratio analysis and image conversion to wavelet analysis to eliminate abnormal image samples, reducing manual intervention and improving overall work efficiency.

[0042] Specifically, in a specific embodiment of the present invention, step S3 specifically includes: S301, defining the morphological feature parameters of the complete rice grain image; S302, constructing a Filter-I algorithm based on morphological quantization according to the morphological feature parameters; S303, obtaining the rice grain mask image from the second rice grain image dataset, and then inputting the rice grain mask image into the Filter-I algorithm to extract the morphological feature parameters of each rice grain in the image; S304, setting a preset parameter threshold, comparing and analyzing the morphological feature parameters of the rice grain with the parameter threshold, and filtering out rice grain mask images that do not meet the parameter threshold requirements; S305, outputting the filtered rice grain mask images and merging them to obtain the second rice grain image dataset.

[0043] Specifically, in a specific embodiment of the present invention, the morphological feature parameters include: grain area. Circumference of a rice grain Area to perimeter ratio Length of the major axis of the fitted ellipse Length of the minor axis of the fitted ellipse Area of ​​fitted ellipse Fitted ellipse perimeter Area difference Aspect Ratio and ellipticity .

[0044] Specifically, in a specific embodiment of the present invention, step S304, the method for comparing and analyzing the morphological feature parameters of rice grains with the parameter thresholds, includes: setting a threshold range according to the category of the morphological feature parameters, determining whether the morphological feature parameters of the rice grains are within the threshold range, and screening samples with obviously abnormal values; performing similarity analysis based on the complete rice grain outline and the actual rice grain outline features, and screening samples that do not meet the similarity requirements, wherein the similarity analysis method includes the following steps: Obtain the actual rice grain outline point set And calculate the centroid of the actual rice grain profile. ; Based on the centroid of the actual rice grain profile and the centroid of the fitted ellipse, the center distance of the actual rice grain profile is calculated. and normalized matrix The formula is as follows: , ; Subsequently, based on the normalized matrix, the Hu matrix of the actual rice grain outline is obtained. Next, an ellipse is fitted based on the actual rice grain contour, generating a set of points for the fitted ellipse. The centroid of the fitted ellipse contour is then calculated. The above steps are repeated to obtain the Hu matrix of the fitted ellipse. By combining the Hu matrix of the actual rice grain outline and the Hu matrix of the fitted ellipse, a similarity calculation is performed to evaluate the degree of matching between the rice grain outline and the fitted ellipse outline. The formula is as follows: .

[0045] In this embodiment of the invention, in order to better describe the complete outline of rice grains, a "W-shaped" method is proposed. The core of this method is to convert the edges of the complete rice grain outline into a waveform diagram with digital description.

[0046] Specifically, in a specific embodiment of the present invention, the method steps of the similarity analysis further include: calculating the similarity using a W-shaped algorithm, that is, converting the outline edge of the rice grain into a waveform diagram with digital description, and then performing wave analysis to determine the degree of similarity; specifically including the following steps: Obtain the centroid coordinates of the complete rice grain outline : , ; in, The first grain of rice on the outline boundary The coordinates of the points For the first The weight of each point This represents the total number of boundary points of the rice grain profile; subsequently, the distance from each boundary point to the centroid is calculated using the Euclidean distance formula. : ; Calculate adjacent points on the rice grain profile and The segment length is used to obtain the cumulative arc length. : ; Among them, the initial cumulative arc length Spacing between adjacent points Calculated by the following formula: ; Then, the distance from the boundary point of the rice grain outline to the centroid is used. The vertical axis represents the cumulative arc length. Establish a coordinate system for the horizontal axis, generate a W-shaped curve from the complete rice grain outline, i.e., a complete rice grain outline waveform; according to the above steps, obtain the actual rice grain outline waveform; perform wave analysis based on the complete rice grain outline waveform and the actual rice grain outline waveform to quantify the rice grain outline features and assess the degree of similarity.

[0047] like Figure 10 As shown, the "W-shaped" method converts the rice grain outline boundary into a waveform image. This conversion not only preserves the integrity of the outline but also enhances the analytical capability of its boundary features. This method can highlight morphological changes in the outline, magnify and intuitively reveal the subtle differences between rice grain outlines, making the identification process clearer and more efficient.

[0048] S4. Input the second rice grain image dataset into the pre-trained neural network classification model, perform binary classification on the rice grain mask images in the second rice grain image dataset, and divide the images into complete rice grain mask images and incomplete rice grain mask images. Then output the complete rice grain mask images to obtain the third rice grain image dataset.

[0049] Step S4 is the second filtering mechanism in the rice grain variety identification mechanism of this scheme. Since masks with irregular or abnormal shapes may still exist after the initial morphological screening using Filter-I, these masks require further refinement. To address this limitation, this method proposes a lightweight neural network classifier, named Filter-II, to perform a second screening of the third rice grain image dataset, binary classifying the masks into complete and incomplete categories, thereby ensuring the quality of the final segmentation result. In this embodiment, Filter-II adopts a modular design, which can be flexibly decoupled from the main architecture. Its pluggable design allows for easy replacement and customization according to specific application requirements.

[0050] Specifically, in a specific embodiment of the present invention, step S4, the step of performing binary classification on the rice grain mask images in the second rice grain image dataset, includes: S401, constructing a neural network classification model and pre-training the neural network classification model; S402, inputting the rice grain mask image into the neural network classification model, the image first passing through a 32-channel convolutional layer with a stride of 2 to extract shallow features, and outputting a feature map with halved resolution and expanded channel number; S403, based on the inverted residual structure, stacking multiple bottleneck modules, and gradually extracting deep features of the feature map through multiple bottleneck modules; S404, then expanding the channel of the feature map through 1×1 convolution, then compressing the feature map size with average pooling, and then mapping the number of image channels to the number of classification categories k through 1×1 convolution, and outputting the image classification result.

[0051] In this embodiment of the invention, the resolution of the rice grain mask image is 224×224, and the number of channels is 3, that is, the image size and channel parameters are represented as 224×224×3. In this embodiment, the neural network classification model is specifically the MobileNetV2 model. The steps of using the MobileNetV2 model to perform the second screening of the third rice grain image dataset include: first, inputting a 224×224×3 image, passing the image through a 32-channel convolutional layer with a stride of 2, and outputting a 112×112×32 image. This step can initially capture the low-level features of the image, such as edges and textures. Subsequently, multiple bottleneck modules are stacked to gradually extract deep features of the image. Specifically, in stage one, the first bottleneck module compresses the 32 channels to 16 channels with an expansion factor t=1. The 3×3 DW convolution and the 1×1 convolution can be separated by depth. PW convolution optimizes features, represented as: 112×112×32 → 112×112×16 (bottleneck, \(t=1,c=16,n=1,s=1\)); Stage two: using a spreading factor of t=6, the 16 channels are increased to 96 channels, and then a depthwise convolution with a stride of 2 is performed to halve the feature map size to 56×56, and then compressed to 24 channels. This stage is repeated twice. The second time, the size is maintained and residual connections are introduced to enhance feature reuse, represented as: 11 2×112×16 → 56×56×24 (bottleneck, \(t=6, c=24, n=2, s=2\)); Subsequent dimensionality reduction and feature enhancement: By gradually adjusting the step size s=2 and the expansion factor t=6, the feature map size is successively reduced to 28×28, 14×14 and 7×7, while increasing the number of channels to 320. The first module of each dimensionality reduction stage is halved in size according to the step size 2, and subsequent modules are stacked through residual connections, and each bottleneck ends with... The 1×1 dimensionality reduction convolution uses linear activation to progressively extract high-order semantic features of the image, represented as: 56×56×24→28×28×32 (bottleneck, \(t=6,c=32,n=3,s=2\)), 28×28×32→14×14×64 (bottleneck, \(t=6,c=64,n=4,s=2\)), 14×14×64→14×14×96 (bottleneck, \(t=6, c=96, n=3, s=1), 14×14×96→7×7×160 (bottleneck, (t=6, c=160, n=3, s=2)), 7×7×160→7×7×320 (bottleneck, (t=6, c=320, n=1, s=1)); finally, the feature map is upscaled to 1280 channels through 1×1 convolution, and then 7×7 average pooling is performed to output k channels with 1×1 convolution, which is the number of k classification categories.By adjusting the step size s to control the size reduction, repeating the number of times n to stack modules to deepen the network, and using the expansion factor t to balance the channel complexity, the process of classifying the input image is realized through this series of steps.

[0052] Specifically, in a specific embodiment of the present invention, the neural network classification model is trained by D-FTL stepwise transfer learning based on a preset neural network model. The specific steps include: setting initial parameters: pre-training the neural network model based on the ImageNet dataset, and then obtaining the weights of the neural network model to initialize the model; training the clustered rice grain image dataset: training the initialized model based on the clustered rice grain image dataset and data augmentation techniques, training all convolutional layers and fully connected layers, and normalizing using the mean and variance of the original rice grain image dataset to obtain the weights of the clustered rice grain model, and adjusting the number of neurons in the last fully connected layer according to the number of rice grain categories; training the single rice grain image dataset: initializing the model training for the single rice grain image dataset based on the weights of the clustered rice grain model, freezing the network parameters of the shallower layers of the neural network model during training, training only the deeper networks and fully connected layers, keeping the number of neurons in the last fully connected layer unchanged, and optimizing the model based on the single rice grain image dataset to obtain a neural network classification model for identifying rice grains.

[0053] The preset neural network models include: VGG16, DenseNet, MobileNet, RegNet, ResNet15, and ResNet50. In this embodiment, VGG16 is selected as the neural network model for pre-training the neural network classification model. The pre-training process first uses pre-trained ImageNet models as a foundation, carefully fine-tuning these models on a clustered rice grain dataset to better adapt to the different data characteristics of rice grains. Then, the optimized models are used as the basis for further training of Filter-II and L-MCNN models. This method reduces the model volatility and instability that may occur when directly transferring from pre-trained ImageNet models. We call this stepwise transfer learning method D-FTL, and during training, a cosine annealing strategy is used to adjust the learning rate. Cosine annealing simulates the annealing process by gradually cooling the system to a minimum energy state, thereby adjusting the learning rate.

[0054] S5. Based on the third rice grain image dataset, trace and locate the original rice grain image corresponding to the third rice grain image dataset, and construct a fourth rice grain image dataset containing the original rice grain image.

[0055] S6. Based on the neural network classification model, perform type recognition on the original rice grain images in the fourth rice grain image dataset, and output the rice grain variety recognition result.

[0056] Specifically, the present invention also provides a high-precision identification system for grain particles in clustered images, comprising: an image acquisition module for acquiring original images of rice grains of cereal crops; an image processing module connected to the image acquisition module; the image processing module comprising: an image preprocessing unit for enhancing the original rice grain images to obtain a clustered rice grain image dataset; an image segmentation unit connected to the image preprocessing unit for segmenting the images to achieve rice grain size segmentation; an image normalization unit connected to the image segmentation unit for adjusting the image size; and an image sieving module connected to the image processing module; the image sieving module comprising: a first sieving unit. The system comprises: a first screening unit for rice grain images based on morphological features; a second screening unit connected to the first screening unit for second screening of the rice grain images after the first screening based on integrity requirements; an image tracing module connected to the image screening module for tracing the source of the images output by the second screening unit to obtain the original rice grain images corresponding to the output images of the second screening unit; a rice grain image recognition module connected to the image tracing module for identifying and outputting the category of rice grains in the image based on a neural network classification model; and a model training module for establishing and pre-training the neural network classification model.

[0057] Among them, such as Figure 11 As shown in the embodiment of the present invention, the high-precision identification system for grain particles in aggregated images mainly consists of an image acquisition module, an image processing module, a screening module, an image tracing module, a rice grain image recognition module, and the model pre-training model. The entire system, each module, or each unit in the module generally adopts a modular and pluggable design, which can be decoupled and upgraded individually or changed for different purposes, so that each module or unit can be easily replaced and customized according to specific application requirements.

[0058] In summary, the high-precision identification method and system for grain particles in clustered images disclosed in this invention have direct practical value in solving the challenges of rice variety identification and optimal cooking parameter matching. It can be applied to various types of cooking utensils and provides users with a high-quality cooking experience by offering precise numerical references for rice-to-water ratios. The high-precision identification method for grain particles in clustered images disclosed in this invention employs advanced image processing and machine learning algorithms to identify and classify cereal grains, significantly improving the accuracy and efficiency of grain particle identification. The high-precision identification method for grain particles in clustered images mainly includes six steps: The first step is to acquire original images of cereal grains. After acquiring the original images, preprocessing is required to enhance image features and improve image recognition efficiency, obtaining a clustered grain image dataset containing abundant grain images; the second step is to segment the grains. The original image is used to extract individual rice grain contour images using an image segmentation model, achieving zero-sample segmentation of the grain image and significantly improving the efficiency of rice grain contour segmentation. Since the size of the segmented rice grain mask images does not support subsequent image screening algorithms, step S2 then standardizes the rice grain mask images according to a standard size to eliminate data bias caused by differences in algorithm outputs, obtaining the first rice grain image dataset, providing a unified size input for subsequent algorithms. Steps three and four then use deep learning algorithms to screen the rice grain mask images, with step S3 utilizing a neural network classification algorithm. Morphological feature parameter ratio analysis is performed on the rice grain mask images to achieve the first screening of the images, removing rice grain images that do not meet the morphological feature requirements, and obtaining the second rice grain image dataset. Since irregular or abnormally shaped masks may still exist after the initial screening, further refinement is needed. Therefore, the fourth step combines the differences in rice grain integrity for binary classification. Specifically, based on the second rice grain image dataset after the first screening, a second screening process is performed on the rice grain mask images, achieving two filtering processes for the rice grain mask images to ensure the quality of the final image segmentation result. The fifth step then involves further screening... The processed third rice grain image dataset is traced back to its source to obtain the original rice grain images corresponding to the third rice grain image dataset, thereby constructing a fourth rice grain image dataset. The original rice grain images are then used for variety identification, which preserves the complete rice grain image feature information, enabling the model to have both high accuracy and strong generalization ability, while avoiding the risk of image distortion and affecting the identification results if rice grain mask images are used directly for identification. The final step is to identify the rice grain variety by identifying the original rice grain images after tracing back to their source through a neural network classification model, and outputting the rice grain variety identification result, thus achieving accurate identification of grain rice.Therefore, the technical solution of this invention, compared with the prior art, can accurately identify the variety of grains, provide a numerical reference for the rice-water ratio in intelligent cooking of grains, provide important reference value for the accurate classification of rice varieties in agriculture and food industry, and provide new technical means for the intelligent development of related fields.

[0059] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for high-precision identification of grain particles in aggregated images, characterized in that, Includes the following steps: S1. Obtain the original images of rice grains from cereal crops and preprocess them to output a clustered rice grain image dataset; S2. Perform segmentation processing on the clustered rice grain image dataset to obtain rice grain mask images, and then standardize the rice grain mask images to generate a first rice grain image dataset with a standard size; S3. Perform a first screening on the first rice grain image dataset to remove rice grain images that do not meet the morphological feature requirements, and obtain a second rice grain image dataset. S4. Input the second rice grain image dataset into the pre-trained neural network classification model, perform binary classification on the rice grain mask images in the second rice grain image dataset, divide the images into complete rice grain mask images and incomplete rice grain mask images, and then output the complete rice grain mask images to obtain the third rice grain image dataset. S5. Based on the third rice grain image dataset, trace and locate the original rice grain image corresponding to the third rice grain image dataset, and construct a fourth rice grain image dataset containing the original rice grain image; S6. Based on the neural network classification model, perform type recognition on the original rice grain images in the fourth rice grain image dataset, and output the rice grain variety recognition result.

2. The method for high-precision identification of grain particles in aggregated images according to claim 1, characterized in that, In step S1, the specific steps for outputting the clustered rice grain image dataset include: S101, Multi-scale Retinex enhancement: Normalize the original image of the rice grains and process it using multiple Gaussian filters of different scales to generate corresponding filtered images; Based on the differences between the original image of the rice grain and each filtered image, the multi-scale Retinex enhancement result is calculated and normalized output. S102, Color Space Correction: Convert the enhanced image to the LAB color space, correct the mean of the color channels by offset, and then convert it back to the RGB space. S103, Global White Balance and CLAHE Enhancement: White balance gain is adjusted based on the global mean of the RGB channels, and block adaptive histogram equalization is performed on each channel to generate the final enhanced image.

3. The method for high-precision identification of grain particles in aggregated images according to claim 1, characterized in that, In step S2, the specific steps for obtaining the rice grain mask image include: S201. Construct the RICESAM model by inputting the clustered rice grain image dataset into the RICESAM model and obtaining the image embedding through the model's image encoder. S202. Determine the segmentation cue information of the image, extract its spatial features through a convolutional layer, and then encode the spatial features as a cue embedding aligned with the image embedding using a model-based cue encoder. S203. Based on the mask decoder of the RICESAM model, the image embedding and cue embedding are interactively combined to generate a segmentation mask for the image. S204. Perform morphological filtering on the segmentation mask to obtain the final mask output of the rice grains, and obtain the rice grain mask image in which the rice grains are separated from the black background.

4. The method for high-precision identification of grain particles in aggregated images according to claim 3, characterized in that, In step S2, the specific steps for generating the first rice grain image dataset with a standard size include: S205. Obtain the numerical dimensions of the rice grain mask image and the standard dimensions of the standard image; S206. Determine the geometric center position of the rice grain outline in the rice grain mask image, and align the geometric center with the center coordinates of its rice grain mask image; S207. Obtain the scaling ratio, scale the outline of the rice grain to a standard size black background to obtain a single rice grain image, and then output the single rice grain image dataset, i.e., the first rice grain image dataset.

5. The method for high-precision identification of grain particles in aggregated images according to claim 4, characterized in that, Step S3 specifically includes: S301. Using a complete rice grain image, define the morphological feature parameters of the complete rice grain, including: rice grain area. Circumference of a rice grain Area to perimeter ratio Length of the major axis of the fitted ellipse Length of the minor axis of the fitted ellipse Area of ​​fitted ellipse Fitted ellipse perimeter Area difference Aspect Ratio and ellipticity ; S302. Based on the morphological feature parameters, construct a Filter-I algorithm based on morphological quantization; S303. Obtain the rice grain mask image from the second rice grain image dataset, and then input the rice grain mask image into the Filter-I algorithm to extract the morphological feature parameters of each rice grain in the image; S304. Preset parameter threshold, compare and analyze the morphological feature parameters of rice grains with the parameter threshold, and filter out rice grain mask images that do not meet the parameter threshold requirements; S305. Output the filtered rice grain mask images and merge them to obtain the second rice grain image dataset.

6. The method for high-precision identification of grain particles in aggregated images according to claim 5, characterized in that, In step S304, the method for comparing and analyzing the morphological characteristic parameters of rice grains with the parameter thresholds includes: Based on the morphological feature parameter category, a threshold range is set to determine whether the morphological feature parameter of the rice grain is within the threshold range, and samples with obviously abnormal values ​​are screened out. Based on the characteristics of the complete rice grain outline and the actual rice grain outline, a similarity analysis is performed to screen out samples that do not meet the similarity requirements. The method steps of the similarity analysis include: Obtain the actual rice grain outline point set And calculate the centroid of the actual rice grain profile. ; Based on the centroid of the actual rice grain profile and the centroid of the fitted ellipse, the center distance of the actual rice grain profile is calculated. and normalized matrix The formula is as follows: , ; Subsequently, based on the normalized matrix, the Hu matrix of the actual rice grain outline is obtained. ; An ellipse is fitted based on the actual rice grain contour, generating a set of points for the fitted ellipse. The centroid of the fitted ellipse contour is then calculated. The above steps are repeated to obtain the Hu matrix of the fitted ellipse. ; By combining the Hu matrix of the actual rice grain outline and the Hu matrix of the fitted ellipse, a similarity calculation is performed to evaluate the degree of matching between the rice grain outline and the fitted ellipse outline. The formula is as follows: 。 7. The method for high-precision identification of grain particles in aggregated images according to claim 6, characterized in that, The similarity analysis method further includes: calculating similarity using a W-shaped algorithm, that is, converting the outline edges of rice grains into a waveform diagram with digital description, and then performing waveform analysis to determine the degree of similarity; specifically including the following steps: Obtain the centroid coordinates of the complete rice grain outline : , ; in, The first grain of rice on the outline boundary The coordinates of the points For the first The weight of each point This represents the total number of boundary points of the rice grain outline. Then, the distance from the boundary point of the rice grain profile to the centroid was calculated using the Euclidean distance formula. : ; Calculate adjacent points on the rice grain profile and The segment length is used to obtain the cumulative arc length. : ; Among them, the initial cumulative arc length Spacing between adjacent points Calculated by the following formula: ; Then, the distance from the boundary point of the rice grain outline to the centroid is used. The vertical axis represents the cumulative arc length. Establish a coordinate system for the horizontal axis and generate a W-shaped curve from the complete rice grain outline, i.e., a waveform diagram of the complete rice grain outline; Based on the above steps, an actual rice grain outline waveform is obtained. Wave analysis is then performed on the complete rice grain outline waveform and the actual rice grain outline waveform to quantify the rice grain outline features and assess the degree of similarity.

8. The method for high-precision identification of grain particles in aggregated images according to claim 5, characterized in that, In step S4, the step of performing binary classification on the rice grain mask images in the second rice grain image dataset includes: S401. Construct a neural network classification model and pre-train the neural network classification model; S402. Input the rice grain mask image into the neural network classification model. The image is first passed through a 32-channel convolutional layer with a stride of 2 to extract shallow features and output a feature map with halved resolution and expanded channel number. S403. Based on the inverted residual structure, multiple sets of bottleneck modules are stacked, and deep features of the feature map are extracted step by step through multiple bottleneck modules; S404. Then, the feature map is expanded by 1×1 convolution, followed by average pooling to compress the feature map size. Finally, the number of image channels is mapped to the number of classification categories k by 1×1 convolution, and the image classification result is output.

9. The method for high-precision identification of grain particles in aggregated images according to claim 8, characterized in that, The neural network classification model is trained using D-FTL stepwise transfer learning based on a pre-defined neural network model. The specific steps include: Set initial parameters: Pre-train a neural network model based on the ImageNet dataset, and then obtain the weights of the neural network model to initialize the model; Training of the clustered rice grain image dataset: Based on the clustered rice grain image dataset and data augmentation technology, the initialization model is trained, all convolutional layers and fully connected layers are trained, and the weights of the clustered rice grain model are obtained by normalization through the mean and variance of the original rice grain image dataset, and the number of neurons in the last fully connected layer is adjusted according to the number of rice grain categories. Training on a single grain of rice image dataset: Based on the weights of the clustered rice grain model, the model training on the single grain of rice image dataset is initialized. During training, the network parameters of the shallower layers of the neural network model are frozen, and only the deep network and fully connected layers are trained. The number of neurons in the last fully connected layer is kept unchanged. The model is optimized based on the single grain of rice image dataset to obtain a neural network classification model for identifying rice grains.

10. A method for high-precision identification of grain particles in aggregated images, characterized in that, include: The image acquisition module is used to acquire raw images of rice grains from cereal crops; The image processing module is connected to the image acquisition module; The image processing module includes: an image preprocessing unit for enhancing the original rice grain image to obtain a clustered rice grain image dataset; an image segmentation unit connected to the image preprocessing unit for segmenting the image to achieve rice grain granularity segmentation; and an image normalization unit connected to the image segmentation unit for adjusting the image size. An image screening module connected to the image processing module; The image screening module includes: a first screening unit, used to perform a first screening of rice grain images based on rice grain morphological feature parameters; and a second screening unit connected to the first screening unit, used to perform a second screening of the rice grain images after the first screening based on integrity requirements. An image tracing module connected to the image screening module is used to perform tracing processing on the output image of the second screening unit to obtain the original image of the rice grain corresponding to the output image of the second screening unit. A rice grain image recognition module connected to the image tracing module is used to identify and output the category of rice grains in the image based on a neural network classification model. The model training module is used to build and pre-train the neural network classification model.