Metallic sealing gasket quality detection method based on machine vision

Based on machine vision detection methods, the size and surface defect detection system of metal sealing pads are constructed, and the improved Faster R-CNN network model is used to perform non-contact detection. , Achieve efficient and accurate detection effects.

CN119379654APending Publication Date: 2025-01-28LIAONING POLYTECHNIC VOCATIONAL COLLEGE
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411514739.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The prior art is slow in detecting the size and surface defects of metal sealing gaskets, and is affected by human factors, and cannot meet the needs of high-speed automated production lines.

Method used

Using a machine vision-based detection method, by constructing the size defect detection system and surface defect detection system of metal sealing pads, using image pre-processing, edge detection and dimensional measurement module, combined with the improved Faster R-CNN network model for contactless detection Essence

Benefits of technology

The detection efficiency and accuracy of the metal sealing pads have been improved, and no contact detection has been achieved, the impact of human factors is reduced, and it is suitable for high -speed automated production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379654A_ABST
    Figure CN119379654A_ABST
Patent Text Reader

Abstract

The invention discloses a metal sealing gasket quality detection method based on machine vision. The method comprises the following steps: constructing a metal sealing gasket size defect detection system and a metal sealing gasket surface defect detection system; the metal sealing gasket size defect detection system comprises an image preprocessing module, an edge detection module and a size measurement module, the metal sealing gasket surface defect detection system is obtained through training of an improved Faster R-CNN network model. Wherein the improved Faster R-CNN network model comprises a feature extraction module, an RPN module, an ROI Align module and a full connection layer which are connected in sequence; shooting an image of the to-be-detected metal sealing gasket through a camera, inputting the image of the metal sealing gasket into a metal sealing gasket size defect detection system, and judging whether the size of the metal sealing gasket is qualified or not; and inputting the metal sealing gasket image with the qualified size into a metal sealing gasket surface defect detection system, and outputting a surface defect detection result by the metal sealing gasket surface defect detection system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of metal sealing gaskets, and in particular relates to a metal sealing gasket quality detection method based on machine vision. Background Art

[0002] The industry has high requirements for the processing dimensional accuracy of metal sealing gaskets. At present, manual sampling is usually used to detect their dimensions and surface defects. There are two main ways to detect dimensions: designing standard measuring tools to clamp, position and compare the parts to be tested; using simple measuring tools for manual measurement, such as vernier calipers and micrometers. The defects of manual detection are: slow detection speed and low accuracy, which cannot meet the needs of high-speed automated production lines; and the detection quality is affected by human factors, with high errors and false detection rates. In addition, manual detection is a contact measurement, and for parts that are easily deformed under contact force, the measurement error is large. Summary of the invention

[0003] The purpose of the present invention is to provide a metal sealing gasket quality inspection method based on machine vision, which can sequentially perform non-contact inspection on the size and surface defects of the metal sealing gasket, thereby improving the inspection efficiency and inspection accuracy.

[0004] The technical solution provided by the present invention is:

[0005] A metal sealing gasket quality detection method based on machine vision, comprising:

[0006] Construct metal sealing gasket size defect detection system and metal sealing gasket surface defect detection system;

[0007] The metal sealing gasket size defect detection system comprises: an image preprocessing module, an edge detection module and a size measurement module;

[0008] The metal sealing gasket surface defect detection system is obtained by training the improved Faster R-CNN network model;

[0009] The improved Faster R-CNN network model includes a feature extraction module, an RPN module, a ROI Align module and a fully connected layer connected in sequence;

[0010] Taking an image of the metal sealing gasket to be inspected by a camera, and inputting the image of the metal sealing gasket into the metal sealing gasket size defect detection system to determine whether the size of the metal sealing gasket is qualified;

[0011] Inputting an image of a metal sealing gasket with a qualified size into the metal sealing gasket surface defect detection system, and the metal sealing gasket surface defect detection system outputs a surface defect detection result;

