Real-time defect detection and self-adaptive repair method for additive manufacturing

Through deep learning technology, the powder laying process in additive manufacturing is monitored in real time, and defect repair is identified and adaptively repaired, which solves the problem of lack of real-time defect detection and adaptive repair in the prior art, and improves print quality and part repair efficiency.

CN120205836APending Publication Date: 2025-06-27WUHAN UNIV
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202510357813.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-06-27

Smart Images

  • Figure CN120205836A_ABST
    Figure CN120205836A_ABST
Patent Text Reader

Abstract

The invention provides a real-time defect detection and self-adaptive repair method for additive manufacturing, which belongs to the technical field of additive manufacturing and comprises the following steps: capturing an image of a powder bed after powder spreading; identifying powder spreading defects in each layer of image after powder spreading, and fitting a bounding box according to the category and position information of the powder spreading defects; taking the interior of the contour boundary corresponding to the slice of the current layer as a key printing area, comparing a bounding box with the key printing area, judging whether the bounding box coincides with the key printing area or not, if so, triggering a self-adaptive repair mechanism, and if not, performing a laser scanning action; after printing is completed, an image of the printed part is extracted and processed, the edge contour of the printed part of the current layer is extracted through a trained network edge detection algorithm, and registration and overlapping comparison are conducted on the edge contour and the design contour of the slice of the current layer; and calculating the area deviation between the edge contour of the printing part of the current layer and the design contour of the slice of the current layer, and deciding to pause or continue printing according to the area deviation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of additive manufacturing, and particularly to a method for real-time defect detection and adaptive repair in additive manufacturing. Background Art

[0002] Additive Manufacturing (AM) is a manufacturing technology that fabricates three-dimensional objects by layer-by-layer material deposition, and is widely used in fields such as aerospace, medical devices, and automotive manufacturing. Selective Laser Melting (SLM), as an important technology in additive manufacturing, melts metal powder layer by layer with a high-power laser beam to form high-density metal components. The quality control of the powder spreading process has a decisive impact on the performance and accuracy of the final part.

[0003] During the SLM process, powder spreading is the basic step for forming each layer of the metal part. The powder spreading quality directly affects the uniformity and accuracy of subsequent laser melting, and thus affects the density, surface quality, and mechanical properties of the overall part. If powder spreading defects are not detected and repaired in time, it may lead to internal pores, dimensional deviations, incomplete structures in the part, or even overall forming failure. Therefore, real-time and accurate powder spreading defect detection and control have become the key links for quality assurance in SLM technology. Existing technologies mainly rely on image processing and machine learning to monitor the overall quality of the powder spreading layer, ignoring the detailed analysis of the printed part contour. Moreover, powder spreading detection lacks the associated analysis of the printed part area and cannot detect whether the powder spreading defect is located in the key printing area, resulting in the inability to repair the powder spreading defect targeted, affecting the precise repair of the powder spreading defect, and may also affect the quality and repair efficiency of subsequent printing layers.

[0004] Therefore, it is necessary to provide a method for real-time defect detection and adaptive repair in additive manufacturing to identify the defects in the powder spreading process of each layer in real time, compare the defect location with the current printed model file, and decide whether to re-spread the powder for repair, which is very necessary for improving the printing quality and the repair efficiency of the part. Summary of the Invention

[0005] In view of this, the present invention proposes a method for real-time defect detection and adaptive repair in additive manufacturing that applies deep learning to real-time monitoring and automatically identifies and intervenes in defects through a layer-by-layer printing quality control decision logic.

[0006] The technical solution of the present invention is realized as follows: On the one hand, the present invention provides a method for real-time defect detection and adaptive repair in additive manufacturing, including the following steps:

[0007] S1: Capture an image after powder bed spreading;

[0008] S2: Based on the trained object detection algorithm, identify the powder spreading defects in the image after each layer of powder spreading, mark and store the category and position information of each powder spreading defect in the image, and fit the bounding box of the powder spreading defect;

[0009] S3: Take the inside of the design contour boundary of the current layer slice as the key printing area; compare the bounding box with the key printing area to determine whether the bounding box coincides with the key printing area. If so, trigger the adaptive repair mechanism; if not, perform the laser scanning printing action;

[0010] S4: After printing is completed, capture the image of the printed part, and use the trained network edge detection algorithm to extract the edge contour of the printed part of the current layer;

[0011] S5: Register and overlap compare the extracted edge contour of the printed part of the current layer with the design contour of the current layer slice;

[0012] S6: Calculate the area deviation between the edge contour of the printed part of the current layer and the design contour of the current layer slice according to the results of the registration and overlap comparison, and decide whether to pause printing or continue printing based on the area deviation.

[0013] Furthermore, the training process of the object detection algorithm in step S2 includes the steps of:

[0014] Collect defect images, including defect images captured by industrial cameras in real-time monitoring and sample images taken under laboratory conditions;

[0015] Preprocess the defect images;

[0016] Use annotation tools to annotate the defect areas of the defect images, draw bounding boxes and annotate the categories of the defects. After reviewing the annotated data to ensure accuracy, convert the annotated defect images into the image files and several label files required by the object detection algorithm. The several label files include the numbers of the defect categories and the coordinate information of the bounding boxes; Data annotation is the basis for system construction. By collecting defect image data during the powder spreading process, different types of defects are covered;

[0017] Divide the collected annotated data into a training set, a validation set and a test set. By iteratively optimizing the parameters of the object detection algorithm, use the training set to update the parameters, and use the validation set to monitor the performance of the object detection algorithm until the training is completed to obtain the trained object detection algorithm.

[0018] Furthermore, the powder spreading defects include insufficient powder spreading, pits, protrusions and grooves;

[0019] Insufficient powder spreading: Incomplete diffusion of powder on the substrate due to insufficient powder supply to the powder dispenser;

[0020] Pit: discrete concave holes on the image;

[0021] Protrusion: uneven powder spreading layer, resulting in excessive local powder accumulation;

[0022] Groove: depression caused by damaged blade or particles dragging across the powder bed.

[0023] Furthermore, the comparison between the bounding box and the key printing area includes the steps of:

[0024] Calibrate the image of the powder spreading layer obtained by shooting. The calibration process includes determining the internal and external parameters of the industrial camera to correct the distortion in the image;

[0025] Establish a mapping relationship between the image pixel coordinates and the coordinates of the slice file of the current layer to align the two-dimensional image with the two-dimensional slice data;

[0026] Judge whether there is an overlapping area between the bounding box of the powder spreading defect and the key printing area. If there is an overlapping area, it is determined that the powder spreading quality of the current layer is unqualified and has an impact on the subsequent printing quality, and the corresponding repair mechanism is automatically triggered; if there is no overlapping area, it is considered that the powder spreading defect will not affect the printed part of the current layer.

[0027] Furthermore, the triggering of the adaptive repair mechanism includes the steps of:

[0028] S31. Re-spread the powder according to the defect category by matching the corresponding moving speed and powder feeding coefficient to repair the powder spreading defect. Set the default moving speed of the blade as V1 and the initial powder feeding coefficient of the powder dispenser as G1. The moving speeds and powder feeding coefficients matched for different defects are specifically as follows:

[0029] If the defect is a protrusion, the matched moving speed is the set moving speed V1, and the matched powder feeding coefficient is the initial powder feeding coefficient G1;

