Intelligent grading detection method and system for agricultural products, storage medium and equipment
By combining multimodal data acquisition and hierarchical nested AI algorithms with knowledge distillation technology, the problems of opaque model decision-making logic, complex grading logic processing, and insufficient feature dimensions in agricultural product grading have been solved, achieving high-precision and high-speed intelligent grading of agricultural products.
Patent Information
- Application Number
- CN202511732901.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-02-24
AI Technical Summary
Existing agricultural product grading technologies suffer from several problems, including opaque model decision-making logic, disconnect from industry standards, difficulty in handling complex grading logic, difficulty in balancing accuracy and speed, and insufficient feature dimensions due to single-modal information acquisition.
By employing a multimodal data acquisition hardware system, combined with hierarchical nested AI algorithms and knowledge distillation technology, high-dimensional feature vectors are extracted by simultaneously acquiring reflective and transmissive images of agricultural products. Feature weights associated with industry standards are quantified, a hierarchical nested decision model is constructed, and knowledge distillation is used to transfer the knowledge of the large model to a lightweight student model.
It achieves a high degree of consistency between the grading results and industry standards, strong human-machine consistency, and can accurately handle complex grading logic. It balances high precision and high speed, breaks through the accuracy bottleneck of single-modal detection, and meets the demand for high production capacity.
Smart Images

