Method and device for identifying imperfect grains of cereals based on image analysis

By using multi-view image analysis and fine-grained grading, a volume and weight assessment model was constructed, which solved the shortcomings of existing grain identification technologies and achieved accurate identification and quality detection of imperfect grains.

CN121545148AInactive Publication Date: 2026-02-17BEIJING SINO INSTR INTELLIGENT CONTROL CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511822432.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-02-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing imperfect grain identification methods perform poorly in image acquisition and analysis, fail to effectively integrate multi-view features and volume assessment, have insufficient accuracy in weight assessment, lack density coefficient adjustment mechanisms and fine-grained classification strategies, and are difficult to accurately identify impurities and the degree of damage, thus affecting the reliability of grain quality detection.

Method used

By acquiring multi-view images, performing preprocessing and image segmentation, a single-view volume assessment model is constructed. Combined with fine-grained grading and density coefficient, a weight assessment mechanism is established. By introducing damage degree grading and impurity identification models, accurate assessment of volume and weight can be achieved.

Benefits of technology

It enables accurate identification of imperfect grains, improves the accuracy of image processing, weight assessment and impurity identification, and provides technical support for grain quality testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121545148A_ABST
    Figure CN121545148A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an incomplete grain recognition method and device based on image analysis, and the method and device achieve the precise evaluation of the volume through the innovative design of a multi-view image analysis model, region segmentation and feature extraction. And a density coefficient system is constructed, and a reliable weight evaluation mechanism is established by combining damage degree grading. Fine-grained classification is introduced, and the accuracy of an identification result is ensured through area-density calculation and percentage statistics. According to the method, the defects of the traditional technology in the aspects of image processing, weight evaluation, impurity identification and the like are effectively overcome, and technical guarantee is provided for grain quality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, specifically to a method and apparatus for identifying imperfect grains in grains based on image analysis. Background Technology

[0002] Existing grain identification methods have significant shortcomings. Traditional systems perform poorly in image acquisition and analysis, failing to effectively integrate multi-view features and volume assessment, thus affecting identification accuracy.

[0003] Furthermore, existing technologies suffer from bottlenecks in weight assessment and classification standards. Most systems lack robust density coefficient adjustment mechanisms and fine-grained classification strategies, resulting in insufficient accuracy in weight assessment.

[0004] Existing systems have technical shortcomings in impurity identification. They lack in-depth analysis of grain damage levels, making accurate weight calculations using area-density models difficult and impacting assessment reliability. Solving these problems is crucial for improving grain quality inspection. Summary of the Invention

[0005] To address the problems in the existing technology, this application provides a method and apparatus for identifying imperfect grains based on image analysis, which can effectively solve the shortcomings of traditional technologies in image processing, weight assessment and impurity identification, and provide technical support for grain quality detection.

[0006] To solve at least one of the above problems, this application provides the following technical solution:

[0007] In a first aspect, this application provides a method for identifying imperfect grains in cereals based on image analysis, comprising:

[0008] Multi-view images of grain samples are collected, and the multi-view images are preprocessed. The shooting angle is adjusted so that at least one single-view image simultaneously contains a side height region and a front main information region. The side height region and the front main information region are segmented, and the contour features of the two regions are extracted respectively. The minimum bounding box size and pixel area of ​​the two regions are calculated. The height direction is determined according to the bounding box size. Confidence coefficients are assigned to the two regions respectively. A single-view volume assessment model is constructed based on the bounding box size, pixel area and confidence coefficient. The volume assessment values ​​of multiple views are weighted and combined to generate the volume assessment result of the grain sample.

[0009] A fine-grain grading standard is established based on the type of grain. Grain samples are classified into fine-grain categories. The density coefficient corresponding to each fine-grain category is obtained through experiments. The density coefficient is multiplied by the volume assessment result to calculate the weight assessment value of the grain sample. An effective range for the density coefficient is set. When the density coefficient exceeds the effective range, it is set as the benchmark value.

[0010] The grain samples are classified into heterogeneous grains, light impurities, and other impurities. The total image area of ​​each fine-grained category is calculated. The total image area is multiplied by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category. The weight percentage of imperfect grains is calculated based on the weight assessment value.

[0011] Furthermore, it also includes: arranging multiple image acquisition devices from different directions, setting the shooting angle of the image acquisition devices to form a fixed tilt angle with the horizontal plane, calibrating the light source brightness, focus parameters and exposure time of the image acquisition devices, acquiring original images of grain samples from different perspectives, and performing noise reduction, enhancement and normalization processing on the original images to generate pre-processed multi-view images.

[0012] The preprocessed multi-view images are labeled and grouped according to the shooting angle. The image containing both the side height region and the main information region of the front is selected from the multi-view images as the target image. The region growing algorithm is applied to the target image for image segmentation. The boundary point set of the side height region and the main information region of the front is extracted from the target image. The boundary point set is used to construct the region contour. The minimum bounding rectangle size and the region pixel area of ​​the region contour are calculated.

[0013] Furthermore, it also includes: comparing the minimum bounding box size of the side height region and the front main information region, marking the long side of the bounding box as the height direction, calculating the aspect ratio of the two regions, determining the confidence coefficient of the two regions based on the aspect ratio, multiplying the pixel area of ​​the side height region by the minimum bounding box width of the front main information region to obtain a first volume component, multiplying the pixel area of ​​the front main information region by the minimum bounding box width of the side height region to obtain a second volume component, multiplying the first volume component and the second volume component by the confidence coefficient of the corresponding region respectively, and summing them to construct a single-view volume evaluation model;

[0014] Volume assessment values ​​are obtained from multiple perspectives. Perspective weight coefficients are calculated based on the clarity and integrity of the images from each perspective. The volume assessment values ​​are multiplied by the corresponding perspective weight coefficients and then summed to obtain the comprehensive volume assessment result of the grain sample. The comprehensive volume assessment result is then standardized to generate the final volume assessment value.

[0015] Furthermore, it also includes: constructing a multi-layer sieve size grading structure, grading grain samples with different degrees of damage through the sieve, measuring the maximum pore size of the damaged area of ​​the grain sample, calculating the edge curvature and area ratio of the damaged area, using the maximum pore size, edge curvature and area ratio as feature parameters, establishing a damage degree grading model, and quantitatively assessing the damage degree of the grain sample based on the feature parameters;

[0016] Contour detection and feature extraction are performed on pores, local defects or hyperplasia, cracks, attachments, and deteriorated areas on the surface of grain samples. The depth, diameter, and shape parameters of pores, local defects or hyperplasia, cracks, attachments, and deteriorated areas are measured. The distribution location and density of appearance defects on the grain surface are analyzed. The depth, diameter, shape parameters, and distribution characteristics are input into a classifier to perform fine-grained classification of the appearance defect status of the grain samples.

[0017] Furthermore, it also includes: collecting standard groups of grain samples of different fine grain size classifications, measuring the actual volume and mass of each sample in the standard group, calculating the mass value per unit volume, performing statistical analysis on the mass value per unit volume, establishing a density coefficient calculation model, applying the density coefficient calculation model to new grain samples, and generating a density coefficient matrix corresponding to each fine grain size classification;

[0018] Based on historical data analysis, upper and lower thresholds for the density coefficient are determined. The density coefficient is numerically matched with the volume assessment results. Density coefficients exceeding the threshold range are corrected. The weight assessment value is calculated by multiplying the corrected density coefficient with the volume assessment result. A weight assessment database is established, and the weight assessment value is stored in the database for dynamic updates.

[0019] Furthermore, it also includes: acquiring images of grain samples, extracting the shape, color, and texture features of the grain samples, constructing multi-level classification feature vectors, inputting the feature vectors into a classifier for training, establishing a heterogeneous grain identification model, a light impurity identification model, and other impurity identification models, using the identification models to classify the grain samples, and generating sample sets for each category;

[0020] Contour segmentation is performed on the grains in each category of the sample set. The projected area of ​​a single grain sample is calculated. The projected areas of samples in the same fine-grained category are summed to obtain the total image area of ​​that fine-grained category. An area calculation data table is established to record the total image area values ​​of different fine-grained categories under each category.

[0021] Furthermore, it also includes: obtaining the total image area of ​​different fine-grained classifications under each category of heterogeneous grains, light impurities and other impurities; multiplying the total image area by the corresponding density coefficient to obtain the mass coefficient; weighting the mass coefficient with the respective volume assessment results to generate the weight assessment values ​​for each category; and establishing a weight assessment data record table.

[0022] The weight assessment values ​​of each category are normalized, the proportion of each category's weight assessment value to the total weight is calculated, the proportions are accumulated to obtain the weight percentage value of imperfect grains, a weight percentage calculation model is established, and the weight percentage value is stored in a database for quality grading.

[0023] Secondly, this application provides a grain imperfect grain identification device based on image analysis, comprising:

[0024] The sample evaluation module is used to acquire multi-view images of grain samples, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction based on the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume evaluation model based on the bounding box size, pixel area and confidence coefficients, and weight and combine the volume evaluation values ​​of multiple views to generate the volume evaluation result of the grain sample.

[0025] The fine-grainedness calculation module is used to establish fine-grainedness grading standards based on grain grain type, classify grain samples by fine-grainedness, obtain the density coefficient corresponding to each fine-grainedness classification through experiments, multiply the density coefficient by the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as the benchmark value when it exceeds the effective range.

[0026] The imperfect grain identification module is used to classify the grain sample into different types of grain, light impurities, and other impurities. It calculates the total image area of ​​each fine-grained category, multiplies the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculates the weight percentage of imperfect grains based on the weight assessment value.

[0027] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the image analysis-based method for identifying imperfect grains.

[0028] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image analysis-based method for identifying imperfect grains.

[0029] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the image analysis-based method for identifying imperfect grains.

[0030] As described above, this application provides a method and apparatus for identifying imperfect grains based on image analysis. Through an innovative multi-view image analysis model, it achieves accurate volume assessment via region segmentation and feature extraction. A density coefficient system is constructed, combined with damage level grading, to establish a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively addresses the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of this application 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 some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a flowchart illustrating the image analysis-based method for identifying imperfect grains in an embodiment of this application.

[0033] Figure 2 This is a structural diagram of the image analysis-based imperfect grain identification device in the embodiments of this application;

[0034] Figure 3 This is a schematic diagram of the structure of the electronic device in the embodiments of this application;

[0035] Figure 4 This is a schematic diagram of broken corn kernels passing through sieves with apertures of 3.0 mm, 4.5 mm, and 6.0 mm in the embodiments of this application.

[0036] Figure label:

[0037] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver storage unit 9144, antenna 9111, speaker 9131, microphone 9132. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0039] The acquisition, storage, use, and processing of data in this application comply with relevant laws and regulations.

[0040] To address the shortcomings of existing technologies, this application provides a method and apparatus for identifying imperfect grains based on image analysis. By innovatively designing a multi-view image analysis model, and through region segmentation and feature extraction, it achieves accurate volume assessment. A density coefficient system is constructed, combined with damage level grading, to establish a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively solves the deficiencies of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0041] To effectively address the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, and to provide technical support for grain quality inspection, this application provides an embodiment of an image analysis-based method for identifying imperfect grains in cereals. See [link to embodiment]. Figure 1 The image analysis-based method for identifying imperfect grains specifically includes the following:

[0042] Step S101: Acquire multi-view images of the grain sample, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction according to the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume assessment model based on the bounding box size, pixel area and confidence coefficient, and weight and combine the volume assessment values ​​of multiple views to generate the volume assessment result of the grain sample;

