Paper cup three-dimensional surface defect online detection method and system

By constructing a graph structure model and graph neural network for the surface of paper cups, the problem of insufficient identification of subtle defects on the surface of paper cups in traditional detection methods is solved, and efficient detection and defect localization of the three-dimensional surface of paper cups are achieved.

CN121504848APending Publication Date: 2026-02-10ZHEJIANG NEW DEBAO MACHINERY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511617411.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Traditional testing methods struggle to accurately identify subtle quality differences on the surface of paper cups, especially for paper cups with complex geometries. They lack sensitivity to intrinsic quality changes between samples, leading to missed defects.

Method used

By constructing a graph structure model of the paper cup surface, a graph neural network is used to identify node-level defects. By combining the screening of defective and non-defective samples, a node defect identification model is generated, which outputs the defect type and three-dimensional coordinates.

Benefits of technology

It enables continuous defect localization and detection on the three-dimensional surface of paper cups, improving the detection effect. It can identify and mark the distribution coordinates of defects on the three-dimensional surface, significantly improving the defect omission problem of traditional 2D vision methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121504848A_ABST
    Figure CN121504848A_ABST
Patent Text Reader

Abstract

The invention discloses a paper cup three-dimensional surface defect on-line detection method and system, and relates to the field of defect detection.The method comprises the steps that D paper cup samples are selected, defective samples and defect-free samples are anchored in the D paper cup samples, a surface graph structure template of the paper cup samples is predefined, and the surface graph structure template of the paper cup samples is obtained; the method comprises the following steps: constructing a surface graph structure of Q defective samples and P defect-free samples, constructing a paper cup training sample set according to the surface graph structure, carrying out iterative supervised training on the training sample set, generating a node defect identification model, constructing a real-time surface graph structure based on a predefined surface graph structure template, and identifying the defect of the paper cup. And inputting the real-time surface graph structure into a node defect identification model, outputting defect probability distribution of each node, and aggregating to generate a defect type of the real-time finished paper cup and a three-dimensional coordinate of each defect position. And the detection effect of the three-dimensional surface defect of the paper cup is obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of defect detection, in particular to a paper cup three-dimensional surface defect online detection method. BACKGROUND

[0002] As a widely used disposable tableware, the surface quality of paper cups directly affects the user experience. It is essential to accurately detect the surface of paper cups during production.

[0003] During the production of paper cups, different batches of products may have varying degrees of quality fluctuations, which requires detection not only to identify obvious defects, but also to distinguish subtle quality differences. Traditional detection methods usually use fixed thresholds or simple machine learning to classify whether the product is qualified, but lack sensitivity to the inherent quality changes between samples, especially when it comes to products with complex geometric shapes such as paper cups.

[0004] In recent years, with the development of artificial intelligence technology, especially the breakthrough of graph neural networks (GNN) in image processing. By constructing a graph structure model of the surface of the paper cup, and using graph semantic segmentation technology for node-level defect recognition, the details and spatial distribution of the paper cup surface can be more accurately captured. On this basis, how to effectively select a sample set that truly represents different quality levels from a large number of samples has become a key technical challenge. SUMMARY

[0005] To overcome the shortcomings of the prior art, the present application provides a paper cup three-dimensional surface defect online detection method, which solves the technical problems raised in the background art by introducing the screening of defective samples and non-defective samples.

[0006] To achieve the above purpose, the present application realizes the following technical solutions: In a first aspect, the present application provides a paper cup three-dimensional surface defect online detection method, comprising: S1, selecting D paper cup samples in a paper cup production database; S2, anchoring Q defective samples and P non-defective samples in the D paper cup samples; S3, predefining a surface graph structure template of the paper cup sample; S4, based on the pre-defined surface graph structure template, constructing surface graph structures of the Q defective samples and the P non-defective samples; S5, constructing a paper cup training sample set according to the surface graph structures of the Q defective samples and the P non-defective samples; Wherein, the paper cup training sample set contains P non-defective paper cup training samples and R defective paper cup training samples; S6, input the paper cup training sample set into the graph neural model for iterative supervised training to generate a node defect recognition model; S7, select a real-time finished paper cup to be detected, and construct a real-time surface graph structure based on a pre-defined surface graph structure template; S8, input the real-time surface graph structure into the node defect recognition model to output a defect probability distribution of each node, and aggregate to generate a defect type and a three-dimensional coordinate of each defect position of the real-time finished paper cup.

[0007] In some embodiments, among the D paper cup samples, Q defective samples and P non-defective samples are anchored, including: S2-1, obtain the surface reflectivity, local wall thickness and local curvature at the preset representative positions of the D paper cup samples; S2-2, calculate the surface quality scores of the D paper cup samples according to the surface reflectivity, local wall thickness and local curvature at the preset representative positions of the D paper cup samples; S2-3, arrange the surface quality scores of the D paper cups in descending order to generate a quality score sequence; S2-4, sequentially combine the surface quality scores of adjacent two items in the quality score sequence to form D-1 binary score groups; S2-5, calculate the first-order differences of the D-1 binary score groups; S2-6, identify the first-order differences with absolute values greater than a set threshold from the D-1 first-order differences, and mark them as significant decreasing differences; S2-7, anchor the binary score group corresponding to the significant decreasing difference, and mark it as a quality mutation score group; S2-8, mark the larger score in the quality mutation score group as a high quality score, and mark the smaller score as a low quality score; S2-9, locate the high quality score and the low quality score in the quality score sequence, and cut the quality score sequence into a high quality subsequence and a low quality subsequence between them; Wherein, the high quality subsequence and the low quality subsequence respectively contain P and Q surface quality scores; S2-10, based on the high quality subsequence and the low quality subsequence, determine P non-defective samples and Q defective samples from the D paper cup samples; Wherein, the non-defective samples and the defective samples are respectively labeled with a binary sample label, and the sample label is represented as a defective label or a non-defective label.