[0030] If the defect is a groove, the matched moving speed is V2 and the powder feeding coefficient is G2;

[0031] If the defect is a pit, the matched moving speed is V3 and the powder feeding coefficient is G3;

[0032] If the defect is insufficient powder spreading, the matched moving speed is V4 and the powder feeding coefficient is G4;

[0033] V1 > V2 > V3 > V4, G1 < G2 < G3 < G4, where V1, V2, V3, V4 decrease in gradient, and G1, G2, G3, G4 increase in gradient;

[0034] S32. After the recoating is completed, detect the recoating defects again. If the recoating defects still exist after recoating and there is still an overlapping area between the bounding box of the recoating defects and the key printing area, pause the current printing process and perform an alarm process; if the recoating defects still exist after recoating, but the bounding box of the recoating defects does not overlap with the key printing area, or the recoating defects are eliminated after recoating, continue with the printing of the current layer.

[0035] Further, the step of matching the corresponding moving speed and powder feeding coefficient according to the type of defect to recoat and repair the recoating defects includes the following steps:

[0036] The object detection algorithm can also output the confidence level corresponding to the defect. After the defect type matches the corresponding moving speed and powder feeding coefficient, it is dynamically corrected according to the confidence level values corresponding to different defects. Specifically, on the basis of the matched powder feeding coefficient, increase or decrease the change amount ΔG x , and increase or decrease ΔV on the basis of the matched moving speed x for adjustment;

[0037] When C≥0.8, increase by 20% on the basis of the matched powder feeding coefficient and decrease the speed by 20% on the basis of the matched moving speed;

[0038] When 0.5≤C<0.8, ΔG x =G x ×[1 + 0.2×(C - 0.5) / 0.3]; ΔV x =V x ×[1 - 0.2×(C - 0.5) / 0.3];

[0039] When C<0.5, ΔG x =G x ×[1 + 0.1C / 0.5], ΔV x =V x ×[1 - 0.1C / 0.5];

[0040] where x = 1, 2, 3, 4 correspond to four defect types of protrusion, groove, pit and insufficient powder coating respectively.

[0041] Further, the network edge detection algorithm is configured with an input layer, a convolutional neural network, a Transformer encoder, a sparse self-attention mechanism, an edge detection layer and a decoder; among them:

[0042] The input layer preprocesses the image of the printed part of the current layer;

[0043] Input the preprocessed image of the printed part into the convolutional neural network for local feature extraction;

[0044] After local feature extraction, the feature map of the image is passed to the Transformer encoder, which combines the local information and global information of the image of the printed part, fuses the global features and local features, and extracts the global features of the image;

[0045] The edge detection layer enhances the edge features in the image of the printed part through an edge detection algorithm;

[0046] The decoder maps the feature processed by the edge detection layer back to the image of the printed part to generate the edge contour of the printed part in the current layer.

[0047] Furthermore, the input layer preprocesses the image of the printed part in the current layer through brightness adaptive adjustment, contrast adaptive adjustment, and denoising, where:

[0048] Brightness adaptive adjustment includes: calculating the difference ΔL between the average brightness of each pixel in the image of the printed part in the current layer and the standard brightness, and setting a brightness difference threshold L th , for pixels whose brightness value exceeds the brightness difference threshold L th , dynamically adjusting the brightness value to make the brightness distribution of the entire image of the printed part more uniform. The setting of the brightness difference threshold L th is based on the following formula:

[0049] L th = L avg + α × σ L ;

[0050] where, L avg is the average brightness of the image, with a value range of 0 to 255; σ L is the standard deviation of brightness, representing the degree of brightness dispersion, with a value range of 0 to 100; α is the sensitivity coefficient, with a value range of 0.5 to 2;

[0051] When the brightness difference ΔL in a certain area of the image is greater than the brightness difference threshold L th , the following formula is used to adjust the brightness:

[0052] L adj = L ori + β × ΔL;

[0053] where, L ori is the original brightness value, L adj is the adjusted brightness value, and β is the brightness adjustment amplitude; Contrast adaptive adjustment includes: obtaining the maximum value G max and minimum value G min of the gray levels of each pixel in the image of the printed part. When the maximum value G max and minimum value Gmin The difference Δgary is less than the set grayscale difference threshold Δgary th When this occurs, the contrast is enhanced by the linear stretching method to make the edges of the image of the printed part more prominent, where the grayscale difference Δgary is calculated according to the following formula:

[0054] Δgary = G max - G min ;

[0055] Δgary th is set according to the following formula:

[0056] Δgary th = μG + κ × σ G ;

[0057] where μG is the mean value of the image grayscale value, and its value range is 50 - 200; σ G is the standard deviation of the image grayscale value, and its value range is 10 - 80; κ is the enhancement coefficient, and its value range is 1 - 2;

[0058] The specific formula of the linear stretching method is:

[0059]

[0060] where G i represents the original grayscale value of each pixel in the image, and G new represents the adjusted grayscale value;

[0061] Denosing: Use Gaussian filtering to smooth the image of the printed part, and use the adaptive filtering method to dynamically adjust the filtering intensity according to the pixel values in the local area. While eliminating noise, the edge features in the image of the printed part are retained.

[0062] Furthermore, the registration and overlap comparison in step S5 includes the steps of:

[0063] According to the mapping relationship between the image pixel coordinates and the coordinates of the current layer slice, the edge contour of the printed part in the current layer and the design contour of the current layer slice are converted into the same two-dimensional coordinate system;

[0064] Taking a vertex of the edge contour of the printed part in the current layer and at least one side line where the vertex is located as the adjustment object, through rotation and / or translation operations, using the corresponding vertex and side line of the design contour of the current layer slice as a reference for alignment.

[0065] Furthermore, step S6 includes the steps of:

[0066] S61. Calibrate the conversion relationship between pixels and physical units in advance, and place a standard in the captured image

[0067] a reference object of a size, with the physical area of the reference object being A2, measuring the pixel area A1 of the reference object in the image, and obtaining the conversion relationship A between pixels and physical units:

[0068] A = A2 / A1;

[0069] S62. Convert the edge contour of the printed part of the current layer into a closed contour, use the cv2.contourArea function of OpenCV to calculate the pixel area B1 of the edge contour of the printed part of the current layer, and then convert the pixel area B1 of the edge contour of the printed part of the current layer into a physical area B2 according to the following formula:

[0070] B2 = B1 × A;

[0071] S63. Extract the design contour of the current layer slice for projection, ensure that the direction of the projection view is consistent with the shooting direction of the edge contour of the printed part of the current layer, convert the projection of the design contour of the current layer slice into a grayscale image, detect the edge and extract the largest contour in the grayscale image, close the largest contour in the grayscale image, use the cv2.contourArea function of OpenCV to calculate the pixel area C1 corresponding to the largest contour in the grayscale image, and obtain the design model area C2 corresponding to the design contour of the current layer slice according to the conversion relationship,

[0072] C2 = C1 × A;

[0073] S64. Judge the deviation between the physical area B2 of the edge contour of the printed part of the current layer and the design model area C2 corresponding to the design contour of the current layer slice;

[0074] Let the deviation between the physical area B2 of the edge contour of the printed part of the current layer and the design model area C2 corresponding to the design contour of the current layer slice be ΔS,

[0075]