[0043] Optionally, this embodiment focuses on S101 for online inspection of bulk grains. This application begins with image acquisition. Three camera arrays are arranged on both sides and above the conveyor belt. The side cameras shoot at a fixed angle to the horizontal plane, ensuring that each frame of a single-view image naturally includes a "side height region" and a "frontal main information region." Circular polarized light is used as the light source. First, a grayscale calibration is performed based on brightness, focus, and exposure. Then, white balance presets are established for different grain varieties to reduce contour jitter caused by color differences.

[0044] The raw image enters the preprocessing pipeline, where it undergoes the following steps: noise reduction (small kernel bilateral or non-local mean, preserving edges), contrast-limited histogram equalization, scale normalization (converted to a uniform resolution by calibration board pixels / mm), and viewpoint labeling to ensure that sharpness and integrity can be identified during subsequent weighted combination.

[0045] This embodiment does not use a single threshold for region extraction, but rather segmentation driven by geometric constraints.

[0046] The target image is first segmented using coarse-grained superpixels, and then region growing is performed by combining color and texture similarity to obtain candidate grain foregrounds. The key to identifying the side height region lies in the "thickness boundary at the tilt angle". This application uses the light and dark boundary generated by the illumination direction in conjunction with the conveyor belt reference line to lock a boundary section that is nearly perpendicular to the belt surface; the main information region on the front retains the abdominal contour and germ features.

[0047] After the segmentation results are converted into a set of boundary points, an outline is constructed using α-shape or polygon fitting. The minimum bounding rectangle (bounding box) size and pixel area of ​​the two regions are calculated, and the long side, short side, and rotation angle are recorded. Since some grains may overlap or be occluded by shadows, this application detects concave points on the outline and performs morphological splitting when necessary to remove obviously abnormal small fragments, thereby reducing the interference of pseudo-area.

[0048] This embodiment requires determining the true "height direction" from two regions. The method involves comparing the long and short sides of the bounding boxes of the two regions, combining the tilt angle calibration value with the surface direction, and determining the long side that is more consistent with the surface normal as the height candidate. If the two conflict, "contour longitudinal gradient consistency" is introduced as an arbitration criterion, calculating the strength stability of the boundary normal direction, and the stable side is recorded as the height reference. After obtaining the height direction, confidence coefficients are assigned to the two regions.

[0049] This application uses aspect ratio to approximate the credibility of the "thin sheet perspective": the larger the aspect ratio of the side height region, the smoother the contour curvature, and the lower the occlusion score, the higher the confidence coefficient; the meaning of confidence is very straightforward - whichever region can better represent the three-dimensional thickness and area from the current perspective, that region will be given the weight.

[0050] This embodiment constructs a single-view volume assessment model accordingly. This application considers an approximate decomposition of volume under a two-dimensional projection viewpoint. The pixel area of ​​the side height region multiplied by the bounding box width of the front region forms the first volume component; the pixel area of ​​the front region multiplied by the bounding box width of the side region forms the second volume component. The two components are multiplied by their respective confidence coefficients and then summed to obtain the volume estimate for that viewpoint.

[0051] To suppress deviations caused by differences in size units, the area is converted to square millimeters in "pixels × (mm / pixel)^2", the width is in millimeters, and the final approximate volume is in cubic millimeters.

[0052] For camera fields of view with slight perspective distortion, this application introduces a first-order perspective correction factor after imaging geometry calibration, so that near and far scaling is compensated according to the grid error of the calibration plate.

[0053] This embodiment does not limit itself to a single viewpoint; this application aggregates volumetric evidence from multiple viewpoints. Each viewpoint's volume estimate requires a viewpoint weight, which is not constant but determined by image sharpness, target integrity, and occlusion level. Sharpness is measured using the Tenengrad gradient threshold; integrity is determined by the overlap ratio between the grain boundary rectangle and the image boundary; and occlusion level comes from the confidence output of the foreground occlusion discrimination network. This application standardizes these three factors and synthesizes the viewpoint weights, then performs a weighted average of the volume estimates from each viewpoint.

[0054] Considering the differences in surface reflectance among different grain varieties, this application performs a robust standardization (based on median and MAD) on the volume estimation before weighting to avoid bias in the results from individual outliers.

[0055] This embodiment also addresses the separation problem when single particles and groups of particles are mixed. It is inevitable that two particles will stick together on the conveyor belt, and directly estimating the volume will be too high.

[0056] This application uses concave corners of the contour and skeletal bifurcation to perform "pseudo-connected body splitting." When the splitting confidence is insufficient, a conservative volume estimation strategy is adopted: the confidence coefficient is reduced and "suspicious samples" are marked for subsequent statistical filtering. For the morphological differences between long and thin grains (such as long-grained rice) and round grains (such as corn kernels), the linear approximation of volume mapping will have systematic errors. In the calibration stage, this application learns a lightweight linear correction term for each fine-grained classification, corresponding to the selection of correction coefficients based on category priors during runtime, maintaining interpretability.

[0057] This embodiment packages the output of the above process into two layers of results:

[0058] First, the volume component, confidence level, and correction factor of each particle at each viewpoint;

[0059] Second, the volume assessment value is summarized from all perspectives.

[0060] To facilitate subsequent density and weight estimation, this application records the height orientation angle, circumscribed rectangle scale, segmentation quality score, and anomaly markers for each grain to ensure traceability. Regarding the sources of error, this application focuses on controlling three key aspects: viewpoint geometry (through calibration and tilt angle fixation), segmentation quality (through illumination and edge-preserving denoising), and weight setting (through sharpness and occlusion measurement). The combined error of these three factors is reflected in the distribution of viewpoint weights; extreme viewpoints are automatically downweighted, which aligns with the natural laws of imaging physics.

[0061] This embodiment also provides two extended examples.

[0062] Firstly, for transparent or semi-transparent grain fragments, insufficient edge contrast leads to unstable segmentation. This application incorporates polarization difference in the preprocessing, using the difference image taken at two different polarization angles to enhance the contour, and then performs the same volume estimation.

[0063] Secondly, to address motion blur caused by high-speed belt movement, this application employs short exposures and strong light pulses at the camera end to simultaneously reduce motion blur. If blur still exists, the sharpness score automatically decreases, almost eliminating the weight of that viewpoint, while the overall volume can still converge stably. Ultimately, the volume assessment results will serve as the basis for subsequent density coefficient matching and weight estimation, permeating the entire quality grading process.

[0064] Step S102: Establish a fine-grain grading standard based on the type of grain, classify the grain samples into fine-grain categories, obtain the density coefficient corresponding to each fine-grain category through experiments, multiply the density coefficient with the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as the benchmark value when it exceeds the effective range.

[0065] Optionally, this embodiment focuses on step S102, with the scene being a grain depot inspection upon entry into the warehouse, where the quality of the raw grain is uneven and the shooting conditions are affected by ambient light. This application first clarifies the two scales upon which fine-grained classification relies: the degree of damage and the state of insect infestation.

[0066] To ensure compliance and verifiability in subsequent weight calculations, this embodiment first uses a "table" logic of standard sieve aperture and image measurement to provide a classification. Specifically, a multi-layered sieve aperture size classification standard is constructed, with the physical sieve aperture diameter serving as the calibration baseline. On the image side, three features in pixel space—"maximum aperture, edge curvature, and percentage of damaged area"—are used as corresponding quantities. During calibration, samples from the same batch pass through a physical sieve, and their placement level is recorded. Then, the pixel value of the maximum aperture is measured using an image and converted to millimeters by photographing a calibration board. Edge curvature is represented by the median value in the curvature histogram of the damaged contour, and the area percentage is the pixel area of ​​the damaged region divided by the projected area of ​​the particle. In this way, the damage level has a unified mapping between physical and visual aperture, and subsequent classification thresholds can be determined by supervised regression, avoiding reliance on experience-based assessments.

[0067] This embodiment establishes a classification standard for hole types in insect-eaten conditions, focusing on "hole depth, diameter, shape deviation, and spatial distribution". Depth is estimated by multi-view shadow changes and shape from the height gradient of the side view area. Diameter is given by the minimum circumcircle of the hole. Shape deviation is a combination of roundness and aspect ratio. Spatial distribution is simplified to a binary label of "dense / discrete" using Ripley's K statistics.

[0068] This application collects labeled samples of both insect-damaged and non-insect-damaged samples. First, an interpretable threshold tree is used to construct an initial screening model to separate extreme samples. Then, a lightweight convolutional classifier is used to further subdivide the samples into three categories: "shallow bites," "through bites," and "edge-connected bites." The model input is a fusion of the aforementioned handcrafted features and local texture patches, and the output is an insect-damaged type label and confidence level. This combination is chosen because insect-damaged samples have strong geometric interpretability; simple black-box classification is prone to false positives for light spots and stains, while adding geometric features makes the decision-making logic closer to physical common sense.

[0069] Optionally, this application can establish grading standard sizes based on the fineness of the grains that affects density or volume. For example, damaged corn kernels can be graded using sieve sizes of 3.0mm, 4.5mm, 6.0mm, 8.0mm, and 12mm in diameter. Different sizes of damaged kernels affect density estimation. Similarly, insect-damaged kernels can be graded according to the size and location of the insect holes. Different sizes of insect holes affect density estimation.

[0070] Those skilled in the art know that when sieves with different aperture sizes are used, the height of the damaged area is generally different, resulting in different weights per unit area. From the perspective of weight assessment, the damaged area is finely classified according to the aperture size (e.g., 1.0 mm, 3.0 mm, 4.5 mm, 6.0 mm) that can pass through the sieve. Each fine category obtains its corresponding density coefficient p through experiments. For example, for normal and embryo-damaged grains of the same area, the size and severity of the insect-damaged holes will also cause different weights. Insect damage is finely classified, such as large embryo holes, small embryo holes, insect-damaged tunnels under the seed coat surface, and large and small insect-damaged holes under the seed coat surface, etc., and different density coefficients are assigned to each fine category.

[0071] Optional, see Figure 4 Let p1, p2, and p3 be the density coefficients of broken corn kernels that pass through sieves with apertures of 3.0 mm, 4.5 mm, and 6.0 mm. Minimum and maximum thresholds for the fine-grained density coefficients are defined. If the density assessment exceeds the threshold range, the calculation is considered inaccurate, and the simplification factor is set to 1.

[0072] In this embodiment, the damage classification and insect infestation classification are combined using Cartesian methods to form fine-grained categories, such as "moderate damage + shallow bite" and "minor damage + no insect infestation". After image segmentation and contour fitting, each particle first enters the damage model to determine the level, then enters the insect infestation classifier for further subdivision, and finally falls into the fine-grained category.

[0073] To reduce misclassification, a hysteresis strategy and dual-channel verification are employed: when the confidence difference between the two channels is less than a threshold, manual small-sample verification is triggered, and the verified sample is included in the next round of threshold correction, thus achieving sustainable calibration. The rationale for this is practical: seasonal, varietal, and humidity variations can alter appearance statistical characteristics, fixed thresholds will eventually become outdated, and closed-loop correction can control drift within an interpretable range.

[0074] The core of this embodiment is the experimental acquisition and constraint of the density coefficient. This application collects standard groups for each fine-grained category, measures the actual volume using the volume substitution method, measures the mass using an electronic balance, calculates the mass per unit volume, and obtains the "density coefficient" of the target category. To avoid sample bias, this application uses stratified sampling at different moisture contents and varieties, and records the covariant relationship between moisture content and density. In statistical modeling, stratified robust regression is used, where the density coefficient is jointly determined by the category indicator variable and the moisture content correction term. This conforms to natural laws: within the same fine category, the mass density usually changes when the moisture content increases, but not abruptly. Finally, the point estimate after regression is used as the coefficient center, and the interval estimate is used as a reference for the effective range.