[0008] In some embodiments, a surface graph structure template of a paper cup sample is pre-defined, including: S3-1, obtain N three-dimensional coordinates of the surface of the paper cup sample, and the RGB features of each three-dimensional coordinate; S3-2, identify the junction region coordinates of the cup bottom and the cup body in N three-dimensional coordinates; S3-3, divide the N three-dimensional coordinates into a cup bottom coordinate set and a cup body coordinate set based on the junction region coordinates; S3-4, uniformly sample the three-dimensional coordinates in the cup bottom coordinate set and the cup body coordinate set to obtain M uniformly sampled points; S3-5, define the M uniformly sampled points as nodes of a graph structure, and generate M unconnected nodes with their three-dimensional coordinates and RGB features as node features; S3-6, label the M unconnected nodes with region labels to generate F cup bottom nodes and G cup body nodes; S3-7, establish connection edges and set edge weights in the F cup bottom nodes and the G cup body nodes to generate a cup bottom graph structure and a cup body graph structure; S3-8, fuse the cup bottom graph structure and the cup body graph structure to generate a surface graph structure template of the paper cup sample; In some embodiments, the generation of the F cup bottom nodes and the G cup body nodes includes: S3-6-1, select a target node from the M unconnected nodes; S3-6-2, identify the source coordinate set of the uniformly sampled point corresponding to the target node; S3-6-3, if the source coordinate set of the target node is the cup bottom coordinate set, label it as a cup bottom node; if the source region is the cup body coordinate set, label it as a cup body node; S3-6-4, traverse the M unconnected nodes and repeatedly execute the region label labeling to generate the F cup bottom nodes and the G cup body nodes, wherein F+G=M.

[0009] In some embodiments, the generation of the cup bottom graph structure and the cup body graph structure includes: S3-7-1, select any two nodes to form a node pair in the F cup bottom nodes or the G cup body nodes; S3-7-2, identify the region labels of the two nodes in the node pair; S3-7-3, if the region labels are both cup bottom nodes, calculate the Euclidean distance between the two nodes; S3-7-4, if the region labels are both cup body nodes, calculate the curved surface distance between the two nodes on the surface of the paper cup; wherein the curved surface distance is the shortest path length along the outer surface of the cup body; S3-7-5, compare the calculated Euclidean distance or curved surface distance with the corresponding preset connection threshold; S3-7-6, if the Euclidean distance or the curved surface distance is less than a preset connection threshold, a connection edge is established between the two nodes, and the reciprocal of the Euclidean distance or the curved surface distance is obtained as the edge weight of the corresponding connection edge; otherwise, no connection edge is established; S3-7-7, each node pair in the F cup bottom nodes and the G cup body nodes is traversed respectively to generate a cup bottom graph structure composed of the F cup bottom nodes and a cup body graph structure composed of the G cup body nodes.

[0010] In some embodiments, the surface graph structure of the paper cup sample is generated, including: S3-8-1, cup bottom edge nodes and cup body edge nodes adjacent to the boundary region in the cup bottom graph structure and the cup body graph structure are identified; S3-8-2, based on the boundary region coordinates, the Euclidean distance between any two cup bottom edge nodes and cup body edge nodes is calculated; S3-8-3, if the Euclidean distance between the cup bottom edge nodes and the cup body edge nodes is less than a fusion tolerance threshold, the cup body edge nodes are deleted, and the connection relationship is merged to the corresponding cup bottom edge nodes; S3-8-4, for each cup bottom edge node retained, the cross-region Euclidean distance between the cup bottom edge node and the G cup body nodes is calculated; S3-8-5, among the G cross-region Euclidean distances, the minimum cross-region Euclidean distance is selected and the corresponding cup bottom edge node and cup body node are anchored; S3-8-6, a cross-region connection edge is established between the anchored cup bottom edge node and the cup body node, and the reciprocal of the minimum cross-region Euclidean distance is taken as the edge weight of the connection edge; S3-8-7, the cup bottom edge nodes are traversed, and the cross-region connection edges and edge weights thereof are repeatedly established until the cup bottom graph structure and the cup body graph structure are fused into a surface graph structure template covering the complete surface of the paper cup.

[0011] In some embodiments, the surface graph structures of the Q defective samples and the P non-defective samples are constructed, including: S4-1, a target paper cup sample is selected from the Q defective samples and the P non-defective samples; S4-2, N three-dimensional coordinates of the target paper cup sample and RGB features of each three-dimensional coordinate are obtained; S4-3, the N three-dimensional coordinates of the target paper cup sample and the RGB features thereof are substituted into the surface graph structure template to generate a surface graph structure of the target paper cup sample; S4-4, it is judged whether the sample label of the target paper cup sample belongs to a defective label or a non-defective label; S4-5. If the label is defective, mark the surface map structure of the target paper cup sample as the surface map structure of a defective sample; otherwise, mark it as the surface map structure of a non-defective sample. S4-6. Traverse the Q defective samples and P non-defective samples, and repeat the marking process until the surface graph structure of the Q defective samples and P non-defective samples is constructed.

[0012] In some embodiments, constructing the paper cup training sample set includes: S5-1. Input the surface graph structures of Q defective samples and P undefective samples into the GNN encoder, perform feature aggregation based on message passing mechanism, and output the graph-level representations of Q defective samples and P undefective samples. S5-2. Cluster the graph-level representations of the Q defective samples to generate K typical defect clusters; S5-3. Perform cluster center back projection on K typical defect clusters to generate R defective paper cup training samples with defect categories. S5-4. Label the P defect-free sample graph representations with defect-free categories to generate P defect-free paper cup training samples with defect-free categories. S5-5. Merge the P undefective paper cup training samples with the R defective paper cup training samples to generate a paper cup training sample set.

[0013] In some embodiments, constructing R training samples of defective paper cups with defect categories includes: S5-3-1. Based on a predefined knowledge base of paper cup defect types, label the defect categories for K typical defect clusters; S5-3-2. Obtain the cluster center vector of each typical defect cluster to form K typical defect vectors; Among them, the typical defect vector inherits the defect category of its typical defect cluster; S5-3-3. For any typical defect vector, backtrack to the node feature layer of the GNN encoder before global pooling, and obtain the aggregated feature vector of the T nodes that contribute the most to the graph representation corresponding to the typical defect vector. S5-3-4. Calculate the T similarities between the aggregated feature vector and the corresponding typical defect vector; S5-3-5, Use the T similarity scores as the confidence that the corresponding node belongs to the defect category inherited by the typical defect vector; S5-3-6. Select the R nodes with the highest confidence and their corresponding aggregated feature vectors to form R high-confidence nodes; S5-3-7. Assign the defect category corresponding to the current typical defect vector to R high-confidence nodes, and bind the three-dimensional coordinates of the high-confidence nodes to generate R defective paper cup training samples with three-dimensional coordinates and defect categories.

