Intelligent detection method and detection system for surface coating micropores
By combining high-resolution industrial cameras and deep learning models, efficient and accurate automated detection of micron-level coating pores has been achieved, solving the problems of low detection efficiency and poor accuracy in existing technologies and meeting the quality control needs of modern manufacturing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 深圳市智弦科技有限公司
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies for detecting micron-level coating pores are inefficient, inaccurate, and costly, and cannot achieve full-process automation and real-time online detection, making it difficult to meet the quality control needs of modern manufacturing.
Images are acquired using a high-resolution industrial camera. By combining a trained hole contour segmentation model and a missed hole detection model with morphological operations and geometric feature determination, hole recognition and defect determination are achieved, and the detection quality results are output.
It achieves efficient and accurate automated testing of all batches of products, reduces manpower and equipment investment, meets the requirements of high consistency and full-process automated management and control, and avoids missed detections and misjudgments.
Smart Images

Figure CN122156174A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of industrial intelligent inspection, and more specifically, to an intelligent inspection method and system for micron-level pores in surface coatings. Background Technology
[0002] Currently, on-site quality inspection of micron-level coating pores in industrial settings primarily relies on manual sampling, and requires the simultaneous use of appropriate high-magnification microscopes for effective control. For example... Figure 1 As shown in the diagram, the distribution of micron-sized pores and gap areas on the coating surface in the prior art indicates that the diameter of a single pore is approximately 25–50 μm. The extremely small pore size and high distribution density lead to many limitations in manual inspection. Firstly, the testing efficiency is low. Due to the limitations of manual operation speed and the observation range of high-powered microscopes, it can usually only achieve sampling testing and cannot cover the comprehensive quality control of the entire batch of products. Secondly, the results are unstable. The detection process is easily affected by factors such as the operator's subjective experience, visual fatigue, and microscope parameter settings. The judgment results of the same hole may differ between different inspectors or at different time points. Third, the detection accuracy is limited. The edge features of micron-sized holes are subtle, and manual observation can easily lead to missed detections (such as holes that have not completely collapsed or holes with extremely small gaps) or misjudgments (such as mistaking gap areas for holes), making it difficult to guarantee the reliability of the detection results. Fourth, the testing cost is high, requiring professional testing personnel and high-precision microscope equipment, and it cannot achieve real-time online testing on the production line, making it difficult to meet the needs of modern manufacturing for high consistency of product surface coating quality, full-process automated control, and large-volume rapid testing.
[0003] Therefore, there is an urgent need for a high-precision intelligent detection method and system that can efficiently detect micron-level pores in surface coatings, in order to overcome the inherent defects of manual inspection and meet the stringent quality control requirements of industrial automated production. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an intelligent detection method and system for micron-level pores in surface coatings, addressing the above-mentioned deficiencies of the prior art.
[0005] The technical solution adopted by this invention to solve its technical problem is as follows: On one hand, the present invention provides an intelligent detection method for micron-level pores in surface coatings, comprising the following steps: A detection image of the coating surface is acquired, and the detection image is subjected to normalization preprocessing, which includes image scaling and pixel filling of missing areas in the scaled image. The preprocessed image is input into the trained hole contour segmentation model to obtain the hole pixel probability distribution map. The hole pixel probability distribution map is binarized and the hole contour coordinates are extracted using a contour tracking algorithm. Based on the hole contour coordinates, a hole connected region is constructed through morphological operations, and gap regions that do not require drilling are selected according to the geometric features of the connected region. The preprocessed image is input into the trained missing hole detection model to obtain the coordinates of the suspected missing hole area. The suspected missing hole area is then filtered in conjunction with the gap area to obtain the real missing hole area. The geometric feature parameters of the hole are calculated based on the hole contour coordinates, and the collapsed hole is determined based on the geometric feature parameters; the hole distribution density is calculated by combining the hole diameter determination algorithm and the hole spacing determination algorithm, and the detection quality result is output.
[0006] The intelligent detection method of the present invention includes the following method for image scaling and filling preprocessing: The scaling factor is calculated based on the long side of the acquired image. The short side is scaled by the same factor to scale the image to a preset resolution. Areas on the short side that are insufficient after scaling are filled with preset pixel values, and the position information of the filled areas is recorded.
[0007] The intelligent detection method of the present invention includes the following steps for hole contour segmentation: S1: Delete the filled area during scaling in the hole pixel probability distribution map; S2: Upsample the remaining portion to the same size as the original image using bilinear interpolation; S3: Filter out all pixel regions with a probability value greater than 0.5 by thresholding, set these regions to 255, and set other regions to 0 to obtain the mask image; S4: Use a contour tracking algorithm to identify all contour coordinate points in the mask image, i.e., the contour coordinate points of holes.
[0008] The intelligent detection method of the present invention includes the following steps for screening gap areas without the need for drilling: The opening and dilation operations are performed sequentially on the binarized hole region to obtain the hole connectivity mask image; The region in the image to be detected, excluding the hole-connected mask, is taken as a suspected blank region, and the minimum bounding rectangle of the suspected blank region is calculated. If the length or width of the minimum bounding rectangle is greater than a preset ratio threshold of the corresponding side length of the image, then the region is determined to be a gap region.
[0009] The intelligent detection method of the present invention includes the following method for determining the collapsed hole: The minimum circumcircle and the maximum incircle are fitted based on the coordinate points of a single hole profile to obtain the center of the minimum circumcircle, the diameter of the minimum circumcircle, the center of the maximum incircle, and the diameter of the maximum incircle. The coordinates of the center of the reference circle are calculated as the midpoint between the center of the smallest circumcircle and the center of the largest incircle. The diameter of the reference circle is calculated as half the sum of the diameters of the smallest circumcircle and the largest incircle. If the diameter of the reference circle is less than the preset collapse threshold, the hole is determined to be a collapse hole; otherwise, it is not.
[0010] The intelligent detection method of the present invention, wherein the hole contour segmentation model adopts a U-shaped deep learning model; The network comprises multiple modules; each module includes a self-attention mechanism and two convolutional layers. These modules are arranged symmetrically left and right. The left-hand module is a downsampling feature extraction and encoding module, where the image scale is halved and the dimension is doubled with each downsampling. The right-hand module is an upsampling decoding module, where the image scale is doubled and the dimension is halved with each upsampling. Shortcut links are used between the left and right modules to prevent the location information and shallow information of the items to be detected in the image from being forgotten as the network deepens. The mathematical logic formula for the self-attention mechanism is as follows:
[0011] Where: Q is the query vector, representing the content that needs to be focused on; K is the key vector, used to match the query vector Q and determine which content needs to be focused on; V is the value vector, storing the actual information and ultimately used to generate a new representation. This is a scaling factor to prevent large values from affecting gradient stability. `softmax` is a normalization function that outputs the result as a probability value between 0 and 1.
[0012] The intelligent detection method of the present invention includes the following steps in the hole spacing calculation algorithm: Select a hole with a diameter within the preset standard hole diameter range as the initial reference hole; Calculate the center distance between the reference hole and the remaining holes, and mark the holes whose center distance is within the preset qualified spacing range as adjacent holes; Using the adjacent holes as the new reference holes for the next iteration, the center distance is repeatedly calculated until all holes that meet the conditions have been traversed; If there are no adjacent holes with a center-to-center distance that meets the preset acceptable spacing range for the current reference hole, then the iterative calculation of this path will stop.
[0013] On the other hand, the present invention also provides an intelligent detection system for micron-level pores in surface coatings, comprising: The image acquisition and processing module is used to acquire the image to be inspected on the coating surface and perform standardized preprocessing operations such as image scaling and pixel filling. The hole contour recognition module is equipped with a trained hole contour segmentation model, which is used to segment the preprocessed image, obtain the hole pixel probability distribution map, perform binarization on the hole pixel probability distribution map, and extract the hole contour coordinates using a contour tracking algorithm. The Gap region recognition module is used to perform morphological operations and geometric size determination based on the hole contour coordinates to identify the Gap region on the coating surface. The missing hole detection module is equipped with a pre-trained missing hole detection model to detect suspected missing hole areas, and combines the results of the Gap area recognition module to remove false detection areas and output the coordinates of the real missing holes. The quality assessment and output module is used to calculate the hole diameter and hole spacing geometric parameters based on the hole contour coordinates, perform collapsed hole assessment and hole spacing iterative calculation, and output the inspection quality results.
[0014] The intelligent detection system of the present invention includes a hole contour recognition module in which the hole contour segmentation model adopts a U-shaped deep learning model based on a self-attention mechanism. The network contains multiple symmetrically arranged modules, each including a self-attention mechanism and two convolutional layers. The left module is a downsampling feature extraction and encoding module, where the downsampled image scale is 1 / 2 of the previous one and the dimension is twice the original. The right module is an upsampling decoding module, where the upsampled image scale is twice the previous one and the dimension is 1 / 2 of the original. The modules are linked by shortcuts.
[0015] The intelligent detection system of the present invention, wherein the quality judgment and output module includes: The collapse hole determination unit is used to calculate the minimum circumcircle and the maximum incircle of the hole profile, and determine whether the hole has collapsed based on the average diameter of the two and a preset threshold. The hole spacing calculation unit is used to perform iterative hole spacing determination. It calculates hole distribution information by selecting a reference hole and iteratively searching for adjacent holes whose center distance meets the preset conditions.
[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. By acquiring images in real time through a high-resolution industrial camera and performing standardized preprocessing, and relying on a trained hole contour segmentation model and a missed hole detection model, the system can automatically complete hole identification and defect judgment without the need for manual observation of each hole, significantly shortening the inspection time. It can cover the entire batch of products and does not require professional inspection personnel or high-magnification microscope equipment. The automated inspection system can realize real-time online inspection on the production line, reducing manpower and equipment investment, while meeting the needs of modern manufacturing industry for high consistency of surface coating quality, full-process automated control, and large-volume rapid inspection.
[0017] 2. The segmentation model can accurately identify holes of different sizes, and the detection model can distinguish between missed drilling areas and gap areas. Combined with morphological operations, collapsed hole judgment, and iterative calculation of hole spacing, it can effectively avoid missed detections and misjudgments, ensure the reliability of detection results, and solve the problem of limited accuracy of manual detection. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort: Figure 1 The background diagram shows the distribution of micron-sized pores and gap areas on the coating surface.
[0019] Figure 2 This is a flowchart of an intelligent detection method for micron-level pores in a surface coating according to Embodiment 1 of the present invention.
[0020] Figure 3 This is a schematic diagram of step S200 mask diagram in Embodiment 1 of the present invention.
[0021] Figure 4 This is a model diagram of the U-shaped deep learning model in Embodiment 1 of the present invention.
[0022] Figure 5 This is a model diagram of the deep learning detection model in Embodiment 1 of the present invention.
[0023] Figure 6 This is a schematic diagram of an 8-connected graph of the Freeman chain code in Embodiment 1 of the present invention.
[0024] Figure 7 This is a schematic diagram of the contour points of Embodiment 1 of the present invention.
[0025] Figure 8 This is a schematic diagram of the aperture rendering (left side) and aperture spacing rendering (right side) in Embodiment 1 of the present invention.
[0026] Figure 9 This is a schematic diagram of the Excel spreadsheet information in Embodiment 1 of the present invention.
[0027] Figure 10 This is a schematic diagram of an intelligent detection system for micron-level pores in a surface coating, according to Embodiment 2 of the present invention. Detailed Implementation
[0028] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0029] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0030] "Multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0031] Furthermore, the terms indicating orientation, such as "up, down, front, back, left, right, upper end, lower end, longitudinal," etc., are all based on the posture and position of the device or equipment described in this solution during normal use.
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, a clear and complete description will be provided below in conjunction with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the protection scope of the present invention.
[0033] Example 1: This invention provides an intelligent detection method for micron-level pores in surface coatings, such as... Figure 2 As shown, the specific implementation steps are as follows: Step S100: Image acquisition and normalization preprocessing Images of the coating surface were acquired using a high-resolution industrial camera (approximately 152 megapixels, 53.0mm × 29.4mm field of view). Eight images were acquired at a time and numbered sequentially. The eight sorted images were then scaled down to a resolution of 1600*1600 pixels. Normalization preprocessing was performed on each image, including image scaling and pixel filling of missing areas in the scaled image. The specific method is as follows: Based on the number of pixels on the long side of the image, calculate the scaling factor (R) to scale to 1600. Scale the short side at the same factor. Areas where the scaled short side is less than 1600 (i.e., the filling area, X) are filled with a pixel value of 114. Record the position information of the filling area (for subsequent removal). The processed images are all sized to 1600×1600 pixels to ensure that the input size of subsequent models is consistent.
[0034] Step S200: Hole contour segmentation and extraction The preprocessed image is input into a U-shaped deep learning model (segmentation model 1) based on a self-attention mechanism and a fully convolutional neural network. The output is a probability distribution map (0~1) of all pixels containing holes in the image to be detected, with an image scale of 1600*1600. First, the filled region (X) from step S100 scaling is removed from the pixel probability map. Second, the remaining portion is upsampled to the same size as the original image using bilinear interpolation. Next, all pixel regions with a probability value greater than 0.5 are selected by thresholding, and these regions are set to 255, while other regions are set to 0, i.e., the mask image (e.g., ...). Figure 3 Finally, a contour tracking algorithm is used to identify all contour coordinate points in the mask image, namely the contour coordinate points of the holes; Among them, such as Figure 4 As shown, the U-shaped deep learning model contains 9 modules (att), each of which includes a self-attention mechanism and 2 convolutional layers; the 8 modules are arranged symmetrically on the left and right; the module on the left is the downsampling feature extraction and encoding module: each downsampling reduces the image scale to half of the previous one, and the feature dimension increases to twice the original size; the module on the right is the upsampling decoding module: each upsampling increases the image scale to twice the previous one, and the feature dimension decreases to half the original size; Shortcut links are used between the left and right modules to prevent the loss of location information and shallow information of the items to be detected in the image as the network layers deepen. Each module includes a self-attention mechanism, the mathematical formula of which is as follows:
[0035] Where: Q (Query) is the query vector, representing the content that needs to be focused on; K (Key) is the key vector, used to match the query vector Q and determine which content needs to be focused on; V (Value) is the value vector, storing the actual information and ultimately used to generate a new representation. This is a scaling factor to prevent large values from affecting gradient stability. Softmax is a normalization function that outputs the result as a probability value between 0 and 1, highlighting the key parameters.
[0036] During training, a fixed value of pos_weight=5 is used in the BCEWithLogits loss function for the first 30% of epochs to maintain a moderate learning ability for the network to target features. In the latter 70% of epochs, the model has a certain understanding of the detected targets. The BCEWithLogits loss function with pos_weight is dynamically updated using self-learning. That is, in each epoch, the ratio of positive to negative samples detected by the model is calculated for each batch size. A threshold is used to obtain the total number of target samples (N) predicted by the model in the current batch size of images. The total number of positive samples (P) is obtained from the target labels. Finally, the total number of negative samples (NP) is obtained. The ratio of positive to negative samples is P / (N-P+1*10-6), where 10-6 is to prevent extreme cases where the division by zero occurs. The pos_weight parameter of the current batch size is the pos_weight of the previous batch size * 0.9 plus 0.1 of the positive and negative sample ratio of the current batch size, and the final value is limited to the range [1, 10) to achieve the purpose of automatically adjusting the learning ability of the model during training. The specific mathematical logic formula is as follows:
[0037]
[0038] The model outputs a pixel probability distribution map of holes (1600×1600). The subsequent hole contour segmentation processing steps are as follows: S1: Delete the filled area: Based on the filled position information recorded in step S100, delete the pixel values of the filled area in the probability distribution map; S2: Upsampling Restoration: Use bilinear interpolation to upsample the remaining portion to match the original image size; S3: Binarization: Pixels with a probability value > 0.5 are set to 255, and the rest are set to 0, to obtain a binarized mask image; S4: Contour Extraction: Use a contour tracking algorithm (combined with Freeman chain code, 8-connected traversal) to identify the coordinates of all hole contours in the mask image.
[0039] Step S300: Detect the gap area based on the distribution of the detection wells. Based on the hole contour coordinates extracted in step S200, an opening algorithm with a 7-pixel convolution kernel (i.e., erosion followed by dilation) is first used to remove misidentified hole regions. Then, a dilation algorithm with a 49-pixel convolution kernel (standard hole spacing is 98µm) is used to connect all hole regions to obtain a hole connectivity mask. Regions in the image to be detected other than the hole connectivity mask are considered suspected blank areas. The minimum bounding rectangle of the suspected blank area is calculated. If the length or width of the minimum bounding rectangle is greater than half the length or width of the image, the region is determined to be a gap region.
[0040] Step S400: Missing Drill Hole Detection and Filtration The preprocessed image from step S100 is fed into a deep learning detection model, such as a trained missed-hole detection model (Detection Model 2). The model outputs the center coordinates (c_x, c_y), length (h), width (w), and confidence score (probability value from 0 to 1) of all rectangular regions in the image that may contain missed holes. Initial screening and coordinate calculation are performed using the confidence threshold to identify regions that the model considers to have missed holes, along with their corresponding top-left coordinates (x1, y1) and bottom-right coordinates (x2, y2). Combining this with the output from step S300, it is determined whether the rectangular regions detected by the model contain missed holes have gaps. Regions with gaps are removed, and those that do are the true missed-hole regions.
[0041] like Figure 5 As shown, the deep learning detection model of this invention uses a Transformer encoding structure as the feature extractor of the detection algorithm, which includes 12 multi-head attention. The image is encoded into a feature map (Pi) through the feature extraction network (Backbone), and finally Pi is decoded into two branches to predict the class of the detected target and the bounding box information (i.e., Box, which includes the center point coordinates (c_x, c_y), length (h), width (w) and confidence score).
[0042] The training parameters were configured, including an SGD optimizer with an initial learning rate of 0.01, a batch size of 8, and a maximum training epoch of 300. During training, validation was performed on the validation set in each epoch, and an early stopping mechanism was configured to stop training when the validation set mAP metric no longer increased after 100 epochs. After training, the model weights were changed from float32 to float16 to reduce resource consumption during deployment and improve detection speed.
[0043] like Figure 6 As shown, the 8-connected graph of Freeman chaincode works as follows: Starting from the initial point, record the coordinates of the initial point. Then, using an 8-connected (i.e., 8 directions) approach, search for the next boundary pixel starting from the direction encoded as 1 (45 degrees). Once found, record the direction encoding (0 to 7). Then, starting from the found pixel, repeat the above steps to find unencoded points, resulting in a set of chaincode, which is the Freeman chaincode. If it is a closed loop, after encoding, return to the initial point, and the initial point coordinates can be omitted. Figure 7 The diagram shows the outline points. The bottom left corner cell represents the starting point of the chain code, with coordinates (1, 1). Traversing the chain code in the arrow manner, the Freeman code is 21176644 (excluding the starting point) or 211766444 (including the starting point).
[0044] Contour tracking algorithm: First, starting from the boundary point, traverse adjacent pixels according to specific rules. Second, use a dual thresholding mechanism (i.e., foreground pixel threshold and background pixel threshold, with a pixel threshold range of 0~255) to distinguish between the foreground and background of the inner and outer boundaries. Finally, use the Freeman chain code mentioned above to record the direction of movement of the contour points.
[0045] Outline area calculation algorithm: Green's theorem is used to calculate the area of a polygon outline. Let D be a region in a plane bounded by piecewise smooth simple closed curves L, and let P(x,y) and Q(x,y) have continuous first-order partial derivatives on D. The specific formula is as follows:
[0046] The contour coordinates of the gap region (new mask) are obtained by using a contour tracking algorithm, and the area of the gap region is obtained by using a contour area calculation algorithm.
[0047] Step S500: Collapse Hole Determination and Geometric Parameter Calculation The geometric feature parameters of the hole are calculated based on the hole contour coordinates, and the collapsed hole is determined based on the geometric feature parameters. The hole distribution density is calculated by combining the hole diameter determination algorithm and the hole spacing determination algorithm, and the detection quality result is output. The specific steps are as follows: For each hole contour coordinate point obtained in step S200, fit the minimum circumcircle and the maximum incircle, and obtain the center of the minimum circumcircle (r_x1, r_y1), the diameter of the minimum circumcircle (r_d1), the center of the maximum incircle (r_x2, r_y2), and the diameter of the maximum incircle (r_d2). The center of the filter circle is the distance from the center of the minimum circumcircle and the center of the maximum incircle to the center, i.e., ((r_x1+r_x2)*0.5, (r_y1+r_y2)*0.5). The diameter of the filter circle is half of the sum of the diameters of the minimum circumcircle and the maximum incircle, i.e., (r_d1+r_d2)*0.5. The criterion for determining a collapsed hole is: whether the diameter of the filter circle is less than 15um; if so, it is a collapsed hole; otherwise, it is not.
[0048] The hole spacing calculation algorithm includes the following steps: First, identify a hole with a diameter of 25 (standard hole diameter is 25±5) as the reference hole. Calculate the center distance between the reference hole and all other holes. Then, select all holes with a center distance between 85µm and 110µm as the reference holes for the next round of calculation and calculate their center distances with the remaining holes (i.e., excluding the reference holes from the previous round). This process continues until all holes meeting the standard have been calculated. If the reference hole has no adjacent holes with a center distance between 80µm and 110µm, the reference hole is discarded and its center distance is not calculated. Figure 8 As shown, the renderings of the aperture (left) and the aperture spacing (right) are displayed.
[0049] like Figure 9 As shown, the results of all steps are integrated and an Excel report is output. This Excel report contains the following information: Total number of holes drilled, total number of holes missed, and percentage; Aperture distribution (including collapsed hole markings); Hole spacing distribution (including the results of iterative calculation of the reference hole); Information on the area, length, and width of the gap region.
[0050] Example 2: This invention also provides an intelligent detection system for micron-level pores in surface coatings, such as... Figure 10 As shown, it includes the following modules: Image acquisition and processing module 01 acquires images of the coating surface using an industrial camera and performs the steps of step S100 in Example 1; the image acquisition and processing module is used to acquire the image to be inspected on the coating surface and perform standardized preprocessing operations such as image scaling and pixel filling.
[0051] The hole contour recognition module 02 executes the steps of step S200 in embodiment 1; it is equipped with a trained hole contour segmentation model, which is used to segment the preprocessed image, obtain the hole pixel probability distribution map, perform binarization processing on the hole pixel probability distribution map, and extract the hole contour coordinates using a contour tracking algorithm.
[0052] The model training employs a dynamic weight adjustment strategy. For the first 30% of training epochs, a fixed value of pos_weight=5 is used in the BCEWithLogits loss function to maintain a moderate learning ability for target features. In the latter 70% of epochs, the model has developed a certain understanding of the detected targets. The BCEWithLogits loss function with dynamically updated pos_weight is then used. Specifically, in each epoch and for each batch size, the ratio of positive to negative samples detected by the model is calculated. A threshold is used to filter the data to obtain the total number of target samples (N) predicted by the model in the current batch size image. The number of positive samples (P) is obtained from the target labels, and finally, the number of negative samples (NP) is obtained. The ratio of positive to negative samples is P / (N-P+1*10-6), where 10-6 is used to prevent extreme cases where the division by zero occurs. The pos_weight parameter of the current batch size is the pos_weight of the previous batch size * 0.9 plus 0.1 of the positive and negative sample ratio of the current batch size, and the final value is limited to the range [1, 10) to achieve the purpose of automatically adjusting the learning ability of the model during training. The specific mathematical logic formula is as follows:
[0053] .
[0054] The Gap region identification module 03 executes the steps of step S300 in Example 1; it is used to perform morphological operations and geometric size determination based on the hole contour coordinates to identify the Gap region on the coating surface.
[0055] The missing hole detection module 04 executes the steps of step S400 in Example 1; it is equipped with detection model 2 (Transformer structure); it is configured with a trained missing hole detection model to detect suspected missing hole areas, and combines the results of the Gap area recognition module to remove false detection areas and output the coordinates of the real missing hole.
[0056] The quality judgment and output module 05 executes the steps of step S500 in Example 1; it is used to calculate the hole diameter and hole spacing geometric parameters based on the hole contour coordinates, perform collapsed hole judgment and hole spacing iterative calculation, and output the detection quality results.
[0057] The quality determination and output module includes: Collapse Hole Judgment Unit 51: Used to calculate the minimum circumcircle and the maximum incircle of the hole profile, and determine whether the hole has collapsed based on the average diameter of the two and a preset threshold. Hole spacing calculation unit 52: used to perform iterative hole spacing determination, by selecting a reference hole and iteratively searching for adjacent holes whose center distance meets the preset conditions, and calculating hole distribution information; Result output unit 53: Used to integrate data and generate an Excel report, including total number of holes, statistics of missed holes, hole diameter / hole spacing distribution, etc.
[0058] The above embodiments describe in detail the specific steps of the method and the module implementation of the system, covering the entire process from image acquisition to result output. They solve the problems of efficiency, accuracy and adaptability in micron-level pore detection, and all technical details correspond to the content of the claims, providing sufficient basis for the claims.
[0059] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A smart detection method for micron-level pores in a surface coating, characterized in that, Includes the following steps: A detection image of the coating surface is acquired, and the detection image is subjected to normalization preprocessing, which includes image scaling and pixel filling of missing areas in the scaled image. The preprocessed image is input into the trained hole contour segmentation model to obtain the hole pixel probability distribution map. The hole pixel probability distribution map is binarized and the hole contour coordinates are extracted using a contour tracking algorithm. Based on the hole contour coordinates, a hole connected region is constructed through morphological operations, and gap regions that do not require drilling are selected according to the geometric features of the connected region. The preprocessed image is input into the trained missing hole detection model to obtain the coordinates of the suspected missing hole area. The suspected missing hole area is then filtered in conjunction with the gap area to obtain the real missing hole area. Calculate the geometric feature parameters of the hole based on the hole outline coordinates, and determine the collapsed hole based on the geometric feature parameters; The aperture distribution density is calculated by combining the aperture determination algorithm and the aperture spacing determination algorithm, and the detection quality result is output.
2. The intelligent detection method according to claim 1, characterized in that, The methods for image scaling and padding preprocessing are as follows: The scaling factor is calculated based on the long side of the acquired image. The short side is scaled by the same factor to scale the image to a preset resolution. Areas on the short side that are insufficient after scaling are filled with preset pixel values, and the position information of the filled areas is recorded.
3. The intelligent detection method according to claim 1 or 2, characterized in that, The following steps are used to segment the outline of the hole: S1: Delete the filled area during scaling in the hole pixel probability distribution map; S2: Upsample the remaining portion to the same size as the original image using bilinear interpolation; S3: Filter out all pixel regions with a probability value greater than 0.5 by thresholding, set these regions to 255, and set other regions to 0 to obtain the mask image; S4: Use a contour tracking algorithm to identify all contour coordinate points in the mask image, i.e., the contour coordinate points of holes.
4. The intelligent detection method according to claim 3, characterized in that, The method for filtering gap areas without drilling includes the following steps: The opening and dilation operations are performed sequentially on the binarized hole region to obtain the hole connectivity mask image; The region in the image to be detected, excluding the hole-connected mask, is taken as a suspected blank region, and the minimum bounding rectangle of the suspected blank region is calculated. If the length or width of the minimum bounding rectangle is greater than a preset ratio threshold of the corresponding side length of the image, then the region is determined to be a gap region.
5. The intelligent detection method according to claim 1, characterized in that, The method for determining the collapsed hole is as follows: The minimum circumcircle and the maximum incircle are fitted based on the coordinate points of a single hole profile to obtain the center of the minimum circumcircle, the diameter of the minimum circumcircle, the center of the maximum incircle, and the diameter of the maximum incircle. The coordinates of the center of the reference circle are calculated as the midpoint between the center of the smallest circumcircle and the center of the largest incircle. The diameter of the reference circle is calculated as half the sum of the diameters of the smallest circumcircle and the largest incircle. If the diameter of the reference circle is less than the preset collapse threshold, the hole is determined to be a collapse hole; otherwise, it is not.
6. The intelligent detection method according to claim 1, characterized in that, The hole contour segmentation model adopts a U-shaped deep learning model; The U-shaped deep learning model comprises multiple modules; each module includes a self-attention mechanism and two convolutional layers; the modules are arranged symmetrically left and right; the left module is a downsampling feature extraction and encoding module, where the image scale is halved and the dimension is doubled with each downsampling; the right module is an upsampling decoding module, where the image scale is doubled and the dimension is halved with each upsampling; shortcut links are used between the left and right modules to prevent the location information and shallow information of the items to be detected in the image from being forgotten as the network layers deepen; The mathematical logic formula for the self-attention mechanism is as follows: Where: Q is the query vector, representing the content that needs to be focused on; K is the key vector, used to match the query vector Q and determine which content needs to be focused on; V is the value vector, storing the actual information and ultimately used to generate a new representation. This is a scaling factor to prevent large values from affecting gradient stability. `softmax` is a normalization function that outputs the result as a probability value between 0 and 1.
7. The intelligent detection method according to claim 1, characterized in that, The hole spacing calculation algorithm includes the following steps: Select a hole with a diameter within the preset standard hole diameter range as the initial reference hole; Calculate the center distance between the reference hole and the remaining holes, and mark the holes whose center distance is within the preset qualified spacing range as adjacent holes; Using the adjacent holes as the new reference holes for the next iteration, the center distance is repeatedly calculated until all holes that meet the conditions have been traversed; If there are no adjacent holes with a center-to-center distance that meets the preset acceptable spacing range for the current reference hole, then the iterative calculation of this path will stop.
8. An intelligent detection system for micron-level pores in a surface coating, characterized in that, include: The image acquisition and processing module is used to acquire the image to be inspected on the coating surface and perform standardized preprocessing operations such as image scaling and pixel filling. The hole contour recognition module is equipped with a trained hole contour segmentation model, which is used to segment the preprocessed image, obtain the hole pixel probability distribution map, perform binarization on the hole pixel probability distribution map, and extract the hole contour coordinates using a contour tracking algorithm. The Gap region recognition module is used to perform morphological operations and geometric size determination based on the hole contour coordinates to identify the Gap region on the coating surface. The missing hole detection module is equipped with a pre-trained missing hole detection model to detect suspected missing hole areas, and combines the results of the Gap area recognition module to remove false detection areas and output the coordinates of the real missing holes. The quality assessment and output module is used to calculate the hole diameter and hole spacing geometric parameters based on the hole contour coordinates, perform collapsed hole assessment and hole spacing iterative calculation, and output the inspection quality results.
9. The intelligent detection system according to claim 8, characterized in that, In the hole contour recognition module, the hole contour segmentation model adopts a U-shaped deep learning model based on a self-attention mechanism. The network contains multiple symmetrically arranged modules, each of which includes a self-attention mechanism and two convolutional layers. The left module is a downsampling feature extraction and encoding module, in which the scale of the downsampled image becomes half of the previous one and the dimension is twice the original. The right module is an upsampling decoding module, in which the scale of the upsampled image is twice the previous one and the dimension is half the original. The modules are linked by shortcuts.
10. The intelligent detection system according to claim 8, characterized in that, The quality determination and output module includes: The collapse hole determination unit is used to calculate the minimum circumcircle and the maximum incircle of the hole profile, and determine whether the hole has collapsed based on the average diameter of the two and a preset threshold. The hole spacing calculation unit is used to perform iterative hole spacing determination. It calculates hole distribution information by selecting a reference hole and iteratively searching for adjacent holes whose center distance meets the preset conditions.