A method for visually identifying a sealing defect of a food-grade packaging container

By combining phase consistency algorithm and graph neural network, the problem of insufficient low-contrast and weak feature extraction of sealing defects in food packaging containers is solved, and high-precision identification and localization of sealing defects is achieved.

CN122493450APending Publication Date: 2026-07-31浙江群鹿新材料股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
浙江群鹿新材料股份有限公司
Filing Date
2026-04-28
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing visual inspection methods struggle to effectively extract weak, low-contrast features when dealing with sealing defects in food packaging containers, resulting in a high rate of missed detections and failing to meet the high standards of modern food safety testing.

Method used

The initial sealing image is processed using a phase consistency algorithm. Combined with deformable hole convolution and graph neural network, spatial frequency features are accurately extracted and defect locations are located through sealing trajectory mask and feature topology map.

Benefits of technology

It significantly improves the identification accuracy of weak sealing defects, reduces the missed detection rate, enhances the ability to resist background noise, and realizes the accurate capture and location of fine sealing defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122493450A_ABST
    Figure CN122493450A_ABST
Patent Text Reader

Abstract

This invention discloses a visual recognition method for sealing defects in food-grade packaging containers, belonging to the field of defect visual recognition technology. Specifically, it includes: First, acquiring the original image of the container, extracting pixel coordinates to construct a sealing trajectory mask, and cropping the initial sealing image; Second, processing the image using a phase consistency algorithm to extract pixel phase offset components to generate a local morphological feature tensor; Next, calculating the spatial sampling offset using mask constraints, and accurately extracting spatial frequency features through deformable dilated convolution; Subsequently, mapping this frequency feature to topological nodes, and constructing a feature topology graph by combining spatial physical distance and feature similarity to aggregate node features; Then, performing global pooling on the local morphological tensor to generate a context vector, driving the hypernetwork to dynamically generate the weights of the graph neural network, thereby updating the nodes and extracting abnormal nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect visual recognition technology, and more specifically to a method for visually recognizing sealing defects in food-grade packaging containers. Background Technology

[0002] With the increasing automation in the food industry, the sealing quality of food-grade packaging containers directly affects food safety and shelf life. To ensure the quality of products leaving the factory, non-destructive testing technologies based on machine vision and image processing have been widely applied to the sealing status monitoring stage of packaging production lines. Existing visual recognition methods typically utilize industrial cameras to acquire real-time images of the packaging containers to be inspected, and then use computer vision algorithms to perform feature analysis and status determination of the sealing area. In practice, conventional technical solutions often employ image segmentation algorithms to extract the contour and grayscale information of the sealing area, or introduce deep learning technology to construct multi-layer convolutional neural networks to perform forward propagation and feature map dimensionality reduction calculations on the original image, thereby extracting a generalizable spatial feature representation to achieve automated classification and visual recognition of the sealing status of packaging containers.

[0003] However, existing visual inspection methods generally suffer from a severe deficiency in extracting low-contrast, weak features when dealing with sealing defects in food packaging containers. These defects often manifest as microscale airtight channels, minute wrinkles, or slight uneven compression. The differences in pixel grayscale and texture between these defects and the normal, intact sealing area are extremely subtle, representing typical low-contrast, weak features. When conventional image segmentation algorithms or traditional deep learning models are used for feature map dimensionality reduction, these crucial, subtle spatial details are easily filtered out as redundant noise. Furthermore, changes in lighting and background noise from conveyor belts in actual production environments further mask these minute morphological variations, preventing existing models from establishing high-precision local feature representations in the feature space. Ultimately, this results in a very high false negative rate for minute sealing defects, failing to meet the high standards of modern food safety inspection. Summary of the Invention

[0004] The purpose of this invention is to provide a visual identification method for sealing defects in food-grade packaging containers, thereby solving the problems in the background art:

[0005] The objective of this invention can be achieved through the following technical solutions:

[0006] A visual identification method for sealing defects in food-grade packaging containers includes the following steps:

[0007] S1. Acquire the original image of the packaging container, extract the pixel spatial coordinates in the image to construct a sealing trajectory mask, and capture the initial sealing image;

[0008] S2. The initial sealed image is processed using the phase consistency algorithm to extract the phase offset components between pixels and generate a local morphological feature tensor.

[0009] S3. Input the local morphological feature tensor into the feature extractor, calculate the spatial sampling offset using the sealed trajectory mask, and extract the spatial frequency features through deformable dilated convolution.

[0010] S4. Map spatial frequency features to topological nodes, calculate the adjacency matrix based on the spatial physical distance between nodes and the similarity of feature vectors, construct a feature topology graph, and aggregate the spatial frequency features of nodes.

[0011] S5. Perform global pooling on the local morphological feature tensor to generate a global context mapping vector, construct a hypernetwork to dynamically generate the weight parameters of the graph neural network based on the global context mapping vector, and use the graph neural network to update node features and extract abnormal nodes.

[0012] S6. Inversely project the abnormal nodes onto the pixel space coordinates of the initial sealing image to locate the spatial position of the visually recognized defects and output the defect distribution mask.

[0013] As a further aspect of the present invention: in step S1, the process of acquiring the original image of the packaging container, extracting the pixel spatial coordinates within the image to construct a sealing trajectory mask, and cropping the initial sealing image is as follows:

[0014] A photoelectric device is used to trigger a camera to capture the original image of the packaging container to be inspected, and the original image is converted into a single-channel grayscale image.

[0015] The edge contour of the packaging container is extracted based on the pixel gradient distribution of the single-channel grayscale image, and the pixel space coordinates of the corresponding pixels of the edge contour are read to construct a sealing trajectory mask.

[0016] The sealing trajectory mask is superimposed on the original image, the original image pixels within the coverage area of ​​the sealing trajectory mask are retained and the background pixels are removed, and the initial sealing image is extracted.

[0017] As a further aspect of the present invention: in step S2, the process of using a phase consistency algorithm to process the initial sealed image, extracting the phase offset components between pixels, and generating a local morphological feature tensor is as follows:

[0018] A multi-scale and multi-directional frequency domain convolution operation is performed on the initial sealing image using a logarithmic Gaussian filter to obtain the frequency domain response matrix. Based on the frequency domain response matrix, the local amplitude matrix and local phase matrix of the initial sealing image are extracted.

[0019] The weighted average phase of the local phase matrix is ​​calculated using the local amplitude matrix as a weighting parameter. The difference between the local phase matrix and the weighted average phase is solved to extract the phase offset components between pixels.