[0014] This invention provides an online detection method for three-dimensional surface defects in paper cups, which has the following beneficial effects: This invention identifies quality boundaries and divides sample intervals by locating first-order differential mutation points in the quality scoring sequence. Combined with three-dimensional surface modeling of paper cups and node-level defect identification, it can objectively distinguish the continuous changes in the surface quality of paper cups, effectively solving the problem of missed defect detection in traditional 2D vision methods.

[0015] Furthermore, by modeling the surface of the paper cup as a graph structure with interconnected relationships, the connection relationships between nodes reflect the physical surface characteristics of the paper cup, thus realizing the localization of continuous defects. At the same time, through cluster center back projection, the detection results not only include the defect type, but also mark its distribution coordinates on the three-dimensional surface of the paper cup, significantly improving the detection effect of three-dimensional surface defects of the paper cup.

[0016] In a second aspect, the present invention provides an online detection system for three-dimensional surface defects of paper cups, which performs the detection method described in the first aspect, characterized in that it includes: The sample selection unit is used to select D paper cup samples from the paper cup production database; Anchoring unit, used to anchor Q defective samples and P non-defective samples among D paper cup samples; The template definition unit is used to predefine the surface diagram structure template of the paper cup sample; The graph structure building unit is used to construct surface graph structures for Q defective samples and P defect-free samples based on a predefined surface graph structure template. The sample set construction unit is used to construct a paper cup training sample set based on the surface map structure of Q defective samples and P non-defective samples. The paper cup training sample set includes P defect-free paper cup training samples and R defective paper cup training samples. The model training unit is used to input the paper cup training sample set into the graph neural network model for iterative supervised training and generate a node defect recognition model. The real-time graph structure building unit is used to select the real-time finished paper cup to be inspected and build its real-time surface graph structure based on a predefined surface graph structure template. The defect detection unit is used to input the real-time surface map structure into the node defect identification model, output the defect probability distribution of each node, and aggregate to generate the defect type and three-dimensional coordinates of each defect location of the real-time finished paper cup.

[0017] Compared with the prior art, the beneficial effects of the online detection system for three-dimensional surface defects of paper cups of the present invention are the same as those of the online detection method for three-dimensional surface defects of paper cups described above, and therefore will not be repeated here. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the detection process of the online detection method for three-dimensional surface defects of paper cups according to the present invention; Figure 2 This is a schematic diagram illustrating the process for determining defect-free and defective samples according to the present invention. Figure 3 This is a schematic diagram illustrating the definition process of the surface diagram structure template described in this invention; Figure 4 This is a schematic diagram illustrating the process of generating the paper cup training sample set according to the present invention; Figure 5 This is a structural block diagram of the online detection system for three-dimensional surface defects of paper cups according to the present invention. Detailed Implementation

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

[0020] Example 1: Please refer to Figures 1 to 4 This invention provides an online detection method for three-dimensional surface defects in paper cups, comprising the following detection steps: S1. Select D paper cup samples from the paper cup production database; S2. Anchor Q defective samples and P non-defective samples among D paper cup samples; S3, Predefined surface structure template for paper cup samples; S4. Based on a predefined surface graph structure template, construct the surface graph structures of Q defective samples and P defect-free samples. S5. Based on the surface map structures of Q defective samples and P non-defective samples, construct a paper cup training sample set; The paper cup training sample set includes P defect-free paper cup training samples and R defective paper cup training samples. S6. Input the paper cup training sample set into the graph neural network model for iterative supervised training to generate a node defect recognition model; S7. Select the real-time finished paper cup to be inspected, and construct its real-time surface map structure based on the predefined surface map structure template; S8. Input the real-time surface map structure into the node defect identification model, output the defect probability distribution of each node, and aggregate to generate the defect type and three-dimensional coordinates of each defect location of the real-time finished paper cup.

[0021] In this embodiment, a graphical representation of the paper cup surface is established, and a node-level defect recognition model is used to simultaneously determine the defect type and spatial coordinates on the three-dimensional surface of the paper cup. This enables the production line to obtain a defect distribution map with accurate three-dimensional coordinates, supporting the location and classification of defects in areas such as the intersection of the cup body curved surface and the cup bottom plane, thus meeting the real-time quality inspection needs of the paper cup production line.

[0022] Specifically, in this embodiment, the detection step S2 includes the following sub-steps: S2-1. At the preset representative locations of D paper cup samples, obtain the surface reflectivity, local wall thickness, and local curvature. The preset representative locations include: the cup rim ring, the cup body middle ring, and the cup bottom center area; S2-2. Calculate the surface quality score of D paper cup samples based on the surface reflectance, local wall thickness and local curvature of D paper cup samples at preset representative positions. The formula for calculating the surface quality score is:

[0023] in: Q s Indicates surface quality score; r i represents the surface reflectance at the i-th representative location (normalized to [0,1]); t i This represents the local wall thickness deviation (the absolute difference relative to the nominal wall thickness) at the i-th representative location. k i This represents the absolute value of the local curvature at the i-th representative location; W1, W2, and W3 represent the weights of surface reflectivity, local wall thickness deviation, and absolute value of local curvature, respectively. L represents the number of preset representative locations.

[0024] It should be noted that the preset representative position can be determined in the following way: Divide the paper cup into three areas along its height: the rim area (85%–100% of the height), the body area (30%–70% of the height), and the bottom area (0%–15% of the height). Within each region, 16 sampling points are evenly selected along the circumference. A total of 48 fixed sampling points were obtained, which served as anchor points for the preset representative locations.

[0025] S2-3. Sort the surface quality scores of the D paper cups in descending order to generate a quality score sequence; S2-4. Combine the surface quality scores of two adjacent items in the quality scoring sequence in turn to form D−1 binary scoring groups; S2-5. Calculate the first difference of D-1 binary rating groups; S2-6. Identify first-order differences whose absolute values ​​are greater than a set threshold among D-1 first-order differences and mark them as significantly decreasing differences; The set threshold can be dynamically determined based on the first-order difference statistics of historical good product data, for example, taking three times the standard deviation of the mean of the first-order difference in the high-quality range.