[0012] Wherein, the surface defect detection result is qualified or surface defect type.

[0013] Preferably, judging whether the size of the metal sealing gasket is qualified comprises the following steps:

[0014] Step 1: using the image preprocessing module to sequentially perform distortion correction, grayscale conversion, filtering and denoising, and threshold segmentation on the metal sealing gasket image;

[0015] Step 2: performing edge detection on the preprocessed metal sealing gasket image by the edge detection module to obtain sub-pixel repositioned edge points of the metal sealing gasket;

[0016] Step 3: Using a size measurement module to perform circle fitting on the sub-pixel repositioned edge points, and obtain the inner diameter and outer diameter of the metal sealing gasket;

[0017] Step 4: Calculate the dimensional errors between the inner diameter and outer diameter of the metal sealing gasket and the specified size respectively; if the dimensional error meets the set threshold, the metal sealing gasket is judged to be qualified in size; otherwise, the metal sealing gasket is judged to be unqualified in size.

[0018] Preferably, in said step three, it further comprises:

[0019] The roundness of the sub-pixel relocated edge points is measured to obtain the inner and outer roundness of the metal sealing gasket respectively;

[0020] In the step 4, it also includes:

[0021] The roundness errors of the inner and outer roundness of the metal sealing gasket and the specified values ​​are calculated respectively; if the roundness error and the size error both meet the set thresholds, the size of the metal sealing gasket is judged to be qualified; otherwise, the size of the metal sealing gasket is judged to be unqualified.

[0022] Preferably, in step 2, the process of edge detection of the metal sealing gasket image by the edge detection module is as follows:

[0023] After the Canny operator is used to extract the pixel-level edge of the metal sealing gasket, the Zernike moment method is used to extract the sub-pixel edge of the metal sealing gasket, and the sub-pixel relocation edge point of the metal sealing gasket is obtained.

[0024] Preferably, in step three, the least square method is used for circle fitting, and the minimum area method is used for roundness measurement.

[0025] Preferably, the feature extraction module consists of a ResNet-50 feature extraction network and a feature pyramid network.

[0026] Preferably, the improved Faster R-CNN network model is trained using a stochastic gradient descent optimization algorithm with momentum; the dynamic parameter is set to 0.9, the weight decay coefficient is set to 0.0005; and the number of training iterations is 25,000.

[0027] The beneficial effects of the present invention are:

[0028] The metal sealing gasket quality inspection method based on machine vision provided by the present invention can sequentially perform non-contact inspection on the size and surface defects of the metal sealing gasket, thereby improving the inspection efficiency and inspection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 This is a flow chart of the metal sealing gasket quality detection method based on machine vision described in the present invention.

[0030] Figure 2 This is a framework diagram of the improved feature extraction module described in the present invention. DETAILED DESCRIPTION

[0031] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.

[0032] like Figure 1 As shown, the present invention provides a metal sealing gasket quality detection method based on machine vision, and the specific implementation method is as follows.

[0033] 1. Construct a metal sealing gasket size defect detection system and a metal sealing gasket surface defect detection system.

[0034] The metal sealing gasket size defect detection system includes: an image preprocessing module, an edge detection module and a size measurement module. The metal sealing gasket surface defect detection system is obtained by training an improved Faster R-CNN network model. The improved Faster R-CNN network model includes a feature extraction module, an RPN module, an ROI Align module and a fully connected layer connected in sequence.

[0035] Faster R-CNN is an extension of the R-CNN and Fast R-CNN algorithms, including a feature extraction network, a candidate region generation network (RPN), a ROIPooling layer, and a fully connected layer that are connected in sequence. The feature extraction network is mainly used to extract features of the input image; the candidate region generation network (RPN) takes the feature map output by the feature extraction network as input, uses an n×n sliding window and combines different scales and ratios to generate a target region proposal box; the ROIPooling layer takes the feature map output by the feature extraction network and the target region proposal box generated by the RPN as input. Then a feature map with a fixed size is generated; finally, the feature map generated by ROIPooling is passed through a fully connected layer to complete classification and position regression.