[0076] Define the deviation preset value as S T , when |ΔS| ≤ S T , it is determined that the size is qualified; when |ΔS| > S T , it is determined that the size is unqualified, and the operator is notified to check and adjust. The value range of S T is 3% - 5%.

[0077] On the other hand, the present invention also provides a computer-readable storage medium, on which a program for an additive manufacturing real-time defect detection and adaptive repair method is stored. When the method program is executed by a computer, the above-mentioned additive manufacturing real-time defect detection and adaptive repair method is implemented.

[0078] The additive manufacturing real-time defect detection and adaptive repair method provided by the present invention has the following beneficial effects compared with the prior art:

[0079] (1) The present invention utilizes deep learning object detection and edge detection models to achieve real-time detection of powder spreading defects and part contours. Compared with traditional rule-based image processing methods, it has higher robustness and accuracy, and is particularly suitable for complex powder bed surfaces and the dynamic environment of printed parts.

[0080] (2) Compared with the printing process with fixed parameters in the prior art, the present invention realizes dynamic adjustment of printing parameters through layer-by-layer quality monitoring and dimensional deviation analysis, which can effectively reduce the probability of printing defects and dimensional tolerances exceeding, and improve the quality consistency of printed parts. When serious defects are detected, the present invention can attempt to repair them. If the defects still exist after repair, the printing will be automatically paused and the operator will be prompted to intervene. Compared with the traditional method that completely relies on manual inspection, the efficiency and intelligence level of the printing process are significantly improved.

[0081] (3) The network edge detection algorithm EDTER can effectively cope with common image quality problems in the additive manufacturing process, such as uneven illumination, defocusing, and noise interference, by introducing a brightness / contrast adjustment and noise filtering module. The brightness and contrast adjustment ensure that the image remains clear under different lighting and shooting conditions, while the noise filtering module effectively removes the noise that may appear during the printing process, making the image cleaner. In this way, the image after these optimization processes can provide a more accurate basis for subsequent edge detection, thereby improving the geometric shape detection accuracy of 3D printed parts, ensuring that the differences from the design model can be accurately evaluated, realizing quantitative secondary measurement, and adding a sparse attention mechanism that only focuses on the correlation within adjacent regions of the image, thus significantly reducing the computational amount, improving the detection speed of the network, and ensuring real-time detection.

[0082] (4) By recording the defect detection data, dimensional deviations, and repair operations of each layer during the printing process, a detailed quality report can be further generated, providing data support for process improvement and quality traceability, while the prior art usually lacks systematic full-process tracking capabilities. Description of the Drawings

[0083] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0084] Figure 1 This is a flowchart of a real-time defect detection and adaptive repair method for additive manufacturing according to the present invention;

[0085] Figure 2 This is a flowchart of powder spreading defect detection and adaptive repair according to the present invention;

[0086] Figure 3 This is a schematic diagram for judging whether there is an overlapping area between the bounding box of the powder spreading defect and the key printing area in a real-time defect detection and adaptive repair method for additive manufacturing according to the present invention;

[0087] Figure 4 This is a schematic diagram for extracting the designed contour of the current layer slice and the edge contour of the current layer part in a real-time defect detection and adaptive repair method for additive manufacturing according to the present invention;

[0088] Figure 5 This is an example picture of the powder spreading defect in a real-time defect detection and adaptive repair method for additive manufacturing according to the present invention;

[0089] Figure 6 This is a flowchart for defect detection of the current layer printed part;

[0090] Figure 7 This is a schematic diagram of the relative positions of the devices in a real-time defect detection and adaptive repair method for additive manufacturing according to the present invention;

[0091] Figure 8 This is a structural block diagram of a network edge detection algorithm. Detailed implementation manners

[0092] Next, in combination with the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0093] As Figures 1-7 shown, the present invention provides a real-time defect detection and adaptive repair method for additive manufacturing, including the following steps:

[0094] S1: Capture the image after powder bed spreading.

[0095] During the SLM printing process, a high-resolution industrial camera is used to capture the image after spreading each layer of powder in real time.

[0096] S2: Process the image after powder spreading based on the trained object detection algorithm, identify the powder spreading defects in the image after each layer of powder spreading, mark and store the category and position information of each powder spreading defect in the image, and fit the bounding box of the powder spreading defect.

[0097] Among them, the training process of the object detection algorithm includes the following:

[0098] Collect defect images, where the defect images include defect images captured by industrial cameras in real-time monitoring and sample images taken under laboratory conditions;

[0099] Process the defect images, including random cropping, rotation, scaling, flipping, or color transformation, to increase the diversity of defect image data;

[0100] Use annotation tools to annotate the defect regions of the defect images, draw bounding boxes and annotate the categories of the defects. After verifying the accuracy of the annotated data, convert the annotated defect images into the image files and several label files required by the object detection algorithm. The several label files include the numbers of defect categories and the coordinate information of the bounding boxes;

[0101] Divide the collected annotated data into a training set, a validation set, and a test set. By iteratively optimizing the parameters of the object detection algorithm, use the training set to update the parameters, and use the validation set to monitor the performance of the object detection algorithm until the training is completed to obtain the trained object detection algorithm.

[0102] Detect powder spreading defects using image processing and analysis techniques. Such methods can intuitively capture the state of the powder spreading layer, with high real-time performance and flexibility. However, their detection accuracy and anti-interference ability depend on the advancement of the image processing algorithm and the stability of the ambient light conditions; use a variety of sensor technologies such as laser scanning, optical sensors, or thermal imaging to monitor the powder distribution, thickness, and density during the powder spreading process. These methods can provide quantitative powder spreading parameters, which helps to precisely control the powder spreading quality. However, the installation and calibration complexity of the sensors is relatively high, and they may be affected by the equipment environment. In recent years, with the development of artificial intelligence technology, defect detection methods based on machine learning and deep learning have gradually become a research hotspot. By training a model to identify and classify powder spreading defects, efficient and accurate defect detection can be achieved.

[0103] Powder spreading defects include insufficient powder spreading, pits, protrusions, and grooves; specifically:

[0104] Insufficient powder spreading: The amount of powder supplied to the powder dispenser is insufficient, and the powder does not spread completely on the substrate; Morphological constraints of insufficient powder spreading: The area of insufficient powder spreading usually presents a locally uneven thin layer or an area completely without powder coverage. Morphologically, it may present obvious linear, patchy, or large-scale bare areas. See the situation of insufficient powder spreading inFigure 5 Upper left view.

[0105] Pit: Discrete concave holes on the image. There are gaps during powder spreading, and due to vibration, the powder spreading is not dense; Morphological constraints of pits: The pit area usually shows a sunken shape, with different sizes and depths. It can be isolated small pits or long strip-shaped trenches. The edges of the pits are usually more regular, and the shapes are irregular circles or ellipses. For the situation of pits, see Figure 5 Upper right view.

[0106] Protrusion: The powder spreading layer is uneven, resulting in excessive local powder accumulation; Morphological constraints of protrusions: The protrusion area usually shows a relatively high local accumulation form, and may form circular or irregular protrusions. The powder layer in the local area is significantly thicker than the surrounding area, and the edges are relatively blurred, which may cause the powder accumulation in some areas to form small ridge-like protrusions. For the situation of protrusions, see Figure 5 Lower left view.