[0026] S2-7, the binary scoring group corresponding to the anchored significant decrease difference is marked as the quality mutation scoring group; S2-8. Mark the larger scores in the quality mutation score group as high-quality scores and the smaller scores as low-quality scores; S2-9. Locate high-quality and low-quality scores in the quality scoring sequence, and then determine the quality score between them. The scoring sequence is divided into high-quality subsequences and low-quality subsequences; Among them, the high-quality subsequence and the low-quality subsequence contain P and Q surface quality scores, respectively; S2-10. Based on high-quality and low-quality subsequences, determine P defect-free samples and Q defective samples from D paper cup samples, respectively. Among them, the defect-free samples and the defective samples are respectively labeled with binary sample labels, and the sample labels are characterized as defective labels or defect-free labels.

[0027] This embodiment collects surface reflectivity, wall thickness, and curvature data from the cup rim, body, and bottom areas to establish a surface quality scoring sequence. The first-order difference mutation point of the quality scoring sequence is used to divide the sample intervals into high-quality and low-quality ranges, thereby enabling the screening of defect-free and defective samples and providing a training sample set with quality boundaries for the paper cup defect detection model.

[0028] Specifically, in this embodiment, the detection step S3 includes the following sub-steps: S3-1. Obtain N three-dimensional coordinates of the surface of the paper cup sample, and the RGB features of each three-dimensional coordinate; S3-2. Identify the coordinates of the boundary region between the cup bottom and the cup body in N three-dimensional coordinates; specifically, in this embodiment, the boundary region coordinates represent the geometric transition boundary between the cup bottom plane and the cup body sidewall. Because the paper cup is a solid of revolution, the cup bottom is approximately planar, and the cup body is a cylindrical / frustum surface. At the boundary, its three-dimensional coordinate normal vector abruptly changes from vertical (Z-axis) to horizontal (radial), and the curvature also exhibits a local maximum. Therefore, the boundary point can be identified in any of the following ways: Calculate the angle between the normal vector of each 3D coordinate and the Z-axis. Points with an angle within the range of 45°±10° are considered as boundary candidates. Calculate the Gaussian curvature, and take the point where the curvature has a local maximum and is located in the bottom region as the coordinates of the boundary region.

[0029] S3-3. Based on the coordinates of the boundary region, divide the N three-dimensional coordinates into a set of coordinates for the bottom of the cup and a set of coordinates for the body of the cup; Specifically, in this embodiment, the division is achieved by determining whether the height of the Z-axis of each three-dimensional coordinate is less than the average height of the boundary area coordinates. If it is less, it is assigned to the bottom coordinate set; otherwise, it is assigned to the body coordinate set. S3-4. Uniformly sample the three-dimensional coordinates of the cup bottom coordinate set and the cup body coordinate set to obtain M uniform sampling points; Specifically, in this embodiment, the uniform sampling adopts the farthest point sampling and is performed independently in the coordinate set of the bottom of the cup and the coordinate set of the body of the cup, so as to ensure the balance of node density in the bottom region and the body region of the cup.

[0030] In practice, the specific steps for sampling the farthest point are as follows: S3-4-1. Randomly select a point from the target coordinate set (the coordinate set of the bottom of the cup or the coordinate set of the body of the cup) as the initial sampling point to form the initial set of sampled points; S3-4-2. For all unsampled points in the target coordinate set, calculate their Euclidean distances to each point in the current sampled point set, and record the minimum distance from each unsampled point to the sampled point set. S3-4-3. Among all unsampled points, select the point with the largest minimum distance and add it to the set of sampled points; S3-4-4. Repeat steps S3-4-2 to S3-4-3 until the number of points in the sampled point set reaches the preset number (M1 for the bottom area and M2 for the body area, and M1 + M2 = M). The ratio of M1 to M2 is set according to the surface area ratio of the bottom to the body of the cup, typically 1:3. It should be noted that the point with the largest minimum distance is the one furthest from existing sampled points among all unsampled points—the most isolated point—and is selected first to ensure uniform coverage. Selecting a new point furthest from existing sampled points each time avoids point clustering and achieves a uniform distribution.

[0031] S3-5. Define the M uniform sampling points as nodes of the graph structure, and use their three-dimensional coordinates and RGB features as node features to generate M unconnected nodes. S3-6. Label the M unconnected nodes with region labels to generate F cup bottom nodes and G cup body nodes; S3-7. Establish connecting edges and set edge weights in the F cup bottom nodes and G cup body nodes respectively to generate the cup bottom graph structure and the cup body graph structure; S3-8. Merge the bottom image structure and the body image structure of the cup to generate a surface image structure template for the paper cup sample. The surface diagram structure template represents the spatial adjacency relationship and region affiliation of M nodes on the three-dimensional surface of the paper cup.

[0032] This embodiment identifies the coordinates of the boundary area between the bottom and the body of the cup, divides the surface of the paper cup into two regions: the bottom and the body. It uses farthest point sampling to obtain representative nodes, constructs local graph structures for the bottom plane and the body curved surface respectively, and merges them to form a graph structure template that retains the node-based expression of the three-dimensional surface of the paper cup.

[0033] Furthermore, in specific implementation, the steps for generating the cup bottom node and cup body node include: S3-6-1. Select a target node from M unconnected nodes; S3-6-2. Identify the source coordinate set of the uniform sampling points corresponding to the target node; The source coordinate set is the coordinate set of the bottom of the cup or the coordinate set of the body of the cup from which it originates during the uniform sampling process.

[0034] S3-6-3. If the source coordinate set of the target node is the bottom coordinate set, then label its region as the bottom node; if the source region is the body coordinate set, then label it as the body node. S3-6-4. Traverse the M unconnected nodes and repeatedly perform the region labeling to generate F cup bottom nodes and G cup body nodes, where F+G=M.

[0035] It should be noted that when performing farthest point sampling, a region identifier is attached to each uniformly sampled point. The region identifier is determined by the original 3D coordinates sampled: if sampled from the coordinate set of the cup bottom, then the region identifier = cup bottom; if sampled from the coordinate set of the cup body, then the region identifier = cup body. Therefore, when labeling regions, only this region identifier needs to be read to complete the classification, without the need for additional coordinate comparison.

