A method for deep hole surface defect detection and CV size calculation

The pyramid features are extracted through the HRNet and ASPP modules, combined with the Opencv library to calculate the defect arc and depth coordinates, and the least squares method is used to fit the deep hole defect size, which solves the problem of illumination and noise effects in deep hole detection and achieves high-precision deep hole detection. Defect detection.

CN118037664BActive Publication Date: 2024-10-01CHENGDU TIANXING YAMADA AUTOMOTIVE PARTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410188841.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-20
Publication Date
2024-10-01
Estimated Expiration
2044-02-20

AI Technical Summary

Technical Problem

Deep hole defect detection is affected by lighting conditions, noise, internal stains, metal reflection and other factors of the imaging equipment. The detection is difficult and the accuracy is low. The textured surface with extremely small aperture increases the resistance to background interference requirements.

Method used

The HRNet backbone network is used to extract the pyramid features, and is cascaded through the ASPP module and the Decoder module, combined with the Opencv library to calculate the arc and depth coordinates of the defect contour and the aperture center, and the least squares regression is used to fit a high-order polynomial function to determine the defect size.

Benefits of technology

It achieves high-precision detection of defect size in deep hole environment, reduces detection difficulty and noise impact, improves detection accuracy, and is suitable for deep hole defect detection applications such as endoscopes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118037664B_ABST
    Figure CN118037664B_ABST
Patent Text Reader

Abstract

The invention discloses a method for detecting surface defects of deep holes. The image of the deep hole to be tested is input into the HRNet backbone network. The HRNet backbone network extracts the pyramid feature #imgabs0#. The HRNet backbone network inputs the pyramid feature #imgabs1# into the ASPP module. The Decoder module cascades the pyramid feature #imgabs2# to obtain the spatial feature of the size of the original input #imgabs3#. The spatial feature is upsampled 4 times to obtain the segmentation semantics. A method for calculating the CV size of the surface defect of a deep hole is also disclosed. The Opencv library is called to obtain the coordinate set of each point on the defect closed contour in the segmentation semantics, the arc formed by each point and the aperture center is calculated, and the two points with the largest arc are found. The angle / arc between the two points and the aperture center is used to determine the maximum arc formed between the defect contour and the aperture center point, and the shallowest coordinate and the deepest coordinate in the depth direction of the defect. The invention adopts HRNet that maintains high-resolution features, utilizes all the pyramid features output by HRNet, and adopts the improved ASPP-Pool module to enhance important features, suppress unimportant features, reduce the difficulty of deep hole defect detection, and accurately calculate the CV size of the deep hole surface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of deep hole surface defect detection, in particular to a deep hole surface defect detection and CV size calculation method. Background Art

[0002] Deep hole defect detection is an important inspection task in the industrial field. Due to the particularity of deep holes, the detection rate of deep hole defects and the detection accuracy of size have become the pain points and difficulties in this field. Unlike traditional planar imaging CV (computer machine vision) tasks, the deep hole environment will cause imaging distortion, and the area ratio of defects can be as low as <1 / 10000, so it is necessary to use high-precision algorithms and cooperate with high-resolution endoscopic imaging equipment for detection. In addition, the detection of deep hole defects is affected by factors such as the lighting conditions, noise, internal stains, and metal reflections of the imaging equipment, which increases the difficulty of deep hole defect detection. The detection of deep hole defects requires very high precision, and even tiny defects may have a significant impact on the quality of the product. At the same time, textured surfaces with rich apertures or variable lighting conditions will increase the requirements for the detection method's resistance to background interference. Summary of the invention

[0003] The purpose of the present invention is to provide a method for deep hole surface defect detection and CV size calculation, which is used to solve the problem that the detection of deep hole defects in the prior art is affected by factors such as the lighting conditions of the imaging equipment, noise, internal stains, metal reflections, etc., and the deep hole defect detection is difficult and has low accuracy, and further provides a method for accurately calculating the size of deep hole defects.

[0004] The present invention solves the above problems through the following technical solutions:

[0005] A deep hole surface defect detection method, comprising:

[0006] Step S100: Input the deep hole image to be measured into the HRNet backbone network, and the HRNet backbone network extracts pyramid features

[0007] Step S200, HRNet backbone network transforms pyramid features Input ASPP module; Decoder module cascade pyramid features Get the original input Spatial characteristics of size;