[0020] A phase consistency function is constructed based on the phase offset component. The phase consistency function is normalized using the local amplitude matrix to generate phase response maps in various directions. The phase response maps are then stitched together according to the directional dimension to generate a local morphological feature tensor.

[0021] As a further aspect of the present invention: In step S3, the process of inputting the local morphological feature tensor into the feature extractor, calculating the spatial sampling offset using the sealed trajectory mask, and extracting spatial frequency features through deformable dilated convolution is as follows:

[0022] The local morphological feature tensor and the sealing trajectory mask are concatenated along the channel dimension and input into a feature extractor containing standard convolutional kernels to generate an initial position offset map.

[0023] The Hadamard product operation is performed using the sealed trajectory mask and the initial position offset map to eliminate offset values ​​outside the mask coverage area and generate spatial sampling offset.

[0024] Construct a regular spatial sampling grid corresponding to the dilated convolution, and superimpose the spatial sampling offset point by point onto the regular spatial sampling grid to generate a deformation sampling grid.

[0025] Pixel features are resampled in the local morphological feature tensor according to the coordinates recorded by the deformation sampling grid, and spatial frequency features are output by performing inner product operation through convolution kernel.

[0026] As a further aspect of the present invention: In step S4, the process of mapping spatial frequency features to topological nodes, calculating adjacency matrices based on spatial physical distance and feature vector similarity between nodes, constructing a feature topological graph, and aggregating the spatial frequency features of nodes is as follows:

[0027] Extract the feature vector of each pixel position in the spatial frequency features and define it as a topological node. Read the pixel spatial coordinates corresponding to the feature vector and assign them to the corresponding topological node.

[0028] Calculate the Euclidean distance between the pixel spatial coordinates of any two topological nodes as the spatial physical distance, and solve for the inner product of the feature vectors of the two topological nodes as the feature vector similarity.

[0029] The connection weight is obtained by multiplying the reciprocal of the spatial physical distance plus the smoothing bias constant with the feature vector similarity. An adjacency matrix is ​​constructed according to the connection weights between all topological nodes to generate a feature topology graph.

[0030] The feature vectors of adjacent topological nodes are extracted along the connecting edges of the feature topology graph. The adjacent feature vectors are weighted and summed using the connection weights of the adjacency matrix to aggregate the spatial frequency features of the nodes.

[0031] As a further aspect of the present invention: in step S5, the process of using a graph neural network to update node features and extract abnormal nodes is as follows:

[0032] Global pooling is performed along the spatial dimension of the local morphological feature tensor to obtain the pixel mean, and the pixel mean values ​​of each channel are concatenated to generate a global context mapping vector.

[0033] The global context mapping vector is input into the supernetwork composed of the feedforward neural network to perform matrix projection calculation, and the weight parameters of the graph neural network are dynamically generated.

[0034] The processing layer of the graph neural network is configured using weight parameters, and the updated node feature vector is generated by aggregating the features of the topological nodes based on the adjacency matrix of the feature topological graph.

[0035] Calculate the anomaly prediction value of the updated node feature vector of each topology node, and select topology nodes whose anomaly prediction value is greater than the anomaly judgment threshold as anomaly nodes.

[0036] As a further aspect of the present invention: the specific method for performing matrix projection calculation on the supernetwork composed of the global context mapping vector input to the feedforward neural network to dynamically generate the weight parameters of the graph neural network is as follows:

[0037] The global context mapping vector is input into the nonlinear mapping layer inside the supernetwork, and linear transformation and bias summation are performed to extract the high-dimensional feature representation of global features in the latent space and construct the feature latent vector used to generate weights.

[0038] A matrix projection operator is established for the parameter space of graph neural networks. The latent feature vectors are multiplied by the projection matrix to map the latent space features to the preset weight parameter space dimension, thereby realizing the projection transformation of context information to the weight distribution.

[0039] The feature sequence output by the projection operation is obtained and the shape reshaping operation is performed. The dimensions are arranged according to the size requirements of the graph neural network weight matrix, and the feature sequence is transformed into the corresponding weight parameter matrix, thus completing the dynamic generation of weight parameters.

[0040] As a further aspect of the present invention: in step S6, the process of inversely projecting the abnormal node onto the pixel space coordinates of the initial sealing image, locating the spatial position of the visually recognized defect, and outputting the defect distribution mask is as follows:

[0041] Read the pixel space coordinates corresponding to the abnormal node, set the read pixel space coordinates as the reverse mapping anchor point, and summarize all the reverse mapping anchor points to generate an anchor point set;

[0042] Create a blank pixel matrix with the same pixel dimensions as the initial sealed image, and perform inverse projection in the blank pixel matrix according to the inverse mapping anchors inside the anchor set;

[0043] Morphological dilation and closing operations are performed on the coordinates of the abnormal nodes in the reverse projection to connect adjacent abnormal nodes and close the region, thereby locating the spatial position of the defect.

[0044] Pixels within the defect spatial location range in the blank pixel matrix are assigned anomaly identification values, while pixels outside this range are assigned background values, resulting in a defect distribution mask.

[0045] The beneficial effects of this invention are:

[0046] This invention effectively solves the problem of insufficient extraction of weak sealing defects with low contrast, significantly improving the accuracy of weak feature recognition. By processing the initial sealing image using a phase consistency algorithm, it can accurately extract the phase shift components between pixels without relying on pixel grayscale intensity changes, generating a local morphological feature tensor containing microscale defect details. This avoids misclassifying weak features such as microscale airtightness channels and subtle wrinkles as redundant noise. Combined with deformable dilated convolution, and relying on the spatial sampling offset calculated using the sealing trajectory mask, the receptive field of the convolution can be flexibly adjusted. Spatial frequency features are extracted without losing details, addressing the pain point of weak spatial details being filtered out during dimensionality reduction in conventional algorithms. This enables accurate capture of slight compression unevenness defects with minimal differences in pixel grayscale and texture.

[0047] This invention significantly enhances resistance to background noise, reduces the missed detection rate of minute sealing defects, and improves positioning accuracy. By constructing a sealing trajectory mask to capture the initial sealing image, background noise from the production environment can be effectively isolated, reducing the noise's obscuring of weak defect features. A feature topology graph is constructed, and features are aggregated based on node spatial distance and feature similarity to strengthen local feature representation, helping the model distinguish between defects and noise interference. Simultaneously, a hypernetwork is used to dynamically generate graph neural network weights, combined with global context mapping vectors to optimize abnormal node extraction. Then, inverse projection is used to achieve precise defect location, outputting a clear defect distribution mask. This not only solves the problem of traditional models being unable to establish high-precision local feature representation but also significantly reduces the missed detection rate of minute sealing defects. Attached Figure Description