[0036] Furthermore, in specific implementation, the steps for generating the cup bottom diagram and the cup body diagram include: S3-7-1. Select any two nodes from the F cup bottom nodes or the G cup body nodes to form a node pair; S3-7-2. Identify the region labels of the two nodes in the node pair; S3-7-3. If both region labels are cup bottom nodes, calculate the Euclidean distance between the two nodes; S3-7-4. If all area labels are cup body nodes, calculate the surface distance between the two nodes on the paper cup surface; where the surface distance is the shortest path length along the outer surface of the cup body. The formula for calculating the surface distance is:

[0037] in: This represents the shortest path length between two nodes on the surface of the paper cup, i.e., the surface distance. Z1 and Z2 represent the absolute difference in height between the two nodes along the Z-axis, respectively, where Z1 and Z2 represent the Z coordinates of the first and second nodes. Let X and Y represent the radial distances from the two nodes to the central axis, respectively. i With y i Let X and Y represent the coordinates of the i-th node (i=1,2). It represents the minimum effective angle difference between two nodes and is used to handle periodicity in the circumferential direction; These represent the azimuth angles of the two nodes, and atan2 is the arctangent function in the four quadrants, ensuring that the angle is within the range of 0 to 2π. It represents the shortest arc length of two nodes on the same height circle.

[0038] In summary, the surface distance is equivalent to the shortest path length along the surface of the cup from one point to another. The calculation process is as follows: first, move the absolute difference in height between the two points vertically in the Z-axis direction, then move the corresponding arc length horizontally around the circumference. The two are orthogonal, and finally synthesize the total distance using the Pythagorean theorem.

[0039] S3-7-5. Compare the calculated Euclidean distance or surface distance with the corresponding preset connection threshold. S3-7-6. If the Euclidean distance or surface distance is less than the preset connection threshold, then establish a connection edge between the two nodes. The reciprocal of the Euclidean distance or surface distance is used as the edge weight of the corresponding connecting edge; otherwise, no connecting edge is established. S3-7-7. Traverse the node pairs in each of the F cup bottom nodes and the G cup body nodes to generate the cup bottom graph structure composed of the F cup bottom nodes and the cup body graph structure composed of the G cup body nodes, respectively.

[0040] In this embodiment, Euclidean distance is used for the bottom nodes of the cup, and curved surface distance is used for the body nodes, taking into account the conical structure and the periodicity of the circle. The connection relationship between nodes is established based on the distance threshold and the edge weight is set to generate a bottom graph structure and a body graph structure that conform to the physical surface characteristics of the paper cup. This ensures that the connection relationship in the graph structure accurately reflects the actual geometric proximity of the paper cup surface.

[0041] Furthermore, in specific implementation, the steps for integrating the surface diagram structure template include: S3-8-1. Identify the cup bottom edge nodes and cup body edge nodes in the adjacent boundary areas of the cup bottom diagram structure and the cup body diagram structure; Specifically, for nodes in the bottom of the cup structure, the difference between their Z-axis height and the average height of the boundary area is calculated. If the difference is less than a preset height threshold (e.g., 0.2mm), they are marked as bottom edge nodes. Similarly, edge nodes of the cup body are identified.

[0042] S3-8-2. Based on the coordinates of the boundary region, calculate the Euclidean distance between any two nodes on the bottom edge of the cup and nodes on the body edge of the cup. S3-8-3. If the Euclidean distance between the bottom edge node and the body edge node is less than the fusion tolerance threshold, the body edge node will be deleted and its connection will be merged into the corresponding bottom edge node. Wherein, the corresponding cup bottom edge node refers to the cup bottom edge node with the smallest Euclidean distance, and the fusion tolerance threshold is set to 0.1mm.

[0043] S3-8-4. For each retained cup bottom edge node, calculate its cross-regional Euclidean distance with the G cup body nodes; S3-8-5. Among the G cross-region Euclidean distances, select the smallest cross-region Euclidean distance and anchor its corresponding bottom edge node and body node. S3-8-6. Establish a cross-regional connection edge between the anchored bottom edge node and the body node of the cup, and use the reciprocal of the minimum cross-regional Euclidean distance as the edge weight of the connection edge. S3-8-7. Traverse the nodes at the bottom edge of the cup, repeatedly establish their cross-regional connecting edges and edge weights, until the bottom graph structure and the body graph structure are merged into a surface graph structure template that covers the entire surface of the paper cup.

[0044] This embodiment identifies neighboring nodes in the boundary area between the cup bottom and cup body diagrams, and uses a distance threshold to control node merging and cross-regional connections, thereby achieving seamless integration of the cup bottom and cup body diagrams and generating a unified diagram structure covering the entire surface of the paper cup. This ensures that the defect detection model can identify continuous defects that cross the boundary between the cup bottom and cup body.

[0045] Specifically, in this embodiment, the detection step S4 includes the following sub-steps: S4-1. Select the target paper cup sample from Q defective samples and P non-defective samples; S4-2. Obtain the N three-dimensional coordinates of the target paper cup sample, and the RGB features of each three-dimensional coordinate; S4-3. Substitute the N three-dimensional coordinates and their RGB features of the target paper cup sample into the surface map structure template to generate the surface map structure of the target paper cup sample. S4-4. Determine whether the sample label of the target paper cup sample is a defective label or a non-defective label; S4-5. If the label is defective, mark the surface map structure of the target paper cup sample as the surface map structure of a defective sample; otherwise, mark it as the surface map structure of a non-defective sample. S4-6. Traverse the Q defective samples and P non-defective samples, and repeat the marking process until the surface graph structure of the Q defective samples and P non-defective samples is constructed.

[0046] This embodiment maps the three-dimensional coordinates and RGB features of the paper cup sample to a predefined surface map structure template, and retains the defective or non-defective attributes of the sample label, so that the training sample presents the feature differences between defective and non-defective samples.

[0047] Specifically, in this embodiment, the detection step S5 includes the following sub-steps: S5-1. Input the surface graph structures of Q defective samples and P undefective samples into the GNN encoder, perform feature aggregation based on message passing mechanism, and output the graph-level representations of Q defective samples and P undefective samples. Specifically, feature aggregation based on message passing is a core mechanism in graph neural networks, where each node enhances its own representation by exchanging features with its neighboring nodes.