[0008] Step S300, upsample the spatial features by 4 times to obtain segmentation semantics, which is described as follows:

[0009]

[0010] It can be seen that the semantic shape is (H, W, 2), where H and W represent the height and width of the image respectively, and the array with an internal length of 2 represents whether the current pixel is a defect and satisfies:

[0011]

[0012] A method for calculating the CV size of a deep hole surface defect, comprising:

[0013] Step A: Call the Opencv library to obtain the coordinate set of each point on the defect closed contour in the segmentation semantics:

[0014] [(x 1 ,y 1 ),(x 2 ,y 2 ),…,(x n ,y n )]

[0015] Calculate the arc formed by each point on the defect closed contour and the aperture center on the deep hole image to be measured, find the two points with the largest arc, that is, find the boundary coordinates of the defect, and determine the maximum arc formed between the defect contour and the aperture center point from the angle / arc between these two points and the aperture center, and replace the defect boundary width calculation with arc length calculation:

[0016] Arc length = θ·R

[0017] R represents the actual deep hole radius;

[0018] Step B, calculating the shallowest coordinate and the deepest coordinate of the defect in the depth direction, specifically including:

[0019] The least squares regression method is used to fit the high-order polynomial function, and the mathematical expression between the coordinates of each point on the defect closed contour and the depth dimension is constructed:

[0020]

[0021] Where n' represents the polynomial order, A m , B m represents the coefficients of the mth-order polynomial;

[0022] By traversing the coordinates of each point on the closed contour of the defect, calculating the Euclidean distance between each point and the center of the aperture, the shallowest and deepest coordinates in the depth direction are found; using the defect contour coordinates and combining the depth fitting formula, the depth size of the deep hole defect is determined, which is expressed as follows:

[0023]

[0024] Among them, (x max ,y max ) and (xmin ,y min ) represent the shallowest and deepest coordinates of the defect in the depth direction, respectively.

[0025] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0026] (1) The present invention adopts HRNet that maintains high-resolution features, utilizes all pyramid features output by HRNet, and adopts an improved ASPP-Pool module to enhance important features, suppress unimportant features, and reduce the difficulty of deep hole defect detection.

[0027] (2) The present invention further uses the feature of the scaling invariance of the angle between the boundary of the defect contour and the center of the aperture to segment the semantics of the deep hole defect detection, calculates the width of the defect contour and converts it into arc length, and then calculates the Euclidean distance between each point on the contour and the center of the aperture by constructing a fitting expression between the defect contour coordinates and the depth dimension, finds the shallowest and deepest coordinates in the depth direction, and uses the defect contour coordinates combined with the depth fitting formula to determine the depth dimension of the deep hole defect. This enables accurate calculation of the defect CV dimension.

[0028] (3) The present invention reduces model overhead.

[0029] (4) The present invention can be applied to deep hole defect detection applications such as endoscopes. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is a diagram of the architecture of the model HR-DeepLabV3+ used for deep hole surface defect detection in the present invention;

[0031] Figure 2 It is a schematic diagram of the visual presentation change of defects accompanying the lens movement in the deep hole defect detection process;

[0032] Figure 3 The defect closed contour obtained by the Opencv / findContours method based on the semantic output of HR-DeepLabV3+;

[0033] Figure 4 This is a schematic diagram showing that the real size of the defect cannot be converted by the pixel size under the endoscopic imaging distortion and deep hole environment;

[0034] Figure 5 It is a schematic diagram showing that the angle formed by the defect edge and the aperture center remains unchanged during the movement of the endoscope;

[0035] Figure 6 This is a schematic diagram showing that the scale intervals gradually approach each other as the depth increases, with the marking being engraved at intervals of 0.5 mm. DETAILED DESCRIPTION

[0036] The present invention is further described in detail below in conjunction with examples, but the embodiments of the present invention are not limited thereto.

[0037] Embodiment 1:

[0038] A deep hole surface defect detection method is implemented based on the semantic segmentation model DeepLabv3+, in which the encoder is composed of a conventional backbone model (ResNet, used to extract multi-scale features) and a spatial pyramid pooling module (ASPP, enhanced spatial information) based on dilated convolution. The decoder module fuses the underlying features with the high-level features to enhance the multi-scale semantic expression of the model. The improvements of the present invention include:

[0039] 1) In the present invention, HRNet, which maintains high-resolution features, is used as the BackBone of DeepLabV3+, which solves the problem that most traditional backbone models use residual cascades due to the extremely small defect size of the aperture, which may lead to the loss of small defect features.

[0040] The present invention Panoptic-DeepLab uses Replace the original As the basis, all pyramid features output by HRNet are fully utilized.

[0041] 2) The ASPP-Pool module uses global pooling to compress features into a global description vector to capture global information. The present invention uses a scaled convolutional attention mechanism (SEB) to replace the ASPP-Pool module;

[0042] The module composition before and after replacement is as follows:

[0043] Before replacement:

[0044] After replacement:

[0045] Among them, Swish activation can be expressed as:

[0046] x·Sigmoid(x)

[0047] The S function controls the output in the (0,1) interval, and this process achieves the weighting of feature x.

[0048] The forward reasoning is as follows:

[0049] Before replacement:

[0050] After replacement:

[0051] Assume that the shape of the input feature x is (B, H, W, C). The feature information in the calculation process is represented as follows:

[0052]

[0053] First, global pooling compresses the feature x into a global description vector to capture global information. Then the global description vector is mapped to a low dimension to compress the potential features. It is then remapped to a high dimension through Swish activation to learn the channel weights. Finally, the channel weights are multiplied by the broadcast matrix with the input x to enhance important features and suppress unimportant features.

[0054] 3) Panoptic-DeepLab both use 5×5 depthwise separable convolutions when concatenating features. This paper uses two 3×3 depthwise separable convolutions instead, with a smaller number of parameters than 5. 2 :3 2 , reducing model inference overhead.

[0055] The architecture of HR-DeepLabV3+ is as follows Figure 1 As shown:

[0056] It can be seen that the overall structure of the Decoder module is almost the same as Panoptic-DeepLab, and the underlying input features are The number of cascade operations of features increases from 2 to 3. The specific process is described as follows:

[0057] concat(Upsample(concat(UpSample(concat(UpSample(P 5 )by 2,P 4 )by 2),P 3 ))by 2,P 2 )

[0058] The deep hole surface defect detection process includes:

[0059] Step S100: Input the deep hole image to be measured into the HRNet backbone network, and the HRNet backbone network extracts pyramid features

[0060] Step S200, HRNet backbone network transforms pyramid features Input ASPP module; Decoder module cascade pyramid features Get the original input Spatial characteristics of size;

[0061] Step S300, upsample the spatial features by 4 times to obtain segmentation semantics, which is described as follows:

[0062]

[0063] It can be seen that the semantic shape is (H, W, 2), where H and W represent the height and width of the image respectively, and the array with an internal length of 2 represents whether the current pixel is a defect and satisfies:

[0064]

[0065] The above steps utilize the improved model to determine whether there are defects in the current image from the deep hole image to be tested.

[0066] Embodiment 2:

[0067] In the deep hole defect detection process, as the endoscope moves, the same defect appears in different sizes visually. Therefore, the accurate defect size can only be calculated through invariant features.

[0068] Based on the segmentation semantics obtained in Example 1, a method for calculating the CV size of a deep hole surface defect includes:

[0069] Step A: Take a deep hole image containing defects such as Figure 3 As shown, the Opencv library is called to obtain the coordinate set of each point on the defect closed contour in the segmentation semantics output by HR-DeepLabV3+:

[0070] [(x 1 ,y 1 ),(x 2 ,y 2 ),…,(x n ,y n )]

[0071] Theoretically, under the condition of plane imaging, the closed contour of the defect can be obtained, and the actual size can be converted based on methods such as the circumscribed rectangle of the defect.

[0072] Due to the distortion of endoscope imaging and the deep hole environment, the actual size of the defect cannot be converted by the pixel size. Taking the depth (height) of the defect as an example, Figure 4 As shown, it can be seen that even if the two farthest points in the depth direction (P 1 ,P 2 ), it is still impossible to establish a mathematical expression to calculate the size, so the solution of converting the size through imaging is not feasible.

[0073] like Figure 2 As shown in , we found that as the endoscope moves, the visual presentation of the defect has size differences, but the angle between the edge of the defect and the center of the aperture remains unchanged during the entire process, which is scale invariant. Figure 5 Show.

[0074] The formula for calculating radians is as follows:

[0075]