[0075] This embodiment combines volume and density into a single weight assessment. The volume assessment value is derived from the multi-view volume model of the preceding steps. The weight assessment is obtained by multiplying the volume of each particle or batch by the density coefficient corresponding to its subclass. To suppress the impact of outlier coefficients on weight, this application sets an effective range for the density coefficient, derived from the quantile intervals and experimental error boundaries of the historical database. When the density coefficient of a new sample (estimated from the subclass and water content) falls outside the range, it first reverts to the baseline value of that class, and then the anomaly is added to the database. If similar anomalies occur frequently in the future, recalibration is triggered. The underlying principle of this rule is quite simple: image grading may occasionally result in misclassification or lighting anomalies. Directly using the anomaly coefficient would amplify the error, and reverting to the baseline can lock the risk within an interpretable range.

[0076] This embodiment introduces "category weight integration" in the batch processing layer to address mixed samples. A single tray often contains multiple subcategories, making it unsuitable to simply use the mean. This application calculates the category proportion based on the number of instances obtained from image segmentation and the proportion of projected area. It generates a batch density vector using either area-weighted or instance-weighted methods, then multiplies each item by the batch volume vector and sums them to obtain the batch weight assessment. The choice between the two methods depends on the particle size difference: if the size difference is large, area-weighted is more stable; if the sizes are similar, instance-weighted is more intuitive. After the project goes live, this application compares the residuals of the two methods and automatically selects the one with the smaller deviation as the calculation method for the current batch.

[0077] To ensure the robustness of the correlation between the algorithm and physical quantities, this embodiment also includes a consistency check: the weight assessment is aligned with the short-term weight measured by the conveyor belt, and the volume scale is slowly corrected using a proportional correction factor within the alignment window, rather than changing the density coefficient. This is because density represents physical properties and should be primarily determined by laboratory calibration; volume assessment is more affected by viewing angle, lighting, and segmentation boundaries, making it more suitable as a vehicle for online calibration. This division of labor maintains clarity of physical meaning and avoids the "self-reinforcing" bias of the model.

[0078] This embodiment considers two extended scenarios to cover more field conditions. The first scenario involves a mixture of long, thin grains (such as rice) and short, wide grains (such as corn), where the sources of error in volume assessment differ. This application introduces a "shape factor" at the sub-category level, calculated from aspect ratio and roundness, as a fine-tuning term for the density coefficient. However, its weight is limited to prevent confusion with the density itself. The second scenario involves overexposure of damaged boundaries due to highly reflective environments. This application superimposes polarized image capture and highlight suppression filtering during preprocessing, reducing the weight of the damaged area in grading when necessary, and instead relying on a combination of edge curvature and aperture to ensure stable grading.

[0079] This embodiment records all intermediate products in the warehouse: fine-grained labeling, graded confidence level, density coefficient and effective range, whether a rollback is triggered, batch volume and weight assessment, and alignment weighing correction factor. The next batch's determination will read these records, update the threshold, or prompt for manual sampling.

[0080] The final technical effects are reflected in three aspects: the coupling of fine-grained classification and density coefficient is based on dual evidence of physics and statistics; weight assessment is insensitive to outliers and is traceable; and it can maintain a stable caliber across batches despite moisture content and variety drift. If engineers inquire why a certain batch uses a benchmark density, they can directly see its detailed category label, moisture content records, evidence of out-of-range conditions, and rollback rules, providing a complete explanation chain.

[0081] Step S103: Classify the grain samples into heterogeneous grains, light impurities and other impurities, calculate the total image area of ​​each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculate the weight percentage of imperfect grains based on the weight assessment value.

[0082] Optionally, this embodiment revolves around step S103, following the volume assessment in S101 and the fine-grained classification and density coefficient in S102.

[0083] The on-site environment is a mixed sample flow on the conveyor line before warehousing, containing both staple grains and mixed with different types of grains, light impurities, and other impurities. This application first streamlines the chain of "category classification - area statistics - weight estimation - percentage calculation". The starting point for classification is a multi-level feature vector constructed from shape, color, and texture. This application uses a priori interpretable rule model for coarse classification: different types of grains emphasize grain shape deviation and hue shift, light impurities (such as husks and awns) highlight thinning and low-saturation texture, and other impurities (such as sand and metal shavings) are more prominent in edge sharpness and reflective features. After coarse classification, the sample enters a lightweight convolution classifier for verification, outputting category labels and confidence scores. Low-confidence samples enter an artificial small sample pool for boundary correction during the next batch of training. The reason for this two-stage approach is to leverage the strengths of interpretable geometry and stable deep features, reducing drift caused by changes in ambient light.

[0084] This embodiment performs fine-grained statistics within categories. Each instance already has a fine-grained label (damage × insect damage combination) and a segmentation outline. This application categorizes instances into buckets, and then summarizes the area within each bucket according to fine-grained subcategories. The area is calculated using orthogonal projected area, with the pixel count from the outline polygon multiplied by the calibration scale and converted to square millimeters.

[0085] To avoid overlay errors caused by adhesion, this application introduces overlap correction at the instance level: for suspected adhered instance pairs, the skeleton bifurcation and concave corner points are calculated. If the split confidence is insufficient, the overlapping area is distributed between the two instances according to curvature weights using conservative rules. The distribution record and confidence level are stored together for easy traceability. The statistical results form three category area tables, listing the total area and sample count of each fine-grained subclass.

[0086] This embodiment converts area into weight, logically requiring a series connection of "projected area - volume - weight". Preceding step S101 provides the volume assessment value for each particle; S102 provides the density coefficient and effective range for each subclass. When combining subclasses at the category level, this application uses "area participation" as a weighting factor to account for volume heterogeneity. Specifically, for subclass f under the same category C, this application calculates its area proportion Af / ∑f Af, and takes the mean volume assessment value V̄f and density coefficient ρf of the subclass samples, multiplies these three values, and sums them to obtain the category weight estimate. For categories with extremely dispersed volumes (e.g., other impurities with large particle size ranges), a robust approach of "instance count proportion × median volume × density" is used to avoid the mean being influenced by extreme values.

[0087] If the density coefficient falls outside the valid range, this application will revert to the baseline value for that class and mark this reversion in the anomaly record for that class.

[0088] This embodiment considers the volume information gap caused by incomplete viewpoints. Some instances are truncated at certain viewpoint boundaries, resulting in an underestimation of volume. This application introduces viewpoint integrity weighting at the batch layer: for each instance, a completeness score is synthesized using sharpness, occlusion, and boundary contact ratio, which serves as a scaling factor for the instance's volume participation; when this score is too low, the instance's volume contribution is reduced, while its area still participates in the area weighting, avoiding the category weight being skewed by a very small number of incomplete volumes.

[0089] In this embodiment, the inter-category calibrator is first calibrated when calculating the weight percentage.

[0090] The density differences among different grain types, light impurities, and other impurities can be significant, leading to marked differences in the weight contribution from the same area. This application normalizes the weight estimates of the three categories to obtain relative proportions. To avoid short-term fluctuations, the category proportions from the previous time window and the current window's estimates are compounded over time, with the decay factor gradually widened during in-warehouse operations to ensure a balance between response speed and stability. It should be noted that this time smoothing follows physical intuition: the sample flow properties will not change abruptly unless upstream batches are switched.

[0091] This embodiment introduces a consistent closed loop in the online system, using the short-window weight of a belt scale or sampling scale as a reference. This application does not directly allocate the reference to each category, but rather uses it only to correct the global drift of the volume scale, preserving the physical property meaning of the density coefficient.

[0092] When a residual of a certain category is found to be consistently positive or negative, this application examines two aspects: first, whether the fine-grained composition of the category has changed, leading to ρf mismatch; and second, whether the segmentation quality score of the category has decreased, causing volume underestimation.

[0093] This embodiment provides two variants for complex operating conditions. First, when the proportion of fine, light impurities is high, traditional segmentation may miss fine, filamentous edges. This application introduces a super-resolution reconstruction window to enhance the edges of suspected light impurity areas before performing secondary segmentation, resulting in more complete area statistics. Second, highly reflective impurities (such as metal shavings) exhibit significant fluctuations in projected area under different lighting conditions. This application sets a dedicated lighting compensation factor for this category, measures the true contour through polarization difference, and uses a conservative truncated mean for volume estimation. Both variants require logging the compensation factor and evidence chain for easy review by quality inspectors.

[0094] This embodiment provides a compact formula for calculating the category weight percentage to facilitate understanding:

[0095] Pc= Wc / ∑k Wk, where Wc= ∑f (Af / ∑f Af)·V̄f·ρf.

[0096] In the formula, Pc represents the weight percentage of category c; Wc represents the weight estimate of category c; Af represents the total image area of ​​sub-class f under category c; V̄f represents the mean volume estimate of sub-class f (output by the multi-view volume model); ρf represents the density coefficient of sub-class f (calibrated experimentally and constrained within an effective range); and ∑k Wk represents the sum of the weight estimates of the three categories. This relationship reflects natural logic: area describes quantity and coverage, volume carries the three-dimensional scale, density reflects material properties, and the weight is obtained by multiplying the three together.

[0097] This embodiment writes the final weight and percentage for each category into the database, along with the batch number, camera version, calibration parameter hash, segmentation quality distribution, and anomaly rollback records. The downstream quality grading module directly reads the percentage and, in conjunction with the standard curve, provides a batch rating.

[0098] When encountering unusual percentage jumps, the system will replay the classification confidence histogram and view integrity map of that window, allowing the on-duty engineer to quickly determine whether it is a sudden change in upstream incoming materials or an anomaly in the visual link, and thus decide whether to trigger manual re-inspection.

[0099] As described above, the image analysis-based method for identifying imperfect grains provided in this application can achieve accurate volume assessment through innovative multi-view image analysis model design, region segmentation, and feature extraction. A density coefficient system is constructed, combined with damage degree grading, to establish a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively solves the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0100] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0101] Step S201: Arrange multiple image acquisition devices from different directions, set the shooting angle of the image acquisition devices to form a fixed tilt angle with the horizontal plane, calibrate the light source brightness, focus parameters and exposure time of the image acquisition devices, acquire original images of grain samples from different perspectives, and perform noise reduction, enhancement and normalization processing on the original images to generate pre-processed multi-view images.

[0102] Step S202: The preprocessed multi-view images are labeled and grouped according to the shooting angle. The image containing both the side height region and the main information region of the front is selected from the multi-view images as the target image. The region growing algorithm is applied to the target image for image segmentation. The boundary point set of the side height region and the main information region of the front is extracted from the target image. The boundary point set is used to construct the region contour. The minimum bounding rectangle size and the region pixel area of ​​the region contour are calculated.

[0103] Optionally, this embodiment focuses on S201 and S202. On-site, a group of cameras is installed above and on both sides of the inbound conveyor belt, where the belt speed and incoming material particle size fluctuate significantly. This application first addresses the geometric and optical consistency of the acquisition process. Multiple image acquisition devices are distributed on the left, right, and top of the belt. The side cameras are installed at a fixed tilt angle to the horizontal plane, with the tilt angle selected based on the average sample thickness and the camera's field of view, ensuring that a single frame covers both the side height area and the main information area on the front. The light source uses a linear array supplementary light and a switchable polarizer. Brightness-uniformity calibration is first performed (the field of view illuminance distribution is recorded using a diffuse reflection scale for subsequent flat-field correction), then the focus and exposure time are calibrated one by one. Exposure aims to freeze motion, ensuring that motion blur does not exceed one pixel at maximum belt speed. The focal length and working distance are written into a configuration file for easy conversion from image to physical size.