[0048] The invention will now be further described with reference to the accompanying drawings.

[0049] Figure 1This is a flowchart illustrating a visual identification method for sealing defects in food-grade packaging containers according to the present invention. Detailed Implementation

[0050] 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.

[0051] Please see Figure 1 As shown, this invention provides a visual identification method for sealing defects in food-grade packaging containers, comprising the following steps:

[0052] S1. Acquire the original image of the packaging container, extract the pixel spatial coordinates in the image to construct a sealing trajectory mask, and capture the initial sealing image;

[0053] S2. The initial sealed image is processed using the phase consistency algorithm to extract the phase offset components between pixels and generate a local morphological feature tensor.

[0054] S3. Input the local morphological feature tensor into the feature extractor, calculate the spatial sampling offset using the sealed trajectory mask, and extract the spatial frequency features through deformable dilated convolution.

[0055] S4. Map spatial frequency features to topological nodes, calculate the adjacency matrix based on the spatial physical distance between nodes and the similarity of feature vectors, construct a feature topology graph, and aggregate the spatial frequency features of nodes.

[0056] S5. Perform global pooling on the local morphological feature tensor to generate a global context mapping vector, construct a hypernetwork to dynamically generate the weight parameters of the graph neural network based on the global context mapping vector, and use the graph neural network to update node features and extract abnormal nodes.

[0057] S6. Inversely project the abnormal nodes onto the pixel space coordinates of the initial sealing image to locate the spatial position of the visually recognized defects and output the defect distribution mask.

[0058] In one embodiment of the present invention, the process of acquiring the original image of the packaging container, extracting the pixel spatial coordinates in the image to construct a sealing trajectory mask, and cropping the initial sealing image in step S1 is as follows:

[0059] In the specific implementation process, when acquiring the original image of the packaging container, the packaging container to be inspected is first placed on an automated conveyor belt and moved at a constant speed. When the packaging container passes through a specific inspection station, the photoelectric devices arranged on both sides of the conveyor belt will emit infrared detection beams. Once the physical body of the packaging container blocks the detection beam, the photoelectric device can capture the position signal and immediately generate a high-level trigger pulse. This trigger pulse is directly transmitted to the industrial camera, which completes the exposure and shooting within microseconds, thereby acquiring a high-definition original image containing the complete physical morphological features of the packaging container. In order to reduce the computational dimension in the image processing process and eliminate the interference caused by changes in illumination and color, a weighted average calculation method is used to perform color dimensionality reduction processing on the acquired high-definition original image. By assigning different weight coefficients to the three color channels of red, green and blue, the original image containing multiple color channel matrices is mapped into a single-channel grayscale image containing only single brightness information. This conversion process can greatly preserve the brightness and dark details and texture features in the original image, so that all two-dimensional spatial pixels are completely expressed by a single grayscale value and arranged to form a single-channel grayscale image.

[0060] After obtaining the single-channel grayscale image, spatial differential operators are used to calculate the pixel gradient distribution of each pixel in the horizontal and vertical directions. By setting specific high and low thresholds, the calculated pixel gradient magnitudes are rigorously filtered, retaining areas with drastic jumps in pixel grayscale values ​​as candidate edge points. Simultaneously, background noise from smooth areas with small gradient magnitudes is removed. Then, edge connection and non-maximum suppression calculations are performed on the retained candidate edge points to find local maxima along the gradient direction, thereby accurately locating the true physical edge contour of the packaging container. Since the sealed area of ​​the packaging container is usually located within a fixed distance range of the edge contour, it is necessary to iterate through... For each valid pixel on the edge contour, read the corresponding horizontal and vertical coordinates of these pixels in the two-dimensional image matrix, that is, extract the corresponding pixel space coordinates. Then, using these precise pixel space coordinates as the reference center, perform morphological dilation expansion operations of a specified width inward and outward. Map all the expanded pixel coordinate sets completely into a blank two-dimensional matrix with the same size as the original grayscale image. Set the grayscale values ​​of the pixels in this coordinate set to the highest valid values ​​to be retained, while set the other blank areas of the two-dimensional matrix to the lowest values ​​to be discarded. In this way, a sealing trajectory mask that can accurately cover the entire sealing feature area is constructed.

[0061] After successfully constructing a high-quality sealing trajectory mask, it needs to be precisely registered and overlaid with the initially acquired original image as the core spatial filtering template. At this point, coordinate alignment must be used to ensure that the 2D matrix dimensions of the sealing trajectory mask are completely consistent with those of the original image. Then, with perfect spatial pixel alignment, pixel-by-pixel logical operations or Hadamard product calculations are performed on the two matrices. Since the pixel values ​​of the sealing trajectory mask are logical true values ​​or specific non-zero constants within the sealing region to be detected, and logical false values ​​or absolute zero values ​​in the background region where no detection is required, this pixel-level product filtering operation can completely and losslessly preserve the coverage area of ​​the sealing trajectory mask. The original image pixel information within the mask is used to force the feature values ​​of the conveyor belt background and other irrelevant light and shadow interference pixels outside the mask coverage area to be zero, thereby completely removing redundant and useless complex background pixels from the original image data. In order to further reduce the consumption of computing resources and significantly improve the response speed of the operation, a minimum bounding rectangle with constraint properties is generated based on the outer boundary of the effective pixel area retained after the operation. According to the spatial coordinate range of the rectangle, the core area containing complete sealing features is directly cropped from the overall image matrix, and finally an initial sealing image containing only key sealing status data is generated that can be directly used for defect feature extraction and analysis.

[0062] In one embodiment of the present invention, step S2, which involves processing the initial sealed image using a phase consistency algorithm, extracting the phase offset components between pixels, and generating a local morphological feature tensor, is as follows:

[0063] After acquiring the initial sealing image, it needs to be transformed from the spatial domain to the frequency domain for depth feature extraction. At this point, a logarithmic Gaussian filter is used to perform multi-scale and multi-directional frequency domain convolution operations on the initial sealing image. Because the logarithmic Gaussian filter has Gaussian transfer function characteristics at the logarithmic frequency scale, it can effectively overcome the DC component interference problem generated by traditional filters when processing images. In specific implementation, multiple different center frequency scales and multiple different rotation direction angles are first preset to construct a set of logarithmic Gaussian filter banks covering a wide frequency range. The initial sealing image is then mapped to the frequency domain space through a fast Fourier transform. The algorithm performs element-wise complex multiplication with the image in the frequency domain using pre-constructed logarithmic Gaussian filters at various scales and directions. This completes multi-scale and multi-directional frequency domain convolution operations and obtains the corresponding frequency domain response matrix. Then, it performs a two-dimensional inverse fast Fourier transform on the frequency domain response matrix to remap it back to the spatial domain. Based on this, it extracts the complex response results containing real and imaginary parts. By calculating the modulus of the complex response results, it extracts the local amplitude matrix of the initial sealing image at various scales and directions. At the same time, it extracts the local phase matrix corresponding to the initial sealing image by calculating the arctangent value of the complex response results.

[0064] To accurately capture the changing patterns of image edges and textures, it is necessary to further calculate the deviation of phase information. At this point, the previously extracted local amplitude matrix is ​​used as a key weighting parameter to calculate the weighted average phase of the local phase matrix. At different frequency scales, the structural features of the image exhibit different degrees of significance. The magnitude of the local amplitude matrix directly reflects the energy intensity of the local features. Therefore, the local amplitude value is used as a weighting factor and multiplied and added with the corresponding local phase value. The sum of the weighted phases at all scales is divided by the sum of the amplitude weights at all scales, thereby calculating the weighted average phase of each pixel in a specific direction. This weighted average phase represents the overall phase distribution trend of the local structure of the image at multiple scales. Subsequently, it is necessary to calculate the difference between the local phase matrix at each specific scale and the weighted average phase just obtained. By performing subtraction operations on each pixel, the value reflecting the degree of local phase dispersion is obtained. This difference result successfully extracts the phase offset component between pixels. This phase offset component can extremely sensitively reflect the physical deformation caused by tiny defects in the sealed image, providing highly reliable underlying data support for accurately identifying poor sealing or wrinkling defects at the edges of packaging containers.

[0065] After extracting the highly sensitive phase shift component, it needs to be nonlinearly mapped to highlight structural consistency. Based on the obtained phase shift component, a phase consistency function containing a cosine function is constructed. The design principle of this function is that the closer the phase shift component is to zero, the closer its output value is to the maximum value. This can strongly penalize the phase divergence region and highlight the real edge region with high phase consistency. In order to ensure the stability and scale invariance of the feature representation, the constructed phase consistency function must be strictly normalized using the previously extracted local amplitude matrix. Specifically, the phase consistency function values ​​at all frequency scales are accumulated and divided by the sum of the local amplitude values ​​at all scales and a small bias constant to prevent the denominator from being zero. After this normalization process, independent and stable phase response maps can be generated in each preset rotation direction. These phase response maps effectively filter out the shadow interference caused by the change in illumination. Finally, the phase response maps in all directions are extracted and stitched layer by layer in the depth channel according to the spatial dimensional order. Through this multi-dimensional arrangement and combination, a local morphological feature tensor containing rich structural information is finally generated.

[0066] In one embodiment of the present invention, step S3, which involves inputting the local morphological feature tensor into the feature extractor, calculating the spatial sampling offset using the sealed trajectory mask, and extracting spatial frequency features through deformable dilated convolution, is as follows:

[0067] After generating the local morphological feature tensor, it is necessary to further extract its deep spatial features to accurately locate the sealing defect. Since the sealing area of ​​the packaging container is not a regular straight line but a complex structure with a certain curvature and irregular edges, traditional standard convolution often introduces a large amount of irrelevant background interference when extracting such non-rigid features due to the fixed receptive field. Therefore, the previously constructed sealing trajectory mask is first introduced as key spatial prior information into the feature extraction stage. In specific implementation, the data matrices of the local morphological feature tensor and the sealing trajectory mask are extracted. The local morphological feature tensor and the single-channel sealing trajectory mask are seamlessly stitched and integrated along the depth dimension of the feature channels. This stitching... The operation ensures that the synthesized high-dimensional tensor contains rich local morphological and textural features while clearly defining the effective physical working area that needs to be focused on. Then, the stitched high-dimensional tensor is input into a feature extractor with pre-set standard convolutional kernels for linear transformation and mapping. The standard convolutional kernels inside the feature extractor perform sliding window scanning operations on this high-dimensional tensor. By learning the inherent topological correlation of the data, the spatial deformation trend of each pixel in the horizontal and vertical directions is calculated, and then an initial position offset map containing two-dimensional coordinate displacement vectors is generated. This map records the theoretical magnitude of the offset that each pixel should undergo in order to better capture defect features.

[0068] Because the feature extractor lacks awareness of physical constraints on absolute boundaries when performing global mapping calculations, the generated initial position offset map inevitably produces some non-zero offset values ​​in the conveyor belt background or non-sealed container areas outside the coverage of the sealed trajectory mask. These useless offset predictions not only consume a large amount of already limited computing resources but may also cause the model to extract incorrect noise features during sampling. To ensure that the sampling process is strictly confined to the specific physical space of interest, spatial masking processing is necessary. At this point, the previously prepared sealed trajectory mask is directly used to constrain the initial position offset map just obtained. Specifically, the matrix multiplication module is called to constrain the sealed trajectory mask. The sealing trajectory mask and the initial position offset map perform precise pixel-level Hadamard product operations. Because the pixel values ​​of the sealing trajectory mask inside the effective working area represent high-level values ​​to be retained, while the pixel values ​​outside the working area represent absolute zero values ​​to be discarded, this element-wise dot product operation ensures that the initial offset values ​​within the mask coverage area are completely and losslessly preserved, while forcibly eliminating any tiny offset values ​​outside the mask coverage area. Through this rigorous mathematical logic constraint and data cleaning operation, a truly physical and clean spatial sampling offset is finally generated, which precisely guides the receptive field to dynamically expand and contract only at the effective packaging edge.

[0069] After obtaining the pure spatial sampling offset, a dynamic perceptual mesh model needs to be established by combining the structural characteristics of dilated convolution. To expand the receptive field as much as possible to capture a wider range of contextual dependencies without increasing the computational parameters of the network model, a dilation rate parameter is pre-set in the feature map space to construct a regular spatial sampling mesh corresponding to dilated convolution. The sampling points in this regular mesh are uniformly distributed at fixed intervals and their basic spatial coordinates are recorded in the form of a two-dimensional matrix. Since this regularly arranged mesh cannot adapt to non-rigid deformation defects such as random wrinkles or foreign object indentation at the edges of food packaging containers, it is necessary to modify the previously calculated... The obtained spatial sampling offset is introduced into this fixed grid model for reconstruction. The horizontal and vertical coordinate offset components contained in the spatial sampling offset are superimposed pixel by pixel onto the basic spatial coordinates of the regular spatial sampling grid. Through this vector addition operation, the sampling points that originally presented a rigid regular arrangement collectively move and cluster towards the area where the defect features are more dense, thus generating a deformable sampling grid that can perfectly fit the local geometric texture of the image. This grid breaks the rigid limitation of the classical convolution kernel on the shape of the receptive field and gives the algorithm a powerful ability to dynamically adjust the size and shape of the receptive field at different spatial positions.