[0036] ROIPooling is to separate the region of interest from the feature map and then make it a feature map of fixed size and dimension. However, in the process of feature mapping and block processing, two quantization operations are introduced for rounding, resulting in the problem of region mismatch. Therefore, the present invention replaces ROIPooling with ROI Align to solve the problem of region mismatch.

[0037] The operation process of ROI Align is as follows: first, traverse each candidate area without quantizing the floating point coordinates after mapping; then, divide the candidate area into k×k units without quantizing the boundaries of the divided units; finally, divide each unit into 4 small units, take its center position as the sampling point, and determine 4 sampling points in each unit. Use bilinear interpolation to calculate the image value on the pixel of the sampling point coordinate, and then perform maximum pooling on the calculated 4 sampling points to obtain a fixed-dimensional ROI output. Using ROI Align can obtain more accurate ROI position information on the surface of the metal sealing gasket, thereby improving the accuracy of defect detection.

[0038] As a preferred embodiment, the feature extraction module in the improved Faster R-CNN network model consists of a ResNet-50 feature extraction network and a feature pyramid network.

[0039] The original Faster R-CNN uses VGG16 as the feature extraction network, but due to its limited number of convolutional layers (13 layers), VGG16 cannot ensure that the surface defect features of metal sealing gaskets are fully extracted. However, if a deeper network is used to improve the network feature extraction capability, problems such as gradient vanishing and overfitting may occur. The residual network ResNet can effectively avoid the above problems by adding a residual module structure to the stacked convolutional layers. After testing ResNet networks of different depths, the present invention selects ResNet-50 as the feature extraction network, and combines the feature pyramid network (FPN) to perform multi-scale feature extraction on the surface defects of metal sealing gaskets. The structure of the improved feature extraction module is as follows: Figure 2 shown.

[0040] FPN mainly consists of two parts: bottom-up, top-down and lateral connection. The input image is processed from bottom to top through the convolution kernel of the last layer of the five stages of the ResNet-50 network to output feature maps of different scales from C1 to C5. The output feature maps of C2 to C5 are subjected to 1×1 convolution dimensionality reduction processing. C5 generates feature map M5 after dimensionality reduction processing, and C4 after dimensionality reduction processing is laterally connected and fused with the feature map generated by 2 times upsampling from top to bottom of M5 to generate feature map M4. And so on, M3 and M2 are generated respectively. In order to effectively eliminate the aliasing effect of upsampling, M5 to M2 are subjected to 3×3 convolution processing to generate feature maps P5, P4, P3 and P2. P5 is downsampled by maximum pooling to obtain P6, and finally P2 to P6 feature maps are obtained. The improved feature extraction module can effectively fuse the strong semantic information of high-level feature maps with the strong spatial position information of low-level feature maps to generate multi-scale feature maps with rich position and semantic information.

[0041] The present invention uses real metal sealing gasket surface defect images collected from the metal sealing gasket production line as training sets and test sets. The defect types include three common defects: pits, protrusions and scratches. Labeling is used to annotate the defect types and bounding box positions in the metal sealing gasket images according to the VOC2007 dataset format. Due to the limited number of collected data samples, in order to balance the dataset samples of various types of defects, the metal sealing gasket surface defect sample dataset is expanded through data enhancement to obtain 1,500 images, and 85% of the 500 images of each defect are randomly selected as training sets and 15% as test sets.

[0042] The stochastic gradient descent optimization algorithm with momentum was used to train the configuration parameters of Faster R-CNN. The dynamic parameter was set to 0.9. To prevent overfitting of the model, the weight decay coefficient was set to 0.0005. A total of 25,000 iterations were performed. The learning rate was set to 0.05 for the first 5,000 iterations, 0.005 for 5,000 to 15,000 iterations, and 0.0002 for 15,000 to 25,000 iterations.