[0104] In this embodiment, the original image is acquired and then enters the preprocessing pipeline. Noise denoising employs little-kernel bilateral filtering or non-local averaging to suppress photosensitive noise while preserving grain edges. The enhancement stage introduces CLAHE-limited histogram equalization to alleviate insufficient contrast caused by shadows. Normalization has two meanings: first, white balance normalization of brightness and color temperature, based on the gain correction matrix obtained from gray card shooting; second, geometric scale normalization, using a calibration board (checkerboard) to obtain the pixel-to-millimeter ratio and distortion parameters, completing distortion removal and unified resolution resampling. The preprocessing output carries metadata: camera ID, tilt angle, exposure, sharpness score, and surface normal direction. This metadata will be read during subsequent viewpoint grouping and quality weighting.

[0105] In step S202 of this embodiment, the multi-view images are first grouped according to the shooting angle. Grouping involves not only checking the camera ID but also verifying the shooting posture and field of view coverage, eliminating frames with excessively low sharpness scores, overexposure, or severe occlusion to prevent poor-quality perspectives from interfering with subsequent volumetric evaluation. Then, within each group, target images that "simultaneously contain both the side height region and the main frontal information region" are selected. The judgment criteria rely on two geometric pieces of evidence: first, the projection of the surface direction into the image should be nearly horizontal to ensure the thickness boundary of the side height region is visible; second, the texture and contour of the grain's belly should be complete and not truncated by the image boundary. Only images that meet these conditions are entered into segmentation.

[0106] This embodiment employs a region growing algorithm for segmentation of the target image. The initial seed is selected from the intersection of edge response and color clustering: first, high-confidence edges are extracted using Laplacian-of-Gaussian, then coarse clustering is performed in the Lab color space using k-means, with the intersection region serving as foreground candidates. During region growing, pixel similarity is measured by three components: grayscale difference, local binary pattern (LBP) difference, and normal consistency (the sign of the brightness gradient inferred from the illumination direction). The growth threshold is adaptively determined by local contrast. To avoid adhesion, concave points are detected during the growing process. When a significant concave angle is encountered, a cutting attempt is made; if the cutting confidence is insufficient, it is marked as "suspected adhesion" and reserved for subsequent special case processing.

[0107] This embodiment requires extracting the side height region and the main information region of the front from the segmentation results. This application utilizes prior knowledge of the installation tilt angle and the surface normal to construct a candidate segmentation line: scanning the brightness gradient along the surface normal direction at the upper and side edges of the grain to find a stable set of zero-crossing points, using RANSAC fitting to approximate the boundary, and combining texture anisotropy (the side surface typically has weaker texture, while the front surface has richer texture) to determine region assignment. After assignment, the boundary point sets of each region are extracted, and a smooth contour is constructed using α-shape or multi-segment spline fitting, while filtering out isolated burr points to avoid overestimating the area.

[0108] This embodiment calculates geometric quantities at the contour level. For the boundary point set of each region, the minimum bounding rectangle is calculated (using the rotating caliper method) to obtain the long side, short side, and rotation angle; the region pixel area is accumulated with sub-pixel precision (polygon scan line integration), and the contour compactness, roundness, and curvature statistics are recorded as evidence for subsequent confidence and quality control. To correct for scale deviations caused by the viewing angle, this application converts the bounding box size from pixels to millimeters, and the conversion formula is obtained by using calibration plates inside and outside the camera; when there is slight perspective in the viewing angle, local projective correction is used, and the width near the edge of the field of view is corrected in the first order according to the homography matrix.

[0109] This embodiment provides logical reasoning for determining the "height direction" from the "minimum bounding rectangle size". The bounding box of the side height region theoretically aligns with the grain thickness direction, but due to attitude deviations, it may compete with the front region for the "long side". This application compares the aspect ratio and rotation angle of the two regions to determine how close they are to the surface normal, calculating a consistency score; then, it introduces a gradient stability index in the boundary normal direction, with higher stability more likely representing thickness. If the two are still indistinguishable, it references the historical attitude on the same trajectory in the previous frame, performing a smooth selection to ensure temporal continuity.

[0110] This embodiment ultimately produces four types of elements in each frame of the target image: the bounding box dimensions and area of ​​the side height region, the bounding box dimensions and area of ​​the main information region on the front, and the corresponding segmentation quality score. These quantities are then used for single-view volume estimation and confidence calculation. To ensure data traceability, this application archives the boundary point set of each region in compressed form and records anomaly markers (adhesion, occlusion, reflection). If the anomaly rate exceeds a threshold at a certain viewpoint, the weight of that viewpoint is automatically reduced during multi-view fusion to avoid causing system bias in volume assessment.

[0111] This embodiment provides two on-site variations. Variation 1: In dusty night shifts, light scattering leads to decreased contrast. This application adds a priori dehazing to the dark channel during preprocessing, followed by CLAHE. The segmentation threshold adaptively increases with local contrast to ensure the contours are not obscured by haze. Variation 2: When encountering highly reflective polished rice grains, the belly highlights can disturb the frontal region discrimination. This application uses alternating polarization shooting and subtracts the two frames to suppress specular reflection components before performing region growing, improving the stability of the frontal region.

[0112] The technical advantages of this embodiment are reflected in three aspects: First, the fixed tilt angle and flat field calibration "lock" geometric and optical variations within a correctable range; second, the region growth and demarcation method based on geometry and texture can still extract reliable contours under complex conditions such as adhesion, shadows, and reflections; and third, the size conversion and perspective correction calibrated by physical quantities make the minimum bounding rectangle and pixel area comparable and superimposed measures, providing stable input for subsequent volume estimation and density coupling. When engineers backtrack, they can see the basis for each step from metadata, contours, and quality scores, with a complete chain, without relying on experience or verbal explanations.

[0113] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0114] Step S301: Compare the minimum bounding box dimensions of the side height region and the front main information region, mark the long side of the bounding box as the height direction, calculate the aspect ratio of the two regions, determine the confidence coefficient of the two regions based on the aspect ratio, multiply the pixel area of ​​the side height region by the minimum bounding box width of the front main information region to obtain the first volume component, multiply the pixel area of ​​the front main information region by the minimum bounding box width of the side height region to obtain the second volume component, multiply the first volume component and the second volume component by the confidence coefficient of the corresponding region respectively, and then sum them to construct a single-view volume evaluation model;

[0115] Step S302: Obtain volume assessment values ​​from multiple perspectives, calculate perspective weight coefficients based on the clarity and integrity of each perspective image, multiply the volume assessment values ​​by the corresponding perspective weight coefficients and sum them to obtain the comprehensive volume assessment result of the grain sample, standardize the comprehensive volume assessment result, and generate the final volume assessment value.

[0116] Optionally, this embodiment focuses on S301 and S302 as the main lines, inputting the contours of two regions from S201–S202 along with their minimum bounding rectangle parameters, pixel area, and quality score. The goal is to construct a volume approximation from a single viewpoint and fuse it into a stable volume evaluation value across viewpoints. The logic begins with geometric judgment: This application compares the bounding boxes of the side height region and the main information region of the front view one by one, prioritizing the consistency between the long side direction and the surface normal to calibrate the "height direction". If both long sides are close to the normal, a historical pose smoothing term is introduced, selecting the one with the same trajectory particle height direction as the previous frame to avoid directional jitter caused by viewpoint perturbations. After completing the direction calibration, the aspect ratios rside and rfront of the two regions are calculated, used to characterize their representativeness for thickness or frontal projection area under this viewpoint: the larger r is, the more the region tends to be "thin side view" or "full frontal view", and the higher the credibility.

[0117] This embodiment assigns confidence coefficients to two regions accordingly. This application does not solely rely on aspect ratio for confidence; it also introduces contour curvature stability, segmentation quality score, and occlusion score to construct the synthesized confidence values ​​Sside and Sfront. Before synthesis, all parameters are standardized and have lower limits set to prevent anomalies in any single metric from dragging the confidence value to extremely low levels. The confidence of the side height region prioritizes the consistency of aspect ratio and boundary normals, while the confidence of the front region relies more on compactness and texture integrity. After determining the confidence weights, the volume components are constructed. In 2D projection, the pixel area of ​​the side height region is closer to the dimension of "thickness × length," while the bounding box width of the front region can approximate "width." Multiplying the two yields a stereoscopic information; symmetrically, multiplying the pixel area of ​​the front region by the bounding box width of the side region also constitutes another stereoscopic information. Both components are converted to millimeters to avoid scale deviations due to different camera resolutions.

[0118] This embodiment sums the two volume components according to their respective confidence weights to form a single-view volume estimate. To suppress local overestimation caused by adhesion and highlights, this application incorporates quality gating: if the segmentation quality of a certain region is below a threshold, its confidence is compressed to a conservative range; if the quality of both regions is low, a backoff strategy is triggered, and the volume estimate only takes the exponential smoothing prediction of the historical trajectory, preventing poor single-frame input from disrupting batch stability. For elongated grains, this application learns a shape factor (obtained by regression of aspect ratio and roundness) during the calibration stage as a small-amplitude linear correction term, which is applied online according to fine-grained categories to maintain interpretability and avoid tampering with physical dimensions.

[0119] This embodiment continues with the cross-view fusion in S302. The volume estimates Vi for each viewpoint are not equivalent and need to be weighted according to image quality and visibility. Sharpness is evaluated using Tenengrad or SMD, integrity is measured by the overlap ratio between the bounding rectangle and the image boundary, and occlusion is output by the occlusion discrimination network of the foreground segmentation. The three terms are synthesized into viewpoint weights wi after quantization and normalization. If a viewpoint has strong reflections or overexposure, the weight is directly discounted. This application linearly synthesizes the volumes of each viewpoint according to the weights to obtain the comprehensive volume Vsum; to avoid extreme viewpoint perturbations, the weight distribution is subject to entropy constraints. When it is too concentrated, the minimum quota of the suboptimal viewpoint is increased to ensure that the evidence from different angles is not overly singular, which is consistent with the common sense of multi-view geometric complementarity.

[0120] This embodiment takes into account the slight fluctuations in Vsum caused by short-term geometric perturbations, and therefore standardizes the synthesis results. Specifically, a robust scale is constructed using the median volume of the current window and MAD, mapping Vsum to a uniform scale, and then gently smoothing it with the trajectory history of that particle or batch. The smoothing coefficient is inversely proportional to the viewpoint completeness; the more complete the viewpoint, the more confident the current observation. For batch processing mode, this application uses a truncated low-rank approximation with instances as rows and viewpoints as columns. The column residuals of abnormal viewpoints are naturally absorbed, and the retained main directions express the common changes in the "true volume" without changing the physical meaning.

[0121] This embodiment sets several rules for anomaly management. If the Vi of a certain viewpoint deviates from the median of other viewpoints in the same frame by more than a robustness threshold, it is judged as an outlier and removed or its weight is reduced to a very low level. If the sharpness of all viewpoints is low, a high-confidence volume is not forcibly given; instead, a conservative estimate with a wide confidence interval is given, and a "low-confidence" mark is added to the record to reduce its influence during downstream density matching. For system deviations caused by slight camera attitude drift, this application relies on the periodic self-check of the calibration board or belt end reference block to correct the pixel-to-millimeter ratio online, and the correction factor is written into the metadata to ensure that the volume diameter of different shifts is comparable.

[0122] The key technical points of this embodiment are reflected in three aspects: First, different information bits of the two-dimensional region (side thickness cues and front area cues) are multiplied by each other to form two volume components. This "complementary product" is physically consistent with the composition of volume dimensions and has a certain robustness to single-region errors. Second, the confidence is constructed from interpretable indicators such as aspect ratio, curvature and segmentation quality. It is consistent with the intuition that "this region is more representative of thickness / frontal view" and does not violate natural laws. Third, the viewpoint weight and result standardization adopt robust statistical methods to avoid long tails and extreme viewpoints from destroying the final volume assessment and to ensure stable input for density coupling with S101–S102.