[0070] By utilizing the constructed deformation sampling grid, highly targeted information aggregation and extraction can be performed on the original feature data. The algorithm engine strictly follows the latest floating-point spatial coordinates recorded in the deformation sampling grid to perform pixel feature resampling operations in the local morphological feature tensor. Since these coordinate values ​​obtained after offset calculation usually contain decimal parts and cannot be directly mapped to the discrete image pixel matrix, a bilinear interpolation algorithm must be introduced during the resampling process to accurately calculate the feature response values ​​at these non-integer coordinate positions. A weighted average is calculated using the feature values ​​of the four nearest actual pixels around the target floating-point coordinates to obtain smooth and continuous sampling features. This interpolation... The resampling mechanism ensures that spatial features maintain good differentiability and gradient propagation stability even after non-rigid deformation. After extracting all resampled pixel features that have undergone deformation within the target receptive field, the convolution kernel matrix of the convolution processing unit is called to perform a weighted summation of these feature sets. This is equivalent to performing a standard inner product operation in the spatial feature dimension. Through inner product calculation, multiple local deformation features are highly integrated and mapped and projected into a high-dimensional space. The final output is a high-order spatial frequency feature containing rich defect morphology and edge geometric attributes. These features have completely filtered out background noise and significantly enhanced the presentation of subtle defect details in the sealed area of ​​the packaging container.

[0071] In one embodiment of the present invention, the process of mapping spatial frequency features to topological nodes, calculating adjacency matrices based on spatial physical distance and feature vector similarity between nodes, constructing a feature topology graph, and aggregating the spatial frequency features of nodes in step S4 is as follows:

[0072] After extracting the spatial frequency features, they need to be converted into a graph data structure for global correlation analysis. First, every discrete pixel position in the entire spatial frequency feature tensor is traversed. At any specific pixel position, a one-dimensional feature vector containing multi-dimensional data is extracted along the depth channel dimension. This feature vector is logically defined as an independent topological node, thus providing a basic entity for the construction of the graph structure. Since the feature vector alone cannot characterize the actual physical location of the node in the real image, it is necessary to simultaneously read the two-dimensional pixel spatial coordinates of the original image pixel corresponding to the feature vector before extraction. The spatial position information containing the horizontal and vertical coordinates is directly assigned to the newly established topological node. This method of binding spatial coordinates with high-dimensional features ensures that each topological node not only contains abstract numerical information reflecting the defect morphology but also accurately retains its absolute geometric position within the sealed area of ​​the packaging container. By repeating the above extraction and binding operations on all valid pixel positions, a massive set of basic topological nodes can be successfully constructed for further structured analysis.

[0073] After establishing a massive set of basic topological nodes, it is necessary to evaluate the degree of intrinsic connection between these nodes in terms of physical location and feature representation. At this point, two different topological nodes are randomly selected from the set as analysis targets. First, the two-dimensional pixel spatial coordinates bound to these two topological nodes are extracted. The classic Euclidean distance formula is used to calculate the straight-line distance between these two coordinate points on the two-dimensional plane as the spatial physical distance. This spatial physical distance intuitively reflects the proximity of the two nodes on the surface of the packaging container. At the same time, the high-dimensional feature vectors carried by these two topological nodes are extracted. The standard inner product operation is performed on these two feature vectors in the feature mathematical space. The scalar value obtained by the inner product calculation is directly defined as the feature vector similarity between the two nodes. This feature vector similarity can sensitively measure the degree of convergence of two pixels in different spatial locations in terms of texture details and defect response. This calculation method, which is carried out simultaneously from two dimensions, geometric space and feature space, lays a solid quantitative foundation for comprehensively characterizing the close relationship between topological nodes.

[0074] After obtaining the dual evaluation metrics between any two topological nodes, they need to be merged into a unified connection weight value. To prevent mathematical overflow errors where the denominator is zero when the two nodes physically overlap or are extremely close, a very small smoothing bias constant must be added to the spatial physical distance value just obtained. Then, the reciprocal of the distance value after adding the smoothing bias constant is taken to generate a spatial decay factor. This spatial decay factor is multiplied by the previously obtained feature vector similarity to obtain the final connection weight between the two topological nodes. This weight calculation logic ensures that nodes that are physically closer and have more similar features have stronger mutual connections. Following the above algorithm, all possible node pairs in the node set are traversed and all connection weights are calculated. Using all topological nodes as the rows and columns of the matrix, these connection weight values ​​are arranged according to their corresponding positions to construct a complete global adjacency matrix. This adjacency matrix is ​​mathematically perfectly equivalent to a complex spatial topological structure. Based on this, a feature topology graph reflecting the overall node association strength can be successfully generated.

[0075] After successfully generating the feature topology graph, feature fusion and updating are required based on the information transfer mechanism of graph neural networks. For each central topology node in the graph, the exploration needs to proceed outward along the connection edges established inside the feature topology graph to find and locate all adjacent topology nodes that have direct edge connections with the central node. All high-dimensional feature vectors contained in these adjacent topology nodes are extracted as the basic material to be fused. At this time, the global adjacency matrix that was just constructed is called, and the connection weight values ​​between the central node and each adjacent node are read from it. These connection weight values ​​are used as scaling factors to perform a weighted summation operation on the extracted adjacent feature vectors. This weighted summation operation based on weights allows neighboring nodes containing important defect features to make a greater information contribution to the central node. Through this spatial domain information aggregation and transfer, the deep update of the spatial frequency features inside the central node is successfully completed. By performing the above aggregation operation on all nodes in the entire graph, the dynamic receptive field of the algorithm can be effectively expanded and the salience of local small defects in the global context can be significantly improved.

[0076] In one embodiment of the present invention, step S5, the process of using a graph neural network to update node features and extract abnormal nodes, is as follows:

[0077] After constructing the feature topology map, it is necessary to extract macroscopic background information that reflects the sealing state of the entire packaging container. At this point, the previously generated local morphological feature tensor is retrieved, and a global average pooling operation is strictly performed on this tensor in two-dimensional space, namely the horizontal width and vertical height dimensions. By traversing each spatial position on the feature map, the feature values ​​of all pixels are accumulated and divided by the total area of ​​the spatial pixels, thereby accurately calculating the pixel mean of all pixels within each independent depth channel. This pooling method not only greatly compresses the amount of data in the spatial dimension to reduce redundant calculations, but also effectively preserves the most representative background statistical information in each feature channel. Then, following the original depth channel order of the local morphological feature tensor, the pixel mean values ​​of each independent channel calculated are sequentially concatenated. Through this vector concatenation operation, the statistical data that were originally discretely distributed at different feature levels are fused into a complete one-dimensional vector, ultimately generating a global context mapping vector containing rich macroscopic features. This vector highly condenses the overall morphological distribution pattern and global brightness contrast relationship of the current image to be detected from a macroscopic perspective, providing key prior knowledge for the subsequent parameter generation process.

[0078] The specific method for dynamically generating the weight parameters of the graph neural network by inputting the global context mapping vector into the supernetwork composed of the feedforward neural network to perform matrix projection calculation is as follows:

[0079] After obtaining the global context mapping vector reflecting the macroscopic features of the entire image, it needs to be transformed into the underlying core parameters used to control the network behavior. At this point, the global context mapping vector is directly input into the pre-constructed nonlinear mapping layer inside the hypernetwork. This nonlinear mapping layer contains multiple interconnected hidden neuron nodes. When the global context mapping vector enters this mapping layer, it is immediately multiplied by the internally preset basic weight matrix to perform a basic linear transformation operation. Through this linear combination calculation, the originally compact context features are stretched and extended in multiple dimensions within the feature space. This enhances the model's ability to fit and express complex nonlinear relationships during the mapping process. Necessary translation corrections are introduced. Immediately after completing the linear transformation calculation, the pre-set bias vector is superimposed and combined onto the obtained linear transformation result to perform precise bias summation. Through the above rigorous mathematical matrix calculation operations, the linear constraints of the original features in the low-dimensional space are completely broken, thus successfully extracting the high-dimensional feature representation of the global features in the latent space of the deep neural network. This high-dimensional feature representation removes the redundant appearance interference in the original image data and highly condenses the core correlation attributes necessary for defect judgment. Finally, based on this pure and logically related high-dimensional feature representation, a feature latent vector is constructed specifically to guide the weights of the generation network.

[0080] After successfully constructing the feature latent vectors containing rich information, it is necessary to further transform them into a data form that meets the dimensional requirements of the target network. At this point, a dedicated matrix projection operator is pre-established for the huge parameter space inside the target graph neural network structure. The core essence of this operator is a projection matrix with specific row and column dimensions. The specific dimension setting strictly depends on the total number of weight parameters required by each processing layer of the graph neural network. Then, the matrix multiplication unit is called to strictly perform a mathematical dot product operation on the previously extracted and constructed feature latent vectors and the newly established projection matrix. In this high-intensity matrix dot product calculation process, each dimension feature contained in the feature latent vector is precisely allocated and projected onto the new vector space coordinate axis according to a specific numerical ratio. This dot product operation not only greatly expands the physical length of the data sequence, but also ensures that the internal logic of the original context features does not undergo any attenuation or distortion during the projection process. Through this directional mathematical space projection, the high-dimensional condensed features inside the latent space are successfully mapped accurately to the pre-set weight parameter space dimension. This mapping processing across different mathematical spaces perfectly realizes the seamless projection transformation of the macro-context information of a specific packaging container to the weight distribution state of the underlying network.

[0081] After complex matrix projection transformation calculations, the computation unit outputs a feature sequence containing a massive number of floating-point values ​​arranged in a one-dimensional linear pattern. Since the parameters called by the graph neural network when performing graph node information aggregation operations must be presented as a two-dimensional or multi-dimensional matrix structure with a specific depth, it is necessary to obtain the one-dimensional feature sequence output by the projection operation and perform a precise shape reshaping operation on it in the memory cache. Before performing the shape reshaping operation, the algorithm control program will fully read the specific size requirements of the weight matrix required by the graph neural network in the current hidden layer, that is, obtain the precise number of rows and columns of the target weight matrix and the number of depth channels. Then, using these precisely read size requirement parameters as the benchmark template, all floating-point values ​​inside the obtained one-dimensional feature sequence are re-split and truncated. The one-dimensional sequence is folded and arranged into a multi-dimensional hierarchical structure in strict accordance with the row and column arrangement rules of the target matrix. Through this rigorous element position migration and dimension transformation operation, the originally linearly distributed feature sequence is completely transformed into the corresponding weight parameter matrix that can directly participate in graph convolution calculation. Thus, the goal of dynamically calculating and matching network parameters according to the characteristics of different input images is fully realized, and the dynamic generation of the core operation weight parameters of the graph neural network is successfully completed.

[0082] After successfully obtaining the dynamically generated weight parameters, they must be deployed to the feature processing layer to leverage data fusion. At this point, these customized weight parameters are precisely loaded and configured into the hidden processing layers of the graph neural network, enabling the graph neural network to adaptively extract features for a specific packaging container image. Subsequently, the feature topology graph and its corresponding adjacency matrix, constructed in the previous steps, are retrieved. For each topology node in the feature topology graph, the feature aggregation mechanism of the graph neural network is activated. The algorithm uses the configured weight parameters to perform linear transformations and nonlinear activation processing on the features of the central topology node and all its adjacent topology nodes. In this process, the adjacency matrix plays a crucial routing and navigation role, clearly guiding the information from adjacent nodes to be converged and accumulated towards the central node according to the connection ratio. Through this graph message passing mechanism based on spatial connectivity, the central node effectively absorbs key local frequency features and boundary morphology information from its surroundings. After multiple rounds of deep feature aggregation and state refresh operations, the original node features are greatly enriched and corrected, ultimately generating an updated node feature vector that integrates macroscopic prior information and microscopic neighborhood information.