[0043] After training, Faster R-CNN was tested on the test set, with the average precision (AP) and mean average precision (mAP) of each defect detection as indicators. After testing, the average precision of pits, bumps and scratches were 96.53%, 97.85% and 97.36% respectively, and the mAP reached 97.24%. This shows that after training, Faster R-CNN can effectively detect surface defects of metal sealing gaskets.

[0044] Second, a camera is used to capture an image of the metal sealing gasket to be inspected, and the image of the metal sealing gasket is input into the metal sealing gasket size defect detection system to determine whether the size of the metal sealing gasket is qualified.

[0045] Determining whether the size of the metal sealing gasket is qualified includes the following steps:

[0046] (1) The image preprocessing module sequentially performs distortion correction, grayscale conversion, filtering and denoising, and threshold segmentation on the metal sealing gasket image.

[0047] Since the images of metal sealing gaskets are taken and collected by enterprises during the industrial production process, the images may be distorted by the lens or geometrically distorted by the poor on-site construction environment and the misaligned shooting angle. Both distortions will affect the subsequent dimensional measurement results.

[0048] This embodiment uses the Lagrange interpolation method as the image distortion correction algorithm to correct the distortion of the metal sealing gasket image. Compared with the traditional template calibration method, this method does not need to solve equations and has a wide range of applications. The inner and outer circles of the distorted metal sealing gasket image are elliptical, while the inner and outer circles of the metal sealing gasket image after dedistortion using the Lagrange interpolation method are restored to a circle, which proves that this algorithm has a good effect on image distortion correction.

[0049] In order to reduce the amount of subsequent calculations and improve the calculation efficiency, the present invention performs grayscale processing on the image after distortion correction. According to the test, the grayscale operation does not damage the edge and surface defects of the image, but the stored image information is only 1 / 4 of the previous one, which verifies the necessity of grayscale processing.

[0050] The commonly used filtering algorithm for image denoising is generally to move an N-dimensional window on the image, and replace the pixel value of the center point of the window with the result of the convolution of the window template and the image to complete the filtering of the entire image. The difference between different algorithms mainly lies in the different window templates. The present invention uses the median filtering method to filter the metal sealing gasket image after grayscale processing. The median filtering has a good effect on eliminating noise points in the original image, and the edges are clear. The processed image is close to the original image.

[0051] Size measurement requires edge information of the metal sealing gasket to be measured. Before extracting the edge, segmenting the target from the background can not only greatly reduce the amount of data and improve the efficiency of subsequent edge detection, but also reduce the interference of irrelevant information and obtain better edge detection effect. Therefore, the present invention uses a threshold segmentation method to process the denoised metal sealing gasket image.

[0052] As a preferred method, the maximum inter-class variance method (Otsu) is used as the threshold segmentation method. The Otsu method can clearly separate the target from the background, and the edge is sharp, which is conducive to subsequent edge detection.

[0053] (2) The edge detection module performs edge detection on the preprocessed metal sealing gasket image to obtain sub-pixel repositioned edge points of the metal sealing gasket.

[0054] First, the Canny operator is used for pixel-level edge detection. The Canny operator is an improvement on the Sobel, Prewitt and other operators. It can effectively suppress image noise and achieve more accurate positioning by refining the edges.

[0055] After that, the moment method is used for sub-pixel edge detection. The moment method detects sub-pixel edges based on the principle of moment invariance: first, the parameter-containing expressions of the moment of the initial image function of the object to be tested and the moment of the image function after rotation or translation of a certain angle are calculated according to the definition formula, and then the equivalent relationship is established according to the corresponding relationship between the moments of the image function before and after rotation or translation. By solving the equation, the parameters reflecting the edge information of the image can be obtained, thereby determining the sub-pixel coordinate points.

[0056] The moment method has simple principle, simple calculation and high positioning accuracy. Based on these advantages, it is widely used in the field of edge detection. As a preferred embodiment, the present invention uses the Zernike moment method to extract the sub-pixel edge of the metal sealing gasket image.