[0123] This embodiment provides two types of extended examples. First, if a variety has extremely weak epidermal texture, resulting in large fluctuations in the area of ​​the frontal region, this application increases the upper limit of the weight of the side height region in the confidence synthesis and introduces boundary normal stability as a supplement to ensure that a reliable volume component can still be given from a single viewpoint. Second, in daylight with strong backlight, the shadow edge rises, and the area growth is prone to outward expansion. This application adds illumination correction flattening and shadow compensation to the preprocessing, and then reduces the weight of this viewpoint during weight synthesis, so that the final comprehensive volume will not be pushed by the daylight cycle. In summary, this link from bounding box, area to volume component, and then to multi-view fusion and standardization not only follows the imaging geometry but also retains a complete record of evidence, facilitating engineering review and quality tracking.

[0124] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0125] Step S401: Construct a multi-layer sieve size grading structure, grade grain samples with different degrees of damage by passing them through the sieve, measure the maximum pore size of the damaged area of ​​the grain sample, calculate the edge curvature and area ratio of the damaged area, use the maximum pore size, edge curvature and area ratio as feature parameters, establish a damage degree grading model, and quantitatively evaluate the damage degree of the grain sample based on the feature parameters.

[0126] Step S402: Perform contour detection and feature extraction on the pores, local defects or growths, cracks, attachments, and deteriorated areas on the surface of the grain sample. Measure the depth, diameter, and shape parameters of the pores, local defects or growths, cracks, attachments, and deteriorated areas. Analyze the distribution location and density of appearance defects on the grain surface. Input the depth, diameter, shape parameters, and distribution features into a classifier to perform fine-grained classification of the appearance defect status of the grain sample.

[0127] Optionally, this embodiment focuses on steps S401 and S402, providing a closed-loop system from physical grading to visual quantification for the complex scenario of online inspection before warehousing. First, the "physical aperture" and "visual aperture" of the damaged grains are aligned. This application establishes a multi-layered sieve aperture size grading structure: the standard sieve aperture serves as the baseline layer, covering layers from intact grains to severely damaged grains. On the online side, after image segmentation to obtain the damaged area, the maximum aperture dmax (the largest inscribed circle or largest circumscribed gap size of the damaged connected region, converted to millimeters according to calibration) is measured grain by grain. Statistics of the edge curvature κ are calculated (such as the median and upper quantile, reflecting the sharpness of the break), and then the damaged area ratio pA is calculated as: damaged pixel area / total projected area. These three are listed side-by-side because looking at dmax alone can be misleading due to thin, elongated cracks, while pA reflects the extent of the defect, and κ indicates the sharpness of the fracture surface.

[0128] In this embodiment, damage quantification is achieved through a "physical grading → visual mapping → model decision" logic in S401. Specifically, samples from the same batch are first passed through a physical sieve, and the physical level of each particle is recorded to form a supervisory label. Visual features (dmax, κ, pA) are extracted to establish a grading model. To ensure interpretability and verifiability, this application employs a hybrid of piecewise regression and threshold trees: in lightly damaged sections, damage scores are fitted using dmax as the principal axis and pA as the correction term; in moderately to severely damaged sections, κ is introduced to split the "chipping / wear" morphology, setting thresholds for each. The model ultimately outputs continuous damage scores and discrete grades. Continuous values ​​facilitate subsequent weight allocation, while discrete grades are used for compliance reports. For edge fractures caused by backlighting or strong reflections, this application uses a polarization difference map to enhance the damage contour before feature extraction, avoiding misjudging highlight defects as damage.

[0129] This embodiment considers that grain posture and adhesion affect the stability of dmax and pA, and therefore introduces multi-view consistency constraints. The dmax of the same particle in adjacent views should be within a reasonable fluctuation range. If a view deviates too much, the median value of the neighboring views is used to replace or lower the frame weight to ensure that the damage score is not skewed by single-frame noise. For adhered samples, this application first attempts skeleton segmentation; if the confidence is insufficient, the "minimum damage assumption" is adopted, and only the high-confidence breakage area is counted. The conservative bias is made up for by statistical regression at the batch level. This trade-off follows the natural law: it is better to be slightly conservative and not to treat the adhesion boundary as damage.

[0130] This embodiment proceeds to S402, focusing on the geometry and spatial distribution of worm-eaten holes. Contour detection employs a multi-scale edge and local contrast joint thresholding to eliminate false holes such as bright spots and water stains. For each candidate hole, this application measures and stores the diameter D (minimum circumcircle diameter and equivalent diameter) and shape parameters S (roundness, eccentricity, Hu moment), and estimates the hole depth H using multi-view shadow difference and side-view height gradient. The depth concept originates from the natural relationship between illumination and geometry: deeper holes have stronger shadow extension at different incident angles and a more pronounced "height concavity" in tilted views. To reduce illumination dependence, this application configures two polarization angles at the camera end, calculates the difference image to suppress the specular component, and retains the shape darkening dominated by diffuse reflection.

[0131] This embodiment also examines the spatial distribution of pores on the grain surface. This application projects the centroid of the pores onto normalized grain surface coordinates, calculates Ripley's K or a density index based on nearest neighbors, and records the distribution location (germination region, abdomen, midrib). Insect damage typically concentrates in specific weak points and exhibits a pattern of numerous small pores; mechanical damage often occurs at stressed edges, with larger and fewer pores. This application concatenates (H, D, S, location, density) into a feature vector and feeds it into a pore classifier. The classifier employs a two-stage structure: the first stage is an interpretable threshold map (e.g., H threshold + roundness threshold to determine "penetration / shallow erosion"), and the second stage uses a lightweight convolutional network to subdivide the boundary micro-texture, outputting the insect damage type and confidence level. The causal relationship of the model is clear: depth and diameter characterize the "quantity" of pores, shape and density characterize the "type" of pores, and location provides biological priors; the three together conform to the insect damage mechanism.

[0132] This embodiment establishes a data closed loop between training and deployment. The training set is derived from laboratory annotations: slide verification of borehole depth, micrometer calibration of diameter, and calibration errors are written into the sample weights. During deployment, samples are taken each shift and compared with electron microscopes to update the depth-shading mapping coefficients, preventing system biases introduced by light source aging or tilt angle drift. If abnormal surface cuticle reflection is detected for a certain variety, leading to a systematic underestimation of depth, this application prioritizes adjusting the gain and threshold of polarization difference rather than changing the classification boundary. The classification boundary is only updated when there is sufficient evidence, maintaining the stability of the physical meaning.

[0133] This embodiment presents a compact yet transparent formula for synthesizing damage scores, making it easy to understand: Score = α·d̂ + β·p̂ + γ·κ̂, where d̂, p̂, and κ̂ are standardized quantities of the maximum aperture dmax, the damaged area ratio pA, and the edge curvature κ, respectively; α, β, and γ are weighting coefficients under segmented conditions, fitted from calibration data and switched between different damage intervals. The higher the Score, the more severe the damage. Each quantity in this formula has a clear physical interpretation, and the weight switching follows sample statistics, not arbitrary determination.

[0134] This embodiment provides two variants for engineering implementation. For crops with rough surface textures, such as corn, surface pits are easily mistaken for shallow insect-eaten holes. This application introduces texture confidence suppression: raising the threshold for hole candidates in high-frequency texture areas and prioritizing depth evidence for decision-making. For rice with brittle cracking damage after drying, edge curvature increases sharply but pA is not significant. This application adds a "crack pattern" branch to the piecewise regression in S401, giving separate weights to slender and highly curvature cracks to avoid misjudging them as minor damage. Overall, the damage level and insect-eaten sub-classes produced by S401–S402, along with confidence and evidence items, are directly used for density coefficient stratification in S102 and weight percentage calculation in S103. The path is clear, the evidence is traceable, and on-site engineers can trace every judgment conclusion.

[0135] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0136] Step S501: Collect standard groups of grain samples of different fine grain size classifications, measure the actual volume and mass of each sample in the standard group, calculate the mass value per unit volume, perform statistical analysis on the mass value per unit volume, establish a density coefficient calculation model, apply the density coefficient calculation model to new grain samples, and generate a density coefficient matrix corresponding to each fine grain size classification.

[0137] Step S502: Based on historical data analysis, determine the upper and lower thresholds of the density coefficient, match the density coefficient with the volume assessment result, correct the density coefficient that exceeds the threshold range, calculate the weight assessment value by multiplying the corrected density coefficient with the volume assessment result, establish a weight assessment database, and store the weight assessment value in the database for dynamic updates.

[0138] Optionally, this embodiment focuses on S501 and S502, aiming to establish a seamless connection between "laboratory property calibration—online volume estimation—weight assessment—database closure." The scenario involves multiple varieties, moisture contents, and fine-grained categories of damage / insect infestation during incoming quality inspection, where a single density assumption is prone to distortion. This application first constructs a standard group in S501. Samples are taken separately for each fine-grained category, with stratification factors including variety, moisture content range, damage level, and insect infestation type, ensuring coverage of mainstream incoming material distribution. The actual volume of each sample is measured using liquid displacement or micro-volume container sand removal methods, while the mass is measured using a 0.1g electronic balance, with temperature and humidity conditions and timestamps recorded uniformly. To avoid short-term drift caused by surface water absorption or drying, measurements are performed in a stable environment chamber, with volume and mass pairing completed within five minutes. The mass value per unit volume is then calculated and recorded as the density observation value.

[0139] This embodiment performs statistical analysis on density observations to establish a "density coefficient calculation model." The main factors of density are fine-grained category and moisture content, while secondary factors may include shape factors (aspect ratio, roundness) and variety indicator variables. This application employs hierarchical robust regression, where the model synthesizes dummy variables of the category with linear / segmented terms of moisture content. The shape factor is used as a small-weight correction term to prevent morphological differences from being mistaken for crop characteristics. Outliers are removed during the data cleaning stage: if a sample's density deviates significantly from its class distribution and is accompanied by abnormal volume measurements (bubbles, adhesion), it is marked as discarded using a chain of evidence. After regression, the density coefficient point estimates and confidence intervals for each fine-grained category in each moisture content segment are output, forming a density coefficient matrix. The matrix index consists of "fine-grained category × moisture content segment (or continuous mapping)." Robust regression is used because the relationship between density and moisture content conforms to natural laws, is usually monotonic rather than abrupt, and robust terms can suppress individual measurement noise.

[0140] This embodiment applies the density coefficient calculation model to new grain samples. In the online phase, fine-grained tags from S101–S103, along with moisture content sensing or near-infrared estimates, serve as input keys. The model outputs the density coefficient for that sample or batch. If moisture content is missing, the median value from the empirical distribution of adjacent windows within the same batch or from near-infrared estimation is used as a fallback, with the confidence level adjusted accordingly to avoid over-reliance on inference. For samples with extreme shapes (such as elongated extremes), shape factor correction is adjusted only within a small range and limited to the confidence interval, avoiding deviation from the laboratory-calibrated physical property baseline.

[0141] In this embodiment, step S502 sets upper and lower thresholds for the density coefficient. The thresholds are based on a historical database: grouped by fine-grained size and season / origin, past density quantiles and experimental error bands are statistically analyzed, and then combined with the current moisture content distribution to provide a dynamic threshold. This application numerically matches the online predicted density coefficient with the volumetric assessment results, that is, checks the deviation between "density × volume" and short-window weighing. If the density coefficient falls below the threshold, the source of evidence is prioritized: if the batch's volumetric mass match is normal in other categories but deviates independently in this category, the density coefficient is tended to be reverted to the baseline value; if there is a globally consistent deviation, it is more likely a volumetric scale drift, and adjustments are made on the volumetric side. This approach aligns with physical intuition; density represents a material property and should not fluctuate significantly due to viewing angle and lighting issues.