[0083] After fusing and updating all node features, it is necessary to assess the defects in the physical regions represented by each node. At this point, the updated node feature vectors corresponding to all topological nodes are input one by one into the classification and regressor at the end of the graph neural network. This classification and regressor performs numerical dimensionality reduction mapping on each high-dimensional feature vector through inner product operations and normalized exponential functions, accurately calculating the anomaly prediction value reflecting the probability of defects such as poor sealing or indentation / fracture in the pixel region where the node is located. The absolute magnitude of this value directly quantifies the degree of deviation between the feature performance and the standard qualified product. This is crucial for accurately identifying true defects from a massive number of normal nodes. For each node, a very strict anomaly detection threshold must be set in the algorithm parameter configuration file beforehand. Then, the logical comparison operation unit compares and filters all the anomaly prediction values ​​calculated just now with the set anomaly detection threshold one by one. When the anomaly prediction value of a certain topological node is strictly greater than the anomaly detection threshold, it means that there is a structural mutation or texture anomaly in the physical space corresponding to the node that cannot be ignored. At this time, the topological node is directly filtered out and clearly marked as an anomaly node. This threshold-based numerical filtering mechanism effectively filters out the interference of small noise and finally successfully locks all key spatial location points suspected of having sealing defects.

[0084] In one embodiment of the present invention, in step S6, the process of inversely projecting the abnormal node onto the pixel space coordinates of the initial sealing image to locate the spatial position of the visually recognized defect and outputting the defect distribution mask is as follows:

[0085] After successfully identifying all anomalous nodes suspected of having sealing defects, these abstract graph structure data need to be converted back into an intuitive physical image space. At this point, the algorithm will traverse the set of anomalous nodes recorded and output in the previous steps one by one. For each topological node marked as anomalous, it will specifically read the original pixel space coordinates bound to it in the early stage of network construction. These pixel space coordinates contain the exact horizontal and vertical coordinates of the node on the real two-dimensional physical plane. In order to ensure the accuracy of spatial mapping, the calculation unit will directly set the pixel space coordinates of each anomalous node as the reverse mapping anchor point. This reverse mapping anchor point serves as the positioning reference for mutual conversion between the high-dimensional abstract feature space and the low-dimensional concrete pixel space. Through continuous traversal and extraction operations, all discrete anomalous nodes are converted into corresponding reverse mapping anchor points. Finally, a specific data list is allocated in the memory space to summarize all these reverse mapping anchor points, thereby generating an anchor point set containing all potential defect location information for use in the subsequent spatial reconstruction operation.

[0086] After preparing the anchor point set containing core positioning information, a basic canvas environment for carrying the visual image needs to be built. At this time, the physical parameter information of the initial sealed image obtained at the beginning is retrieved. A blank pixel matrix with the same pixel dimension is created strictly according to the total number of pixels in width and height of the initial sealed image. This consistency in dimension is an absolute prerequisite for ensuring that the defect position can be accurately reverse-located to the original physical image. In the initial state of the blank pixel matrix, all pixels inside are uniformly assigned a default initial zero value representing no feature meaning. Then, all the reverse mapping anchor point data recorded in the already established anchor point set are extracted. The control logic strictly traverses and searches in the blank pixel matrix according to the exact spatial position information pointed to by each reverse mapping anchor point. Once the corresponding pixel coordinate position is located, the reverse projection operation is performed at that position. That is, the abnormal response information that originally existed in the abstract feature map structure is restored and placed on this newly established blank canvas, so that the originally empty matrix begins to show sporadic discrete bright spot data representing suspected defects.

[0087] Since the coordinates of abnormal nodes restored to the blank pixel matrix after inverse projection often present a discrete and unconnected speckled distribution, this fragmented distribution cannot accurately describe a complete physical defect outline. Therefore, it is necessary to introduce morphological processing techniques from computer vision to perform in-depth connectivity repair on the coordinates of abnormal nodes in inverse projection. First, morphological dilation calculations are performed on these discrete pixel regions using structuring elements of specific sizes and shapes. Local maximum filtering is used to expand the physical area of ​​the originally tiny abnormal points in all directions. This expansion causes adjacent abnormal nodes that were originally close to each other to merge and connect at the spatial boundary. In order to further eliminate the internal voids that may be generated during the fusion process and smooth the edge boundary of the defect region, morphological closing operations are then performed on the connected regions after the dilation process. That is, a complete dilation operation is performed first, followed by an erosion operation of the same scale. This opening and closing operation can effectively connect adjacent abnormal nodes and achieve perfect region closure, thereby accurately delineating and locating the true spatial location of the defect in the packaging container in the two-dimensional pixel matrix.

[0088] After accurately delineating and locating the true spatial contour of the defect, this geometric positional relationship needs to be converted into a digital mask file that can be directly used for automated detection and judgment. At this point, the entire blank pixel matrix that has undergone morphological restoration is traversed, and the belonging status of each pixel is screened using geometric bounding box algorithms or polygon region judgment logic. All pixels in the blank pixel matrix that are within the determined defect spatial location range are assigned an extremely high high-level abnormality flag value. This value represents that there is a definite unacceptable physical damage or a dangerous state of inadequate sealing in that area. At the same time, all ordinary pixels outside the defect spatial location range are forcibly assigned an extremely low background value. Usually, this background value is set to an absolute zero value to indicate that the area is in a safe and qualified sealing state. This black-and-white binary value assignment operation thoroughly cleans up any blurry transition areas that may remain in the image. Finally, the computer processing core encapsulates and outputs it as a defect distribution mask with extremely high contrast. This mask file can directly guide external hardware rejection devices to accurately intercept and reject unqualified food packaging containers.

[0089] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A method for visually identifying a sealing defect of a food-grade packaging container, characterized by, Includes the following steps: S1. Acquire the original image of the packaging container, extract the pixel spatial coordinates in the image to construct a sealing trajectory mask, and capture the initial sealing image; S2. The initial sealed image is processed using the phase consistency algorithm to extract the phase offset components between pixels and generate a local morphological feature tensor. S3. Input the local morphological feature tensor into the feature extractor, calculate the spatial sampling offset using the sealed trajectory mask, and extract the spatial frequency features through deformable dilated convolution. S4. Map spatial frequency features to topological nodes, calculate the adjacency matrix based on the spatial physical distance between nodes and the similarity of feature vectors, construct a feature topology graph, and aggregate the spatial frequency features of nodes. S5. Perform global pooling on the local morphological feature tensor to generate a global context mapping vector, construct a super network to dynamically generate the weight parameters of the graph neural network based on the global context mapping vector, and use the graph neural network to update node features and extract abnormal nodes. S6. Inversely project the abnormal nodes onto the pixel space coordinates of the initial sealing image to locate the spatial position of the visually recognized defects and output the defect distribution mask.