[0107] Groove: A depression caused by a damaged blade or particles dragging across the powder bed. Morphological constraints of grooves: Groove-like defects usually show linear or curved shapes, with relatively shallow depths and unequal widths, and may present continuous or intermittent groove shapes. The edges of the grooves are relatively sharp, and the depth and width vary with the degree of friction of the blade, and are commonly found in the scratched or abraded areas of the powder bed. For the situation of grooves, see Figure 5 Lower right view.

[0108] As a specific embodiment, the method for detecting powder spreading defects in the image after each layer of powder spreading provided by the present invention is based on the trained YOLOV9 object detection algorithm. The YOLOV9 (You Only Look Once version 9) object detection algorithm specifically includes accurately identifying various defects in the powder spreading layer, and the detection speed meets the requirements of real-time detection without affecting the normal printing process. The entire system includes key links such as data annotation, model training, weight file conversion, and deployment and invocation in the C# environment. The training process of the YOLOV9 object detection algorithm includes the following content:

[0109] Collect defect images, including defect images captured by real-time monitoring of industrial cameras and sample images taken under laboratory conditions;

[0110] Process the defect images. To improve the robustness and generalization ability of the training model, it includes random cropping, rotation, scaling, flipping, or color transformation to increase the diversity of defect image data; it can reduce the model's dependence on specific data patterns and prevent overfitting.

[0111] Using an annotation tool, annotate the defect areas of the defect images, draw bounding boxes and label the defect categories. After reviewing the annotated data to ensure accuracy, convert the annotated defect images into the image files and several label files required by the YOLOV9 object detection algorithm. The several label files include the numbers of defect categories and the coordinate information of the bounding boxes. Data annotation is the foundation of system construction. A large amount of defect image data during the powder spreading process was collected from the actual production line, and these images cover a variety of defect pictures. Use professional data annotation tools such as LabelImg, and then accurately annotate the defect areas in each image, draw bounding boxes and indicate the corresponding defect categories. These annotated data are strictly reviewed to ensure their accuracy and consistency, and then converted into image files in the format required by the YOLOV9 model and several txt-format label files. The several label files contain category numbers and the coordinate information of the bounding boxes for subsequent training.

[0112] Divide the collected annotated data into a training set, a validation set, and a test set. By iteratively optimizing the parameters of the object detection algorithm, use the training set to update the parameters and use the validation set to monitor the performance of the object detection algorithm until the training is completed to obtain the trained YOLOV9 object detection algorithm.

[0113] During the training process, first configure the training environment for deep learning, including installing the PyTorch framework, configuring CUDA to support GPU-accelerated computing, and installing relevant dependency libraries to optimize the training efficiency. The collected annotated data set is reasonably divided into a training set, a validation set, and a test set. Usually, 80% is used for the training set, 10% for the validation set, and 10% for the test set to ensure that the YOLOV9 object detection algorithm has good generalization ability. In the architecture configuration of the YOLOV9 object detection algorithm, adjust the size of the input image, the batch size, the learning rate, and the choice of optimizer according to specific application requirements, and optimize the depth and width of the model to balance accuracy and computing resources. Key performance indicators such as the loss value, the mean average precision (mAP), and the recall rate are continuously monitored and recorded to guide the adjustment and optimization of the model. Finally, a YOLOV9 model with excellent performance in various powder spreading defect detections is trained.

[0114] After the training is completed, the weight file of the YOLOV9 object detection algorithm is saved in the PT format of PyTorch for subsequent conversion and deployment. To achieve cross-platform applications, the PT weight file needs to be converted into the ONNX (Open Neural Network Exchange) format. The conversion process includes loading the trained model and defining the shape of the input tensor. This conversion step ensures the compatibility of the model in different programming environments, enabling it to be efficiently called in a C# language environment. Specifically, libraries that support ONNX such as ONNX Runtime are used to load the converted ONNX model in a C# project to implement defect detection for real-time or batch images. The category and location information of each powder spreading defect in the image are recorded and stored together to form a detailed defect detection report.

[0115] S3: Take the inside of the design contour boundary of the current layer slice as the key printing area; compare the bounding box with the key printing area to determine whether the bounding box coincides with the key printing area. If so, trigger the adaptive repair mechanism; if not, perform the laser scanning printing action.

[0116] Specifically, the powder-spread image obtained by shooting is calibrated. The calibration process includes determining the internal and external parameters of the industrial camera to correct the distortion in the image, establishing the mapping relationship between the image pixel coordinates and the coordinates of the current layer slice, and realizing the alignment of the two-dimensional image and the two-dimensional slice data.

[0117] As Figure 3 shown, the bounding box of the powder spreading defect is obtained according to the method in step S2; judge whether there is an overlapping area between the bounding box of the powder spreading defect and the key printing area. If there is an overlapping area, it is determined that the powder spreading quality of the current layer is unqualified and has an impact on the subsequent printing quality, and the corresponding repair mechanism is automatically triggered; if there is no overlapping area, it is considered that the powder spreading defect will not affect the printed part of the current layer.

[0118] Execute the corresponding repair mechanism, including the following content:

[0119] The default moving speed of the doctor blade is V1, and the gradient speeds corresponding to the four types of defects, namely protrusion, groove, pit, and insufficient powder spreading, are V1, V2, V3, and V4 respectively, where V1 > V2 > V3 > V4; the initial powder feeding coefficient of the powder dispenser is G1, and the gradient powder feeding coefficients corresponding to the four types of defects, namely protrusion, groove, pit, and insufficient powder spreading, are G1, G2, G3, and G4 respectively, where G1 < G2 < G3 < G4; when re-spreading the powder for the powder spreading defect, first identify the type and confidence level C of the powder spreading defect, where C ∈ [0, 1]: according to the confidence level and defect type, select the parameters such as the doctor blade speed, powder feeding coefficient, change in gradient speed, and gradient powder feeding coefficient when re-spreading the powder according to Table 1. For the protrusion defect, the doctor blade speed is the default speed and the powder feeding coefficient is also the default value, while the powder spreading parameters for the groove, pit, and insufficient powder spreading are obtained according to Table 1.

[0120] The powder feeding coefficient refers to the ratio of the actually supplied powder amount to the theoretically required powder amount during the forming process per unit area or unit volume. For example, if the theoretically required powder amount of the equipment is set to 0.03 mm, the powder feeding coefficient is equivalent to how many times this value is.

[0121] In Table 1, ΔV x is the change in the gradient speed; ΔG x is the gradient powder feeding coefficient, and x = 1, 2, 3, 4 respectively correspond to the four types of defect types, namely protrusion, groove, pit, and insufficient powder spreading.

[0122] For example, if the default moving speed of the doctor blade V1 = 100 mm / s, the set gradient speed when re-spreading the powder for the protrusion defect is V1, the gradient speed V2 = 90 mm / s when re-spreading the powder for the groove defect, the gradient speed V3 = 80 mm / s when spreading the powder for the pit, and the gradient speed V4 = 70 mm / s when re-spreading the powder for the insufficient powder spreading defect.

[0123] Table 1 Rules for dynamic adjustment of parameters when re-spreading the powder

[0124]