[0142] In this embodiment, the weight assessment value is calculated by multiplying the corrected density coefficient by the volume assessment result particle by particle or sub-batch, and then summing them into a batch weight. To avoid extreme values ​​affecting the batch, this application uses truncated mean or Huber weight aggregation for the weight contribution of each class, combined with dual verification of instance number and area percentage. After aggregation, the weight assessment is written to the "Weight Assessment Database," with fields including batch ID, time window, fine-grained composition vector, density source (experiment / model / rollback), volume scale version, weighing alignment factor, and confidence interval. The database is versioned; once the density model or volume scale is updated, the results of the old batch retain the old version identifier to ensure traceability without confusion.

[0143] In this embodiment, to make the threshold and correction rules interpretable, an "evidence chain record" is constructed. Once a correction is triggered, the system writes: trigger category, original density coefficient, threshold range, backoff baseline, short-window weighing deviation, viewpoint integrity statistics, and segmentation quality distribution. The rule evaluation of the next window reads these records. If multiple consecutive windows trigger backoff in the same category, the recalibration task list is automatically invoked, laboratory sampling is arranged, and the density coefficient matrix is ​​revised. This closed loop connects online data drift with offline physical property calibration, preventing the model from "talking to itself" for a long time.

[0144] This embodiment provides two extended examples under complex operating conditions. First, when moisture content sensing is unstable, the density model accepts a mixed reference from near-infrared and drying methods, employs stratified bias correction, maps equipment bias to a fixed offset of the batch layer, and updates at a low frequency to avoid high-frequency jitter being transmitted to the density. Second, when the mixing ratio is extreme (a certain subclass is sparse), the data sparsity of that cell in the density matrix is ​​too high. This application enables smoothing patches for adjacent subclasses and nearby moisture content ranges to ensure continuous model output. The patch strength decreases with the sample size and is reverted when new experimental data becomes available.

[0145] This embodiment also incorporates cross-validation in its engineering organization: small samples are taken each shift, and the density is remeasured using the substitution method. The results are then compared with the density entries for that subcategory in the database. If the deviation persists and exceeds the confidence band, the perspective weight distribution and segmentation quality heatmap of the volume assessment are examined first. The model is then adjusted after confirming the cause of the problem. The rationale behind this approach is to make the error in weight assessment localizable and to clarify the responsibility boundaries between "property drift" and "visual measurement drift."

[0146] This embodiment supplements a simplified formula to facilitate the explanation of the relationship between online weight calculation and threshold correction: Wb=∑iVi·ρi*, where Wb is the batch weight assessment value, Vi is the volume assessment value of the i-th sample or sub-batch (output by the multi-view volume model and standardized), and ρi* is the corrected density coefficient (output by the density model; if it exceeds the threshold, it falls back to the baseline or is corrected according to rules). The physical meaning of this relationship is straightforward: volume comes from imaging geometry and calibration, density comes from material properties and experimental calibration, and the product of the two is the weight. Threshold correction is used to eliminate the unnatural impact of abnormal readings on weight.

[0147] The technical advantages of this embodiment are reflected in three connections: the density coefficient is dominated by laboratory evidence and its relationship with moisture content conforms to natural laws, but its effectiveness is limited when used online; volume assessment and weighing references establish a lightweight match without compromising the meaning of density properties; the database records versions and the chain of evidence, providing a solid basis for cross-batch assessment and verification. The final weight assessment is stable and controllable, and any anomalies can be quickly traced back to the density or volume side, eliminating reliance on subjective experience in engineering procedures.

[0148] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0149] Step S601: Collect images of grain samples, extract the shape, color and texture features of the grain samples, construct multi-level classification feature vectors, input the feature vectors into a classifier for training, establish a heterogeneous grain identification model, a light impurity identification model and other impurity identification models, use the identification models to classify the grain samples, and generate sample sets of each category;

[0150] Step S602: Perform contour segmentation on the grains in each category of sample set, calculate the projected area of ​​a single grain sample, sum the projected areas of samples in the same fine-grained classification to obtain the total image area of ​​that fine-grained classification, establish an area calculation data table, and record the total image area values ​​of different fine-grained classifications under each category.

[0151] Optionally, this embodiment focuses on S601 and S602, and the working environment is a continuous flow of multi-variety mixed samples on the warehousing conveyor line. To ensure a solid denominator and numerator basis for subsequent weight percentage calculations, we first distinguish between "what it is" and "how big it is" from the image. The former relies on multi-level feature modeling, while the latter rests on verifiable geometric measures. The original image comes from previously calibrated multi-view acquisitions. In this embodiment, single-grain candidates are obtained through preliminary target detection for each frame, and three types of features—shape, color, and texture—are extracted for each grain. The shape aspect includes major axis, minor axis, aspect ratio, roundness, moment invariance, and skeleton length, etc., to express differences in grain shape and the degree of flaky texture. The color aspect uses joint statistics of Lab and HSV after standardized white balance, such as a*, b* mean-variance, and hue mode, to capture the hue shift of different grains and impurities. The texture aspect uses LBP histogram, gray-level co-occurrence matrix (contrast, homogeneity), and Gabor energy to map the thin flaky texture common to light impurities and the high-frequency reflective texture of other impurities. To balance scale sensitivity and robustness, features are generated into multi-level classification feature vectors by multi-scale pooling within the bounding rectangle of the instance.

[0152] This embodiment does not directly throw all features into a large model, but instead builds a coarse-to-fine three-channel system based on business semantics. First, an interpretable rule tree is used to coarsely separate heterogeneous grains, light impurities, and other impurities. The rules are based on physical priors of shape and color: light impurities are often thin, have curled edges, and low saturation; heterogeneous grains show more of a systematic shift in grain shape from the staple grain; and other impurities are unique in edge sharpness and specular response. After coarse segmentation, the data enters three lightweight classifier branches to train heterogeneous grain recognition models, light impurity recognition models, and other impurity recognition models, respectively. The model structure uses a shallow CNN combined with hand-crafted features: the input is a multi-level feature vector concatenated with a small-window image; the network channels extract micro-textures and boundary micro-morphologies; and the fusion layer is then combined with hand-crafted statistics to reduce the impact of ambient light drift. Labels are derived from previous manual annotations and a small number of online error-correcting samples; class imbalance is offset by focus loss and hierarchical sampling. The output includes not only category labels, but also confidence scores and confusion pairs (e.g., the similarity between "heterogeneous grains and staple grains"). Low-confidence samples are marked with a verification tag and enter the subsequent data loop.

[0153] This embodiment emphasizes that the natural relationship between features and discrimination should be self-consistent. Increasing the shape factor and flaky density leads to an intuitively higher confidence level for light impurity channels; when the hue deviates from the core of the main grain cluster but the texture still retains the stripes on the grain's belly, it is more likely to fall into the heterogeneous grain channel; if the second derivative distribution at the edges is concentrated and the highlight ratio is abnormally high, the confidence level for other impurities increases. The correspondence between these indicators and the model output is not a black box construct, but rather driven by the combined constraints of physics and geometry. Explicit feature importance assessment is also used during training to filter out redundant data that contributes unstablely to discrimination.

[0154] In this embodiment, the area measurement chain begins in S602. Within the already categorized sample set, contour segmentation is performed piece by piece. The segmenter adds an adhesion separation process to the previous region growing process: adhesion boundaries are confirmed through three types of evidence: concave point detection, skeleton bifurcation, and narrow neck minimum cut. Instances with insufficient confidence in separation are retained as single instances, but a "suspected adhesion" marker is recorded to prevent subsequent area anomalies from going unnoticed. After the effective contour is established, the minimum bounding rectangle under the rotating caliper is used to retain the geometric reference. The projected area is calculated using polygon scan line integration, superimposed with sub-pixel edge correction. The unit is converted from pixels to square millimeters via a calibration plate to ensure physical alignment with volume assessment.

[0155] This embodiment aggregates the projected area at a fine-grained classification level. Each category (heterogeneous grains, light impurities, other impurities) already has fine-grained labels (the combined damaged × insect-eaten subcategory comes from S401–S402 and S102). This application accumulates the instance areas of the same subcategory and records the instance count, area confidence mean, and adhesion ratio of that subcategory to measure statistical reliability. For instances with truncated views, this application uses a view integrity score to slightly reduce their area, avoiding excessive inflation or deflation of the area due to missing boundaries. If a subcategory sample is extremely rare, this application retains its area entry in the data table but marks it with a small sample label to remind downstream users to reduce its weight in weight estimation, which conforms to the common sense of statistical stability.

[0156] To prevent system drift in area aperture across different shifts and under different lighting conditions, this embodiment maintains an area quality control process. A standard reference piece (a planar block with a known shape and area) is placed on the conveyor belt for each shift. The system automatically identifies and calculates the projected area deviation from the flow. If the deviation consistently exceeds the tolerance, it prompts for calibration parameter correction or lighting compensation. The reference piece record, along with the shift's area data, is written into metadata, allowing subsequent verification to determine whether the area fluctuation is caused by changes in imaging aperture or segmentation errors.

[0157] In this embodiment, the total area of ​​images under different fine-grained classifications within each category is written into an "area calculation data table". The table structure includes batch ID, time window, category label, fine-grained label, total area, number of samples, average segmentation quality, adhesion ratio, average viewpoint integrity, and area unit scale hash. The area table is associated with the preceding volume and density database through a fine-class key and a time window key. Downstream S103 directly reads the total area and aligns it with the volume and density coefficients when calculating the weight percentage, reducing redundant statistics.

[0158] The key to this embodiment lies in the connection and traceability of "feature-model-area". The physical meaning of the classification features determines the model's emphasis, thereby reducing drift under environmental changes; the geometric evidence chain of contour segmentation records the reasons for each split and conservative processing, without hiding errors; surface accumulation is enhanced with confidence correction and small sample annotation to avoid being influenced by a few anomalies in the final weight. These processes follow the natural laws of imaging and materials, making them easy to explain.

[0159] This embodiment prepares two field variants to cover the challenges. First, high dust levels during night shifts can obscure textures. This application applies dark channel dehazing and CLAHE before feature extraction. The classifier automatically increases the weight of shape features for "low-contrast" samples, reducing reliance on texture. Second, highly reflective impurities such as metal shavings deviate significantly in color space but may lose texture under high exposure. This application enables input with alternating polarization and two-frame fusion. The classifier channel reads the reflection difference map, separating highlight noise from the texture channel and reducing misclassification. Both variants write relevant preprocessing switches and feature weight adjustments to the log, forming a complete chain of evidence along with the area table.

[0160] The technical advantages of this embodiment are reflected in three aspects: First, the three-channel classifier is built around interpretable features, and the category division remains stable under illumination and belt speed fluctuations; second, the contour segmentation and area calculation have clear geometric boundaries and quality corrections, and the total area serves as a sufficiently "rigid" bridge for weight calculation; third, the linkage between the data table and metadata ensures cross-shift comparability, and if an abnormal weight ratio is subsequently found, the location can be traced back step by step along category → subcategory → area → segmentation quality → viewpoint completeness, without relying on guesswork based on experience.

[0161] In one embodiment of the image analysis-based method for identifying imperfect grains in grains according to this application, it may further include the following:

[0162] Step S701: Obtain the total image area of ​​different fine-grained classifications under each category of heterogeneous grains, light impurities and other impurities. Multiply the total image area by the corresponding density coefficient to obtain the mass coefficient. Perform weighted calculation on the mass coefficient and the respective volume assessment results to generate the weight assessment value of each category and establish a weight assessment data record table.

[0163] Step S702: Normalize the weight assessment values ​​of each category, calculate the proportion of each category's weight assessment value to the total weight, sum the proportion values ​​to obtain the weight percentage value of imperfect grains, establish a weight percentage calculation model, and store the weight percentage value in the database for quality grading.