Figure CN121564407A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated sorting technology for agricultural products, and in particular to an intelligent grading and detection method, system, storage medium, and equipment for agricultural products. Background Technology
[0002] With the rapid development of modern agriculture and food processing, increasingly higher requirements are being placed on the quality grading of agricultural products (such as tobacco leaves, fruits, and vegetables). Traditional manual sorting methods suffer from problems such as high subjectivity, low efficiency, high labor intensity, and inconsistent standards, making it difficult to meet the needs of large-scale, standardized production. Therefore, automated sorting technology based on machine vision has emerged.
[0003] Existing automated sorting technologies typically employ industrial cameras to capture images of agricultural products, which are then analyzed and processed using computer vision algorithms. Early technologies relied heavily on traditional image processing algorithms, extracting shallow features such as color, shape, size, and texture for classification by setting fixed thresholds. In recent years, with the rise of deep learning technology, particularly convolutional neural networks (CNNs), agricultural product grading technology has made significant progress. For example, publications in journals such as *Shanghai Light Industry* (e.g., Zang Chuanjiang, Li Gengxin, et al., "Research and Application of Flue-cured Tobacco Grading Based on Deep Learning," 2024) have disclosed the use of NIR technology and ANN classifiers to classify agricultural product images, automatically extracting deep features through end-to-end learning, thus improving grading accuracy to some extent. These systems typically consist of an image acquisition unit, a data transmission network, and a backend computer, realizing an automated process from image input to grade output.
[0004] Although agricultural product grading technology based on standard deep learning models has been applied, it still faces the following four core challenges when dealing with industrialized production scenarios involving high capacity, high precision, and complex grading logic: 1. Model decision-making is disconnected from industry standards, resulting in a "black box" problem: Traditional deep learning models extract features through autonomous learning, and their internal decision-making logic is often an uninterpretable "black box." The key features judged by the model may not fully correspond to the grading standards accumulated by industry experts over a long period of time (such as the "oil content," "maturity," and "organic density" of tobacco leaves). This leads to a situation where even if the model has a high accuracy rate on the test set, its actual grading results may deviate significantly from the judgment of human experts, resulting in poor human-machine consistency and making it difficult to gain complete trust and application in the production field.
[0005] 2. Difficulty in handling complex and hierarchical grading logic: Many agricultural product grading standards are not simple linear classifications, but rather complex nested or hierarchical logics with preconditions. For example, in tobacco leaf sorting, there's the "one-choose-five" rule: first identify the part (upper, middle, lower), then judge the quality (good / bad or good / medium / poor) based on the different parts. Existing single, flat classification models struggle to directly implement this complex decision-making logic. Forcibly incorporating all logic into a single model results in an exceptionally complex model structure, training difficulties, and virtually impossible fine-tuning of parameters for specific stages.
[0006] 3. A trade-off between model accuracy and detection speed, failing to meet high-volume production demands: In industrial applications, a common contradiction exists: higher-accuracy deep learning models typically have more complex structures and a larger number of parameters (i.e., "large models"), resulting in lengthy inference computation times, making it difficult to meet the real-time requirements of high-speed production lines such as those exceeding 3000 kg / h or 3 pieces / second. On the other hand, lightweight models adopted in pursuit of speed often sacrifice accuracy, failing to meet the ≥85% pass rate requirement. Existing technological solutions usually have to compromise between accuracy and speed, making it impossible to achieve both simultaneously.
[0007] 4. Single-modal information acquisition leads to insufficient feature dimensions, limiting the upper limit of grading: Most existing visual inspection systems rely solely on visible light reflectance images acquired by standard industrial cameras, primarily analyzing product color, surface texture, and shape. However, many key quality indicators, such as the internal structure of tea leaves, moisture uniformity, and internal damage of fruits, cannot be accurately determined based on surface information alone. This single-modal information acquisition method results in the loss of key features, fundamentally limiting further improvements in grading accuracy. Summary of the Invention
[0008] The purpose of this invention is to provide an intelligent grading and detection method, system, storage medium, and device for agricultural products. Through a software process that integrates a multimodal data acquisition hardware system and a hierarchical nested AI algorithm, it systematically solves the shortcomings of existing technologies in terms of grading standard alignment, complex logic processing, balance between speed and accuracy, and feature dimensions.
[0009] The objective of this invention is achieved through the following technical solution: Firstly, a method for intelligent grading and testing of agricultural products is provided, referring to... Figure 1 This includes the following steps: S1. Synchronously acquire multimodal image information of the agricultural products to be tested; S2. Based on the multimodal image information, extract the initial high-dimensional feature vector of agricultural products; perform statistical correlation analysis between the initial high-dimensional feature vector and the grading annotation results in the pre-stored expert knowledge base, and quantify to obtain the feature weight vector that is strongly correlated with the industry grading standard; S3. Input the quantized feature vector into a hierarchical nested decision model for processing; the hierarchical nested decision model includes: L1 decision layer: used to identify macroscopic parts of agricultural products and output part category labels; L2 Decision Layer: Contains multiple quality assessment sub-models. Based on the part category labels output by the L1 Decision Layer, the corresponding quality assessment sub-models are called to conduct a detailed quality assessment of agricultural products and output the final quality grade. S4. Using knowledge distillation technology, the knowledge of the hierarchical nested decision model is transferred to a lightweight student model; the student model is deployed in the production system to perform real-time hierarchical reasoning and output sorting instructions.
[0010] In some embodiments, the multimodal image information includes reflective and transmissive images of the agricultural product to be tested.
[0011] In some embodiments, the method further includes preprocessing the acquired multimodal image information, the preprocessing including: The reflected and transmitted images are denoised and corrected; the reflected and transmitted images of the same agricultural product are combined into a data pair and timestamp and location information are attached.
[0012] In some embodiments, the statistical association analysis uses Pearson correlation coefficient or gradient boosting decision tree to assess feature importance.
[0013] In some embodiments, the loss function used in the hierarchical nested decision model is: L total =L CE (y pred ,y true )+λ * L regularization (V, W) in, L CE It is the standard cross-entropy loss function. y pred These are model predictions. y true It's a real label. L regularization It is a regularization term constructed based on the weight vector W, and λ is a hyperparameter.
[0014] In some embodiments, the knowledge distillation technique trains the student model using the following loss function: L student =α* L CE (S pred , y true )+(1-α)*T 2 *KL_Div(softmax(S logits / T), softmax (T logits / T)) in, S pred and S logits These are the predictions and outputs of the student model. T logits This is the output of the teacher model, y true These are the true labels, KL_Div is the KL divergence, T is the distillation temperature, and α is the equilibrium coefficient.
[0015] In some embodiments, the step of performing real-time hierarchical reasoning and outputting sorting instructions includes: The student model's output grade information is converted into a control signal; The control signal is sent to the sorting execution mechanism; Based on the received signals, the implementing agency accurately places the agricultural products into the corresponding grade collection bins when they arrive at the designated location, completing a physical closed loop of intelligent grading.
[0016] Secondly, an intelligent grading and testing system for agricultural products is provided, including: The multimodal information acquisition module is used to simultaneously acquire multimodal image information of the agricultural products to be tested; The feature extraction and quantization module is used to extract an initial high-dimensional feature vector of agricultural products based on the multimodal image information; and to perform statistical correlation analysis between the initial high-dimensional feature vector and the grading annotation results in the pre-stored expert knowledge base to quantify and obtain a feature weight vector that is strongly correlated with the industry grading standard. A hierarchical nested decision module is used to input the quantized feature vector into the hierarchical nested decision model for processing; the hierarchical nested decision model includes: L1 decision layer: used to identify macroscopic parts of agricultural products and output part category labels; L2 Decision Layer: Contains multiple quality assessment sub-models. Based on the part category labels output by the L1 Decision Layer, the corresponding quality assessment sub-models are called to conduct a detailed quality assessment of agricultural products and output the final quality grade. The knowledge distillation module is used to transfer the knowledge of the hierarchical nested decision model to a lightweight student model through knowledge distillation technology; the student model is then deployed in the production system to perform real-time hierarchical reasoning and output sorting instructions.
[0017] Thirdly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the relevant steps in the intelligent grading and detection method for agricultural products described in the first aspect.
[0018] Fourthly, an electronic device is provided, including a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and the processor executes the relevant steps in the intelligent grading and detection method for agricultural products described in the first aspect when executing the computer instructions.
[0019] It should be further noted that the technical features corresponding to the above-mentioned options and embodiments can be combined or substituted with each other to form new technical solutions without conflict.
[0020] Compared with the prior art, the beneficial effects of the present invention are: 1. The grading results of this invention are highly consistent with industry standards, with strong human-machine consistency, and solve the problem of "black box" decision-making.
[0021] Existing deep learning models often lack transparent decision-making logic, leading to discrepancies between their results and industry expert standards. This invention innovatively establishes a quantitative correlation between AI-extracted high-dimensional features and expert-graded indicators (such as "oil content" and "maturity") before model training by introducing feature engineering and quantitative correlation guided by industry standards. By integrating these correlation weights into the model training process, this invention forces the model to focus on industry-recognized key features, transforming its decision-making logic from an unexplainable "black box" into a well-documented and highly aligned "gray box" reflecting expert thinking. Therefore, the graded results output by this invention are not only highly accurate but also more consistent with actual production practices, significantly improving the consistency between human and machine judgments and making them more readily accepted and trusted by frontline production workers.
[0022] 2. It accurately implements complex hierarchical logic, and the model has strong adaptability and maintainability.
[0023] To address the challenge of existing single-model approaches to handling complex industrial grading logic such as "identification first, evaluation later," this invention designs a hierarchical nested decision-making model. This model comprises an L1 decision layer for macroscopic identification and an L2 decision layer containing multiple specialized evaluation sub-models. This architecture decomposes complex, multi-faceted tasks into clear, independent sub-tasks, perfectly replicating the step-by-step decision-making process in industrial settings. For example, in tobacco leaf sorting, it accurately distinguishes between "upper, middle, and lower" sections before invoking the corresponding "binary" or "triple" sub-models for quality assessment. This modular design not only significantly improves the accuracy of implementing complex rules but also allows for adjustments or retraining of the corresponding sub-models when grading standards change at any stage, without altering the entire large system. This greatly enhances the system's maintainability and its ability to rapidly adapt to changes in production processes.
[0024] 3. Balancing high precision and high speed, it successfully meets the requirements of high-capacity industrial production.
[0025] This invention effectively resolves the contradiction between model accuracy and inference speed in existing technologies. By employing a large-model compression and high-speed inference deployment strategy based on knowledge distillation, a highly accurate and complex "teacher model" is first trained offline. Then, through knowledge distillation, its rich classification knowledge is efficiently transferred to a lightweight "student model." The final model deployed on the production line is this optimized, small-sized, and computationally fast student model. This "broad learning first, then refinement" approach ensures that the deployed model inherits the high accuracy of the teacher model (e.g., ≥85%) while possessing the high-speed inference capability of the student model (e.g., <500ms). This allows it to easily handle high-capacity demands of 3000kg / h while maintaining classification quality, a feat difficult to achieve with existing technologies.
[0026] 4. The grading criteria are more comprehensive, breaking through the accuracy bottleneck of single-modal detection.
[0027] To address the issue of insufficient feature dimensions caused by existing technologies relying solely on surface information, this invention designs a hardware system based on multimodal data acquisition. By simultaneously acquiring reflective images (to obtain surface features) and transmissive images (to obtain internal features) of agricultural products, a complete feature profile containing both internal and external information is constructed for each sample. This multimodal data fusion approach enables AI models to perceive crucial quality information such as internal tissue density and hidden defects, which are imperceptible to the naked eye or a single camera. This enriches the decision-making basis from the data source, fundamentally breaking through the accuracy limit of traditional single-modal visual inspection, resulting in a qualitative leap in grading accuracy and robustness. Attached Figure Description
[0028] Figure 1This is a simplified flowchart of an intelligent grading and detection method for agricultural products according to the present invention; Figure 2 This is a hardware architecture block diagram of an intelligent grading and detection method for agricultural products based on feature engineering and large-scale AI model according to the present invention. Figure 3 This is a software flowchart of an intelligent grading and detection method for agricultural products based on feature engineering and large-scale AI model according to the present invention. Detailed Implementation
[0029] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0030] It should be noted that the defects in the solutions in the prior art are all the results of the inventors' practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the embodiments of this application in the following text should be the inventors' contributions to this application in the process of invention and creation, and should not be understood as technical content known to those skilled in the art.
[0031] In view of the technical problems pointed out in the background art, the present invention provides the following embodiments: In an exemplary embodiment, a method for intelligent grading and detection of agricultural products based on feature engineering and large-scale AI models is provided, specifically including the following steps: Step 1: Acquiring Internal and External Feature Information of Agricultural Products Based on a Multimodal Data Acquisition Hardware System This step aims to address the insufficient feature dimensions caused by single-modal information acquisition in existing technologies. The hardware system is deployed on an automated production line, and its structure and workflow are as follows: Physical transport and positioning: Agricultural products (taking tobacco leaves as an example) enter a closed detection point at a constant speed via a conveyor belt.
[0032] Multimodal image synchronous acquisition: Within the detection point, a multi-source detection unit working collaboratively was designed to perform synchronous, non-contact image acquisition of the same tobacco leaf. Surface feature acquisition module: such as Figure 2As shown, two high color rendering index (CRI ≥ 95) reflected light sources and two ultra-high definition line scan industrial cameras (cameras A and B) are positioned above and below the conveyor belt. The reflected light sources uniformly illuminate the surface of the tobacco leaves, and cameras A and B are responsible for capturing high-resolution reflected images of the front and back of the tobacco leaves. These images are mainly used to analyze the external characteristics of the tobacco leaves, such as color, gloss (oil content), surface texture, shape contour, and surface lesions.
[0033] Internal Feature Acquisition Module: A highly uniform backlight (transmitted light source) is positioned below the conveyor belt, directly opposite camera A. As tobacco leaves pass through, this light source illuminates the gaps between the conveyor belts from below, while line-scan camera C simultaneously captures the transmitted image after it penetrates the tobacco leaf. This image is primarily used to analyze the internal features of the tobacco leaf, such as leaf thickness, tissue density, vein distribution, and hidden defects.
[0034] Data preprocessing and packaging: The acquired reflective and transmissive images are transmitted to the edge processing unit deployed near the production line. This unit is responsible for preliminary noise reduction and correction of the images, and packages the three images of the same tobacco leaf in two modalities into a data pair, attaching a timestamp and location information, and transmitting them at high speed to the central AI computing server via a 10-gigabit fiber optic network.
[0035] The principle behind this step is that by combining reflective and transmissive optics, this invention constructs visual information in two dimensions—"external" and "internal"—for a single sample, forming a data foundation that is far richer than a single image, providing more comprehensive feature basis for subsequent high-precision grading from a physical source.
[0036] Step Two: Feature Engineering and Quantitative Correlation Guided by Industry Standards This step aims to address the "black box" problem of AI models, ensuring that model decisions are highly aligned with industry expert standards. This step is implemented in software on the central AI server. High-dimensional feature vector extraction: Using a pre-trained deep convolutional neural network (CNN), the received multimodal image data pairs are processed to extract an initial high-dimensional feature vector containing information such as color, texture, contour, and translucency.
[0037] Feature correlation analysis and weight quantification: This is the key innovation of this invention. Specifically, an expert knowledge base is established, storing the results of industry experts' hierarchical labeling of a large number of samples according to standards (such as "maturity", "oil content", and "structure"). Then, the following correlation process is executed: Statistical correlation analysis is performed between the high-dimensional feature vectors extracted by AI and the human rating results in the expert knowledge base. For example, Pearson correlation coefficient or gradient boosting decision tree (GBDT) can be used to assess feature importance. This analysis will reveal which specific numerical combinations in the high-dimensional vectors are strongly correlated with the expert's "high maturity" rating and which are strongly correlated with "high oil content".
[0038] Based on this correlation analysis result, the influence weight of each dimension or combination of features on the final classification result is quantified.
[0039] Weighted feature-guided model training: These quantized weights are introduced into the loss function of subsequent model training. This is equivalent to forcibly guiding the AI model to focus on features that are highly correlated with industry standards during the learning process, suppressing interference from irrelevant features, thereby making its decision-making logic closer to expert thinking and solving the problem of the "black box" being out of touch with standards.
[0040] Step 3: Construction and Training of Hierarchical Nested Decision Model This step aims to accurately implement complex industrial hierarchical logic and solve the problem that a single model cannot handle complex decision-making. This invention designs and trains a hierarchical nested model containing two decision layers, L1 and L2: L1 Decision Layer - Part Identification Model: Function: As the entry point for decision-making, it is responsible for macro-level, preliminary classification of tobacco leaves, such as identifying whether they belong to "upper tobacco leaves", "middle tobacco leaves" or "lower tobacco leaves".
[0041] Implementation: The model is a standalone CNN classifier whose training data focuses on structural features of tobacco leaves, such as leaf contour, vein density, and overall thickness (from transmission images).
[0042] Output: A clearly defined part category label.
[0043] L2 Decision Layer - Quality Refinement Assessment Sub-model Set: Function: Based on the output of the L1 decision layer, call the corresponding dedicated sub-model for refined quality assessment.
[0044] Implementation: This is a collection of models, not a single model. For example: Sub-model A (Upper Tobacco Leaf Binary Classification Model): When the L1 output is "Upper Tobacco Leaf", the system feeds the feature data into this model. It is specifically trained to judge the "good" and "bad" of the upper tobacco leaves, and its judgment is based on key features such as oil content and maturity.
[0045] Sub-model B (Middle / Lower Tobacco Leaf Three-Classification Model): This model is called when the L1 output is "Middle Tobacco Leaf" or "Lower Tobacco Leaf". It is trained to determine the three grades of "Good", "Medium" and "Poor", and its judgment criteria focus more on color uniformity, tissue density, lesions and debris.
[0046] Workflow: After receiving tobacco leaf data, the central AI server first makes a judgment using the L1 model. Then, based on the judgment result, it acts like a router to guide the data to the corresponding expert sub-model in L2. Finally, the sub-model outputs a detailed quality grade.
[0047] The principle behind this step: This architecture decomposes a complex multi-task problem into multiple simple sub-tasks, which not only perfectly replicates the "first see what it is, then evaluate whether it is good or bad" operational logic in industrial settings, but also allows each sub-model to focus more on a specific task, thereby improving the accuracy and maintainability of the overall classification.
[0048] Step 4: Deployment of large-scale model compression and high-speed inference based on knowledge distillation This step aims to resolve the conflict between model accuracy and detection speed, in order to meet the demand for high production capacity.
[0049] Training the "Teacher Big Model": The complete model built in step three, which integrates feature engineering and hierarchical nested logic, is defined as the "Teacher Big Model". This model has a complex structure and a huge number of parameters. It is trained extensively with massive amounts of data in an offline environment to achieve an extremely high classification accuracy (e.g., ≥95%), without considering its inference speed.
[0050] The design of the "student mini-model": Design a lightweight model with a similar network structure but shallower and narrower, namely the "student mini-model". This model has far fewer parameters than the teacher model and has a natural potential for fast inference.
[0051] Knowledge distillation process: The same unlabeled production data is simultaneously input into both the pre-trained "large teacher model" and the "small student model" to be trained.
[0052] The “Teacher Big Model” will output a “soft label” containing the probability distribution of each category (for example, for a certain tobacco leaf, the output is {Good: 0.9, Medium: 0.08, Poor: 0.02}).
[0053] The training objective of the "student mini-model" is not only to learn the "hard labels" of real data (i.e., the final grade "good"), but more importantly, to learn and imitate the "soft labels" output by the "teacher large model".
[0054] In this way, the "knowledge" such as the complex inter-category relationships contained in the teacher model is efficiently "distilled" and transferred to the student model.
[0055] Optimized deployment and real-time sorting: After training, the lightweight "student mini-model" is optimized to the extreme using inference engines such as TensorRT, and compiled into a format that can run most efficiently on the target AI computing card.
[0056] The optimized student model is deployed to the central AI server. In actual production, the model is responsible for processing production line data in real time. Due to its lightweight nature, it can complete a full "L1+L2" hierarchical decision within 500 milliseconds and output the level signal to the downstream mechanical sorting actuator, realizing high-speed and high-precision automated sorting.
[0057] The principle behind this step is that knowledge distillation technology condenses the "wisdom" of a large model into a small model, allowing us to enjoy the high precision of the large model while utilizing the high speed of the small model, thus perfectly solving the core contradiction in industrial applications.
[0058] Reference Figure 2 In this embodiment, the hardware system is deployed on a tobacco leaf sorting production line. Its operation is as follows: the tobacco leaves to be inspected enter a closed inspection station at a constant speed along the conveyor belt. Inside the inspection station, a reflective light source and a backlight source, as well as multiple industrial cameras for imaging, are installed.
[0059] Reference Figure 3 The specific software flow and physical process transformation of the method of the present invention are as follows: Step 201: Synchronous acquisition of multimodal images This is a step in converting physical information into digital information. When the tobacco leaf to be inspected moves to the center of the inspection station's field of view, the control system simultaneously triggers the light source and camera.
[0060] 1. With the reflective light source turned on, the industrial camera captures the first set of front and back images, denoted as the reflective image Ir. The pixel values of this image mainly reflect the light reflection characteristics of the tobacco leaf surface, and its physical meaning represents information such as the color, gloss (oil content), surface texture, and external defects of the tobacco leaf.
[0061] 2. Almost simultaneously, the backlight is turned on (the reflected light source is turned off), and the industrial camera acquires the second set of images, denoted as the transmission image It. The pixel values of this image reflect the intensity of light after it penetrates the tobacco leaf, and its physical meaning represents information such as the internal tissue density of the tobacco leaf, leaf thickness, vein structure, and internal damage.
[0062] 3. The edge processing unit packages the (Ir, It) image pairs of the same tobacco leaf and sends them to the central AI computing server via the network.
[0063] Step 202: Multimodal high-dimensional feature extraction On the server, a pre-trained deep convolutional neural network (CNN model), denoted as Fcnn, receives image pairs (Ir, It). This network transforms the raw pixel information into a high-dimensional feature vector V through multiple layers of convolution, pooling, and non-linear activation. V = Fcnn(Ir, It) Here, V is a vector containing hundreds of floating-point numbers, such as V = [v1, v2, ..., vn]. This step abstracts specific image information into a mathematical expression that the machine can understand. Each component vi in the vector V represents a local or global pattern feature learned from the image.
[0064] Step 203: Correlation of features with expert criteria and weight quantification This step is one of the core innovations of this invention, aiming to establish a link between the mathematical characteristics of the model and industry physical standards.
[0065] 1. This invention pre-establishes an expert knowledge base Dexpert, which contains a large number of samples annotated by senior tobacco leaf grading experts. Each sample includes not only an image but also multiple dimensions of evaluation given by experts, such as "maturity score Sm", "oil content score So", and "structure score Ss".
[0066] 2. For the feature vector V extracted in step 202, we perform statistical correlation analysis to calculate the correlation Corr(vi, Sm) between each component vi in V and the expert evaluation score (such as Sm).
[0067] 3. Based on the correlation analysis results, each feature component vi is assigned a weight wi, forming a weight vector W with the same dimension as V, W = [w1, w2, ..., wn]. The magnitude of wi represents the importance of feature vi to the predicted final level, and its physical meaning is to quantify expert experience into a guiding signal for model training.
[0068] Steps 204 and 205: Hierarchical Nested Decision Making This step is implemented on the server through a hierarchical nested AI model structure.
[0069] 1. L1 Decision Layer: Part Identification (204): The feature vector V is input into the part identification model ML1. This model is specifically trained to identify the growth parts of tobacco leaves.
[0070] P = ML1(V) The output P is a category label whose physical meaning is the part of the tobacco leaf, for example, P ∈ {"upper leaf", "middle leaf", "lower leaf"}.
[0071] 2. L2 Decision Layer: Fine-grained Quality Assessment (205): Based on the output P of L1, the system makes conditional judgments and calls different quality assessment sub-models.
[0072] IF P == "Upper Leaf": Call the upper leaf quality assessment model M L2_A G = ML 2_A (V), output level G, G∈ {"good", "bad"}.
[0073] ELSE IF P == "Middle Leaf" or P == "Lower Leaf": Invoke the middle and lower leaf quality assessment model M. L2_B G = M L2_B (V), output grade G, G ∈ {"Good", "Medium", "Poor"}.
[0074] In training model M L1 M L2_A M L2_B In this invention, a weighted loss function Ltotal, which includes a weight vector W, is designed: L total =L CE (y pred ,y true )+λ * L regularization (V, W) in, L CE It is the standard cross-entropy loss function. y pred These are model predictions. y true It's a real label. L regularization This is a regularization term constructed based on the weight vector W, where λ is a hyperparameter. The purpose of this regularization term is to penalize features used by the model in decision-making (reflected in the activation values of V) if they do not match the features marked as important in W. This mathematical model ensures that the AI, while learning classification, must follow the "correct path" defined by expert knowledge.
[0075] Step 206: Knowledge Distillation and Lightweight Model Generation To resolve the trade-off between speed and accuracy, we define the high-precision, but structurally complex and slow-inference models trained in steps 204 and 205 as the teacher model M. Teacher We will design a student model M with a simpler structure and fewer parameters. Student .
[0076] The student model is trained using knowledge distillation techniques, and its loss function is: L student =α* L CE (S pred , y true )+(1-α)*T 2 *KL_Div(softmax(S logits / T), softmax (T logits / T)) in, S pred and S logits These are the predictions and outputs of the student model. T logits This is the output of the teacher model, y true Here, KL_Div is the true label, T is the distillation temperature, and α is the equilibrium coefficient. The physical meaning of this formula is that the student model must learn not only the true answer (the first term) but also the teacher model's "thinking process" for the answer, i.e., the probability distribution of the teacher model's output (the second term). Ultimately, we obtain a lightweight student model M with performance similar to the teacher model but several times faster inference speed. Student .
[0077] Step 207: High-speed inference and sorting instruction output This is a conversion process from digital instructions to physical actions.
[0078] The lightweight student model M will be finally optimized and deployed. Student Used for real-time production. For each new tobacco leaf, M Student The process from feature extraction to the final level G is completed within 500ms.
[0079] The server translates level G into a control signal, such as a binary code.
[0080] The signal is sent to the sorting actuator, such as a pneumatic lever or a robotic arm.
[0081] Based on the received signal, the actuator accurately places the tobacco leaves into the corresponding grade collection bin when they reach the designated location, completing a physical closed loop of intelligent grading.
[0082] Through the above implementation methods, the present invention successfully combines multimodal perception, expert knowledge quantification, hierarchical decision-making logic and model compression technology to realize a high-precision, high-efficiency and high-compliance intelligent grading and detection method for agricultural products.
[0083] In another exemplary embodiment, based on the same inventive concept as the method embodiment, an intelligent grading and detection system for agricultural products is provided, comprising: The multimodal information acquisition module is used to simultaneously acquire multimodal image information of the agricultural products to be tested; The feature extraction and quantization module is used to extract an initial high-dimensional feature vector of agricultural products based on the multimodal image information; and to perform statistical correlation analysis between the initial high-dimensional feature vector and the grading annotation results in the pre-stored expert knowledge base to quantify and obtain a feature weight vector that is strongly correlated with the industry grading standard. A hierarchical nested decision module is used to input the quantized feature vector into the hierarchical nested decision model for processing; the hierarchical nested decision model includes: L1 decision layer: used to identify macroscopic parts of agricultural products and output part category labels; L2 Decision Layer: Contains multiple quality assessment sub-models. Based on the part category labels output by the L1 Decision Layer, the corresponding quality assessment sub-models are called to conduct a detailed quality assessment of agricultural products and output the final quality grade. The knowledge distillation module is used to transfer the knowledge of the hierarchical nested decision model to a lightweight student model through knowledge distillation technology; the student model is then deployed in the production system to perform real-time hierarchical reasoning and output sorting instructions.
[0084] In another exemplary embodiment, based on the same inventive concept as the method embodiment, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which, when executed by a processor, implements the relevant steps in the intelligent grading and detection method for agricultural products provided in this embodiment of the invention. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0085] In another exemplary embodiment, based on the same inventive concept as the method embodiment, an electronic device is provided, including a memory and a processor. The memory stores computer instructions that can be executed on the processor. When the processor executes the computer instructions, it performs the relevant steps in the intelligent grading and detection method for agricultural products provided in the embodiments of the present invention.
[0086] The processor may be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0087] The embodiments of the subject matter and functional operation described in this specification can be implemented in: tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or combinations thereof. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible, non-transitory program carrier for execution by a data processing device or for controlling the operation of a data processing device. Alternatively or additionally, the program instructions may be encoded on artificially generated propagation signals, such as machine-generated electrical, optical, or electromagnetic signals, which are generated to encode information and transmit it to a suitable receiving device for execution by the data processing device.
[0088] The processing and logic flow described in this specification can be executed by one or more programmable computers that execute one or more computer programs to perform corresponding functions by operating on input data and generating output. The processing and logic flow can also be executed by dedicated logic circuitry—such as FPGAs (Field-Programmable Gate Arrays) or ASICs (Application-Specific Integrated Circuits), and the device can also be implemented as dedicated logic circuitry.
[0089] Suitable processors for executing computer programs include, for example, general-purpose and / or special-purpose microprocessors, or any other type of central processing unit. Typically, the central processing unit receives instructions and data from read-only memory and / or random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include one or more mass storage devices for storing data, such as disks, magneto-optical disks, or optical disks, or the computer will be operatively coupled to such mass storage devices to receive data from or transfer data to them, or both. However, a computer is not required to have such devices. Furthermore, a computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, to name a few.
[0090] It should be understood that each block in a flowchart or block diagram can represent a module, segment, or portion of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the figures. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0091] The above detailed embodiments are a description of the present invention. It should not be considered that the specific embodiments of the present invention are limited to these descriptions. For those skilled in the art, several simple deductions and substitutions can be made without departing from the concept of the present invention, and all of these should be considered to fall within the protection scope of the present invention.
Claims
1. A method for intelligent grading and testing of agricultural products, characterized in that, Includes the following steps: S1. Synchronously acquire multimodal image information of the agricultural products to be tested; S2. Based on the multimodal image information, extract the initial high-dimensional feature vector of agricultural products; perform statistical correlation analysis between the initial high-dimensional feature vector and the grading annotation results in the pre-stored expert knowledge base, and quantify to obtain the feature weight vector that is strongly correlated with the industry grading standard; S3. Input the quantized feature vector into a hierarchical nested decision model for processing; the hierarchical nested decision model includes: L1 decision layer: used to identify macroscopic parts of agricultural products and output part category labels; L2 Decision Layer: Contains multiple quality assessment sub-models. Based on the part category labels output by the L1 Decision Layer, the corresponding quality assessment sub-models are called to conduct a detailed quality assessment of agricultural products and output the final quality grade. S4. Using knowledge distillation technology, the knowledge of the hierarchical nested decision model is transferred to a lightweight student model; the student model is deployed in the production system to perform real-time hierarchical reasoning and output sorting instructions.
2. The intelligent grading and detection method for agricultural products according to claim 1, characterized in that, The multimodal image information includes the reflected image and the transmitted image of the agricultural product to be tested.
3. The intelligent grading and detection method for agricultural products according to claim 2, characterized in that, It also includes preprocessing the acquired multimodal image information, the preprocessing including: The reflected and transmitted images are denoised and corrected; the reflected and transmitted images of the same agricultural product are combined into a data pair and timestamp and location information are attached.
4. The intelligent grading and detection method for agricultural products according to claim 1, characterized in that, The statistical association analysis uses Pearson correlation coefficient or gradient boosting decision tree to assess feature importance.
5. The intelligent grading and detection method for agricultural products according to claim 1, characterized in that, The loss function used in the hierarchical nested decision model is: L total =L CE (y pred ,y true )+λ * L regularization (V, W) in, L CE It is the standard cross-entropy loss function. y pred These are model predictions. y true It's a real label. L regularization It is a regularization term constructed based on the weight vector W, and λ is a hyperparameter.
6. The intelligent grading and detection method for agricultural products according to claim 1, characterized in that, The knowledge distillation technique uses the following loss function to train the student model: L student =α* L CE (S pred , y true )+(1-α)*T 2 *KL_Div(softmax(S logits / T), softmax(T) logits / T)) in, S pred and S logits These are the predictions and outputs of the student model. T logits This is the output of the teacher model, y true These are the true labels, KL_Div is the KL divergence, T is the distillation temperature, and α is the equilibrium coefficient.
7. The intelligent grading and detection method for agricultural products according to claim 1, characterized in that, The process of performing real-time hierarchical reasoning and outputting sorting instructions includes: The student model's output grade information is converted into a control signal; The control signal is sent to the sorting execution mechanism; Based on the received signals, the implementing agency accurately places the agricultural products into the corresponding grade collection bins when they arrive at the designated location, completing a physical closed loop of intelligent grading.
8. An intelligent grading and testing system for agricultural products, characterized in that, include: The multimodal information acquisition module is used to simultaneously acquire multimodal image information of the agricultural products to be tested; The feature extraction and quantization module is used to extract an initial high-dimensional feature vector of agricultural products based on the multimodal image information; and to perform statistical correlation analysis between the initial high-dimensional feature vector and the grading annotation results in the pre-stored expert knowledge base to quantify and obtain a feature weight vector that is strongly correlated with the industry grading standard. A hierarchical nested decision module is used to input the quantized feature vector into the hierarchical nested decision model for processing; the hierarchical nested decision model includes: L1 decision layer: used to identify macroscopic parts of agricultural products and output part category labels; L2 Decision Layer: Contains multiple quality assessment sub-models. Based on the part category labels output by the L1 Decision Layer, the corresponding quality assessment sub-models are called to conduct a detailed quality assessment of agricultural products and output the final quality grade. The knowledge distillation module is used to transfer the knowledge of the hierarchical nested decision model to a lightweight student model through knowledge distillation technology; the student model is then deployed in the production system to perform real-time hierarchical reasoning and output sorting instructions.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the relevant steps in the intelligent grading and detection method for agricultural products according to any one of claims 1-7.
10. An electronic device comprising a memory and a processor, wherein the memory stores computer instructions executable by the processor, characterized in that, When the processor executes computer instructions, it performs the relevant steps in the intelligent grading and detection method for agricultural products as described in any one of claims 1-7.