[0125] When re-spreading the powder, by identifying the defect type and confidence level C ∈ [0, 1]: if a protrusion is detected, then maintain G1 = 1.0 and V1 = 100 mm / s; for the other three types of defects, first match the reference parameters, groove: G2 = 1.2, V2 = 90 mm / s, pit: G3 = 1.4, V3 = 80 mm / s, insufficient powder spreading: G4 = 1.6, V4 = 70 mm / s, and then dynamically correct according to the confidence level. When C ≥ 0.8, increase the reference powder feeding coefficient by 20% and decrease the speed by 20%. For example, for the pit, it is corrected to ΔG3 = 1.4 × 1.2 = 1.68 and ΔV3 = 80 × 0.8 = 64 mm / s; when 0.5 ≤ C < 0.8, according to ΔG x = G x×[1 + 0.2×(C - 0.5) / 0.3] and ΔV x = V x ×[1 - 0.2×(C - 0.5) / 0.3] adjustment;

[0126] When the groove defect groove C = 0.6, ΔG2 = 1.2×[1 + 0.2×(0.6 - 0.5) / 0.3] = 1.24, ΔV2 = 90×[1 - 0.2×(0.6 - 0.5) / 0.3] = 88.5 mm / s; when C < 0.5, according to ΔG x = G x ×[1 + 0.1C / 0.5] and ΔV x = V x ×[1 - 0.1C / 0.5] progressive adjustment. For example, when the powder spreading deficiency defect C = 0.3, ΔG4 = 1.6×[1 + 0.1×0.3 / 0.5] = 1.696, ΔV4 = 70×[1 - 0.1×0.3 / 0.5] = 69.3 mm / s.

[0127] After the powder spreading is completed again, detect the powder spreading defects after the re - powder spreading again: If after the re - powder spreading, the powder spreading defects still exist and there is still an overlapping area between the bounding box of the powder spreading defects and the key printing area, then pause the current printing process and perform an alarm process; If after the re - powder spreading, the powder spreading defects still exist, but the bounding box of the powder spreading defects does not overlap with the key printing area, or the powder spreading defects are eliminated after the re - powder spreading, then continue the printing of the current layer.

[0128] Through the above steps, the identification and repair process of the powder spreading defects can be completed, and subsequent printing can be carried out.

[0129] The entire detection and processing process is highly automated, capable of real - time monitoring of the defect conditions during the powder spreading process, and making intelligent judgments and responses based on the potential impact of the defects on the printing quality. Through precise defect positioning and intelligent repair mechanisms, the system realizes the full - process automation from image capture to defect identification and repair, greatly reducing the workload and error of manual detection, and improving the detection efficiency and accuracy. In addition, the image calibration step ensures the high - precision correspondence between the image data and the slice data, further enhancing the reliability and consistency of defect evaluation. Through this method, the quality control in the production process has been significantly improved, reducing the material waste and time loss caused by defects, and ensuring that the quality of the final printed parts meets the expected standards.

[0130] Combined with the attached Figure 3 It is described as follows. After the powder spreading of the current layer, a powder spreading deficiency type of powder spreading defect is automatically detected, that is, Figure 3 the green box area in the left figure, and then the area of the powder spreading defect is compared with the key printing area, that is, Figure 3The blue box area in the left figure is judged. If there is no overlapping area, it is considered that the defect of the powder bed will not affect the part; if there is an overlapping area, such as Figure 3 As shown in the right figure, the powder spreading defect area of the type of insufficient powder spreading, that is, the green box area in the figure, and the key printing area, that is Figure 3 There is an overlap in the blue box area in the right figure, that is, the area enclosed by the red diagonal lines. Then it is determined that the current powder spreading quality is unqualified and will affect the printed part of the current layer, and re-powder spreading repair will be carried out. If the powder spreading defect still exists and there is an overlap after re-powder spreading and running the defect detection process, then the printing will be paused and an alarm will be given.

[0131] However, powder spreading and printing is not the end. There may still be a deviation between the actual size of the printed part and the designed size. Therefore, it is necessary to further conduct a secondary verification based on the physical object on the printed size.

[0132] The present invention further includes steps:

[0133] S4: After printing is completed, capture an image of the printed part, and use the trained network edge detection algorithm to process the image of the printed part to extract the edge contour of the printed part of the current layer, such as Figure 4 shown.

[0134] In this embodiment, EDTER is selected as the edge detection algorithm because this algorithm performs excellently in the field of deep learning, can capture complex edge details, and still maintains a high detection accuracy under interference factors such as noise and light changes. The network edge detection algorithm EDTER performs global feature extraction and local feature fusion on the image through the Transformer structure, and can finely identify and output the edge of the part contour. Compared with traditional edge detection algorithms (such as Canny, Sobel, etc.), the network edge detection algorithm EDTER has higher robustness and accuracy when processing 3D printed parts with irregular shapes or complex textures.

[0135] The network edge detection algorithm EDTER is executed after each layer of the printing process. The purpose is to obtain the true manufacturing form of the part at an early stage of additive manufacturing and establish a dynamic comparison with the theoretical design model. On the one hand, the system uses an industrial camera to capture the printing image of the current layer; on the other hand, the theoretical shape of the printed part comes from the contour data after layer slicing in the CAD model or other design files. To make the detection more accurate, the system usually performs necessary correction and preprocessing on the captured image, including distortion correction, brightness / contrast adjustment, and noise filtering, etc., to ensure that the image quality input into the network edge detection algorithm EDTER network is stable and the feature information is rich.

[0136] such as Figure 6As shown, after the network edge detection algorithm EDTER extracts the edge contour of the parts on this layer, the system registers and overlaps this contour information with the contour data of the current layer slice or the ideal shape of the design model. During registration, image calibration techniques, feature point matching algorithms, or geometric information-based matching methods can be used to align the actual printed contour and the design contour. After alignment, the system evaluates the accuracy and consistency of the printing process by calculating the deviation between the actual part area and the design model area. This process not only involves geometric position matching but also comprehensively considers the relationship between the size and shape of defects and the printing path to comprehensively evaluate the possible impact of defects on the quality of printed parts.

[0137] As a specific implementation, the network edge detection algorithm EDTER is configured with an input layer, a convolutional neural network CNN, a Transformer encoder, an edge detection layer, and a decoder; it aims to extract the edge features of the printed part image and generate an accurate edge contour map. The input image size is 1024×1024.

[0138] Among them: The input layer preprocesses the image of the printed parts on the current layer through brightness adaptive adjustment, contrast adaptive adjustment, and denoising; the preprocessed image of the printed parts is input into the convolutional neural network for local feature extraction. The convolutional neural network CNN extracts low-level features in the image through multiple convolutional layers and pooling layers, gradually compressing the spatial dimension of the image and retaining the most critical feature information. The output of the convolutional layer undergoes a non-linear transformation through an activation function (such as ReLU) to increase the network's learning ability for complex image patterns. The pooling layer reduces the spatial dimension, reduces the computational complexity, and retains the most important features.

[0139] After local feature extraction, the feature map of the image is passed to the Transformer encoder, which combines the local information and global information of the image of the printed parts, fuses the global features and local features, and extracts the global features of the image.

[0140] The edge detection layer enhances the edge features in the image of the printed parts through an edge detection algorithm; the edge detection layer uses an edge detection algorithm (such as the Sobel operator or a learning-based edge detection network) to enhance the edge features in the image. This layer makes the edges of the printed parts more prominent by strengthening the contours in the image, providing support for the decoder to generate an accurate edge contour. Finally, the decoder restores the feature-processed image to the same resolution as the original image through deconvolution or upsampling operations and generates an edge contour image.

[0141] The decoder maps the features processed by the edge detection layer back to the image of the printed parts and generates the edge contour of the printed parts on the current layer.