[0057] (3) The sub-pixel repositioned edge points are fitted into a circle through the size measurement module to obtain the inner diameter and outer diameter of the metal sealing gasket.

[0058] As a preferred method, the present invention adopts the least square method for circle fitting. The least square method fits the coordinates of the circle center and the radius by minimizing the sum of the squares of the distances from the circle center to all pixel points, with high accuracy and high speed.

[0059] The specific process is as follows: first, the least squares method is used to fit a circle to the entire edge image. The obtained fitting circle can segment the edge points of the image, and the sub-pixel edge point coordinates of the part contours stored in SubpixelContours are extracted and divided into two parts, which are stored in SubpixelContours1 and SubpixelContours2 respectively. Then, the least squares method is used to fit the coordinate points in SubpixelContours1 and SubpixelContours2 respectively to obtain the size information of the inner diameter and outer diameter.

[0060] The radius of the circle fitted by the least squares method is in pixels. In order to correctly convert it into the actual physical size, it is necessary to calculate the relationship coefficient e between the physical unit and the pixel unit. The calculation formula is as follows:

[0061] e = d / d′;

[0062] Where d and d′ are the actual diameter and pixel unit size respectively.

[0063] (4) Calculate the size errors between the inner diameter and outer diameter of the metal sealing gasket and the specified size respectively; if the size error meets the set threshold, the metal sealing gasket is judged to be qualified; otherwise, the metal sealing gasket is judged to be unqualified. The sample images with qualified and unqualified sizes are marked and stored respectively.

[0064] As a preferred embodiment, (3) also includes: measuring the roundness of the sub-pixel repositioned edge points to obtain the inner and outer roundness of the metal sealing gasket respectively.

[0065] (4) also includes: calculating the roundness errors of the inner and outer roundness of the metal sealing gasket and the specified values ​​respectively; if the roundness error and the size error both meet the set thresholds, the size of the metal sealing gasket is judged to be qualified; otherwise, the size of the metal sealing gasket is judged to be unqualified.

[0066] In this embodiment, the minimum zone method (MZC) is used to measure the inner circle roundness and the outer circle roundness.

[0067] The metal sealing gasket size defect detection system detects two metal gasket samples (sample 1: inner diameter 3.2mm, outer diameter 8.5mm, inner roundness 1.874mm, outer roundness 1.989mm; sample 2: inner diameter 2.5mm, outer diameter 6mm, inner roundness 1.146mm, outer roundness 0.996mm) respectively. The maximum absolute errors of the radius measurement values ​​and roundness measurement values ​​of the two different sizes of circular parts are 0.0085mm and 0.0153mm respectively, that is, the accuracy reaches 0.001mm. In addition, the maximum standard deviations of the radius and roundness measured by the system are 0.0018 and 0.0016 respectively. The two samples were measured 5 times respectively, and the errors of the four parameters measured 5 times for each sample and the actual values ​​were all within 0.005mm, which proves that the measurement results of this paper fluctuate smoothly and the size defect detection method has good stability.

[0068] 3. Use the trained improved Faster R-CNN network model as a metal sealing gasket surface defect detection system; input the metal sealing gasket image with qualified size into the metal sealing gasket surface defect detection system, and the metal sealing gasket surface defect detection system outputs the surface defect detection result.

[0069] The surface defect test result is qualified or the surface defect type (pits, bumps, scratches).

[0070] The metal sealing gasket surface defect detection method provided by the present invention is compared with the accuracy of YOLOv5 and the original Faster R-CNN algorithm, and the detection results are shown in Table 1.

[0071] Table 1 Test results

[0072] algorithm Pits (AP) Protrusion (AP) Scratch(AP) mAP YOLOv5 86.39% 87.54% 86.65% 86.86% Faster R-CNN 87.36% 85.78% 88.95% 87.36% Algorithm of the present invention 96.53% 97.85% 97.36% 97.24%