[0076] Among them, P ij represents any coordinate on the defect contour; P center Indicates the center of the aperture.

[0077] By traversing the contour coordinates, the arc formed by each point on the defect closed contour and the aperture center on the deep hole image to be measured is calculated, and the two points that form the largest arc are found, that is, the boundary coordinates of the defect are found. The angle / arc between these two points and the aperture center is used to determine the maximum arc formed between the defect contour and the aperture center point, and the boundary of the defect, that is, the calculation of the deep hole defect width, is replaced by the arc length calculation:

[0078] Arc length = θ·R

[0079] R represents the actual deep hole radius;

[0080] Step B, calculating the shallowest coordinate and the deepest coordinate of the defect in the depth direction, specifically including:

[0081] Since the dimension in the depth direction cannot be calculated by establishing a mathematical expression, the present invention uses the least squares regression to fit a high-order polynomial function to construct a mathematical expression between the coordinates of each point on the defect closed contour and the depth dimension:

[0082]

[0083] Where n' represents the polynomial order, A m , B m represents the coefficients of the mth-order polynomial;

[0084] The accuracy of the fitting formula directly determines the precision of the defect depth. The standard is engraved at intervals of 0.5 mm in depth, such as Figure 6 As shown, it can be seen that as the depth increases, the scale interval gradually approaches. This scheme specifies the maximum fitting depth and utilizes the relationship between the ring coordinates and the depth constructor.

[0085] By traversing the coordinates of each point on the closed contour of the defect, calculating the Euclidean distance between each point and the center of the aperture, the shallowest and deepest coordinates in the depth direction are found; using the defect contour coordinates and combining the depth fitting formula, the depth size of the deep hole defect is determined, which is expressed as follows:

[0086]

[0087] Among them, (x max ,y max ) and (x min ,y min) represent the shallowest and deepest coordinates of the defect in the depth direction, that is, the depth of the deep hole defect is obtained.

[0088] Thus, accurate calculation of the CV size of deep hole surface defects is achieved.

[0089] Although the present invention is described herein with reference to the illustrative embodiments of the present invention, the above embodiments are only preferred embodiments of the present invention, and the embodiments of the present invention are not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and embodiments, which will fall within the scope and spirit of the principles disclosed in this application.

Claims

1. A method for detecting surface defects of deep holes, characterized in that: include: Step S100: Input the deep hole image to be measured into the HRNet backbone network, and the HRNet backbone network extracts pyramid features Step S200, HRNet backbone network transforms pyramid features Input ASPP module; Decoder module cascade pyramid features Get the original input Spatial characteristics of size; Step S300, upsample the spatial features by 4 times to obtain segmentation semantics, which is described as follows: It can be seen that the semantic shape is (H, W, 2), where H and W represent the height and width of the image respectively, and the array with an internal length of 2 represents whether the current pixel is a defect and satisfies:

2. A method for calculating the CV size of a deep hole surface defect implemented by a deep hole surface defect detection method as claimed in claim 1, characterized in that: include: Step A: Call the Opencv library to obtain the coordinate set of each point on the defect closed contour in the segmentation semantics: [(x1,y1),(x2,y2),…,(x n ,y n )] Calculate the arc formed by each point on the defect closed contour and the aperture center on the deep hole image to be measured, find the two points with the largest arc, that is, find the boundary coordinates of the defect, and determine the maximum arc formed between the defect contour and the aperture center point from the angle / arc between these two points and the aperture center, and replace the defect boundary width calculation with arc length calculation: Arc length = θ·R R represents the actual deep hole radius; Step B, calculating the shallowest coordinate and the deepest coordinate of the defect in the depth direction, specifically including: The least squares regression method is used to fit the high-order polynomial function, and the mathematical expression between the coordinates of each point on the defect closed contour and the depth dimension is constructed: Where n' represents the polynomial order, A m , B m represents the coefficients of the mth-order polynomial; By traversing the coordinates of each point on the closed contour of the defect, calculating the Euclidean distance between each point and the center of the aperture, the shallowest and deepest coordinates in the depth direction are found; using the defect contour coordinates and combining the depth fitting formula, the depth size of the deep hole defect is determined, which is expressed as follows: Among them, (x max ,y max ) and (x min ,y min ) represent the shallowest and deepest coordinates of the defect in the depth direction, respectively.