[0048] In practice, for each node in the paper cup surface graph structure, the system collects the representational features (including RGB color values ​​and 3D coordinates) of all its neighboring nodes, and performs spatial weighted aggregation of the representational features based on the edge weight of the connecting edges (i.e., the reciprocal of the distance between nodes). Since the paper cup is a continuous curved surface formed by the connection between the cup bottom and the cup body, it ensures that the closer the surface area is, the greater its visual features and geometric shape have an impact on the current node, accurately reflecting the physical properties of the paper cup surface.

[0049] Subsequently, a gating fusion mechanism is used to fuse the aggregated neighbor features with the original node features to generate an enhanced representation that retains both local details and regional context, thereby capturing common gradient defects in paper cups, such as semi-transparency changes caused by uneven cup wall thickness and slight offsets in printed patterns.

[0050] After multiple rounds of information exchange, the features of all nodes are aggregated into a global graph-level representation, which can simultaneously capture local minor defects (such as pinholes of 0.2mm and printing defects) and overall surface quality (such as cup body roundness deviation and cup bottom flatness), significantly improving the ability to identify defect patterns.

[0051] S5-2. Cluster the graph-level representations of the Q defective samples to generate K typical defect clusters; Specifically, the clustering can employ K-value clustering; for example, the clustering steps of K-value clustering are as follows: S5-2-1. From the Q defective sample graph representations, randomly select K defective sample graph representations as the first round cluster centers; S5-2-2. For any defective sample graph representation, calculate its vector distance to the K first-round cluster centers, and assign it to the first-round cluster center with the smallest vector distance; in this embodiment, the vector distance is preferably the Euclidean distance between vectors.

[0052] S5-2-3. Traverse all defective sample graph representations until each defective sample graph representation is assigned to the first-round cluster center with the minimum vector distance, forming K initial typical defect clusters; S5-2-4. Based on the graph-level representation of all defective samples within each initial typical defect cluster, calculate its cluster center vector and anchor the cluster center vector as the cluster center for the next round. S5-2-5 Calculate the vector distance between the cluster centers of the next round and the cluster centers of the first round; S5-2-6. If the vector distance is greater than the preset threshold, then the graph-level representation of all defective samples will be iteratively allocated based on the cluster center in the next round. S5-2-7. Perform the iterative allocation on the graph representations of the Q defective samples respectively until all vector distances are less than a preset threshold, and obtain K typical defect clusters.

[0053] S5-3. Perform cluster center back projection on K typical defect clusters to generate R defective paper cup training samples with defect categories. Where R represents the number of representative defective training samples selected from the original Q defective samples, and R≤Q.

[0054] S5-4. Label the P defect-free sample graph representations with defect-free categories to generate P defect-free paper cup training samples with defect-free categories. S5-5. Merge the P undefective paper cup training samples with the R defective paper cup training samples to generate a paper cup training sample set.

[0055] In this embodiment, the surface graph structure of the paper cup is aggregated by a GNN encoder to generate a graph-level representation that reflects the overall surface characteristics. The graph-level representations of defective samples are clustered to form typical defect clusters. Then, representative defective samples are selected by back-projection of the cluster centers and together with the undefective samples, a balanced training sample set is constructed.

[0056] Furthermore, in practice, the steps for generating defective paper cup training samples include: S5-3-1. Based on a predefined knowledge base of paper cup defect types, label the defect categories for K typical defect clusters; Specifically, the paper cup defect type knowledge base is a predefined defect classification database containing standard types of common paper cup defects and their characteristic descriptions. This knowledge base includes categories such as: printing defects (misalignment, missing parts, color difference), structural defects (deformation, dents, bulges), material defects (holes, cracks, stains), and joint defects (cracks at the junction of the cup bottom and body). Each defect type is associated with its visual characteristics, typical size range, and preferred location area (such as the cup body, cup bottom, or junction).

[0057] S5-3-2. Obtain the cluster center vector of each typical defect cluster to form K typical defect vectors; Among them, the typical defect vector inherits the defect category of its typical defect cluster; S5-3-3. For any typical defect vector, backtrack to the node feature layer of the GNN encoder before global pooling, and obtain the aggregated feature vector of the T nodes that contribute the most to the graph representation corresponding to the typical defect vector. Wherein, the aggregated feature vector of the T nodes is generated by weighted global pooling operation to produce the main contributors to the corresponding graph-level representation, which have the minimum distance to the cluster center vector in the feature space; T is the preset number of high contribution nodes, T≤M.

[0058] S5-3-4. Calculate the T similarities between the aggregated feature vector and the corresponding typical defect vector; The preferred similarity is cosine similarity. S5-3-5, use the T similarities as the confidence level that the corresponding node belongs to the defect category inherited by the typical defect vector; the higher the confidence level, the more likely the node is to carry the defect category inherited by the typical defect vector. Furthermore, the aggregated feature vector of the node retains its original three-dimensional coordinates and incorporates local contextual features obtained through a message passing mechanism.

[0059] S5-3-6. Select the R nodes with the highest confidence and their corresponding aggregated feature vectors to form R high-confidence nodes; Where R is the preset number of training samples, which can be set according to the model training requirements, for example, R=50.

[0060] S5-3-7. Assign the defect category corresponding to the current typical defect vector to R high-confidence nodes, and bind the three-dimensional coordinates of the high-confidence nodes to generate R defective paper cup training samples with three-dimensional coordinates and defect categories.

[0061] This embodiment backtracks the node feature layer of the GNN encoder and locates the high-confidence node that contributes the most to the cluster center. The defect category is assigned to the high-confidence node and its three-dimensional coordinates are bound to generate representative training samples that contain both defect types and spatial positioning coordinates. This ensures that the actual distribution coordinates and visual features (including color anomalies and texture distortions) of each defect category on the paper cup surface in the training sample set are accurately expressed.