[0073] It can be seen from Table 1 that the present invention adopts the improved Faster R-CNN as the metal sealing gasket detection system, which can improve the detection accuracy of metal sealing gasket surface defects.

[0074] The metal sealing gasket quality inspection method based on machine vision provided by the present invention can sequentially perform non-contact inspection on the size and surface defects of the metal sealing gasket, thereby improving the inspection efficiency and inspection accuracy.

[0075] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A metal sealing gasket quality detection method based on machine vision, characterized in that: include: Construct metal sealing gasket size defect detection system and metal sealing gasket surface defect detection system; The metal sealing gasket size defect detection system comprises: an image preprocessing module, an edge detection module and a size measurement module; The metal sealing gasket surface defect detection system is obtained by training the improved Faster R-CNN network model; The improved Faster R-CNN network model includes a feature extraction module, an RPN module, an ROIAlign module and a fully connected layer connected in sequence; Taking an image of the metal sealing gasket to be inspected by a camera, and inputting the image of the metal sealing gasket into the metal sealing gasket size defect detection system to determine whether the size of the metal sealing gasket is qualified; Inputting an image of a metal sealing gasket with a qualified size into the metal sealing gasket surface defect detection system, and the metal sealing gasket surface defect detection system outputs a surface defect detection result; Wherein, the surface defect detection result is qualified or surface defect type.

2. The metal sealing gasket quality detection method based on machine vision according to claim 1 is characterized in that: Determining whether the size of the metal sealing gasket is qualified includes the following steps: Step 1: using the image preprocessing module to sequentially perform distortion correction, grayscale conversion, filtering and denoising, and threshold segmentation on the metal sealing gasket image; Step 2: performing edge detection on the preprocessed metal sealing gasket image by the edge detection module to obtain sub-pixel repositioned edge points of the metal sealing gasket; Step 3: Using a size measurement module to perform circle fitting on the sub-pixel repositioned edge points, and obtain the inner diameter and outer diameter of the metal sealing gasket; Step 4: Calculate the dimensional errors between the inner diameter and outer diameter of the metal sealing gasket and the specified size respectively; if the dimensional error meets the set threshold, the metal sealing gasket is judged to be qualified in size; otherwise, the metal sealing gasket is judged to be unqualified in size.

3. The metal sealing gasket quality detection method based on machine vision according to claim 2 is characterized in that: In the step three, it also includes: The roundness of the sub-pixel relocated edge points is measured to obtain the inner and outer roundness of the metal sealing gasket respectively; In the step 4, it also includes: The roundness errors of the inner and outer roundness of the metal sealing gasket and the specified values ​​are calculated respectively; if the roundness error and the size error both meet the set thresholds, the size of the metal sealing gasket is judged to be qualified; otherwise, the size of the metal sealing gasket is judged to be unqualified.

4. The metal sealing gasket quality detection method based on machine vision according to claim 3 is characterized in that: In the step 2, the process of the edge detection module performing edge detection on the metal sealing gasket image is as follows: After the Canny operator is used to extract the pixel-level edge of the metal sealing gasket, the Zernike moment method is used to extract the sub-pixel edge of the metal sealing gasket, and the sub-pixel relocation edge point of the metal sealing gasket is obtained.

5. The metal sealing gasket quality detection method based on machine vision according to claim 3 or 4, characterized in that: In the step three, the least square method is used for circle fitting, and the minimum area method is used for roundness measurement.

6. The metal sealing gasket quality detection method based on machine vision according to claim 1 is characterized in that: The feature extraction module consists of a ResNet-50 feature extraction network and a feature pyramid network.

7. The metal sealing gasket quality detection method based on machine vision according to claim 6 is characterized in that: The improved Faster R-CNN network model was trained using the stochastic gradient descent optimization algorithm with momentum; the dynamic parameter was set to 0.9, the weight decay coefficient was set to 0.0005, and the number of training iterations was 25,000.

Citation Information

Cited By

  • Intelligent groove identification system for welding box type steel component

    CN119952351A