Intelligent egg surface defect detecting and grading system based on machine vision

By using machine vision-based image processing and graph convolutional network analysis, the collaborative risks of egg surface defects are quantified, solving the problem that traditional detection technologies cannot assess structural vulnerability, and achieving accurate assessment of egg structure and reduction of economic losses.

CN121391815AInactive Publication Date: 2026-01-23CP EGG IND (SHANDONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511562827.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-01-23
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional egg testing techniques are insufficient to accurately assess the potential structural fragility of eggshells and cannot effectively prevent long-term breakage caused by the synergistic effect of minor defects, leading to economic losses.

Method used

A machine vision-based system is adopted, which uses image acquisition and preprocessing, defect primitive recognition, spatial topology graph construction and structural integrity inference modules to analyze the spatial distribution and type association of defects on the surface of eggs using graph convolutional networks, quantify the structural integrity index, and realize end-to-end evaluation and classification.

Benefits of technology

It enables accurate assessment and forward-looking prediction of the structural integrity of eggs, reduces economic losses caused by potential structural fragility, and improves the accuracy and intelligence of quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121391815A_ABST
    Figure CN121391815A_ABST
Patent Text Reader

Abstract

The invention discloses an egg surface defect intelligent detection and grading system based on machine vision, and belongs to the technical field of intelligent detection and automatic grading, and the system comprises an image acquisition and preprocessing module which is used for obtaining a panoramic image of an eggshell surface and preprocessing the panoramic image to generate a standardized eggshell image; the defect primitive recognition module is used for receiving the standardized eggshell image, performing semantic segmentation to recognize defect primitives in the image, and extracting the position, the type and the geometric feature of each defect primitive to generate a defect primitive set; the space topology graph construction module is used for receiving the defect primitive set so as to construct an undirected weighted graph, nodes of the undirected weighted graph correspond to defect primitives, and edges and weights among the nodes depend on spatial distances and type association among the defect primitives; according to the method, original discrete defect information is converted into a structured data model capable of systematically describing the interaction relationship, and a foundation is laid for deep analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent detection and automated grading, specifically to an intelligent detection and grading system for egg surface defects based on machine vision. Background Technology

[0002] In automated sorting and quality control of eggs, traditional detection technologies mainly rely on the identification of isolated, macroscopic defects on the eggshell surface, such as obvious cracks or stains. These methods can remove products that are already significantly damaged, but they have limited ability to predict the risk of breakage during future circulation, such as transportation and storage. This situation makes it difficult for manufacturers to accurately assess the potential structural fragility of eggshells and to effectively prevent long-term breakage caused by the synergistic effect of minor defects.

[0003] The aforementioned situation and shortcomings are mainly due to the limitations of detection technology and its analytical dimensions. Traditional methods typically treat each defect as an independent and unrelated event, lacking the ability to comprehensively analyze the spatial distribution, type combination, and synergistic effects among defects. Furthermore, their technical means struggle to accurately quantify the overall structural risk constituted by multiple microscopic defects, such as microcracks and calcium anomalies. As a result, many eggs that pass initial testing still break in subsequent stages due to their potential structural fragility, ultimately leading to economic losses.

[0004] The information disclosed in the background section above is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this invention is to provide an intelligent detection and grading system for egg surface defects based on machine vision, so as to solve the problems mentioned in the background art.

[0006] The technical solution of the present invention includes: The image acquisition and preprocessing module is used to acquire panoramic images of the eggshell surface and preprocess the panoramic images to generate standardized eggshell images. The defect primitive identification module is used to receive standardized eggshell images, perform semantic segmentation to identify defect primitives in the images, and extract the position, type and geometric features of each defect primitive to generate a defect primitive set. The spatial topology graph construction module is used to receive a set of defect primitives to construct an undirected weighted graph. The nodes of the undirected weighted graph correspond to defect primitives, and the edges and weights between nodes depend on the spatial distance and type association between defect primitives. The structural integrity inference module is used to receive an undirected weighted graph and perform graph convolution operations to calculate the structural integrity index. The hierarchical execution module is used to generate a rejection signal or a normal signal based on the comparison result between the structural integrity index and the preset rejection threshold.

[0007] Preferably, the defect primitive identification module is specifically used for: A pre-trained convolutional neural network is used to perform pixel-level semantic segmentation on standardized eggshell images to classify image pixels into preset defect categories; By analyzing connected components, adjacent pixels belonging to the same preset defect category are aggregated into independent defect primitives; For each individual defect primitive, extract the center position coordinates, primitive type, area, and principal axis direction angle to form a defect primitive set.

[0008] Preferably, the spatial topology graph construction module is specifically used for: Convert the type characteristics of the defect primitives into one-hot encoded vectors; The area and principal axis direction angle of the defect primitive are normalized to form a numerical vector; By concatenating the one-hot encoded vector and the numerical vector, an initial feature vector is generated for the corresponding node in the undirected weighted graph.

[0009] Preferably, the spatial topology graph construction module is also used for: Calculate the Euclidean distance between any two defect primitives; If the Euclidean distance is less than the preset neighborhood threshold, then a connection edge is established between the corresponding two nodes; Based on the type query of two defect primitives, a pre-defined collaborative risk matrix is ​​obtained, and the weight of the connecting edges is calculated by combining Euclidean distance.

[0010] Preferably, the collaborative risk matrix is ​​a symmetric matrix, and the coefficient values ​​are pre-set based on statistical analysis of physical fracturing experimental data to quantify the collaborative failure risk of different types of defect combinations.

[0011] Preferably, the structural integrity inference module is specifically used for: Graph neural networks are used to perform multi-layer graph convolution processing on undirected weighted graphs. In the convolutional processing of each layer of the graph, the feature vector of each node is iteratively updated. The update process integrates the features of the node itself in the previous layer, the features of the neighboring nodes, and the weights of the corresponding connecting edges. Obtain the final set of node feature vectors from the output of the last layer of the graph neural network.

[0012] Preferably, the process of iteratively updating the feature vector of each node includes: Perform a first linear transformation on the feature vector of the node itself from the previous layer; Perform a second linear transformation on the feature vectors of the previous layer of each neighboring node of the node, and then perform a weighted summation using the corresponding connection edge weights; The result of the first linear transformation is added to the result of the weighted summation, and then processed by a nonlinear activation function to obtain the updated feature vector of the current layer node.

[0013] Preferably, the structural integrity inference module is also used for: Perform a graph readout operation on the final set of node feature vectors to aggregate the feature information of all nodes, thereby forming a graph-level feature vector. The graph-level feature vectors are input into a fully connected layer for linear transformation to obtain scalar values; The scalar values ​​are mapped using an activation function to generate a structural integrity index.

[0014] Preferably, the hierarchical execution module is specifically used for: When the structural integrity index is less than the rejection threshold, the eggshell structure is determined to be fragile, and a rejection signal is generated to drive the mechanical actuator to reject it. When the structural integrity index is not less than the rejection threshold, the eggshell structure is determined to be intact, and a normal signal is generated to allow passage.

[0015] This invention provides an improved intelligent detection and grading system for egg surface defects based on machine vision, which has the following improvements and advantages compared with the prior art: 1. The core innovation of this technical solution lies in providing a completely new analytical paradigm. The system no longer views defects in isolation, but models all defect primitives on the eggshell surface as a networked graph structure. Through the spatial topology graph construction module, each identified defect primitive is used as a node in the graph, and the connection weight between nodes is quantified based on the spatial distance between defects and the preset type correlation. This design transforms the originally discrete defect information into a structured data model that can systematically describe their interaction relationships, laying the foundation for in-depth analysis. 2. Based on this graph structure, the structural integrity inference module utilizes a graph neural network to perform multi-layer graph convolution operations. This operation can aggregate information from each node in the graph and its multi-order neighborhoods, thereby accurately capturing complex failure modes formed by the combined effects of multiple spatially dispersed micro-defects. The structural integrity index, finally calculated after processing, is a single indicator that can quantitatively evaluate the stability of the eggshell structure from a global perspective and end-to-end. This index transcends the scope of traditional technologies that can only perform simple defect counting, representing the overall structural fragility caused by all defects, thus enabling the prediction of long-term damage that may occur during subsequent circulation. 3. The grading execution module makes decisions based on the structural integrity index and configurable rejection thresholds. This automated decision-making mechanism based on quantitative indices not only improves the intelligence and standardization of the egg grading process but also gives the system greater flexibility to meet different quality requirements. In summary, this technical solution achieves accurate assessment and forward-looking prediction of egg structural integrity by modeling eggshell micro-defects as a graph structure and conducting systematic analysis. This improves the accuracy of quality control from the source of production and effectively reduces economic losses caused by potential structural fragility. Attached Figure Description

[0016] The present invention will be further explained below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the system of the present invention. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.

[0018] Example 1 Please see Figure 1 This invention provides a machine vision-based intelligent detection and grading system for egg surface defects, comprising: The image acquisition and preprocessing module is used to acquire panoramic images of the eggshell surface and preprocess the panoramic images to generate standardized eggshell images. The defect primitive identification module is used to receive standardized eggshell images, perform semantic segmentation to identify defect primitives in the images, and extract the position, type and geometric features of each defect primitive to generate a defect primitive set. The spatial topology graph construction module is used to receive a set of defect primitives to construct an undirected weighted graph. The nodes of the undirected weighted graph correspond to defect primitives, and the edges and weights between nodes depend on the spatial distance and type association between defect primitives. The structural integrity inference module is used to receive an undirected weighted graph and perform graph convolution operations to calculate the structural integrity index. The hierarchical execution module is used to generate a rejection signal or a normal signal based on the comparison result between the structural integrity index and the preset rejection threshold. A machine vision-based intelligent detection and grading system for egg surface defects is provided. The system includes an image acquisition and preprocessing module. This module acquires complete visual information of the eggshell surface and standardizes it, providing consistent data input for subsequent precise analysis. In this embodiment, the module uses a high-speed industrial camera to capture multiple frames of images during the egg's rolling process at high resolution, stitching them together into a complete panoramic image of the eggshell surface. After acquiring the panoramic image, preprocessing is performed, including two steps: illumination compensation and size normalization. Illumination compensation aims to eliminate image brightness differences caused by uneven ambient light during acquisition, while size normalization is used to scale egg images of different sizes to a uniform size standard. Through these processes, a standardized eggshell image is finally generated, providing clear and consistent input for subsequent defect identification. The system also includes a defect primitive identification module; the core task of this module is to accurately identify all independent defect units from standardized eggshell images and extract their key attributes; this module receives standardized eggshell images generated by the preceding module and performs semantic segmentation on the images to identify various defect primitives present in the images; after segmentation, the location, type, and geometric features of each identified defect primitive are extracted; after this information is structured and organized, a defect primitive set is generated, which contains complete descriptive information of all defects on the eggshell surface; The spatial topology graph construction module processes the set of defect primitives. The purpose of this module is to transform discrete defect point information into a network structure that can describe their spatial relationships and synergistic effects. It receives the set of defect primitives and constructs an undirected weighted graph based on it. In this graph, each node is used to represent an independent defect primitive. The connection edges between nodes and their corresponding weights are determined based on the spatial distance and type association between the two defect primitives, thereby quantifying the potential interaction strength between defects. The structural integrity inference module is used to analyze the graph structure. This module aims to calculate an index that can characterize the overall structural stability of the eggshell by analyzing the defect network as a whole. It receives an undirected weighted graph generated by the spatial topology graph construction module and performs graph convolution operation on it. This operation can aggregate the information of each node and its neighborhood in the graph, thereby capturing the synergistic effect between defects. Through this operation, a structural integrity index is finally calculated. The system includes a hierarchical execution module; this module is the decision-making and execution terminal of the system, which physically classifies eggs based on the inference results of the preceding modules; this module calculates a structural integrity index based on the structural integrity inference module and compares it with a preset rejection threshold; the comparison result is used to generate corresponding control signals: if the index is lower than the threshold, a rejection signal is generated; if the index is not lower than the threshold, a normal signal is generated; these signals can then be used to drive subsequent robotic arms or sorting devices. In addition, a special case is handled: when the defect primitive identification module does not identify any defect primitives in the eggshell image, the system will skip the spatial topology map construction module and the structural integrity inference module, directly determine that the egg structure is intact, and the hierarchical execution module will generate a normal signal. Alternatively, a default value, such as 1.0, can be set for the structural integrity index SI in this case. This embodiment models the microscopic defects on the eggshell surface as a graph structure and uses graph neural networks for systematic analysis, overcoming the limitations of traditional technologies that can only identify isolated macroscopic defects. Instead of treating defects as independent events, it starts from the spatial distribution and type correlation between defects to quantitatively assess the potential structural breakage risk caused by the synergistic effect of multiple microscopic flaws. This method can predict long-term breakage that may occur during subsequent circulation, thereby improving the accuracy and foresight of the assessment of egg product structural integrity and effectively reducing economic losses caused by potential structural fragility.

[0019] The defect primitive identification module is specifically used for: A pre-trained convolutional neural network is used to perform pixel-level semantic segmentation on standardized eggshell images to classify image pixels into preset defect categories; By analyzing connected components, adjacent pixels belonging to the same preset defect category are aggregated into independent defect primitives; For each individual defect primitive, extract the center position coordinates, primitive type, area, and principal axis direction angle to form a defect primitive set; The defect primitive identification module is implemented as follows; To achieve high-precision defect recognition, a pre-trained convolutional neural network was used to perform pixel-level semantic segmentation on standardized eggshell images. The pre-trained convolutional neural network refers to a deep learning model based on the U-Net architecture that is pre-trained on a large dataset of eggshell images. Its function is to accurately classify each pixel in the image into a preset defect category. In one implementation, the encoder portion of the U-Net model uses ResNet-34 as the backbone network and is initialized with weights pre-trained on the ImageNet dataset. The training dataset used in this embodiment contains over 50,000 standardized eggshell images with a uniform resolution. The dataset was collected by professionals under controlled lighting conditions for multiple egg varieties, including white-shelled and brown-shelled eggs. Pixel-level annotations were performed on defective areas such as microcracks and calcium aberrations in the images. The model was trained using the Adam optimizer with an initial learning rate of [missing value]. The batch size is 16, and a combination of Dice loss function and cross-entropy loss function is used as the total loss function. The training process iterates for 100 cycles to ensure model convergence. The preset defect categories refer to a set of categories defined based on common eggshell defects, such as normal background, microcracks and calcium abnormalities, which are derived from industry experience and egg quality standards. To ensure the objectivity and reproducibility of the classification, each category has a clear morphological definition; for example, microcracks are defined as linear or arc-shaped defects with an aspect ratio greater than 10:1 and a width less than 0.1 mm; calcification anomalies are defined as spot-like areas with an area between 0.5 and 5 square millimeters that differ from the surrounding normal eggshell area by more than 30 gray levels. These quantitative indicators are used to guide the labeling process of training data. After pixel-level segmentation is completed, the system processes the segmentation results through connected component analysis. Connected component analysis is an image processing algorithm that aggregates all spatially adjacent pixels that belong to the same defect category. Through this analysis, the originally discrete pixels are combined into independent defect primitives. For each identified independent defect primitive, the system extracts a set of structured features. This feature set includes: center position coordinates, used to pinpoint the precise location of the defect on the eggshell surface; primitive type, i.e., the preset category to which the defect belongs; area, which quantifies the size of the defect; and principal axis direction angle, which describes the shape and orientation of the defect. After these features are extracted, they together constitute a complete set of defect primitives for subsequent graph construction analysis. Compared to simply identifying defects, this embodiment achieves a refined and structured description of defects by employing pixel-level semantic segmentation and connected component analysis. It can not only identify the existence of defects, but also accurately extract multi-dimensional features such as their location, type, area, and orientation. This refined feature extraction provides a high-quality data foundation for the subsequent construction of a topology map that reflects the complex relationships between defects, thereby improving the accuracy and reliability of the entire system in assessing structural integrity.

[0020] Example 2 The spatial topology graph construction module is specifically used for: Convert the type characteristics of the defect primitives into one-hot encoded vectors; The area and principal axis direction angle of the defect primitive are normalized to form a numerical vector; By concatenating the one-hot encoded vector and the numerical vector, an initial feature vector is generated for the corresponding node in the undirected weighted graph; The spatial topology graph building module is also used for: Calculate the Euclidean distance between any two defect primitives; If the Euclidean distance is less than the preset neighborhood threshold, then a connection edge is established between the corresponding two nodes; Based on the type query of two defect primitives, a pre-defined collaborative risk matrix is ​​obtained, and the weight of the connecting edge is calculated by combining the Euclidean distance. The collaborative risk matrix is ​​a symmetric matrix, and the coefficient values ​​are pre-set based on statistical analysis of physical fracturing experimental data to quantify the collaborative failure risk of different types of defect combinations. The implementation method of the spatial topology graph construction module has been further refined; When generating initial feature vectors for each node in an undirected weighted graph, a feature fusion strategy is employed. This strategy first converts the type features of defect primitives into one-hot encoded vectors. One-hot encoded vectors are high-dimensional sparse vectors with a dimension equal to the total number of preset defect categories, where only the dimension corresponding to the primitive type is 1, and the remaining dimensions are 0. This transforms discrete category features into numerical forms easily processed by machine learning models. Simultaneously, continuous value features such as the area and principal axis angle of defect primitives are normalized to form numerical vectors. Normalization involves scaling the original numerical values ​​to a range using a linear transformation, eliminating the impact of differences in dimensions and numerical ranges between different features on model training. Finally, the one-hot encoded vectors are concatenated with the normalized numerical vectors to form a complete initial node feature vector. The spatial relationship between any two defect primitives is quantified by calculating the Euclidean distance between their center coordinates; a preset neighborhood threshold is used to control the sparsity of the graph; the preset neighborhood threshold is a hyperparameter determined based on experimental statistical data, and its working principle is to limit the spatial range and establish connections only between defects that are spatially close enough, thereby balancing the computational complexity of the model and its ability to capture long-range correlations. In this embodiment, for dimensions normalized to A panoramic image of an eggshell with pixels, where the preset neighborhood threshold is set to 80 pixels; If the Euclidean distance between two defect primitives is less than this threshold, then a connecting edge is established between the corresponding two nodes in the graph. The weight calculation of the connecting edges incorporates two factors: defect type and spatial distance; the calculation formula is as follows: Edge weight risk function type: distance decay constant:

[0021] ; In this formula, It is a connection node and The weight of the edge; It is a collaborative risk function, the value of which is obtained by querying a preset collaborative risk matrix; the preset collaborative risk matrix is ​​a symmetric matrix, and the coefficient values ​​are preset based on statistical analysis of data obtained from physical fracturing experiments on a large number of eggshell samples. : No. The type of a defective primitive; : No. The type of a defective primitive; : The Euclidean distance between the center points of two defective primitives; This embodiment focuses on assessing structural integrity through the synergistic effect of surface defects. It should be noted that other physical properties such as shell thickness and defect depth are also important factors affecting structural integrity. These factors can be further improved in future research by incorporating multimodal sensing data, such as high-frequency acoustics or terahertz imaging, into the model to enhance the comprehensiveness of the assessment. The experimental method is as follows: Sample screening: Through the image acquisition and defect element identification modules of this system, egg samples containing specific defect combinations, such as two microcracks, or one microcrack and one calcium aberration point, are screened out. Physical Experiment: Selected egg samples were subjected to quasi-static compression along the equator using a materials testing machine at a constant loading rate of 0.5 mm / min. The ultimate load at which the eggs broke was recorded. ; Data analysis: for each combination of defect types Collect ultimate load data from at least 100 samples and calculate their average value. Collaborative risk function The value is defined as inversely proportional to the mean ultimate load, for example, by the formula:

[0022] Where C is a normalization constant with the dimension of force, and its unit is... Similarly, the numerical values ​​are chosen to scale the dimensionless risk value to a reasonable range, such as 1 to 10. : For combinations of defect types The collaborative risk function value; For each combination of defect types The average ultimate load at the time of fracture of at least 100 collected samples; For example, a simplified synergistic risk matrix, where category 1 represents microcracks and category 2 represents calcium anomalies, might look like this:

[0023] This indicates that the synergistic risk of the two microcracks is the highest, while the risk of the two calcium anomalies is the lowest; The working principle is that it quantifies the risk of synergistic damage to the eggshell structure when different types of defects, such as two microcracks or a microcrack and a calcium anomalous point, are combined numerically. It is the Euclidean distance between the center points of two primitives extracted by the defect primitive identification module; It is the spatial distance decay constant, which is used as a model hyperparameter. Its value is determined by optimizing the model performance on the validation set. Its function is to adjust the decay rate of the impact of spatial distance on collaborative risk. In this embodiment, the spatial distance attenuation constant The empirical value was set to 40 pixels, which is about half of the neighborhood threshold, to ensure that the weights at the neighborhood boundaries decay meaningfully. It should be noted that calculating the Euclidean distance on a two-dimensional panoramic image is an approximation of the actual geodesic distance on the three-dimensional curved surface of the eggshell. This approximation has high accuracy and computational efficiency within a local range defined by a neighborhood threshold. This graph construction method possesses two technical advantages: First, by introducing a neighborhood threshold, it effectively controls the connection density of the graph, reducing the complexity of subsequent graph computations. Second, the edge weight calculation not only considers distance but also innovatively incorporates prior knowledge of collaborative risk obtained from physical experimental data. This makes the connection weights in the graph no longer simply the reciprocal of distance, but an effective physical approximation of the collaborative destructive effect between defects. The model uses a Gaussian decay function to simulate the modulating effect of distance on risk. Although a simplification, it effectively captures the core physical intuition that near-field effects are strong and far-field effects are weak. For example, the weight of two defects that are close together but have a low combined risk will be less than the weight of two defects that are slightly farther apart but have a very high combined risk. This greatly improves the graph model's ability to express and predict structural risks in the real world.

[0024] Example 3 The structural integrity inference module is specifically used for: Graph neural networks are used to perform multi-layer graph convolution processing on undirected weighted graphs. In the convolutional processing of each layer of the graph, the feature vector of each node is iteratively updated. The update process integrates the features of the node itself in the previous layer, the features of the neighboring nodes, and the weights of the corresponding connecting edges. Obtain the final set of node feature vectors from the output of the last layer of the graph neural network; The process of iteratively updating the feature vector of each node includes: Perform a first linear transformation on the feature vector of the node itself from the previous layer; Perform a second linear transformation on the feature vectors of the previous layer of each neighboring node of the node, and then perform a weighted summation using the corresponding connection edge weights; The result of the first linear transformation is added to the result of the weighted summation, and then processed by a nonlinear activation function to obtain the updated feature vector of the current layer node. The structural integrity inference module is also used for: Perform a graph readout operation on the final set of node feature vectors to aggregate the feature information of all nodes, thereby forming a graph-level feature vector. The graph-level feature vectors are input into a fully connected layer for linear transformation to obtain scalar values; The scalar values ​​are mapped using an activation function to generate a structural integrity index; The workflow of the structural integrity inference module is described in detail; The core of this module is to use a graph neural network to perform multi-layer graph convolution processing on a constructed undirected weighted graph; the graph neural network is designed to include... Each graph convolutional layer; in each graph convolutional processing layer, the feature vector of each node is iteratively updated; the update process integrates the features learned by the node in the previous layer, the features of all its neighboring nodes, and the weights of the edges connecting these neighboring nodes; after... After layer iteration, the final set of node feature vectors output by the last layer of the graph neural network is obtained. At this point, each node feature contains structural information within its multi-order neighborhood. In one implementation, the graph neural network includes Each graph convolutional layer takes an initial node feature vector as input, which is a 12-dimensional concatenation of one-hot encoded and normalized geometric features. Each graph convolutional layer transforms and maintains the node features in a 32-dimensional hidden space. Therefore, for the first layer of the network, the learnable weight matrix... and The dimension is For layers 2 and 3, the weight matrix... and ( The dimensions of ) are all ; The iterative update process of each node's feature vector includes: performing a first linear transformation on the node's own previous layer feature vector; performing a second linear transformation on the previous layer feature vectors of each of the node's neighboring nodes, and using the corresponding connection edge weights to perform a weighted summation to aggregate neighborhood information; adding the result of the first linear transformation to the result of the weighted summation, and processing it through a non-linear activation function to obtain the updated feature vector of the current layer node; the mathematical form of this update process can be expressed as:

[0025] in, : Feature vector Number of floors Activation function , : Weight matrix, w: edge weight, N(i): set of neighboring nodes of node i; in, It is a node In the The feature vector of the layer, and and These originate from features of the preceding network layers or the initial nodes, respectively. It is a non-linear activation function, such as ReLU; and It is the first The learnable weight matrix in the layer network has dimensions set to linearly transform the input feature vector to the target output dimension. These are the connection edge weights calculated by the spatial topology graph construction module; After obtaining the final set of node feature vectors, a graph readout operation is performed to obtain a single indicator representing the entire graph. The graph readout operation refers to an aggregation operation, such as averaging the final feature vectors of all nodes in the graph, or average pooling. The purpose is to gather all node-level information to form a graph-level feature vector that can characterize the entire eggshell defect pattern. In this embodiment, the graph readout operation specifically adopts global average pooling, that is, the final feature vectors of all nodes in the graph are averaged element-wise in 32 dimensions to obtain a 32-dimensional graph-level feature vector. The feature vector at the graph level is input into a fully connected layer for linear transformation to obtain a scalar value; This fully connected layer contains 32 input neurons and 1 output neuron; This scalar value is mapped using the Sigmoid activation function; the Sigmoid activation function maps any real number to... Within the range; the output value is the final structural integrity index. A value close to 1 indicates a structurally sound structure with low risk, while a value close to 0 indicates a structurally fragile structure with high risk. This embodiment employs a multi-layer graph convolutional network to achieve information transfer and aggregation from local to global. Each convolutional layer expands the spatial range of information aggregation for each node, enabling the final node features to contain information about its distant neighbors. This effectively captures complex failure modes formed by the combined effects of multiple spatially dispersed defects. Furthermore, by using graph readout operations to aggregate node information into a single structural integrity index, an end-to-end, quantitative assessment of the entire eggshell structure is achieved. The results are intuitive and easy to use as a basis for subsequent automated grading.

[0026] Example 4 The hierarchical execution module is specifically used for: When the structural integrity index is less than the rejection threshold, the eggshell structure is determined to be fragile, and a rejection signal is generated to drive the mechanical actuator to reject it. When the structural integrity index is not less than the rejection threshold, the eggshell structure is determined to be intact, and a normal signal is generated to allow passage. The decision logic of the hierarchical execution module is as follows; The core functionality of this module is based on a user-configurable rejection threshold. Make decisions; eliminate thresholds These are business logic parameters, and their values ​​can be adjusted based on the current production batch's tolerance for quality risks; for example, for batches requiring extremely high quality, the tolerance can be adjusted accordingly. Set it too high; When the structural integrity index of an egg Once calculated, the module immediately compares it with... Compare; if the comparison result is If the system determines that the eggshell has a fragile microstructure and a high potential risk of breakage, the system will generate a rejection signal. This signal is designed to drive a mechanical actuator, such as a pneumatic pusher or a sorting robot arm, to remove the high-risk egg from the main production line. Conversely, when the structural integrity index Not less than the rejection threshold If the eggshell structure is intact and can withstand the subsequent normal flow pressure, the system will generate a regular signal to instruct the sorting system to release the egg so that it remains on the production line. This grading execution logic gives the system's decision-making flexibility and adaptability at the business level; by adjusting a single rejection threshold, production managers can easily balance production efficiency and product quality risks to adapt to different sales channels or customers' different requirements for product quality; this automated decision-making mechanism based on quantitative indices and configurable thresholds replaces manual sampling or fixed standard testing, greatly improving the intelligence, standardization and flexibility of the egg grading process. To ensure the robustness of the model, stress testing was conducted on the system during the validation phase. The tests covered a variety of extreme cases, including an ideal sample with no defects (in which case the structural integrity index is 1.0 by default), a sample containing only a single defect, and a sample with defects highly clustered in local areas. The results show that the model's output under these boundary conditions conforms to physical common sense and production expectations, demonstrating its stability and reliability in practical applications.

[0027] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A machine vision-based intelligent detection and grading system for egg surface defects, characterized in that, include: The image acquisition and preprocessing module is used to acquire panoramic images of the eggshell surface and preprocess the panoramic images to generate standardized eggshell images. The defect primitive identification module is used to receive standardized eggshell images, perform semantic segmentation to identify defect primitives in the images, and extract the position, type and geometric features of each defect primitive to generate a defect primitive set. The spatial topology graph construction module is used to receive a set of defect primitives to construct an undirected weighted graph. The nodes of the undirected weighted graph correspond to defect primitives, and the edges and weights between nodes depend on the spatial distance and type association between defect primitives. The structural integrity inference module is used to receive an undirected weighted graph and perform graph convolution operations to calculate the structural integrity index. The hierarchical execution module is used to generate a rejection signal or a normal signal based on the comparison result between the structural integrity index and the preset rejection threshold.

2. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 1, characterized in that, The defect primitive identification module is specifically used for: A pre-trained convolutional neural network is used to perform pixel-level semantic segmentation on standardized eggshell images to classify image pixels into preset defect categories; By analyzing connected components, adjacent pixels belonging to the same preset defect category are aggregated into independent defect primitives; For each individual defect primitive, extract the center position coordinates, primitive type, area, and principal axis direction angle to form a defect primitive set.

3. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 2, characterized in that, The spatial topology graph construction module is specifically used for: Convert the type characteristics of the defect primitives into one-hot encoded vectors; The area and principal axis direction angle of the defect primitive are normalized to form a numerical vector; By concatenating the one-hot encoded vector and the numerical vector, an initial feature vector is generated for the corresponding node in the undirected weighted graph.

4. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 3, characterized in that, The spatial topology graph building module is also used for: Calculate the Euclidean distance between any two defect primitives; If the Euclidean distance is less than the preset neighborhood threshold, then a connection edge is established between the corresponding two nodes; Based on the type query of two defect primitives, a pre-defined collaborative risk matrix is ​​obtained, and the weight of the connecting edges is calculated by combining Euclidean distance.

5. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 4, characterized in that, The collaborative risk matrix is ​​a symmetric matrix, and the coefficient values ​​are pre-set based on statistical analysis of physical fracturing experimental data to quantify the collaborative failure risk of different types of defect combinations.

6. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 4, characterized in that, The structural integrity inference module is specifically used for: Graph neural networks are used to perform multi-layer graph convolution processing on undirected weighted graphs. In the convolutional processing of each layer of the graph, the feature vector of each node is iteratively updated. The update process integrates the features of the node itself in the previous layer, the features of the neighboring nodes, and the weights of the corresponding connecting edges. Obtain the final set of node feature vectors from the output of the last layer of the graph neural network.

7. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 6, characterized in that, The process of iteratively updating the feature vector of each node includes: Perform a first linear transformation on the feature vector of the node itself from the previous layer; Perform a second linear transformation on the feature vectors of the previous layer of each neighboring node of the node, and then perform a weighted summation using the corresponding connection edge weights; The result of the first linear transformation is added to the result of the weighted summation, and then processed by a nonlinear activation function to obtain the updated feature vector of the current layer node.

8. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 6, characterized in that, The structural integrity inference module is also used for: Perform a graph readout operation on the final set of node feature vectors to aggregate the feature information of all nodes, thereby forming a graph-level feature vector. The graph-level feature vectors are input into a fully connected layer for linear transformation to obtain scalar values; The scalar values ​​are mapped using an activation function to generate a structural integrity index.

9. The intelligent detection and grading system for egg surface defects based on machine vision according to claim 1, characterized in that, The hierarchical execution module is specifically used for: When the structural integrity index is less than the rejection threshold, the eggshell structure is determined to be fragile, and a rejection signal is generated to drive the mechanical actuator to reject it. When the structural integrity index is not less than the rejection threshold, the eggshell structure is determined to be intact, and a normal signal is generated to allow passage.