[0164] Optionally, this embodiment focuses on S701 and S702, with inputs including volume assessment from S101, fine-grained classification and density coefficient matrix from S102, and category division and area statistics from S103. The on-site scenario involves online detection on the inbound conveyor line, where three types of targets (different grains, light impurities, and other impurities) are mixed and exhibit significant differences in particle shape. This application first clarifies the calculation criteria: the total area is derived from the accumulated sum of instance-level contour projection surfaces, in square millimeters; the volume assessment value is cubic millimeters after multi-view fusion; the density coefficient is determined by experimental calibration and a moisture content model, in mass / volume. Only by combining these three can we reach the weight level, thus naturally closing the logical chain.

[0165] In this embodiment, accounts are first established for the three types of targets in S701. Taking category c∈{heterogeneous grains, light impurities, other impurities}, an area sum Af (pixels converted to mm² after calibration) is established according to fine-grained subclass f. The density coefficient ρf output in S102 (constrained within the effective range) is called to construct the "quality coefficient" Mf=Af·ρf. The intuition of the quality coefficient is: materials with higher density contribute more to the same area, but area and density alone lack the thickness dimension, so volume evidence must be combined. This application takes a robust representative (such as the median V̄f) of the volume estimates of instances falling into subclass f within this category, and performs a weighted combination of Mf and V̄f to obtain the subclass weight contribution Wf, which is then accumulated within the category to obtain Wc. The weight setting follows the principle of evidence reliability: when the subclass has high visual integrity and small volume estimation residual, the weight of V̄f is increased; when the segmentation quality is stable and the confidence of area overlap correction is high, the weight of Mf is increased. For categories with extreme particle size differences (common in other impurities), the area participation is supplemented by the instance count percentage to prevent the minority of large particles from misleading the overall picture.

[0166] This embodiment employs two safeguards to ensure the robustness of the quality coefficient. First, if ρf exceeds the limit (above or below the historical threshold), it reverts to the baseline value ρf,base for that subclass, and records "Reversal reason = exceeding the threshold / lack of evidence". Second, since Af comes from segmentation, adhesion and high reflectivity can introduce biases. This application incorporates the quality scores of "overlap correction area" and "polarization difference suppression of specular highlights" into the reduction term of Mf, automatically reducing the weight when the score is low. The causal relationship of this approach is clear: unstable area leads to less reliance on area, density exceeding the limit leads to a conservative approach, and reliable volume leads to greater reliance on volume.

[0167] This embodiment generates a data record table from the category weight assessment results. The table fields include batch ID, time window, category c, fine-grained composition vector {Af}, viewpoint weight summary, volume representative value {V̄f}, density entry {ρf / ρf,base}, weight synthesis coefficient, category weight Wc, and confidence interval. The record table establishes a foreign key with upstream metadata (camera calibration version, segmentation quality distribution), allowing engineers to trace the evidence chain from weight to volume and area. This is a frequently questioned aspect in online audits, and this application prepares accordingly.

[0168] In step S702 of this embodiment, the three weight categories are normalized to obtain the proportion. Considering noise and incoming material switching within a short window, this application does not directly use the current window value to obtain the proportion. Instead, it gently merges Wc with the smoothed result of the previous window. The fusion coefficient is jointly adjusted by "incoming material switching alarm" and "weighing alignment deviation," which speeds up the response during switching and makes the stabilization period smoother. After normalization, Pc = Wc / ∑k Wk is obtained, and the sum of the three categories is 1. Further, this application needs the weight percentage of imperfect grains. It chooses to accumulate the weight assessment values ​​of heterogeneous grains, light impurities, and other impurities according to the standard caliber to obtain the weight percentage of imperfect grains R = ∑c∈U Pc, where U is the set of categories included in the imperfect grain statistics. If a warehouse uses a different caliber (for example, some heterogeneous grains are excluded), only the corresponding set in U needs to be adjusted, and the calculation logic remains unchanged.

[0169] This embodiment stores the normalization and accumulation results in a database, establishing a versioned record of the weight percentage calculation model. Model record items include a list of categories participating in normalization, whether time smoothing is enabled, smoothing parameters, weighing alignment factor, and anomaly removal rules. Each parameter change generates a new version number, and the proportion values ​​in the database carry the version, avoiding disputes over "different standards for the same batch" during subsequent reconciliation. For abnormal proportion jumps, this application automatically replays the category Wc composition, viewpoint integrity heatmap, and density rollback count for that window to determine whether the change is due to a sudden change in incoming materials or a visual link anomaly, and then decides whether to trigger an emergency re-inspection.

[0170] To better reflect real-world scenarios, this embodiment includes two extensions. First, light impurities are easily missed during high-dust night shifts. This application employs a "secondary enhancement + minimum threshold" strategy to statistically analyze the area of ​​this category in the low-resolution range. While the absolute area is conservative, the proportion is more stable, preventing sudden spikes or drops in S702. Second, other impurities may contain small amounts of metal shavings with extremely high density and very small volume. Direct calculation would result in extreme weighting. This application sets a truncation rule in S701 for high-density, small-volume impurities, limiting their contribution to category Wc to a reasonable upper limit, consistent with the common sense that "foreign objects, though heavy, are extremely few in number."

[0171] The technical advantages of this embodiment are concentrated in three aspects: First, it synthesizes the three pieces of evidence—area, density, and volume—at both the category and sub-category levels, avoiding systematic bias caused by a single caliber; second, it combines normalization and time smoothing with weighing references, resulting in stable and responsive proportional outputs that are not "dull" and react quickly to batch switching; third, it provides end-to-end traceability, allowing any proportional figure to be traced back to its area, volume, density, and weight source, facilitating quality grading and dispute resolution. The entire process is closely integrated with the preceding steps S101–S502, with clear physical meaning, restrained statistical processing, and is engineering-feasible and maintainable.

[0172] To effectively address the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, and to provide technical support for grain quality inspection, this application provides an embodiment of an image analysis-based grain imperfect grain identification device for implementing all or part of the aforementioned image analysis-based grain imperfect grain identification method. See [link to embodiment]. Figure 2 The image analysis-based imperfect grain identification device specifically includes the following components:

[0173] The sample evaluation module 10 is used to acquire multi-view images of grain samples, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction according to the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume evaluation model based on the bounding box size, pixel area and confidence coefficient, and weight and combine the volume evaluation values ​​of multiple views to generate the volume evaluation result of the grain sample.

[0174] The fine-grainedness calculation module 20 is used to establish a fine-grainedness grading standard based on the type of grain, classify the grain samples by fine-grainedness, obtain the density coefficient corresponding to each fine-grainedness classification through experiments, multiply the density coefficient by the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as a benchmark value when the density coefficient exceeds the effective range.

[0175] The imperfect grain identification module 30 is used to classify the grain sample into different types of grain, light impurities and other impurities, calculate the total image area of ​​each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculate the weight percentage of imperfect grains based on the weight assessment value.

[0176] As described above, the image analysis-based grain imperfect grain identification device provided in this application can achieve accurate volume assessment through innovative multi-view image analysis model design, region segmentation, and feature extraction. It constructs a density coefficient system and, combined with damage degree grading, establishes a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively solves the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0177] From a hardware perspective, in order to effectively address the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, and to provide technical support for grain quality inspection, this application provides an embodiment of an electronic device for implementing all or part of the image analysis-based method for identifying imperfect grains. The electronic device specifically includes the following components:

[0178] The system comprises a processor, memory, a communications interface, and a bus; wherein the processor, memory, and communications interface communicate with each other via the bus; the communications interface is used to realize information transmission between the image analysis-based imperfect grain identification device and core business systems, user terminals, and related databases and other related devices; the logic controller can be a desktop computer, tablet computer, or mobile terminal, etc., and this embodiment is not limited to these. In this embodiment, the logic controller can be implemented with reference to the embodiments of the image analysis-based imperfect grain identification method and the image analysis-based imperfect grain identification device in the embodiments, the contents of which are incorporated herein, and repeated details will not be described again.

[0179] It is understood that the user terminal may include smartphones, tablet computers, network set-top boxes, portable computers, desktop computers, personal digital assistants (PDAs), in-vehicle devices, smart wearable devices, etc. Among these, the smart wearable devices may include smart glasses, smartwatches, smart bracelets, etc.

[0180] In practical applications, the image analysis-based method for identifying imperfect grains can be partially executed on the electronic device side as described above, or all operations can be completed in the client device. The choice can be made based on the processing power of the client device and the limitations of the user's usage scenario. This application does not impose any limitations on this. If all operations are completed in the client device, the client device may further include a processor.

[0181] The aforementioned client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side; in other implementation scenarios, it may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, a server cluster consisting of multiple servers, or a distributed server structure.

[0182] Figure 3 This is a schematic block diagram illustrating the system configuration of the electronic device 9600 according to an embodiment of this application. Figure 3 As shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It is worth noting that... Figure 3 This is an example; other types of structures can also be used to supplement or replace this structure to achieve telecommunications functions or other functions.

[0183] In one embodiment, the image analysis-based method for identifying imperfect grains can be integrated into a central processing unit 9100. The central processing unit 9100 can be configured to perform the following control:

[0184] Step S101: Acquire multi-view images of the grain sample, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction according to the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume assessment model based on the bounding box size, pixel area and confidence coefficient, and weight and combine the volume assessment values ​​of multiple views to generate the volume assessment result of the grain sample;

[0185] Step S102: Establish a fine-grain grading standard based on the type of grain, classify the grain samples into fine-grain categories, obtain the density coefficient corresponding to each fine-grain category through experiments, multiply the density coefficient with the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as the benchmark value when it exceeds the effective range.

[0186] Step S103: Classify the grain samples into heterogeneous grains, light impurities and other impurities, calculate the total image area of ​​each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculate the weight percentage of imperfect grains based on the weight assessment value.

[0187] As described above, the electronic device provided in this application, through innovative design of a multi-view image analysis model, achieves accurate volume assessment via region segmentation and feature extraction. It constructs a density coefficient system and, combined with damage level grading, establishes a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively addresses the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0188] In another embodiment, the image analysis-based imperfect grain identification device can be configured separately from the central processing unit 9100. For example, the image analysis-based imperfect grain identification device can be configured as a chip connected to the central processing unit 9100, and the image analysis-based imperfect grain identification method function can be implemented through the control of the central processing unit.

[0189] like Figure 3 As shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily need to include these components. Figure 3 All components shown; in addition, the electronic device 9600 may also include Figure 3 For components not shown, please refer to existing technology.

[0190] like Figure 3 As shown, the central processing unit 9100, sometimes also referred to as a controller or operating control, may include a microprocessor or other processor device and / or logic device, which receives inputs and controls the operation of various components of the electronic device 9600.

[0191] The memory 9140 may be, for example, one or more of a cache, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices. It may store the aforementioned failure-related information, and also store a program for executing that information. The central processing unit 9100 may execute the program stored in the memory 9140 to perform information storage or processing, etc.

[0192] Input unit 9120 provides input to central processing unit 9100. Input unit 9120 may be, for example, a keypad or touch input device. Power supply 9170 provides power to electronic device 9600. Display 9160 displays images and text. Display may be, for example, an LCD display, but is not limited thereto.

[0193] The memory 9140 can be a solid-state memory, such as a read-only memory (ROM), random access memory (RAM), a SIM card, etc. It can also be a memory that retains information even when power is off, can be selectively erased, and contains more data; examples of this type of memory are sometimes referred to as EPROMs. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142 for storing application programs and function programs or processes for executing the operation of the electronic device 9600 via the central processing unit 9100.

[0194] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and / or for performing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0195] The communication module 9110 is a transmitter / receiver that sends and receives signals via the antenna 9111. The communication module 9110 (transmitter / receiver) is coupled to the central processing unit 9100 to provide input signals and receive output signals, which is the same as in a conventional mobile communication terminal.