[0142] To improve the detection speed of the network, especially when dealing with large-scale image data, a sparse attention mechanism is introduced into the Transformer encoder. By restricting the scope of attention calculation, the sparse attention mechanism only focuses on the correlations within adjacent regions of the image, thus significantly reducing the computational amount. The calculation formula of the sparse attention mechanism is as follows:

[0143] Where Q is the query matrix, representing the feature representation of the current processing position; K is the key matrix, representing the feature representations of other positions, and the superscript T represents the transposed matrix; V is the value matrix, representing the feature matrix related to the position; d k is the dimension of the key, which determines the scaling factor of the attention; softmax is the normalization operation, adjusting the attention weights to the range of (0, 1); 1 near(Q,K) is the mask matrix, representing adjacent positions; · is the element-wise multiplication, indicating that only the contributions of adjacent regions are retained when calculating the attention.

[0144] In the main working process of the input layer:

[0145] 1) Brightness adaptive adjustment: Calculate the difference between the average brightness of each pixel in the image of the printed part and the standard brightness, set the brightness difference threshold, and dynamically adjust the brightness values of the pixels exceeding the brightness difference threshold to make the brightness distribution of the entire image of the printed part more uniform; the brightness difference threshold here defines the difference range between the brightness of the image and the standard brightness.

[0146] Brightness difference threshold L th can be set according to the following formula: L th = L avg + α × σ L , where L avg is the average brightness of the image, with a value range of 0 - 255; σ L is the standard deviation of the brightness, representing the degree of brightness dispersion, usually in the range of 0 - 100; α is the sensitivity coefficient, with a value range of 0.5 - 2. If α is too small, the adjustment may not be obvious; if α is too large, the image brightness may be overly balanced.

[0147] When dynamically adjusting the brightness values of the pixels exceeding the brightness difference threshold, when the brightness difference of a certain area in the image is ΔL, and the brightness difference ΔL is greater than the brightness difference threshold L th , the following formula is used to adjust the brightness: L adj = L ori + β × ΔL, where L ori is the original brightness value, and L adj is the adjusted brightness value.

[0148] The brightness adjustment amplitude β determines the intensity of pixel brightness adjustment. The recommended value range is: 0.2 ≤ β ≤ 0.8. For pixels with a large brightness difference, the value of β is larger; for pixels with a small difference, the value of β is smaller to avoid excessive brightness adjustment. The custom rule for dynamic brightness adjustment is: for the low-brightness area, that is, when the original brightness value L ori <80 and the brightness difference is greater than the brightness difference threshold, the brightness adjustment amplitude β takes a value of 0.6 - 0.8; for the medium-brightness area, that is, when the original brightness value 80 ≤ L ori <180 and the brightness difference is greater than the brightness difference threshold, the brightness adjustment amplitude β takes a value of 0.4 - 0.6; for the high-brightness area, that is, when the original brightness value L ori ≥180 and the brightness difference is greater than the brightness difference threshold, the brightness adjustment amplitude β takes a value of 0.2 - 0.4.

[0149] 2) Contrast adaptive adjustment: Obtain the maximum and minimum gray values of each pixel of the image of the printed part. When the maximum and minimum gray values of each pixel are less than the set gray difference value, enhance the contrast by the linear stretching method to make the edges of the image of the printed part more prominent.

[0150] The gray difference Δgary is the difference between the maximum gray value G max and the minimum gray value G min of each pixel of the image, Δgary = G max - G min ; Set the threshold value Δgary th of the gray difference, satisfying Δgary th = μG + κ × σ G , where μG is the mean value of the image gray value, and the value range is usually 50 - 200; σ G is the standard deviation of the image gray value, usually 10 - 80; κ is the enhancement coefficient, and the value range is 1 - 2. The piecewise value-taking rule of the enhancement coefficient is: when the minimum gray value G min <50 of the image, the value of the enhancement coefficient κ is 1.5 - 2; when the minimum gray value 50 ≤ G min <150 of the image, the value of the enhancement coefficient κ is 1 - 1.5; when the minimum gray value G min ≥150 of the image, the value of the enhancement coefficient κ is 1 - 1.2.

[0151] The content of enhancing the contrast by the linear stretching method is: when the gray difference Δgary is less than the threshold value Δgary th of the set gray difference, use linear stretching to enhance the contrast, and the linear stretching formula is where G i represents the original gray value of each pixel in the image, G newIndicates the adjusted grayscale value.

[0152] 3) Denoising: Use Gaussian filtering to smooth the image of the printed part. Use an adaptive filtering method to dynamically adjust the filtering intensity according to the pixel values in the local area. While eliminating noise, preserve the edge features in the image of the printed part.

[0153] The value range of the convolution kernel size k of Gaussian filtering determines the filtering intensity. The convolution kernel size k is usually dynamically set based on the intensity of the image noise σ noise of the intensity: Here, the part inside the parentheses, that is, half of the image noise, is used as a relative ratio of the noise intensity to infer the preliminary size of the convolution kernel. The 2 outside the parentheses represents linear scaling of the preliminary size of the convolution kernel. The purpose is to determine the appropriate convolution kernel size. Higher noise requires a larger convolution kernel for smoothing and denoising. The 2 outside the parentheses in the example formula here can be adjusted as needed and is not regarded as a limitation on the specific content of this solution.

[0154] σ noise is the image noise, usually estimated as the local variance of the image, with a value range of 0 to 50; the common value range of the convolution kernel size is 3×3 or 7×7.

[0155] Adjust the filtering intensity through the filtering intensity coefficient α filter : α filter = 1 - (σ local / σ global ); where σ local is the noise variance of the local area, and σ global is the standard deviation of the global noise of the image, usually in the range of 0 to 80. The value range of the filtering intensity coefficient α filter is 0.5 to 1. Too low noise may result in an unclear denoising effect, and too high a value may cause loss of details.

[0156] For areas with high noise intensity, such as σ noise > 30, the filtering intensity coefficient α filter takes a value of 0.6 to 0.8; for medium noise areas, such as σ noise = 15 to 30, the filtering intensity coefficient α filter takes a value of 0.8 to 0.9; for areas with low noise intensity, such as σ noise < 15, the filtering intensity coefficient α filter takes a value of 0.95 to 1.

[0157] By introducing brightness / contrast adjustment and denoising, it is possible to effectively address common image quality issues in the additive manufacturing process, such as uneven illumination, defocus, and noise interference. Brightness and contrast adjustment ensure that the image remains clear under different lighting and shooting conditions, while denoising effectively removes the noise that may occur during the printing process, making the image purer. In this way, the image after these optimization processes can provide a more accurate basis for subsequent edge contour extraction.

[0158] S5: Register and overlap the edge contour of the currently printed part of the current layer with the designed contour of the current layer slice.

[0159] The registration and overlap process includes, after extracting the image of the edge contour of the currently printed part of the current layer using a network edge detection algorithm, converting the edge contour of the currently printed part of the current layer and the designed contour of the current layer slice to the same two-dimensional coordinate system according to the mapping relationship between the image pixel coordinates and the coordinates of the current layer slice, and taking a vertex of the edge contour of the currently printed part of the current layer and at least one side line where the vertex is located as the adjustment object, and performing alignment by rotation and / or translation operations with reference to the corresponding vertex and side line of the designed contour of the current layer slice.