[0062] Example 2: Please refer to Figure 5 The technical solution of Embodiment 2 differs from Embodiment 1 in that it discloses an online detection system for three-dimensional surface defects of paper cups. This system is used to implement the above-described method embodiments, and details already described will not be repeated. The terms "module," "unit," and "subunit" used below refer to combinations of software and / or hardware that achieve a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0063] Figure 5 This is a structural block diagram of an online detection system for three-dimensional surface defects in paper cups according to the present invention. The system includes: The sample selection unit is used to select D paper cup samples from the paper cup production database; Anchoring unit, used to anchor Q defective samples and P non-defective samples among D paper cup samples; The template definition unit is used to predefine the surface diagram structure template of the paper cup sample; The graph structure building unit is used to construct surface graph structures for Q defective samples and P defect-free samples based on a predefined surface graph structure template. The sample set construction unit is used to construct a paper cup training sample set based on the surface map structure of Q defective samples and P non-defective samples; wherein the paper cup training sample set contains P non-defective paper cup training samples and R defective paper cup training samples. The model training unit is used to input the paper cup training sample set into the graph neural network model for iterative supervised training and generate a node defect recognition model. The real-time graph structure building unit is used to select the real-time finished paper cup to be inspected and build its real-time surface graph structure based on a predefined surface graph structure template. The defect detection unit is used to input the real-time surface map structure into the node defect identification model, output the defect probability distribution of each node, and aggregate to generate the defect type and three-dimensional coordinates of each defect location of the real-time finished paper cup.

[0064] In the above system, paper cup samples are selected through the sample selection unit, defective and non-defective samples are anchored through the anchoring unit, surface graph structure templates are defined through the graph template definition unit, surface graph structures of defective and non-defective samples are constructed through the graph structure construction unit, and a paper cup training sample set is constructed through the sample set construction unit, which contains P non-defective paper cup training samples and R defective paper cup training samples. A node defect recognition model is generated through the model training unit, a real-time surface graph structure is constructed through the real-time graph structure construction unit, and a defect detection unit generates the real-time defect types and three-dimensional coordinates of each defect location of the finished paper cup, thereby improving the detection level of paper cup defects.

[0065] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable system. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means.

[0066] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. An online detection method for three-dimensional surface defects in paper cups, characterized in that, include: S1. Select D paper cup samples from the paper cup production database; S2. Anchor Q defective samples and P non-defective samples among D paper cup samples; S3, Predefined surface structure template for paper cup samples; S4. Based on a predefined surface graph structure template, construct the surface graph structures of Q defective samples and P defect-free samples. S5. Based on the surface map structures of Q defective samples and P non-defective samples, construct a paper cup training sample set; The paper cup training sample set includes P defect-free paper cup training samples and R defective paper cup training samples. S6. Input the paper cup training sample set into the graph neural network model for iterative supervised training to generate a node defect recognition model; S7. Select the real-time finished paper cup to be inspected, and construct its real-time surface map structure based on the predefined surface map structure template; S8. Input the real-time surface map structure into the node defect identification model, output the defect probability distribution of each node, and aggregate to generate the defect type and three-dimensional coordinates of each defect location of the real-time finished paper cup.

2. The online detection method for three-dimensional surface defects of paper cups according to claim 1, characterized in that, Anchor Q defective samples and P non-defective samples from D paper cup samples, including: S2-1. At the preset representative locations of D paper cup samples, obtain the surface reflectivity, local wall thickness, and local curvature. S2-2. Calculate the surface quality score of D paper cup samples based on the surface reflectance, local wall thickness and local curvature of D paper cup samples at preset representative positions. S2-3. Sort the surface quality scores of the D paper cup samples in descending order to generate a quality score sequence; S2-4. Combine the surface quality scores of two adjacent items in the quality scoring sequence in turn to form D−1 binary scoring groups; S2-5. Calculate the first difference of D-1 binary rating groups; S2-6. Identify first-order differences whose absolute values ​​are greater than a set threshold among D-1 first-order differences and mark them as significantly decreasing differences; S2-7, the binary scoring group corresponding to the anchored significant decrease difference is marked as the quality mutation scoring group; S2-8. Mark the larger scores in the quality mutation score group as high-quality scores and the smaller scores as low-quality scores; S2-9. Locate high-quality and low-quality scores in the quality score sequence, and divide the quality score sequence into high-quality and low-quality subsequences between them. Among them, the high-quality subsequence and the low-quality subsequence contain P and Q surface quality scores, respectively; S2-10. Based on high-quality and low-quality subsequences, determine P defect-free samples and Q defective samples from D paper cup samples, respectively. Among them, the defect-free samples and the defective samples are respectively labeled with binary sample labels, and the sample labels are characterized as defective labels or defect-free labels.

3. The online detection method for three-dimensional surface defects of paper cups according to claim 2, characterized in that, A predefined surface structure template for paper cup samples, including: S3-1. Obtain N three-dimensional coordinates of the surface of the paper cup sample, and the RGB features of each three-dimensional coordinate; S3-2. Identify the coordinates of the boundary area between the bottom and the body of the cup in N three-dimensional coordinates; S3-3. Based on the coordinates of the boundary region, divide the N three-dimensional coordinates into a set of coordinates for the bottom of the cup and a set of coordinates for the body of the cup; S3-4. Uniformly sample the three-dimensional coordinates of the cup bottom coordinate set and the cup body coordinate set to obtain M uniform sampling points; S3-5. Define the M uniform sampling points as nodes of the graph structure, and use their three-dimensional coordinates and RGB features as node features to generate M unconnected nodes. S3-6. Label the M unconnected nodes with region labels to generate F cup bottom nodes and G cup body nodes; S3-7. Establish connecting edges and set edge weights in the F cup bottom nodes and G cup body nodes respectively to generate the cup bottom graph structure and the cup body graph structure; S3-8. Merge the bottom image structure and the body image structure of the cup to generate a surface image structure template for the paper cup sample.

4. The online detection method for three-dimensional surface defects of paper cups according to claim 3, characterized in that, The generation of F cup bottom nodes and G cup body nodes includes: S3-6-1. Select a target node from M unconnected nodes; S3-6-2. Identify the source coordinate set of the uniform sampling points corresponding to the target node; S3-6-3. If the source coordinate set of the target node is the bottom coordinate set, then label its region as the bottom node; if the source coordinate set is the body coordinate set, then label it as the body node. S3-6-4. Traverse the M unconnected nodes and repeatedly perform the region labeling to generate F cup bottom nodes and G cup body nodes, where F+G=M.