[0196] Based on different communication technologies, multiple communication modules 9110 can be configured in the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module 9110 (transmitter / receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby realizing typical telecommunications functions. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. Additionally, the audio processor 9130 is coupled to a central processing unit 9100, enabling on-device recording via the microphone 9132 and on-device playback of stored audio via the speaker 9131.

[0197] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the image analysis-based grain imperfect grain identification method with a server or client as the execution subject in the above embodiments. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all steps of the image analysis-based grain imperfect grain identification method with a server or client as the execution subject in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:

[0198] Step S101: Acquire multi-view images of the grain sample, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction according to the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume assessment model based on the bounding box size, pixel area and confidence coefficient, and weight and combine the volume assessment values ​​of multiple views to generate the volume assessment result of the grain sample;

[0199] Step S102: Establish a fine-grain grading standard based on the type of grain, classify the grain samples into fine-grain categories, obtain the density coefficient corresponding to each fine-grain category through experiments, multiply the density coefficient with the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as the benchmark value when it exceeds the effective range.

[0200] Step S103: Classify the grain samples into heterogeneous grains, light impurities and other impurities, calculate the total image area of ​​each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculate the weight percentage of imperfect grains based on the weight assessment value.

[0201] As described above, the computer-readable storage medium provided in this application, through an innovative design of a multi-view image analysis model, achieves accurate volume assessment via region segmentation and feature extraction. It constructs a density coefficient system and, combined with damage level grading, establishes a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively addresses the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0202] Embodiments of this application also provide a computer program product capable of implementing all steps in the image analysis-based method for identifying imperfect grains of grain, where the execution subject is a server or client, as described in the above embodiments. When executed by a processor, this computer program / instruction implements the steps of the image analysis-based method for identifying imperfect grains of grain. For example, the computer program / instruction implements the following steps:

[0203] Step S101: Acquire multi-view images of the grain sample, preprocess the multi-view images, adjust the shooting angle so that at least one single-view image simultaneously contains a side height region and a front main information region, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of ​​the two regions, determine the height direction according to the bounding box size, assign confidence coefficients to the two regions respectively, construct a single-view volume assessment model based on the bounding box size, pixel area and confidence coefficient, and weight and combine the volume assessment values ​​of multiple views to generate the volume assessment result of the grain sample;

[0204] Step S102: Establish a fine-grain grading standard based on the type of grain, classify the grain samples into fine-grain categories, obtain the density coefficient corresponding to each fine-grain category through experiments, multiply the density coefficient with the volume assessment result to calculate the weight assessment value of the grain sample, set the effective range of the density coefficient, and set the density coefficient as the benchmark value when it exceeds the effective range.

[0205] Step S103: Classify the grain samples into heterogeneous grains, light impurities and other impurities, calculate the total image area of ​​each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume assessment result to obtain the weight assessment value of each category, and calculate the weight percentage of imperfect grains based on the weight assessment value.

[0206] As described above, the computer program product provided in this application, through innovative design of a multi-view image analysis model, achieves accurate volume assessment via region segmentation and feature extraction. It constructs a density coefficient system and, combined with damage level grading, establishes a reliable weight assessment mechanism. Fine-grained classification is introduced, and the accuracy of the identification results is ensured through area-density calculation and percentage statistics. This method effectively addresses the shortcomings of traditional technologies in image processing, weight assessment, and impurity identification, providing technical support for grain quality inspection.

[0207] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0208] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0209] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0210] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0211] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for identifying imperfect grains of a cereal based on image analysis, characterized in that, The method comprises: Collecting multi-view images of the grain sample, preprocessing the multi-view images, adjusting the shooting angle to make at least one single-view image contain a side height region and a front main information region at the same time, performing image segmentation on the side height region and the front main information region, extracting the contour features of the two regions respectively, calculating the minimum enclosing box size and pixel area of the two regions, determining the height direction according to the enclosing box size, assigning a confidence coefficient to each of the two regions, constructing a single-view volume evaluation model based on the enclosing box size, pixel area and confidence coefficient, weighting and combining the volume evaluation values of multiple views, and generating a volume evaluation result of the grain sample; Establishing a fine-grained classification standard according to the grain kernel type, classifying the grain sample in a fine-grained manner, obtaining a density coefficient corresponding to each fine-grained classification through experiments, multiplying the density coefficient by the volume evaluation result, and calculating a weight evaluation value of the grain sample; Classifying the grain sample into different types of grain, light impurities and other impurities, calculating the total image area of each fine-grained classification in each category, multiplying the total image area by the corresponding density coefficient and volume evaluation result, obtaining the weight evaluation value of each category, and calculating the weight percentage of imperfect grain based on the weight evaluation value.

2. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The method comprises: Arranging multiple image acquisition devices at different positions, setting the shooting angle of the image acquisition devices to form a fixed inclination angle with the horizontal plane, calibrating the light intensity, focusing parameters and exposure time of the image acquisition devices, collecting original images of the grain sample under different viewing angles, performing denoising, enhancement and normalization processing on the original images, and generating preprocessed multi-view images; Labeling and grouping the preprocessed multi-view images according to the shooting angle, selecting images containing a side height region and a front main information region at the same time from the multi-view images as target images, applying a region growing algorithm to the target images for image segmentation, extracting the boundary point set of the side height region and the front main information region in the target images, constructing a region contour using the boundary point set, and calculating the minimum circumscribed rectangle size and region pixel area of the region contour.

3. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The method comprises: According to the enclosing box size, determining the height direction, assigning a confidence coefficient to each of the two regions, constructing a single-view volume evaluation model based on the enclosing box size, pixel area and confidence coefficient, weighting and combining the volume evaluation values of multiple views, and generating a volume evaluation result of the grain sample. Comparing the minimum bounding box sizes of the side height area and the front main information area, marking the long side of the bounding box as the height direction, calculating the aspect ratio values of the two areas, determining the confidence coefficients of the two areas based on the aspect ratio values, multiplying the pixel area of the side height area by the minimum bounding box width of the front main information information area to obtain a first volume component, multiplying the pixel area of the front main information area by the minimum bounding box width of the side height area to obtain a second volume component, and summing the first volume component and the second volume component after multiplying them by the confidence coefficients of the corresponding areas to construct a single-view volume evaluation model; Obtaining volume evaluation values under multiple viewing angles, calculating viewing angle weight coefficients according to the clarity and integrity of each viewing angle image, summing the volume evaluation values and the corresponding viewing angle weight coefficients to obtain a comprehensive volume evaluation result of the grain sample, and performing standardization processing on the comprehensive volume evaluation result to generate a final volume evaluation value.

4. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The fine-grained classification standard is established according to the type of grain kernels, and the grain sample is classified in a fine-grained manner, including: A multi-layer sieve aperture size grading structure is constructed, and grain samples with different degrees of damage are classified by sieves. The maximum aperture of the damaged area of the grain sample is measured, the edge curvature and area ratio of the damaged area are calculated, the maximum aperture, edge curvature and area ratio are used as feature parameters, a damage degree grading model is established, and the damage degree of the grain sample is quantitatively evaluated according to the feature parameters; The contours of holes, local defects or growths, cracks, attachments and metamorphic regions on the surface of the grain sample are detected and features are extracted. The depth, diameter and shape parameters of the holes, local defects or growths, cracks, attachments and metamorphic regions are measured. The distribution position and density of the appearance defects on the surface of the grain are analyzed. The depth, diameter, shape parameters and distribution characteristics are input into a classifier to classify the appearance defect state of the grain sample in a fine-grained manner.

5. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The density coefficient corresponding to each fine-grained classification is obtained through experiments, the density coefficient is multiplied by the volume evaluation result to calculate the weight evaluation value of the grain sample, and the effective range of the density coefficient is set. When the density coefficient exceeds the effective range, it is set to a reference value, including: A standard group of grain samples of different fine-grained classifications is collected, the actual volume and mass of each sample in the standard group are measured, the unit volume mass value is calculated, the unit volume mass value is statistically analyzed, a density coefficient calculation model is established, and the density coefficient calculation model is applied to new grain samples to generate a density coefficient matrix corresponding to each fine-grained classification; The upper and lower threshold values of the density coefficient are determined based on historical data analysis, the density coefficient is numerically matched with the volume evaluation result, the density coefficient exceeding the threshold range is corrected, the product of the corrected density coefficient and the volume evaluation result is used to calculate the weight evaluation value, a weight evaluation database is established, and the weight evaluation value is stored in the database for dynamic updating.

6. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The grain sample is classified according to different types of grain, light impurities and other impurities, and the total image area of each fine-grained classification in each category is calculated, including: The image of the grain sample is collected, the shape, color and texture features of the grain sample are extracted, a multi-level classification feature vector is constructed, the feature vector is input into a classifier for training, a heterogeneous grain identification model, a light impurity identification model and other impurity identification models are established, the grain sample is classified by using the identification models, and a sample set of each category is generated; The grain in each category sample set is subjected to contour segmentation, the projection area of a single grain sample is calculated, the projection areas of the samples in the same fine-grained category are accumulated to obtain the total image area of the fine-grained category, and an area calculation data table is established to record the total image area values of different fine-grained categories under each category.

7. The image analysis based method of identifying imperfect grains of cereal according to claim 1, characterized in that, The image area total is multiplied by the corresponding density coefficient and volume evaluation result to obtain the weight evaluation value of each category, and the weight percentage of imperfect grains is calculated based on the weight evaluation value, which includes: The image area total of different fine-grained categories under each category of heterogeneous grains, light impurities and other impurities is obtained, the image area total is multiplied by the corresponding density coefficient to obtain a mass coefficient, the mass coefficient and the respective volume evaluation result are weighted to generate weight evaluation values of each category, and a weight evaluation data record table is established; The weight evaluation values of each category are normalized, the proportion of the weight evaluation value of each category to the total weight is calculated, the proportion value is accumulated to obtain the weight percentage value of the imperfect grains, a weight percentage calculation model is established, and the weight percentage value is stored in a database for quality grading.

8. An apparatus for identifying imperfect grains of a cereal based on image analysis, characterized in that The device comprises: A sample evaluation module is configured to collect multi-view images of grain samples, pre-process the multi-view images, adjust the shooting angle to make at least one single-view image contain a side height region and a front main information region at the same time, perform image segmentation on the side height region and the front main information region, extract the contour features of the two regions respectively, calculate the minimum bounding box size and pixel area of the two regions, determine the height direction according to the bounding box size, assign a confidence coefficient to each of the two regions, construct a single-view volume evaluation model based on the bounding box size, pixel area and confidence coefficient, combine the volume evaluation values of multiple views by weighting, and generate a volume evaluation result of the grain sample; A fine-grained calculation module is configured to establish a fine-grained classification standard according to the grain kernel type, classify the grain sample in a fine-grained manner, obtain the density coefficient corresponding to each fine-grained category through experiments, multiply the density coefficient by the volume evaluation result to calculate the weight evaluation value of the grain sample, and set an effective range of the density coefficient, which is set to a reference value when the density coefficient exceeds the effective range; An imperfect grain identification module is configured to classify the grain sample into heterogeneous grains, light impurities and other impurities, calculate the total image area of each fine-grained category in each category, multiply the total image area by the corresponding density coefficient and volume evaluation result to obtain the weight evaluation value of each category, and calculate the weight percentage of imperfect grains based on the weight evaluation value.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor, when executing the program, implements the steps of the image analysis based grain unripe kernel identification method of any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the image analysis based grain unripe kernel identification method of any one of claims 1 to 7.

Citation Information

Cited By

  • Film layer overflow detection method and device based on film interference imaging

    CN121904050A