[0160] Such as Figure 4 The gray part of the first figure in Figure 4 is the obtained current layer slice, Figure 4 The second figure in Figure 4 is the designed contour extracted from the previous layer slice, that is, the contour of the internal white rectangular area;

[0161] S6: Calculate the area deviation between the edge contour of the currently printed part of the current layer and the designed contour of the current layer slice according to the result of registration and overlap, judge the printing effect based on the area deviation, and decide whether to pause printing or continue printing.

[0162] Among them, calculating the deviation between the actual part area corresponding to the edge contour of the current layer part and the designed model area corresponding to the designed contour of the current layer slice includes the following: calibrating the conversion relationship between pixels and physical units in advance, placing a reference object with a standard size in the captured image, given the physical area of the reference object as A2, measuring the pixel area A1 of the reference object in the image, and obtaining the conversion relationship between pixels and physical units A = A2 / A1; then converting the edge contour of the current layer part into a closed contour, using the cv2.contourArea function in OpenCV to calculate the pixel area B1 of the edge contour of the current layer part, and then converting the pixel area B1 of the edge contour of the current layer part into a physical area B2, B2 = B1×A;

[0163] Finally, from the designed model, extract the designed contour of the current layer slice for projection, ensuring that the direction of the projection view is consistent with the shooting direction of the edge contour of the current layer part, such as both being the top view. Convert the projection of the designed contour of the current layer slice into a grayscale image, detect the edges and extract the largest contour in the grayscale image, close the largest contour in the grayscale image, use the cv2.contourArea function in OpenCV to calculate the pixel area C1 corresponding to the largest contour in the grayscale image, and obtain the designed model area C2 corresponding to the designed contour of the current layer slice after converting the pixel area into a physical area, C2 = C1×A; judge the difference between the physical area B2 of the edge contour of the current layer part and the designed model area C2 corresponding to the designed contour of the current layer slice.

[0164] Specifically, let the deviation between the actual part area corresponding to the edge contour of the previous layer part and the designed model area corresponding to the designed contour of the current layer slice be ΔS, Define the preset range of the deviation as 5%. When |ΔS|≤5%, it is judged that the size is qualified; when |ΔS|>5%, it is judged that the size is unqualified, and the operator is notified to check and adjust to avoid further material waste or quality problems.

[0165] Figure 7Disclosed is a real-time defect detection system for additive manufacturing, including a powder dispenser, a doctor blade, a laser, a galvanometer scanner, an F-θ scanning objective lens, a coaxial industrial camera, and a printing controller. The powder dispenser and the doctor blade cooperate to spread the powder; the laser, the galvanometer scanner, and the F-θ scanning objective lens jointly perform printing on the powder spread on the current layer; the coaxial industrial camera is used to obtain the image after powder spreading for each layer and send it to the printing controller. The printing controller respectively obtains the image after powder spreading for each layer, the image of the printed part on the current layer, and the slice of the current layer, and adopts the above-mentioned real-time defect detection and adaptive repair method for additive manufacturing built therein to detect and repair the powder spreading defects in real time, and judges whether the actual part area corresponding to the edge contour of the part on the current layer is abnormal compared with the designed model area corresponding to the designed contour of the slice of the current layer.

[0166] In addition, the present invention also provides a computer-readable storage medium, on which a program for the real-time defect detection and adaptive repair method for additive manufacturing is stored. When the method program is executed by a computer, the above-mentioned real-time defect detection and adaptive repair method for additive manufacturing is realized.

[0167] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for real-time defect detection and adaptive repair in additive manufacturing, characterized in that: The steps include: S1: captures the image of the powder bed after powdering; S2: Based on the trained object detection algorithm, identify the powder defects in the image after each layer of powder, mark and store the category and location information of each powder defect in the image, and fit the bounding box of the powder defect; S3: The interior of the design contour boundary of the current layer slice is taken as the key printing area; Compare the bounding box with the key printing area to determine whether the bounding box overlaps with the key printing area. If so, trigger the adaptive repair mechanism; if not, perform laser scanning and printing; S4: After printing is completed, an image of the printed part is captured, and the edge contour of the printed part in the current layer is extracted using the trained network edge detection algorithm; S5: registering and overlapping the extracted edge contour of the printed part of the current layer with the design contour of the slice of the current layer; S6: Calculate the area deviation between the edge contour of the current layer printed part and the design contour of the current layer slice according to the results of the registration and overlap comparison, and decide whether to suspend printing or continue printing according to the area deviation.

2. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 1, characterized in that: The training process of the target detection algorithm in step S2 includes the following steps: Collect defect images, including defect images captured by industrial cameras in real time and sample images taken under laboratory conditions; Preprocessing the defect image; Use annotation tools to annotate defective areas of defective images, draw bounding boxes and annotate defect categories. After reviewing the annotation data to ensure accuracy, the annotated defective images are converted into image files and several label files required by the target detection algorithm. The several label files include the defect category number and the coordinate information of the bounding box. Data annotation is the basis for system construction. It collects defect image data during the powder laying process to cover different types of defects. The collected labeled data is divided into training set, validation set and test set. The parameters of the target detection algorithm are iteratively optimized, the training set is used to update the parameters, and the validation set is used to monitor the performance of the target detection algorithm until the training is completed, thus obtaining the trained target detection algorithm.

3. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 1, characterized in that: The powder spreading defects include insufficient powder spreading, holes, protrusions and grooves; Insufficient powder spreading: Insufficient amount of powder supplied to the powder dispenser causes incomplete spreading of the powder on the substrate; Potholes: discrete concave holes in an image; Protrusion: The powder layer is uneven, resulting in excessive accumulation of powder in some areas; Grooving: Depression caused by damaged scraper or particles dragged through the powder bed.

4. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 2, characterized in that: The step of comparing the bounding box with the critical printing area comprises the steps of: Calibrate the captured image after powder coating. The calibration process includes determining the intrinsic and extrinsic parameters of the industrial camera to correct the distortion in the image. Establish a mapping relationship between the image pixel coordinates and the coordinates of the slice file of the current layer to achieve alignment between the two-dimensional image and the two-dimensional slice data; Determine whether there is any overlapping area between the boundary box of the powder spreading defect and the key printing area. If there is an overlapping area, the powder spreading quality of the current layer is judged to be unqualified, which will affect the subsequent printing quality and automatically trigger the corresponding repair mechanism; if there is no overlapping area, it is considered that the powder spreading defect will not affect the printed parts of the current layer.

5. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 1, characterized in that: The adaptive repair mechanism comprises the steps of: S31. According to the type of defect, match the corresponding moving speed and powder feeding coefficient to re-powder and repair the powder laying defect. Set the default moving speed of the scraper as V1 and the initial powder feeding coefficient of the powder dispenser as G1. The moving speeds and powder feeding coefficients matched for different defects are specifically as follows: If the defect is a protrusion, the matched moving speed is the set moving speed V1, and the matched powder feeding coefficient is the initial powder feeding coefficient G1; If the defect is a groove, the matched moving speed is V2, and the powder feeding coefficient is G2; If the defect is a pothole, the matched moving speed is V3, and the powder feeding coefficient is G3; If the defect is insufficient powder laying, the matched moving speed is V4, and the powder feeding coefficient is G4; V1 > V2 > V3 > V4, G1 < G2 < G3 < G4, where V1, V2, V3, and V4 decrease in gradient, and G1, G2, G3, and G4 increase in gradient; S32. After re-powdering is completed, detect the powder laying defect after re-powdering again. If the powder laying defect still exists after re-powdering, and there is still an overlapping area between the bounding box of the powder laying defect and the key printing area, pause the current printing process and perform an alarm process; If the powder laying defect still exists after re-powdering, but the bounding box of the powder laying defect does not overlap with the key printing area, or the powder laying defect is eliminated after re-powdering, continue with the printing of the current layer.

6. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 1, characterized in that: The re-powdering to repair the powder laying defect by matching the corresponding moving speed and powder feeding coefficient according to the type of defect includes the following steps: The target detection algorithm can also output the confidence of the corresponding defect. After the defect category matches the corresponding moving speed and powder feeding coefficient, dynamic correction is performed according to the confidence value corresponding to different defects. Specifically, the change amount ΔG is increased or decreased based on the matched powder feeding coefficient. x , increase or decrease ΔV based on the matching moving speed x Make adjustments; When C ≥ 0.8, increase by 20% on the basis of the matched powder feeding coefficient and decrease the speed by 20% on the basis of the matched moving speed; When 0.5≤C<0.8, ΔG x =G x ×[1+0.2×(C-0.5) / 0.3]; ΔV x =V x ×[1-0.2×(C-0.5) / 0.3]; When C<0.5, ΔG x =G x ×[1+0.1C / 0.5], ΔV x =V x ×[1-0.1C / 0.5]; Where x = 1, 2, 3, 4 respectively correspond to four defect types: protrusion, groove, pothole, and insufficient powder laying.

7. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 4, characterized in that: The network edge detection algorithm is configured with an input layer, a convolutional neural network, a Transformer encoder, a sparse self-attention mechanism, an edge detection layer, and a decoder; among them: The input layer preprocesses the image of the printed part of the current layer; Input the preprocessed image of the printed part into the convolutional neural network for local feature extraction; After local feature extraction, the feature map of the image is transmitted to the Transformer encoder. The sparse attention mechanism limits the range of attention calculation. The Transformer encoder combines the local information and global information of the image of the printed part, fuses the global features and local features, and extracts the global features of the image; The edge detection layer enhances the edge features in the image of the printed part through an edge detection algorithm; The decoder maps the features processed by the edge detection layer back to the image of the printed part to generate the edge contour of the printed part of the current layer.

8. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 6, characterized in that: The input layer preprocesses the image of the printed part of the current layer through brightness adaptive adjustment, contrast adaptive adjustment, and denoising, where: Adaptive brightness adjustment includes: calculating the difference ΔL between the average brightness of each pixel of the image of the current layer of the printed part and the standard brightness, setting the brightness difference threshold L th , for the brightness difference threshold L th The brightness value of the pixel is dynamically adjusted to make the brightness distribution of the entire printed part image more uniform. The brightness difference threshold L th The setting is based on the following formula: L th =L avg +α×σ L Among them, L avg is the average brightness of the image, ranging from 0 to 255; σ L is the standard deviation of brightness, indicating the discrete degree of brightness, and its value range is 0 to 100; α is the sensitivity coefficient, and its value range is 0.5 to 2; When the brightness difference of a certain area in the image is ΔL greater than the brightness difference threshold L th When , the following formula is used to adjust the brightness: L adj =L ori +β×ΔL; Among them, L ori is the original brightness value, L adj is the adjusted brightness value, β is the brightness adjustment amplitude; Contrast adaptive adjustment includes: obtaining the maximum value G of the grayscale of each pixel of the image of the printed part max and the minimum value G min , when the maximum gray value G of each pixel max and the minimum value G min The difference Δgary is less than the set grayscale difference threshold Δgary th When the contrast is enhanced by linear stretching, the edge of the printed part image is more prominent, where the grayscale difference Δgary is calculated according to the following formula: Δgary=G max -G min ; Δgary th Set according to the following formula: Δgary th =μG+κ×σ G ; Among them, μG is the mean value of the image grayscale value, ranging from 50 to 200, μ refers to the average operation of the image grayscale value; σ G is the standard deviation of the image grayscale value, ranging from 10 to 80, σ refers to the standard deviation operation of the image grayscale value; κ is the enhancement coefficient, ranging from 1 to 2; The specific formula of the linear stretching method is: Among them, G i Represents the original grayscale value of each pixel in the image, G new Represents the adjusted grayscale value; Denoising: Use Gaussian filtering to smooth the image of the printed part, and use an adaptive filtering method to dynamically adjust the filtering intensity according to the pixel values in the local area, while eliminating noise and retaining the edge features in the image of the printed part.

9. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 6, characterized in that: The registration and overlap comparison in step S5 include the steps: According to the mapping relationship between the image pixel coordinates and the coordinates of the current layer slice, the edge contour of the current layer printed part and the design contour of the current layer slice are converted into the same two-dimensional coordinate system; A vertex of the edge contour of the printed part in the current layer and at least one sideline where the vertex is located are used as adjustment objects, and the corresponding vertex and sideline of the design contour of the current layer slice are used as references for alignment through rotation and / or translation operations.

10. The method for real-time defect detection and adaptive repair in additive manufacturing according to claim 8, characterized in that: Step S6 comprises the steps of: S61, calibrate the conversion relationship from pixels to physical units in advance, specifically, place a reference object of standard size in the captured image, give the physical area of ​​the reference object as A2, measure the pixel area A1 of the reference object in the image, and obtain the conversion relationship A from pixels to physical units: A=A2 / A1; S62, convert the edge contour of the current layer of printed parts into a closed contour, use the cv2.contourArea function of OpenCV to calculate the pixel area B1 of the edge contour of the current layer of printed parts, and then convert the pixel area B1 of the edge contour of the current layer of printed parts into the physical area B2 according to the following formula: B2=B1×A; S63, extract the design contour of the current layer slice for projection, ensure that the direction of the projection view is consistent with the shooting direction of the edge contour of the current layer printed part, convert the projection of the design contour of the current layer slice into a grayscale image, extract the maximum contour in the grayscale image, close the maximum contour in the grayscale image, use the cv2.contourArea function of OpenCV to calculate the pixel area C1 corresponding to the maximum contour in the grayscale image, and obtain the area C2 corresponding to the design contour of the current layer slice according to the conversion relationship A, as shown in the following formula: C2=C1×A; S64, determining the deviation between the physical area B2 of the edge contour of the printed part of the current layer and the design model area C2 corresponding to the design contour of the slice of the current layer; Let the deviation between the physical area B2 of the edge contour of the printed part at the current layer and the design model area C2 corresponding to the design contour of the slice at the current layer be ΔS, Define the default deviation value as S T , when |ΔS|≤S T When |ΔS|>S T When the size is judged as unqualified, the operator is notified to check and adjust. T The value range is 3% to 5%.

Citation Information

Cited By

  • Selective laser melting forming powder bed powder laying quality detection method for metal additive

    CN120721736A

  • Powder spreading method, printing system, electronic equipment and storage medium

    CN121447867A

  • Interface interlocking waveform generation method and system for additive manufacturing technology

    CN121659399A

  • An interface interlocking waveform generation method and system for additive manufacturing technology

    CN121659399B

  • Large-format grayscale image line-by-line rolling exposure method and system based on DLP projection

    CN121946838A