2. The method of claim 1, wherein the method is a method of visually identifying a seal defect of a food-grade packaging container, characterized by, In step S1, the process of acquiring the original image of the packaging container, extracting the pixel spatial coordinates within the image to construct a sealing trajectory mask, and cropping the initial sealing image is as follows: A photoelectric device is used to trigger a camera to capture the original image of the packaging container to be inspected, and the original image is converted into a single-channel grayscale image. The edge contour of the packaging container is extracted based on the pixel gradient distribution of the single-channel grayscale image, and the pixel space coordinates of the corresponding pixels of the edge contour are read to construct a sealing trajectory mask. The sealing trajectory mask is superimposed on the original image, the original image pixels within the coverage area of ​​the sealing trajectory mask are retained and the background pixels are removed, and the initial sealing image is extracted.

3. The method of claim 1, wherein the method is a method of visually identifying a seal defect of a food-grade packaging container, characterized by, In step S2, the process of using the phase consistency algorithm to process the initial sealed image, extract the phase offset components between pixels, and generate a local morphological feature tensor is as follows: A multi-scale and multi-directional frequency domain convolution operation is performed on the initial sealing image using a logarithmic Gaussian filter to obtain the frequency domain response matrix. Based on the frequency domain response matrix, the local amplitude matrix and local phase matrix of the initial sealing image are extracted. The weighted average phase of the local phase matrix is ​​calculated using the local amplitude matrix as a weighting parameter. The difference between the local phase matrix and the weighted average phase is solved to extract the phase offset components between pixels. A phase consistency function is constructed based on the phase offset component. The phase consistency function is normalized using the local amplitude matrix to generate phase response maps in various directions. The phase response maps are then stitched together according to the directional dimension to generate a local morphological feature tensor.

4. The method for visually identifying sealing defects in food-grade packaging containers according to claim 1, characterized in that, In step S3, the process of inputting the local morphological feature tensor into the feature extractor, calculating the spatial sampling offset using the sealed trajectory mask, and extracting spatial frequency features through deformable dilated convolution is as follows: The local morphological feature tensor and the sealing trajectory mask are concatenated along the channel dimension and input into a feature extractor containing standard convolutional kernels to generate an initial position offset map. The Hadamard product operation is performed using the sealed trajectory mask and the initial position offset map to eliminate offset values ​​outside the mask coverage area and generate spatial sampling offset. Construct a regular spatial sampling grid corresponding to the dilated convolution, and superimpose the spatial sampling offset point by point onto the regular spatial sampling grid to generate a deformation sampling grid. Pixel features are resampled in the local morphological feature tensor according to the coordinates recorded by the deformation sampling grid, and spatial frequency features are output by performing inner product operation through convolution kernel.

5. The visual identification method for sealing defects of food-grade packaging containers according to claim 1, characterized in that, In step S4, the process of mapping spatial frequency features to topological nodes, calculating the adjacency matrix based on the spatial physical distance between nodes and the similarity of feature vectors, constructing a feature topological graph, and aggregating the spatial frequency features of nodes is as follows: Extract the feature vector of each pixel position in the spatial frequency features and define it as a topological node. Read the pixel spatial coordinates corresponding to the feature vector and assign them to the corresponding topological node. Calculate the Euclidean distance between the pixel spatial coordinates of any two topological nodes as the spatial physical distance, and solve for the inner product of the feature vectors of the two topological nodes as the feature vector similarity. The connection weight is obtained by multiplying the reciprocal of the spatial physical distance plus the smoothing bias constant with the feature vector similarity. An adjacency matrix is ​​constructed according to the connection weights between all topological nodes to generate a feature topology graph. The feature vectors of adjacent topological nodes are extracted along the connecting edges of the feature topology graph. The adjacent feature vectors are weighted and summed using the connection weights of the adjacency matrix to aggregate the spatial frequency features of the nodes.

6. The visual identification method for sealing defects of food-grade packaging containers according to claim 1, characterized in that, In step S5, the process of using a graph neural network to update node features and extract abnormal nodes is as follows: Global pooling is performed along the spatial dimension of the local morphological feature tensor to obtain the pixel mean, and the pixel mean values ​​of each channel are concatenated to generate a global context mapping vector. The global context mapping vector is input into the supernetwork composed of the feedforward neural network to perform matrix projection calculation, and the weight parameters of the graph neural network are dynamically generated. The processing layer of the graph neural network is configured using weight parameters, and the updated node feature vector is generated by aggregating the features of the topological nodes based on the adjacency matrix of the feature topological graph. Calculate the anomaly prediction value of the updated node feature vector of each topology node, and select topology nodes whose anomaly prediction value is greater than the anomaly judgment threshold as anomaly nodes.

7. The method for visually identifying sealing defects in food-grade packaging containers according to claim 6, characterized in that, The specific method for dynamically generating the weight parameters of the graph neural network by inputting the global context mapping vector into the supernetwork composed of the feedforward neural network to perform matrix projection calculation is as follows: The global context mapping vector is input into the nonlinear mapping layer inside the supernetwork, and linear transformation and bias summation are performed to extract the high-dimensional feature representation of global features in the latent space and construct the feature latent vector used to generate weights. A matrix projection operator is established for the parameter space of graph neural networks. The latent feature vectors are multiplied by the projection matrix to map the latent space features to the preset weight parameter space dimension, thereby realizing the projection transformation of context information to the weight distribution. The feature sequence output by the projection operation is obtained and the shape reshaping operation is performed. The dimensions are arranged according to the size requirements of the graph neural network weight matrix, and the feature sequence is transformed into the corresponding weight parameter matrix, thus completing the dynamic generation of weight parameters.

8. The visual identification method for sealing defects of food-grade packaging containers according to claim 1, characterized in that, In step S6, the process of inversely projecting the abnormal node onto the pixel space coordinates of the initial sealing image to locate the spatial position of the visually recognized defect and outputting the defect distribution mask is as follows: Read the pixel space coordinates corresponding to the abnormal node, set the read pixel space coordinates as the reverse mapping anchor point, and summarize all the reverse mapping anchor points to generate an anchor point set; Create a blank pixel matrix with the same pixel dimensions as the initial sealed image, and perform inverse projection in the blank pixel matrix according to the inverse mapping anchors inside the anchor set; Morphological dilation and closing operations are performed on the coordinates of the abnormal nodes in the reverse projection to connect adjacent abnormal nodes and close the region, thereby locating the spatial position of the defect. Pixels within the defect spatial location range in the blank pixel matrix are assigned anomaly identification values, while pixels outside this range are assigned background values, resulting in a defect distribution mask.