Preserved egg quality intelligent detection method and system based on machine vision
By combining multispectral data acquisition and knowledge distillation with a multi-expert network, visible and non-visible light information is integrated to solve the robustness and real-time issues in the internal quality detection of preserved eggs, thus achieving efficient quality detection of preserved eggs.
Patent Information
- Application Number
- CN202512011092.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies struggle to effectively identify defect patterns with extremely low contrast signals and subtle texture changes in the internal quality inspection of preserved eggs. Furthermore, traditional feature representations are sensitive to environmental noise, resulting in poor robustness and computational intensity, making real-time online detection difficult.
We employ a method that combines multispectral data acquisition, multi-expert networks, and knowledge distillation. We construct deep features using a multispectral ROI cube, fuse visible and non-visible light information, quantify comprehensive quality indicators using a multi-source information fusion model, and perform pattern recognition and classification using a quality status identification model.
It achieves highly robust identification of subtle internal defects in preserved eggs, improves the accuracy and interpretability of detection results, meets the requirements of real-time online industrial detection, and reduces computational load.
Smart Images

Figure CN121904745A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, specifically to a machine vision-based intelligent detection method and system for the quality of preserved eggs. Background Technology
[0002] In the application of image inspection systems to intelligent product inspection, the core challenge lies in how to effectively perform pattern recognition and achieve semantic understanding of the target's microscopic features from high-noise, unstructured perceptual data. For the internal quality inspection of preserved eggs, defects manifest as extremely low-contrast signals and subtle texture changes in transmission images, making pattern recognition extremely difficult. Existing strategies rely on manually designed feature engineering and serial pattern matching logic. This involves constructing low-level perceptual feature representations through complex quantification methods (e.g., based on statistics or spectral analysis), and then inputting these features into a classifier for pattern matching and quality judgment.
[0003] However, this highly coupled process has fundamental flaws: manually designed feature representations are highly sensitive to the quality of the input sensing data. Even minor data distortions caused by industrial environmental noise can lead to drastic shifts in feature representations after nonlinear mapping. This chain-like dependency and error propagation result in extremely poor image recognition robustness when identifying defective patterns with extremely weak signals. Furthermore, traditional feature representations lack an inherent immunity mechanism to environmental and batch variations, leading to low general recognition capabilities. Simultaneously, extracting and quantifying complex manually created feature descriptors is a computationally intensive task, severely hindering real-time online pattern recognition on high-speed production lines. Therefore, there is an urgent need for a new method that breaks through the traditional feature representation and pattern matching paradigm, capable of automatically learning and constructing deep, high-quality feature representations inherently immune to noise directly from raw, noisy sensing data, thereby fundamentally resolving the sharp contradiction between the high coupling of the algorithm and the robustness of pattern recognition in industrial applications.
[0004] To address this, a machine vision-based intelligent detection method and system for the quality of preserved eggs is proposed. Summary of the Invention
[0005] The purpose of this invention is to provide a machine vision-based intelligent detection method and system for the quality of preserved eggs, for intelligent detection of preserved egg quality.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A machine vision-based intelligent quality detection method for preserved eggs includes: The light field intensity data of preserved eggs in the visible light transmission band and the internal medium density data in the non-visible light high transmission band are obtained, and spatial registration and image mask segmentation are performed to obtain a multispectral ROI cube containing the structural information of preserved eggs. Defect quality annotation is performed on the multispectral ROI cube to construct a quality feature dataset; a multi-expert network simulating long-tail, uniform, and anti-long-tail distributions is trained based on the quality feature dataset; the multi-expert network extracts deep features that are independent of environmental noise in the multispectral ROI cube, calculates the KL divergence between the predicted values output by the multi-expert network, and generates a knowledge distillation divergence loss set. A multi-source information fusion model is constructed based on the knowledge distillation divergence loss set; the color and shape features of visible light and the density index features of non-visible light are fused through the multi-source information fusion model to quantitatively calculate the comprehensive quality index of the internal quality of preserved eggs. The quality status recognition model applies quality index decoupling constraints to the comprehensive quality index and performs structural and appearance quality pattern recognition and classification for the internal quality categories of preserved eggs. Based on the judgment results, the image detection results of preserved eggs are output.
[0007] Preferably, the process of constructing the multispectral ROI image includes: Visible light transmission images of the preserved egg to be tested are acquired using a transmission illumination system. These images capture the egg's color, shape, outline, and internal translucency characteristics. Simultaneously, non-visible light band images are acquired using X-ray fluoroscopy to characterize the yolk's coagulation degree, air cell state, and density distribution within the preserved egg. An affine transformation image registration algorithm is used to precisely align the pixel coordinates of the two types of images, generating a pixel-level aligned multispectral feature cube. The channel set of this feature cube includes visible light R, G, and B features and non-visible light density features. A U-Net-based semantic segmentation network is used to perform mask segmentation on the multispectral feature cube, generating a joint mask. Finally, by applying the joint mask, a multispectral ROI cube containing only the main body region of the preserved egg is separated from the multispectral feature cube.
[0008] Preferably, the training of a multi-expert network simulating a long-tailed, uniform, and anti-long-tailed distribution includes: The multispectral ROI cube is input into a multi-expert network with the same skeleton structure and trained under supervision using a preset expert loss function. The first expert network, simulating a long-tailed distribution, is trained using the standard Softmax cross-entropy loss function L1 to focus on learning the feature representations of common defects with a large number of samples. The second expert network, simulating a uniform distribution, is trained using a loss function L2 that introduces a sample prior probability correction term logωi on top of L1 to balance the contribution of each category of samples to the model. The third expert network, simulating an inverse long-tailed distribution, is trained using a loss function L3 that introduces a reversed prior probability correction term logωi on top of L2, where ωi is the reversed order of ωi, specifically used to amplify the learning weights of sparse, weak defect features.
[0009] Preferably, the specific process of the knowledge distillation divergence loss set includes: The multi-expert network predicts the probability distribution of each network at the output layer. The multi-expert networks are then paired, i.e., between the first and second expert networks, the first and third expert networks, and the second and third expert networks. The KL divergence between the predicted values of any two expert networks is calculated, and this KL divergence is used as the soft constraint loss for deep mutual learning among the multi-expert networks. This generates a knowledge distillation divergence loss set, which includes the sum of all divergence losses generated by pairwise combinations.
[0010] Preferably, the construction of the multi-source information fusion model is optimized using an overall loss function, specifically including: The overall loss function is defined as the weighted sum of the supervision losses L1, L2, and L3 of each of the multi-expert networks and the knowledge distillation divergence loss set. The weights of the supervision losses are weight hyperparameters used to balance the classification accuracy of the three expert networks on different distributions, and the weights of the knowledge distillation divergence loss set are weight hyperparameters of the knowledge distillation constraints. During training, the parameters of the multi-source information fusion model are updated uniformly by minimizing the overall loss function through gradient descent. In each training iteration, the model simultaneously calculates the gradients from the supervision losses and the knowledge distillation divergence loss set, and iteratively updates the shared parameters based on the knowledge distillation divergence loss set. When the training reaches the preset convergence condition, the shared skeleton weight set obtained by optimizing the overall loss function constitutes the final multi-source information fusion model with low coupling characteristics for online inference.
[0011] Preferably, the calculation process of the comprehensive quality index includes: From the deep feature map output by the feature extraction layer of the multi-source information fusion model, visible light feature channels corresponding to color and shape information and non-visible light feature channels corresponding to density and structure information are separated. A channel attention mechanism is used to weight these feature channels: global average pooling compresses the two-dimensional feature map of each channel into a single value, representing the global statistical information of the feature channel. This global statistical information is input into a small neural network to learn the complex relationships between channels, and a weight coefficient between 0 and 1 is calculated for each spectral channel. The calculated weight coefficient is multiplied by the corresponding feature channel. Finally, a 1x1 convolution is used to deeply fuse the weighted visible light and non-visible light features, generating a comprehensive quality index that integrates the advantages of multi-source optical information.
[0012] Preferably, the operation process of the quality status identification model includes: The quality status recognition model comprises three parts: an input layer, two hidden fully connected layers with 512 and 256 nodes respectively, and an output layer. ReLU activation functions are cascaded between the hidden layers, and internal regularization can be achieved through the introduction of a Dropout layer. The final output of the quality status recognition model is the original Logit value corresponding to the number of defect categories in the preserved egg. During training and optimization, an additional quality index decoupling constraint is applied. This constraint is defined as a feature correlation penalty term, calculated based on the covariance matrix between different dimensions of features in the comprehensive quality index. The feature correlation penalty term is weighted and added to the model's total loss function, guiding the quality status recognition model through backpropagation. The quality status recognition model learns by inputting a comprehensive quality index into its input layer and outputting a Logit value. The number of nodes in the input layer is consistent with the dimension of the comprehensive quality index. The Logit value is then input into a Softmax function to convert the Logit into a posterior probability distribution. This posterior probability distribution is a probability vector, where each component corresponds to the probability that the preserved egg belongs to each quality category, and the sum of all components is 1. During the inference phase, the quality status recognition model receives the comprehensive quality index directly in an end-to-end manner and outputs a posterior probability distribution based on its learned discrimination weights. The category with the highest probability value in the posterior probability distribution is determined as the final quality category of the preserved egg, and the quality result is output.
[0013] A machine vision-based intelligent quality inspection system for preserved eggs includes: Multispectral data acquisition module: used to acquire light field intensity attenuation data of preserved eggs in the visible light transmission band and internal medium light absorption data in the non-visible light high-penetration band; Image ROI extraction module: used to perform spatial registration and image mask segmentation on light field intensity attenuation data and internal medium light absorption data to obtain multispectral ROI cubes; Multi-expert network feature extraction module: It is used to receive labeled ROI cubes, construct a quality feature dataset based on the ROI cubes, train a multi-expert network simulating long-tailed, uniform, and anti-long-tailed distributions, extract deep features that are independent of environmental noise, and calculate the KL divergence between the predicted values of the expert network outputs to generate a knowledge distillation divergence loss set. Multi-source information fusion and quantification module: used to receive the knowledge distillation divergence loss set, construct a multi-source information fusion model, fuse the color and shape features of visible light with the density index features of non-visible light, and quantify and calculate the comprehensive quality index of the internal quality of preserved eggs. Quality status determination and output module: It is used to receive comprehensive quality indicators, apply quality indicator decoupling constraints to them through the quality status recognition model, perform structural and appearance quality pattern recognition and classification, and output the quality image detection results of preserved eggs based on the determination results.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This method combines multi-expert networks with knowledge distillation to effectively extract deep feature expressions that are independent of environmental noise and have inherent immunity to various defect patterns. This enables highly robust identification of weak defect signals inside preserved eggs, greatly improving the algorithm's general identification capability in complex industrial environments.
[0015] 2. This method deeply integrates visible light information with non-visible light information, so that the final quality judgment is not just a simple "qualified or unqualified" output, but can clearly trace the cause of the abnormality, which significantly improves the accuracy, interpretability and traceability of the test results.
[0016] 3. This method adopts a deep learning end-to-end architecture, which effectively bypasses the time-consuming intermediate processing links in the traditional detection process, significantly reduces the computational load of the algorithm, meets the stringent requirements of high-speed industrial production lines for real-time and online detection, and greatly improves the industrial applicability of the system. Attached Figure Description
[0017] Figure 1 This is a flowchart of the machine vision-based intelligent quality detection method for preserved eggs according to the present invention. Figure 2 This is a schematic diagram of the machine vision-based intelligent quality detection system for preserved eggs according to the present invention. Figure 3 This is a flowchart of the multi-expert network of the present invention; Figure 4 This is a flowchart of the multi-source information fusion model of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments 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, and not all embodiments. 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.
[0019] Please see Figures 1 to 4 This invention provides a machine vision-based intelligent quality detection method and system for preserved eggs, the technical solution of which is as follows: A machine vision-based intelligent quality detection method for preserved eggs, referenced Figure 1 The specific implementation steps of the method proposed in this invention include: S1. Obtain the light field intensity data of preserved egg in the visible light transmission band and the internal medium density data in the non-visible light high transmission band, and perform spatial registration and image mask segmentation to obtain a multispectral ROI cube containing the structural information of preserved egg. S2. Defect quality labeling is performed on the multispectral ROI cube to construct a quality feature dataset; a multi-expert network simulating long-tailed, uniform, and anti-long-tailed distributions is trained based on the quality feature dataset; the multi-expert network extracts deep features in the multispectral ROI cube that are independent of environmental noise, calculates the KL divergence between the predicted values output by the multi-expert network, and generates a knowledge distillation divergence loss set. S3. Construct a multi-source information fusion model based on the knowledge distillation divergence loss set; fuse the color and shape features of visible light with the density index features of non-visible light through the multi-source information fusion model to quantitatively calculate the comprehensive quality index of the internal quality of preserved eggs. S4. Apply quality index decoupling constraints to the comprehensive quality index through the quality state recognition model, and perform structural and appearance quality pattern recognition and classification for the internal quality categories of preserved eggs. Output the image detection results of preserved eggs based on the judgment results.
[0020] Example 1:
[0021] This embodiment provides a specific application of a machine vision-based intelligent quality detection method for preserved eggs, which is used in the scenario of intelligent quality detection of preserved eggs based on multi-band optical measurement and knowledge distillation.
[0022] Further, the light field intensity data of the preserved egg in the visible light transmission band and the internal medium density data in the non-visible light high-transmission band are obtained, and spatial registration and image mask segmentation are performed to obtain a multispectral ROI cube containing the structural information of the preserved egg; corresponding to step S1 above, the specific process is as follows: A data acquisition system is employed, consisting of a high-intensity, constant-color-temperature transmission illumination system (e.g., an LED array with power greater than 10W and a color temperature of 5000K) and a high-resolution industrial camera (e.g., a pixel count greater than 5 million and a dynamic range greater than 60dB). The illumination uniformity of the transmission illumination system is preferably above 95% in the ROI region, and it utilizes an LED array with a light-diffusing plate. The high-resolution industrial camera preferably has a frame rate of at least 100fps and is equipped with a fixed-focus lens with a focal length of 35mm. The preserved egg is placed in the optical path of the transmission illumination system. The high-resolution industrial camera performs high-speed exposure at an angle perpendicular to the transmission optical axis to acquire light field intensity attenuation data of the preserved egg in the visible light transmission band (R, G, B channels). This acquired data is used to record color changes, contour distortion, and overall translucency characteristics after light penetrates the egg's medium. An X-ray imaging device is used as a tool for the non-visible light high-transmission band; the device includes an X-ray source and a high-sensitivity flat panel detector. The data acquisition in the non-visible high-penetration band utilizes a low-dose X-ray imaging device that complies with national or international food safety standards (meeting the dose limits for food testing in GB18871 "Basic Standards for Ionizing Radiation Protection and Radiation Source Safety", or meeting other recognized food testing ionizing radiation standards). Its original grayscale value range is 0-1024 (16-bit encoding); the operating parameters are set as follows: tube voltage between 30kV and 50kV, tube current less than 0.5mA, and single-detection exposure time less than 100ms. The preserved egg is placed between the X-ray source and the detector to acquire its non-visible light band image. This non-visible light band image records the light absorption and density distribution of the internal medium of the preserved egg; its grayscale value is directly related to the degree of yolk coagulation, the size of the air cell, and the presence of internal structural defects (such as abnormal density caused by yolk frying or failure to change color).
[0023] Dynamic range mapping is performed on the X-ray density map using the min-max normalization method to map its grayscale values to the range. The mapping formula is as follows: ,in The original grayscale value. and These are the minimum and maximum grayscale values for this batch of images. After data acquisition, affine transformation is used to precisely align the pixel coordinates of the visible light transmission image and the non-visible light band image, ensuring that the same point in both types of images remains consistent in the pixel coordinate system. First, corner detection identifies at least four common invariant feature points in both types of images. These feature points are preferably stable corner points on the outer contour of the eggshell. A feature point detection network based on a pre-trained SuperPoint network is used to extract pixel-level corner points and descriptors from the visible light transmission image and the non-visible light high-transmittance image, respectively. A nearest neighbor matching algorithm (such as KNN) combined with cross-validation is used for preliminary matching of the extracted descriptors. To ensure the robustness of subsequent affine transformations, a minimum threshold of 500 successfully matched feature point pairs is set. For the feature point set that meets the minimum threshold, the RANSAC algorithm is used for iterative optimization to calculate the mapping moment M used for spatial transformation. The algorithm convergence criterion is set as follows: the root mean square error between corresponding feature points in the two images after registration is less than 0.5 pixels. The mapping matrix M is applied to the pixel coordinates of the non-visible light band image. Bilinear interpolation resampling technology is used to spatially transform the non-visible light image into the coordinate system of the visible light image, eliminating spatial deviations caused by the acquisition viewpoint or equipment vibration. Finally, the aligned visible light R, G, and B channel data and the non-visible light density data are stacked along the channel dimension to generate a pixel-level aligned multispectral feature cube C (dimensions H×W×4, data type float32). A U-Net-based semantic segmentation network is used to perform mask segmentation on the multispectral feature cube C. The semantic segmentation network uses DiceLoss as the loss function and is trained under supervision on a dataset of at least 5000 labeled pixel-level ground truth masks to perform pixel-level classification of the preserved egg main region and background region in the image. The semantic segmentation network outputs a binarized joint mask. The region with a pixel value of 1 precisely covers the main area of the preserved egg, thus eliminating background noise. This is achieved by combining the multispectral feature cube C with the joint mask. Perform pixel-by-pixel multiplication to separate multi-ray ROI cubes that contain only the main medium region of the preserved egg. (Dimensions are 224×224×4, standard input resolution). This is then used as the unified input for deep learning models.
[0024] As an enhancement scheme for the multispectral ROI cube, the acquisition of non-visible light data is extended to micro-time series, and the dynamic stability characteristics of the internal medium of preserved eggs are extracted using a time-aware network structure. The specific implementation is as follows: The system first modifies the non-destructive optical measurement system to simultaneously acquire N frames of non-visible light band images (e.g., N=5 frames of X-ray density maps) within an extremely short time (e.g., within 100 milliseconds) as the preserved egg passes through the detection area. This rapid sequence acquisition can capture the instantaneous deformation or metastable state of the internal medium of the preserved egg under micro-vibrations, slight rotations, or micro-stresses during transport. Therefore, the initial input data of the model is expanded into a spatiotemporal feature tensor. The dimensions are N×224×224×4. Subsequently, a dedicated spatiotemporal feature extraction layer is added to the shared skeleton of the multi-source information fusion model. This layer uses a time-aware network structure, such as a 3D convolutional network or a Conv-LSTM module, to perform deep processing on the N-frame sequence to analyze the temporal consistency and spatial dynamics of the medium. Through this layer, the model can extract spatiotemporal consistency features, such as the stability of the yolk coagulation or the dynamic features of the internal liquid sloshing. These dynamic features are then fused into the deep feature map F and fed into the downstream classifier. This method enables defect detection to no longer rely solely on static spatial shape (e.g., whether the shape conforms to the outline of a fried egg), but can also explicitly identify dynamic defects based on spatiotemporal features: if the spatiotemporal features (e.g., the relative displacement variance of the yolk outline within N frames) exceed a preset threshold, it directly indicates poor yolk coagulation or unstable internal structure.
[0025] By extending non-visible light data acquisition to micro-time series, dynamic or metastable defects can be identified, greatly improving the depth of quality detection.
[0026] By fusing non-visible and visible information through a multispectral ROI cube, the deep learning model can receive high-quality, pixel-aligned, and denoised normalized multi-source heterogeneous optical inputs, laying a solid data foundation for subsequent robust feature learning.
[0027] Further, defect quality annotation is performed on the multispectral ROI cube to construct a quality feature dataset; a multi-expert network simulating long-tailed, uniform, and anti-long-tailed distributions is trained based on the quality feature dataset; the multi-expert network extracts depth features unrelated to environmental noise from the multispectral ROI cube, calculates the KL divergence between the predicted output values of the multi-expert network, and generates a knowledge distillation divergence loss set; corresponding to step S2 above, the specific process is as follows: Defect quality annotation is performed on the multispectral ROI cube to form a long-tail quality feature dataset covering qualified products (head samples) and various minor defects (tail samples, such as slight alkali damage and lack of color change). A multi-expert network with different distributions is initialized and simulated. , , All expert networks employ the same ShuffleNetV2 lightweight skeleton structure (width multiplier of 1.0) as their feature extraction layers, with a computational load controlled to approximately 10 GFLOPs. These multi-expert networks share the skeleton weights, but their output layer loss functions are designed differently. They learn different discriminant weight vectors corresponding to different class distribution biases at their output layers.
[0028] Before training begins, a global statistical scan is performed on the entire training dataset to calculate the number of samples for each defect category. (k=1, 2, ..., K, where K is the total number of defect categories), the total number of samples is N= Calculate the prior probability vector based on global statistical results. ;in The prior probability vector remains constant throughout the training process. Sort the elements in the array in ascending order of value and calculate their corresponding index positions. Reverse sort. Defined as: Reassigning based on the original category order using the sorted reverse index positions, i.e. ,in express The ranking in ascending order. For example, if =[0.01, 0.1, 0.5, 0.3, 0.09] (five defect categories), sorted in ascending order as [0.01, 0.09, 0.1, 0.3, 0.5], corresponding to rankings of [1, 3, 4, 5, 2]. (In original category order) [0.5, 0.09, 0.1, 0.3, 0.01], thus ensuring sparse samples in categories (such as yolk eggs, etc.). =0.01) corresponds to the highest reverse order weight value ( =0.5). To ensure numerical stability, a lower bound protection is introduced for all terms involving logarithmic operations. When or When approaching negative infinity, before calculation... and Add smoothing coefficient ,Right now This is to avoid numerical overflow.
[0029] During training, the multispectral ROI cube is used. As input, it is fed into a multi-expert network and trained under supervised supervision using a pre-defined, specially tuned expert loss function: First Expert Network ( This is used for long-tailed distribution simulation, employing the standard Softmax cross-entropy loss function. Conduct supervised training. The training objective is to maximize classification accuracy across all categories, but due to the long-tail nature of the dataset, its learning focuses on the feature representations of the most numerous common defects and acceptable products (i.e., the head of the long tail). Its mathematical expression is: ; Where n represents the number of input images, This represents the true class label of the j-th input image. express The original Logit value output. This represents the Softmax loss function.
[0030] Second expert network ( For uniform distribution simulation, using... Based on this, a sample prior probability correction term is introduced. loss function Conduct supervised training. For the sample The prior probability of belonging to category k is calculated using the following formula: ,in Let represent the number of times the k-th category appears, and P represent the total number of times all categories appear. By... This correction term is added to the Logit value of the network output to balance the contribution of samples from each class to the model gradient, reducing the excessive dominance of head samples in feature learning. We simulate learning a relatively uniformly distributed feature space. Its mathematical expression is: ; Third expert network ( ) is used for inverse long-tail distribution simulation, employing in Based on this, a reverse prior probability correction term is introduced. loss function Supervised training will be conducted. Among these... for The reverse order of , which means that for sparse weak defect categories, its The value will be higher than that of common defect categories. The loss imposes a greater supervisory weight on the weak defect features of the sparse samples. It is specifically designed to amplify and capture tail defect information that is easily overlooked in traditional methods due to the scarcity of samples (long tail). Its mathematical expression is: ; By training three-expert networks in parallel to simulate long-tailed, uniform, and anti-long-tailed distributions, the imbalance of sample data problem is overcome, ensuring the overall accuracy of the model.
[0031] For each input sample The probability distribution predictions of each multi-expert network at the output layer are inferred using the Softmax function. The predicted value of the probability distribution This is the softmax output after temperature scaling. The temperature scaling parameter is preferably set to 4.0, chosen based on the following principle: on a dataset with 5 defect categories and a long-tailed sample distribution, this temperature value ensures the output probability distribution of the softmax function remains sufficiently "soft," making the probability values of each category relatively uniform, reducing the excessive dominance of a single high-confidence category on the KL divergence, thereby achieving a more balanced knowledge interaction among the three expert networks. This represents the network's soft label for each defect category. The multi-expert networks are then combined in pairs, including ( ), ( ), ( Three pairs. Calculate the KL divergence between the predicted values of any two expert networks. This serves as a soft constraint loss for knowledge transfer. The knowledge distillation divergence loss set... This includes the sum of divergence losses generated by all pairwise combinations (typically involving six two-way divergences), namely: ; Should Constraints are applied to the network's output layer, and the backpropagation algorithm guides the shared feature extraction layer to learn domain-invariant feature representations.
[0032] By calculating the KL divergence between the output probabilities of multiple expert networks, soft knowledge transfer and complementary learning between expert networks are achieved, avoiding the high coupling of traditional serial features.
[0033] A multi-source information fusion model is constructed based on the knowledge distillation divergence loss set; the color and shape features of visible light and the density index features of non-visible light are fused through the multi-source information fusion model to quantitatively calculate the comprehensive quality index of the internal quality of preserved eggs; corresponding to step S3 above, the specific process is as follows: Define the overall loss function The supervision loss of each of the multi-expert networks ( , , ) and the knowledge distillation divergence loss set ( The weighted sum of ). It is the only ensemble optimization objective that the model needs to minimize throughout the entire training process. Its specific calculation formula is: ; Among them, the supervision loss weight ( , , ) is used to balance the contributions of three expert networks with different distribution preferences to classification accuracy; distillation constraint weights ( ) is the weight hyperparameter of the knowledge distillation constraint, used to control The regularization strength for updating shared skeleton parameters.
[0034] The , , The confirmation process mainly revolves around the balanced learning of the long-tail distribution: (Uniform distribution) or (Long-tailed distribution) is set as the baseline value, for example =1.0. Because Using standard cross-entropy loss naturally biases towards top samples. The initial value can be set to around 1.0. If you wish... Provides more stable and more generalizable features. It may be increased appropriately. The part responsible for sparse, weak defects (the long tail) is the most difficult to learn. Therefore, The value is usually set to greater than and The value (for example, ≥1.5) to ensure that the model provides sufficient gradient strength to sparse samples during backpropagation, preventing missed detections of weak features. , , The possible range of parameter values is determined by exhaustively combining all possible parameter sets, and the model performance is evaluated on the validation set. When evaluating performance, it is crucial not to rely solely on overall accuracy but to employ metrics that reflect long-tail characteristics, such as the F1 score of the tail classes, recall value, and mean average precision (mAP). The optimal weights are selected based on maximizing the F1 score of the tail classes while ensuring that overall accuracy does not significantly decrease. The final confirmed... , , Combinations must achieve gradient balance to ensure During training, effective and transferable features can be extracted from weakly defective samples, while It will not dominate the entire feature space due to overlearning of head samples.
[0035] The The validation process mainly revolves around the trade-off between generalization ability and accuracy: The initial value range is usually small (e.g., [0.1, 1.0]), because It is a powerful regularization term; excessively high values can lead to overly smoothed models, sacrificing sharp classification accuracy. Optimization The goal is to find a critical point at which: Large enough to force different expert networks to maintain a high degree of consistency in output distribution, thereby learning domain-invariant feature representations that are independent of environmental noise (such as changes in illumination and eggshell thickness), while The value should not be too large to prevent the Logit value (classification score) from being overly smoothed, thus blurring the distinction between different quality categories. A fixed optimal value should be maintained. , , After combination, for A series of value tests were conducted. Performance metrics were evaluated using external test sets (including unknown lighting and new batches of preserved eggs). The final confirmed [performance metrics] were then determined. The value should be one that maximizes the model's generalization accuracy on the external test set while minimizing the loss of its Top-1 accuracy on the internal training set.
[0036] The parameters of the multi-source information fusion model ( This refers to the set of weights for the deep learning backbone network shared by the three expert networks. During training, by minimizing the weights of this backbone network... To the parameters of the shared skeleton Perform a uniform gradient descent update. In each training iteration, perform the following steps: compute all supervised losses for the current batch of data. , , and knowledge distillation loss Calculated by weighted summation Using the backpropagation algorithm, calculate Shared skeleton parameters gradient .because It is a composite function whose gradient combines the contributions of the supervision term (responsible for accuracy) and the distillation term (responsible for robustness). The Adam optimizer is then used to iteratively update the shared parameters based on this gradient: ;in The learning rate is used. Training continues until a preset number of training epochs is reached or a preset convergence condition is met (e.g., the loss on the validation set no longer significantly decreases over N consecutive iterations). Once training reaches the preset convergence condition, [the process is completed]. The optimized shared skeleton weight set is then locked, and this locked weight set constitutes the final multi-source information fusion model with low coupling characteristics for industrial online inference.
[0037] The overall loss function is defined as a weighted sum of the supervised loss and the distillation loss. During unified gradient descent, the supervised loss ensures classification accuracy, and through systematic optimization of the weight parameters, the final fusion model is made resistant to industrial noise interference.
[0038] The multi-source information fusion model includes an extraction layer, a separation and fusion layer, and a coupling layer. The extraction layer uses the ShuffleNetV2 lightweight deep learning architecture as the main structure for feature extraction, with a channel number of 512. The backbone contains multiple cascaded depthwise separable convolutions. The extraction layer receives , and outputs a deep feature map F. The is a standard input resolution of 224×224 and 4 channels; the deep feature map F undergoes 5 downsamplings (1 / 32 resolution), and the output size is 7×7. The separation and fusion layer logically separates the deep feature map F, divides the channel dimension of F into a visible light feature channel and a non-visible light feature channel , and the and both have 256 channels. Global average pooling operations are performed on each feature channel in and , compressing the spatial dimension of F from 7×7 to 1×1 to obtain a global statistical information vector (dimension 1×1×512), generating a global statistical information vector. The global statistical information vector is then input into a small neural network. The first fully connected layer of the small neural network performs a dimensionality reduction operation, reducing the dimension from 512 to the hidden layer dimension of 32 (based on a dimensionality reduction ratio r = 16, i.e., 512 / 16 = 32), using the ReLU activation function; the second fully connected layer performs a dimension restoration operation, restoring the dimension from 32 to 512, using the Sigmoid activation function, and finally outputs a weight coefficient vector W (dimension 1×1×512). The calculated weight coefficient vector W is separated into and . Channel-wise multiplication operations are performed on the original feature channels and and and to generate weighted and . and are concatenated in the channel dimension to form a fused feature tensor , with a dimension of 7×7×512. Core dimensionality reduction operations are performed on . A 1×1 convolutional kernel is used to perform convolution on , significantly reducing the channel number to the final output dimension D = 256. At the same time, a global pooling operation is performed at the end of the convolution operation. The low-dimensional vector finally output by the dimensionality reduction operation, that is, the comprehensive quality index , has a dimension set to D = 256. The coupling layer only functions during the training phase, responsible for receiving and integrating all loss terms to guide the shared backbone Update.
[0039] As an enhancement to the multi-source information fusion model, robustness constraints are pushed from the network output layer (Softmax probability distribution) to the shared skeleton feature extraction layer, employing an adversarial learning paradigm to explicitly decouple the feature space. The specific implementation is as follows: The model first connects a lightweight domain discriminator to the end of the feature extraction layer of the multi-source information fusion model (shared skeleton). This discriminator is designed to accurately predict which "domain" or "interference domain" (e.g., high-light, low-light, X-ray noise samples) the current input feature comes from. Next, the system defines a dual optimization objective consisting of three parts. The first part is classification loss. The first part uses the overall loss function from the existing scheme to ensure classification accuracy; the second part is the discriminator loss. The first part is used to train the D-discriminator to accurately distinguish the regions from which features originate; the third part is the feature extractor loss. The shared skeleton feature extraction layer is trained by using a gradient inversion layer to deceive the D-discriminator, i.e., minimizing... Through this adversarial constraint mechanism, the deep features F that the shared skeleton is forced to learn will not be able to be used by the D-discriminator to distinguish its original acquisition environment or noise source. This mathematically guarantees that F has domain invariance, that is, the features have been completely decoupled from interference factors such as lighting and equipment noise.
[0040] This explicit adversarial constraint is more targeted than existing soft constraints, and can more effectively eliminate the statistical correlation between features and the acquisition environment, greatly improving the industrial robustness of the model when deployed across batches and production lines.
[0041] Dynamic saliency analysis is performed on visible and non-visible light feature channels by introducing a channel attention mechanism. The model can adaptively assign weights according to defect type, enhancing valuable features and suppressing noise.
[0042] Furthermore, a quality index decoupling constraint is applied to the comprehensive quality index through a quality state recognition model, and structural and appearance quality pattern recognition and classification are performed for the internal quality categories of the preserved egg. Based on the judgment results, the image detection results of the preserved egg are output; corresponding to step S4 above, the specific process is as follows: The quality status identification model is a multi-class fully connected network. The number of input layer nodes in the multi-class fully connected network is strictly set to D=256, which is consistent with the upstream comprehensive quality index. The dimensions are kept consistent; the multi-class fully connected network contains two hidden fully connected layers, configurable with 512 nodes in the first layer and 256 nodes in the second layer. ReLU activation functions are cascaded between the hidden layers to provide sufficient non-linear discrimination capability. Dropout layers (with a dropout rate set to 0.2 to 0.5) are introduced and applied between the hidden layers. The number of nodes in the output layer of the multi-class fully connected network is strictly set to 5, corresponding to the number of defect classification categories for preserved eggs (qualified eggs, gray-white eggs, fried yolk eggs, yolk eggs, and rotten eggs). During the training and optimization of the quality status recognition model, an additional key quality indicator decoupling constraint is applied. .
[0043] During the training phase of the quality status identification model, statistical calculations are performed on all comprehensive quality index vectors in each training batch. Let the comprehensive quality index matrix of the current batch be... , dimension Each row represents a vector of comprehensive quality indicators for a single sample. Calculate the batch-level sample covariance matrix. (Dimension D×D). First, regarding... Centralization by column, i.e. This ensures that the mean of each column (feature dimension) is 0. Then, the covariance matrix is calculated: ,in This is the denominator for the unbiased estimate of the sample covariance. It is a symmetric matrix whose diagonal elements [c, c] represents the variance of the c-th feature dimension, with off-diagonal elements. [c, c'] (c ≠ c') represents the covariance between the c-th and c'-th feature dimensions (reflecting linear correlation). A feature correlation penalty term is defined. For the normalized Frobenius norm: ; It is the Frobenius norm. Defined as... Normalization coefficient This is used to ensure that the magnitude of the penalty term does not diverge with the feature dimension D, such that The gradient remains numerically stable during backpropagation. When the covariance matrix... When the matrix approaches the identity matrix I (i.e., the correlation between all feature dimensions tends to zero and the variance is 1), The features tend towards the minimum value of 0, at which point they are orthogonalized. As an independent loss term, with weights =0.001 is weighted and added to the total loss function of the quality status recognition model: in The standard classification cross-entropy loss is used. The parameters of the quality status identification model are updated using gradient descent, a constraint that guides the network learning to make the comprehensive quality indices statistically tend towards orthogonality and independence. This ensures that the feature dimensions of the input comprehensive quality indices are statistically independent.
[0044] As an enhancement to the quality status identification model, during the training process, the comprehensive quality indicators are... Apply sparsity penalty to the feature dimension After training, the model is structurally pruned based on the importance of the expert network. Specifically, this is implemented as follows: The sparsity penalty use Norm sparsity penalty is applied to the weights of the input layer connections of the quality state recognition model. Mathematically defined ,in It is the hyperparameter of the sparsity penalty strength. By... The total loss function of the weighted summation to the quality status recognition model In the training process, the weights corresponding to feature dimensions that contribute very little to the final judgment are softly driven to zero, thereby marking... The redundant feature dimensions in the model are then addressed. Subsequently, during the post-training convergence analysis phase, the system quantitatively evaluates the impact of each convolutional kernel or feature channel of the multi-source information fusion model (shared skeleton) on the anti-long-tail loss. The gradient sensitivity (contribution) is used to determine its criticality in identifying weak defects (long tails). This quantitative metric is used to generate a ranking list of critical contributions. Finally, using the training results and List-based adaptive model generation (AMP): For high-efficiency initial screening scenarios requiring extremely high speed (e.g., a 50% speed improvement), the strategy is to prioritize structured pruning and remove... The lowest ranking (i.e., for) The channels and kernels with the lowest contribution (e.g., 30%) are removed. These channels are mainly responsible for identifying extremely sparse and weak defects, thus sacrificing a very small amount of accuracy for ultra-high inference speed. For the benchmark full-precision model that requires the highest accuracy, all core channels are retained, and only redundant feature dimensions with strictly zero weights during training are removed.
[0045] Optimal utilization of industrial resources is achieved by imposing sparsity penalties: through a complex knowledge distillation training, multiple accuracy-balanced model versions can be derived, achieving adaptability and flexibility in model deployment.
[0046] During the inference phase, the comprehensive quality index output by the multi-source information fusion model... This serves as the input to the quality status identification model. The quality status identification model performs a complete forward propagation computation from the input layer to the output layer. The hidden layers undergo layer-by-layer transformation through weight matrix multiplication and the ReLU activation function, ultimately generating a raw Logit value vector L at the output layer. L is a 1×C vector, where C=5 (corresponding to the five defect categories of preserved eggs). Each element in the vector... These are the unnormalized confidence scores of the model for class c. The Logit value vector L is then input into the Softmax function. The Softmax function transforms the Logit vector into a posterior probability distribution. The conversion formula is: ; in, This represents the probability that a preserved egg belongs to category c, and T is the temperature parameter of Softmax (usually T=1).
[0047] The It is a probability vector, where each component corresponds to the probability that the preserved egg belongs to each quality category, for example... The quality status identification model directly receives highly abstract comprehensive quality indicators in an end-to-end manner, based on these indicators during the training phase (via...). The discriminant weights learned (and feature decoupling constraints) are used to output the posterior probability distribution. The system finds the posterior probability distribution. The category with the highest probability value is determined as the final quality category of the preserved egg to be tested.
[0048] By imposing feature decoupling constraints, the model is guided to learn more statistically independent feature representations, eliminating discriminative redundancy. The model outputs the posterior probability distribution quickly in an end-to-end manner, ensuring the reliability of real-time response and decision-making.
[0049] This invention establishes an end-to-end detection paradigm based on multi-band optical measurement and depth feature decoupling. By automatically extracting robust features through knowledge distillation and multi-expert networks, the algorithm is freed from its high dependence on fragile serial feature engineering, thus solving the industrial problem of insufficient robustness of traditional methods when dealing with weak features.
[0050] Example 2: This application provides an embodiment of a machine vision-based intelligent quality inspection system for preserved eggs. (See attached document.) Figure 2 The diagram shows the structure of a machine vision-based intelligent quality detection system for preserved eggs. The system includes: a multispectral data acquisition module, an image ROI extraction module, a multi-expert network feature extraction module, a multi-source information fusion and quantification module, and a quality status determination and output module.
[0051] Furthermore, the multispectral data acquisition module includes a visible light acquisition unit and a non-visible light acquisition unit. The visible light acquisition unit is equipped with a high-intensity, constant color temperature LED transmission illumination system, paired with a high-resolution industrial camera module, to acquire light field intensity attenuation data of the preserved egg in the visible light transmission band (R, G, B channels), capturing color and contour features. The non-visible light acquisition unit is equipped with an X-ray imaging device to acquire non-visible light band images characterizing the degree of yolk coagulation, air cell state, and density distribution inside the preserved egg.
[0052] Furthermore, the image ROI extraction module includes a spatial registration unit, a mask segmentation unit, and an ROI cube generation unit. The spatial registration unit uses an affine transformation algorithm to calculate and apply a mapping matrix to perform pixel-level precise alignment of visible and non-visible light images, eliminating acquisition viewpoint bias and generating a multispectral feature cube. The mask segmentation unit uses a pre-trained U-Net semantic segmentation network to perform mask segmentation on the multispectral feature cube, generating a joint mask that excludes background noise. The ROI cube generation unit generates and outputs a standardized multispectral ROI cube by performing pixel-by-pixel multiplication operations on the multispectral feature cube and the joint mask.
[0053] Furthermore, the multi-expert network feature extraction module employs a lightweight deep learning architecture as the shared feature extraction skeleton for all expert networks, comprising a loss function configuration unit and a knowledge distillation computation unit. The loss function configuration unit configures three different expert loss functions (corresponding to corrected losses for long-tail, uniform, and anti-long-tail distributions), used for supervised training guided by the expert networks. The knowledge distillation computation unit calculates the KL divergence between the predicted output probabilities of the expert networks in real time, serving as the soft constraint loss for knowledge transfer.
[0054] Furthermore, the multi-source information fusion and quantization module includes a model building and optimization unit, a feature separation and dynamic weighting unit, and a quantization output unit. The model building and optimization unit defines and minimizes the overall loss function, guides the unified gradient descent update of shared skeleton weights, and ultimately locks the multi-source information fusion model. The feature separation and dynamic weighting unit employs a channel attention mechanism, dynamically and adaptively weighting the two types of features by calculating the weight coefficient vector. The quantization output unit concatenates the weighted features through channels and then performs deep fusion and dimensionality reduction using a 1×1 convolution kernel. Finally, a comprehensive quality index is output via quantization.
[0055] Furthermore, the quality status determination and output module adopts a multi-class fully connected network architecture. The input layer has 256 nodes, including two hidden layers (e.g., 512, 256 nodes), and uses ReLU and Dropout. The output layer has 5 nodes, including a discrimination execution unit and an output control unit. The discrimination execution unit directly receives the comprehensive quality index, and after forward propagation, uses the Softmax function to convert the Logit value into a posterior probability distribution. The output control unit determines the category with the highest probability value in the posterior probability distribution, outputs the final quality inspection result of the preserved egg (category and grade), and sends a control signal to the sorting actuator on the production line.
[0056] Example 3: This application's embodiments address the long-tail problem of subtle defects, such as those found in "yolk eggs," which are difficult to accurately identify due to their scarcity of samples, by employing a core mechanism of multi-expert network knowledge distillation. (See also...) Figure 3 . is a flowchart for a multi-expert network.
[0057] In practice, we first initialize three expert networks using the ShuffleNetV21.0x lightweight skeleton based on a long-tail quality feature dataset containing a small number of "yellow egg" samples. and During training, the system particularly enhanced the third-expert network. loss By setting anti-long tail weights It is 2.0 (significantly higher) = =1.0), ensuring maximum supervision strength is applied to the sparse "young" samples. Subsequently, in each iteration of training, the KL divergence between the output probabilities of all expert networks is calculated, generating a set of knowledge distillation divergence losses. and the distillation constraint weights Increased to 1.5 to enhance The regularization strength. This mechanism forces... The learned stable generalization knowledge is transferred to This effectively compensates for the feature extraction bias caused by insufficient "yolk" samples. Ultimately, by minimizing the integration of high-weight... And strong regularization terms Overall loss function A multi-source information fusion model capable of making highly sensitive and robust judgments on sparse "yolk egg" samples was constructed.
[0058] This embodiment solves the problem of low detection accuracy caused by sparse samples of minor defects (such as yolk eggs) in industrial quality control by constructing and constraining expert networks with different distribution preferences.
[0059] Example 4: This application's embodiments utilize a dynamic weighting mechanism to address the issue of robust detection of internal alkali damage in situations involving fluctuations in ambient light or differences in eggshell color. (See also...) Figure 4 This is a flowchart of a multi-source information fusion model.
[0060] First, a multispectral ROI cube is obtained through multi-band acquisition and preprocessing. After extraction using a shared skeleton, a depth feature map F (7×7×512 pixels) is obtained. Subsequently, dynamic fusion calculations are performed in the multi-source information fusion model: the system logically separates F into visible light feature channels. Non-visible light feature channels (All channels have 256 channels). Utilizing a channel attention mechanism, global average pooling (GAP) is first performed on the two types of features to extract global statistical information. This information is then input into a small MLP (using a dimensionality reduction ratio r=16 and a hidden layer dimension of 32) to calculate the weight coefficient vector W. When detecting internal alkaline damage, this mechanism automatically increases the weights of non-visible light density channels (e.g., ...). The weights are set close to 0.9, while the weights of visible light features (which are susceptible to ambient light interference) are reduced, thereby achieving adaptive enhancement of the alkali damage density features. Finally, the weighted features are deeply fused using a 1×1 convolution kernel to generate a comprehensive quality index with a dimension of D=256, ensuring high robustness of the discrimination decision.
[0061] This embodiment achieves dynamic and intelligent feature fusion by introducing a channel attention mechanism, thus solving the problem of high sensitivity of features to environmental noise (such as light fluctuations) in traditional optical detection.
[0062] Example 5: This application focuses on optimizing the quality status identification model stage, aiming to ensure that the comprehensive quality index on which the final classification decision depends is statistically independent and non-redundant by applying feature decoupling constraints.
[0063] The system first constructs a quality status recognition model: a multi-classification network with D=256 input layer nodes and at least two hidden layers (512 to 256 nodes), using the ReLU activation function. During training and optimization, in addition to the standard Softmax loss, a feature decoupling constraint is applied, defined as a penalty term based on the covariance matrix of the comprehensive quality index vector. This penalty term is weighted and added to the total loss function of the quality status recognition model, forcibly minimizing the off-diagonal elements of the comprehensive quality index through backpropagation. This guides the weight learning of the quality status recognition model, making the 256 feature dimensions statistically tend towards orthogonality and independence. Finally, in the inference phase, the quality status recognition model, based on this optimized weight, efficiently and stably outputs the posterior probability distribution in an end-to-end manner, avoiding the instability and low computational efficiency problems caused by feature redundancy (e.g., the high correlation between shape and color features) in traditional decision-making.
[0064] This embodiment solves the feature redundancy problem in the comprehensive quality index vector by imposing strict mathematical constraints in the final decision-making stage, thereby improving the efficiency and stability of classification and discrimination.
[0065] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A machine vision-based intelligent quality detection method for preserved eggs, characterized in that, include: The light field intensity data of preserved eggs in the visible light transmission band and the internal medium density data in the non-visible light high transmission band are obtained, and spatial registration and image mask segmentation are performed to obtain a multispectral ROI cube containing the structural information of preserved eggs. Defect quality annotation is performed on the multispectral ROI cube to construct a quality feature dataset; a multi-expert network simulating long-tailed, uniform, and anti-long-tailed distributions is trained based on the quality feature dataset; the multi-expert network extracts deep features in the multispectral ROI cube that are independent of environmental noise, calculates the KL divergence between the predicted values output by the multi-expert network, and generates a knowledge distillation divergence loss set. A multi-source information fusion model is constructed based on the knowledge distillation divergence loss set; the color and shape features of visible light and the density index features of non-visible light are fused through the multi-source information fusion model to quantitatively calculate the comprehensive quality index of the internal quality of preserved eggs. The quality status recognition model applies quality index decoupling constraints to the comprehensive quality index and performs structural and appearance quality pattern recognition and classification for the internal quality categories of preserved eggs. Based on the judgment results, the image detection results of preserved eggs are output.
2. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The process of constructing the multispectral ROI image includes: Visible light transmission images of the preserved egg to be tested are acquired using a transmission illumination system. These images capture the egg's color, shape, outline, and internal translucency characteristics. Simultaneously, non-visible light band images are acquired using X-ray fluoroscopy to characterize the yolk's coagulation degree, air cell state, and density distribution within the preserved egg. An affine transformation image registration algorithm is used to precisely align the pixel coordinates of the two types of images, generating a pixel-level aligned multispectral feature cube. The channel set of this feature cube includes visible light R, G, and B features and non-visible light density features. A U-Net-based semantic segmentation network is used to perform mask segmentation on the multispectral feature cube, generating a joint mask. Finally, by applying the joint mask, a multispectral ROI cube containing only the main body region of the preserved egg is separated from the multispectral feature cube.
3. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The training simulates multi-expert networks with long-tailed, uniform, and anti-long-tailed distributions, including: The multispectral ROI cube is input into a multi-expert network with the same skeleton structure, and supervised training is performed using a preset expert loss function; the first expert network simulating a long-tail distribution is trained using the standard Softmax cross-entropy loss function. Supervised learning is implemented to focus on learning the feature representations of common defects with a large number of samples; a second expert network simulating a uniform distribution is trained, using... Based on this, a sample prior probability correction term is introduced. loss function Supervision is performed to balance the contributions of each class of samples to the model; a third expert network simulating an inverse long-tail distribution is trained, using... Based on this, a reverse prior probability correction term is introduced. loss function To supervise, among which for The reverse arrangement is specifically designed to amplify the learning weights of sparse, weak defect features.
4. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The specific process of the knowledge distillation divergence loss set includes: The multi-expert network predicts the probability distribution of each network at the output layer. The multi-expert networks are then paired, i.e., between the first and second expert networks, the first and third expert networks, and the second and third expert networks. The KL divergence between the predicted values of any two expert networks is calculated, and this KL divergence is used as the soft constraint loss for deep mutual learning among the multi-expert networks. This generates a knowledge distillation divergence loss set, which includes the sum of all divergence losses generated by pairwise combinations.
5. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The construction of the multi-source information fusion model is optimized using an overall loss function, specifically including: Define the overall loss function as the supervision loss of each member of the multi-expert network. , , The weighted summation of the knowledge distillation divergence loss set and the overall loss function is used. The weights of the supervision loss are weight hyperparameters used to balance the classification accuracy of the three expert networks on different distributions, and the weights of the knowledge distillation divergence loss set are weight hyperparameters of the knowledge distillation constraints. During training, the parameters of the multi-source information fusion model are updated uniformly by minimizing the overall loss function through gradient descent. In each training iteration, the model simultaneously calculates the gradients from the supervision loss and the knowledge distillation divergence loss set, and iteratively updates the shared parameters based on the knowledge distillation divergence loss set. When the training reaches the preset convergence condition, the shared skeleton weight set obtained by optimizing the overall loss function constitutes the final multi-source information fusion model with low coupling characteristics for online inference.
6. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The calculation process for the comprehensive quality index includes: From the deep feature map output by the feature extraction layer of the multi-source information fusion model, visible light feature channels corresponding to color and shape information and non-visible light feature channels corresponding to density and structure information are separated. A channel attention mechanism is used to weight these feature channels: global average pooling compresses the two-dimensional feature map of each channel into a single value, representing the global statistical information of the feature channel. This global statistical information is input into a small neural network to learn the complex relationships between channels, and a weight coefficient between 0 and 1 is calculated for each spectral channel. The calculated weight coefficient is multiplied by the corresponding feature channel. Finally, a 1x1 convolution is used to deeply fuse the weighted visible light and non-visible light features, generating a comprehensive quality index that integrates the advantages of multi-source optical information.
7. The intelligent quality detection method for preserved eggs based on machine vision according to claim 1, characterized in that, The operation process of the quality status identification model includes: The quality status recognition model comprises three parts: an input layer, two hidden fully connected layers with 512 and 256 nodes respectively, and an output layer. ReLU activation functions are cascaded between the hidden layers, and internal regularization can be achieved through the introduction of a Dropout layer. The final output of the quality status recognition model is the original Logit value corresponding to the number of defect categories in the preserved egg. During training and optimization, an additional quality index decoupling constraint is applied. This constraint is defined as a feature correlation penalty term, calculated based on the covariance matrix between different dimensions of features in the comprehensive quality index. The feature correlation penalty term is weighted and added to the model's total loss function, guiding the quality status recognition model through backpropagation. The quality status recognition model learns by inputting a comprehensive quality index into its input layer and outputting a Logit value. The number of nodes in the input layer is consistent with the dimension of the comprehensive quality index. The Logit value is then input into a Softmax function to convert the Logit into a posterior probability distribution. This posterior probability distribution is a probability vector, where each component corresponds to the probability that the preserved egg belongs to each quality category, and the sum of all components is 1. During the inference phase, the quality status recognition model receives the comprehensive quality index directly in an end-to-end manner and outputs a posterior probability distribution based on its learned discrimination weights. The category with the highest probability value in the posterior probability distribution is determined as the final quality category of the preserved egg, and the quality result is output.
8. A machine vision-based intelligent quality inspection system for preserved eggs, characterized in that, include: Multispectral data acquisition module: used to acquire light field intensity data of preserved eggs in the visible light transmission band and internal medium density data in the non-visible light high-penetration band; Image ROI extraction module: used to perform spatial registration and image mask segmentation on light field intensity attenuation data and internal medium light absorption data to obtain multispectral ROI cubes; Multi-expert network feature extraction module: It is used to receive labeled ROI cubes, construct a quality feature dataset based on the ROI cubes, train a multi-expert network simulating long-tailed, uniform, and anti-long-tailed distributions, extract deep features that are independent of environmental noise, and calculate the KL divergence between the predicted values of the expert network outputs to generate a knowledge distillation divergence loss set. Multi-source information fusion and quantification module: used to receive the knowledge distillation divergence loss set, construct a multi-source information fusion model, fuse the color and shape features of visible light with the density index features of non-visible light, and quantify and calculate the comprehensive quality index of the internal quality of preserved eggs. Quality status determination and output module: It is used to receive comprehensive quality indicators, apply quality indicator decoupling constraints to them through the quality status recognition model, perform structural and appearance quality pattern recognition and classification, and output the image detection results of preserved eggs based on the determination results.