5. The online detection method for three-dimensional surface defects of paper cups according to claim 3, characterized in that, The generation of the cup bottom image structure and the cup body image structure includes: S3-7-1. Select any two nodes from the F cup bottom nodes or the G cup body nodes to form a node pair; S3-7-2. Identify the region labels of the two nodes in the node pair; S3-7-3. If the region labels are all cup bottom nodes, then calculate the Euclidean distance between the two nodes. S3-7-4. If all area labels are cup body nodes, calculate the surface distance between the two nodes on the paper cup surface; where the surface distance is the shortest path length along the outer surface of the cup body. S3-7-5. Compare the calculated Euclidean distance or surface distance with the corresponding preset connection threshold. S3-7-6. If the Euclidean distance or surface distance is less than the preset connection threshold, then establish a connection edge between the two nodes and obtain the reciprocal of the Euclidean distance or surface distance as the edge weight of the corresponding connection edge; otherwise, do not establish a connection edge. S3-7-7. Traverse the node pairs in each of the F cup bottom nodes and the G cup body nodes to generate the cup bottom graph structure composed of the F cup bottom nodes and the cup body graph structure composed of the G cup body nodes, respectively.

6. The online detection method for three-dimensional surface defects of paper cups according to claim 3, characterized in that, The surface map structure of the generated paper cup sample includes: S3-8-1. Identify the cup bottom edge nodes and cup body edge nodes in the adjacent boundary areas of the cup bottom diagram structure and the cup body diagram structure; S3-8-2. Based on the coordinates of the boundary region, calculate the Euclidean distance between any two nodes on the bottom edge of the cup and nodes on the body edge of the cup. S3-8-3. If the Euclidean distance between the bottom edge node and the body edge node is less than the fusion tolerance threshold, the body edge node will be deleted and its connection will be merged into the corresponding bottom edge node. S3-8-4. For each retained cup bottom edge node, calculate its cross-regional Euclidean distance with the G cup body nodes; S3-8-5. Among the G cross-region Euclidean distances, select the smallest cross-region Euclidean distance and anchor its corresponding bottom edge node and body node. S3-8-6. Establish a cross-regional connection edge between the anchored bottom edge node and the body node of the cup, and use the reciprocal of the minimum cross-regional Euclidean distance as the edge weight of the connection edge. S3-8-7. Traverse the nodes at the bottom edge of the cup, repeatedly establish their cross-regional connecting edges and edge weights, until the bottom graph structure and the body graph structure are merged into a surface graph structure template that covers the entire surface of the paper cup.

7. The online detection method for three-dimensional surface defects of paper cups according to claim 4, characterized in that, The construction of the surface map structure of Q defective samples and P defect-free samples includes: S4-1. Select the target paper cup sample from Q defective samples and P non-defective samples; S4-2. Obtain the N three-dimensional coordinates of the target paper cup sample, and the RGB features of each three-dimensional coordinate; S4-3. Substitute the N three-dimensional coordinates and their RGB features of the target paper cup sample into the surface map structure template to generate the surface map structure of the target paper cup sample. S4-4. Determine whether the sample label of the target paper cup sample is a defective label or a non-defective label; S4-5. If the label is defective, mark the surface map structure of the target paper cup sample as the surface map structure of a defective sample; otherwise, mark it as the surface map structure of a non-defective sample. S4-6. Traverse the Q defective samples and P non-defective samples, and repeat the marking process until the surface graph structure of the Q defective samples and P non-defective samples is constructed.

8. The online detection method for three-dimensional surface defects of paper cups according to claim 7, characterized in that, The construction of the paper cup training sample set includes: S5-1. Input the surface graph structures of Q defective samples and P undefective samples into the GNN encoder, perform feature aggregation based on message passing mechanism, and output the graph-level representations of Q defective samples and P undefective samples. S5-2. Cluster the graph-level representations of the Q defective samples to generate K typical defect clusters; S5-3. Perform cluster center back projection on K typical defect clusters to generate R defective paper cup training samples with defect categories. S5-4. Label the P defect-free sample graph representations with defect-free categories to generate P defect-free paper cup training samples with defect-free categories. S5-5. Merge the P undefective paper cup training samples with the R defective paper cup training samples to generate a paper cup training sample set.

9. The online detection method for three-dimensional surface defects of paper cups according to claim 8, characterized in that, The construction of R training samples of defective paper cups with defect categories includes: S5-3-1. Based on a predefined knowledge base of paper cup defect types, label the defect categories for K typical defect clusters; S5-3-2. Obtain the cluster center vector of each typical defect cluster to form K typical defect vectors; Among them, the typical defect vector inherits the defect category of its typical defect cluster; S5-3-3. For any typical defect vector, backtrack to the node feature layer of the GNN encoder before global pooling, and obtain the aggregated feature vector of the T nodes that contribute the most to the graph representation corresponding to the typical defect vector. S5-3-4. Calculate the T similarities between the aggregated feature vector and the corresponding typical defect vector; S5-3-5, Use the T similarity scores as the confidence that the corresponding node belongs to the defect category inherited by the typical defect vector; S5-3-6. Select the R nodes with the highest confidence and their corresponding aggregated feature vectors to form R high-confidence nodes; S5-3-7. Assign the defect category corresponding to the current typical defect vector to R high-confidence nodes, and bind the three-dimensional coordinates of the high-confidence nodes to generate R defective paper cup training samples with three-dimensional coordinates and defect categories.

10. An online detection system for three-dimensional surface defects of paper cups, comprising the detection method according to any one of claims 1 to 9, characterized in that, include: The sample selection unit is used to select D paper cup samples from the paper cup production database; Anchoring unit, used to anchor Q defective samples and P non-defective samples among D paper cup samples; The template definition unit is used to predefine the surface diagram structure template of the paper cup sample; The graph structure building unit is used to construct surface graph structures for Q defective samples and P defect-free samples based on a predefined surface graph structure template. The sample set construction unit is used to construct a paper cup training sample set based on the surface map structure of Q defective samples and P non-defective samples. The paper cup training sample set includes P defect-free paper cup training samples and R defective paper cup training samples. The model training unit is used to input the paper cup training sample set into the graph neural network model for iterative supervised training and generate a node defect recognition model. The real-time graph structure building unit is used to select the real-time finished paper cup to be inspected and build its real-time surface graph structure based on a predefined surface graph structure template. The defect detection unit is used to input the real-time surface map structure into the node defect identification model, output the defect probability distribution of each node, and aggregate to generate the defect type and three-dimensional coordinates of each defect location of the real-time finished paper cup.