A cylinder liner defect detection method based on deep learning
By using the Mask R-CNN algorithm and mask mechanism in cylinder liner defect detection, combined with the Mask RCNN network of Swin converter, small area detection and regression of high-resolution images are performed, which solves the problem of low traditional detection efficiency and low accuracy. problem, achieving high-precision small target detection.
Patent Information
- Application Number
- CN202210146225.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-17
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-02-17
AI Technical Summary
Traditional human eye detection and existing deep learning methods are inefficient, low-precision, and prone to missed detection in cylinder liner defect detection, and cannot meet the detection needs of enterprises.
Using a method based on deep learning, the Mask R-CNN algorithm is combined with the masking mechanism to perform small area detection and regression on high-resolution images. The Mask RCNN network of the Swin converter is used to train the local map, and the large map is mapped through the small map. The graph method and masking mechanism extract areas of interest and improve detection accuracy.
It significantly improves the accuracy and detection speed of small target detection in the cylinder liner, enhances the detection effect, can accurately identify minor defects on the surface of the cylinder liner, and reduces the impact of noise interference.
Smart Images

Figure CN114549446B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a cylinder liner defect detection method based on deep learning. Background Art
[0002] As the core component of the internal combustion engine, the performance of the cylinder liner directly affects the overall performance of the internal combustion engine. During the production process, the cylinder liner may produce defects such as sand holes, cracks, and wear due to temperature, impurities, and uneven stress distribution during processing. Surface defect detection has become an indispensable part of the factory process. The defect size of the cylinder liner is small, and the image noise interference is large. According to the traditional human eye detection, the efficiency is low, the accuracy is not high, and it is easy to miss the detection. At present, human eye detection can no longer meet the requirements of enterprises, so it is very important to use deep learning for cylinder liner defect detection.
[0003] The detection methods are usually divided into the following three categories:
[0004] Traditional inspection: Traditional defect detection mainly includes manual visual inspection, X-ray inspection, acoustic wave inspection, magnetic particle inspection, eddy current inspection and laser scanning inspection.
[0005] Machine learning detection: Machine learning mainly uses artificial qualitative design features or statistical features of specific areas of the image.
[0006] Deep learning detection: In recent years, object detection using deep learning methods has made great progress. Mainstream algorithms can be divided into two categories according to different processes. One is called the first-order method, such as YOLO, SSD, RetinaNet, etc. The first-order method directly generates anchor points. Its main idea is to sample different positions of the image uniformly and densely. In the sampling process, different scales and aspect ratios are used to extract features through convolutional neural networks, and then classification and regression are performed. Only one step is required in the whole process, so the detection speed is very fast. However, there are also certain problems. Due to the extreme imbalance between positive and negative samples, it is more difficult to train the model. The other is called the second-order method. This method divides the object detection task into two stages to achieve it. First, find the area in the image where the object to be detected may exist, and then classify and distinguish, and select the area with a higher score by setting the threshold method to achieve object detection. Its representative algorithms are Fast R-CNN, Faster R-CNN, and Mask R-CNN. Compared with the first-order network, the second-order network has an RPN layer, and the RPN layer generates candidate boxes, and then generates anchor points from the candidate boxes. The effect of doing this is to improve the accuracy of the first-order network to a certain extent, but the detection time is slower. Summary of the invention
[0007] (I) Technical problems to be solved: In order to solve the technical problems raised by the above-mentioned background technology, the present invention proposes regional segmentation to split a high-resolution image into small areas, and combines a mask mechanism to perform target detection in the small areas, and utilizes the small area detection combination to regress to the high-resolution image, thereby effectively improving the accuracy of small target detection in the high-resolution image; the present invention has certain versatility in other types of small target detection.
[0008] (II) Technical solution: 1. A cylinder liner defect detection method based on deep learning, characterized in that the detection method comprises the following steps:
[0009] 1) Collect cylinder liner images to construct an original data set, preprocess and annotate the images in the original data set, and then divide the original data set into a training set and a test set in proportion;
[0010] 2) Obtain a local defect map of the training set;
[0011] 3) Use the Mask R-CNN algorithm to build a model, and train the model through the local defect map of the training set image to obtain the network model;
[0012] 4) Detect the images in the test set using the obtained network model;
[0013] 5) extracting the region of interest from the detection result through a mask mechanism to enhance the detection effect in step 4);
[0014] 6) Evaluate the detection performance of the network model;
[0015] 7) Perform defect detection on the collected cylinder liner image using the network model obtained in step 4).
[0016] Furthermore, a VOC format dataset is created, and the LabelImg tool is used to annotate the image data in the dataset to generate an XML file. The experimental dataset is a cylinder liner defect image with a size of 2448*2048. The dataset contains three categories, namely sand, scratch, and wear.
[0017] Furthermore, image preprocessing is performed. Since there are various noises in the actual image acquisition process, in order to improve the image quality and highlight the target information of defects, the present invention uses a 5*5 Gaussian filter to perform noise reduction on the cylinder liner data set.
[0018] Furthermore, a method for cropping local images from the original image information is constructed. Local images of size 256*256 are captured using the annotation information of the original image of size 2448*2048. Each local image will contain defects. These local images are used to train the Mask RCNN network based on the Swin converter.
[0019] Furthermore, a small-image mapping large-image detection method is designed. The original image of the test set is divided into 64 small images, and the previously trained network is selected for detection, and finally the images are pieced back to their original size.
[0020] Furthermore, a mask mechanism method is proposed to select a suitable threshold for binarization of the cylinder liner mold image. The morphological operation closing operation is used to remove the tiny black dots of the binarization, and ensure that the binarization area contains the entire region of interest, which is used as the region of interest. The coordinates of the upper end face image are measured, and the center of the circle and the maximum and minimum circle radii are determined according to the area to be detected in the upper end face image. A binarized image of a ring of the same size is drawn to complete the production of the upper end face image mold, which is used as the region of interest of the upper end face image. For the last type of image, we design a specific mask to extract the region of interest. Further improve the detection accuracy.
[0021] (III) Beneficial effects
[0022] 1. The present invention uses a Mask RCNN network based on a Swin converter to train local graphs. The Swin converter is the latest visual converter network in the field of computer vision. It is an encoder-decoder structure with a hierarchical feature map. It can merge deep image blocks and has a linear computational complexity.
[0023] 2. The present invention uses a mask mechanism to further improve the detection accuracy and uses a mask to extract the region of interest. The extraction of the region of interest not only reduces the search time of the target area, but also enhances the detection effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a block diagram of the algorithm of the present invention;
[0025] Figure 2 is a network diagram of the Swin converter of the present invention;
[0026] Figure 3 It is a detection block diagram of the algorithm of the present invention; DETAILED DESCRIPTION
[0027] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0028] In order to better illustrate the present embodiment, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted. The technical solution of the present invention is further described below in conjunction with the drawings and embodiments.
[0029] Please refer to the attached Figure 1First, the original high-resolution training image (size is 2448*2048) is denoised by a 5*5 Gaussian filter, and then the local defect map is intercepted according to the defect calibration position and normalized to a 256*256 size image; secondly, the visual transformer is used as the network skeleton, and the local defect map is used to train the network to extract features with visual attention mechanism, which are used to train the Mask-RCNN defect detection network; finally, for the original high-resolution test image, the original image is divided into 64 small area images, and the 64 small area images are detected, and then the mask mechanism with the region of interest is used to shield the influence of noise, thereby improving the detection accuracy and detection speed.
[0030] Constructing local graph: This method includes two key technologies, one is image denoising processing, the other is local graph construction.
[0031] (1) Image denoising: During the process of collecting cylinder liner images by the camera, a large amount of noise will be generated due to various temperature, light, and electronic component signal interference, which will greatly reduce the image quality, affect subsequent processing, and even affect the cylinder liner surface defect detection results. Considering the need to reduce the complexity of the later deep learning algorithm and improve the quality of the original image, the present invention pre-processes the collected cylinder liner images. In order to establish an effective deep learning model, data enhancement is an effective method to achieve this goal. Data enhancement includes techniques such as noise removal and extraction of regions of interest, which can increase the size and quality of the training data set, thereby building a better deep learning model and improving the generalization ability of the model. Common noises include salt and pepper noise, Gaussian noise, and random noise. In the actual image acquisition process, there are many types of noise. Therefore, in order to improve the image quality and highlight the target information of the defect, the cylinder liner image is denoised and simulated and analyzed using Gaussian filtering. In order to ensure reliability, the PSNR (peak signal-to-noise ratio) and AG (definition) values are used to analyze the image effect after denoising. Generally, the larger the PSNR value, the better the image quality. The formula is:
[0032]
[0033] Where I is a monochrome image composed of M×N, and K is a monochrome image composed of M×N. The tiny detail contrast and texture change characteristics in the AG image also reflect the clarity of the image. The larger the value, the better. The formula is:
[0034]
[0035] Among them, △Ix and △Iy are the convolution of Sobel horizontal and vertical edge detection operators at pixel point (i, j), respectively, and M and N are the number of pixels.
[0036] The present invention adopts 5*5 Gaussian filtering to reduce the noise of the collected cylinder sleeve image.
[0037] Local graph construction: The biggest difficulty in identifying surface defects of cylinder liners is that there is no specific and accurate standard for the size and type of defects. The size of the pictures collected by the industry is 2448*2048. The size of the pictures is large, but the defects are small. Some defects are not easy to distinguish with human eyes, and detection is quite difficult. On the other hand, there are various noise interferences. If the detection is carried out directly, the effect is very unsatisfactory. Therefore, the idea of "constructing local graphs" is proposed. The principle is: during training, the defect position of the cylinder liner is intercepted and obtained based on the previous annotation information on the 2448*2048 large picture on the training set and test set of the original picture, and the intercepted picture is manually set and the size is normalized to 256*256. Compared with the original picture, the defects can be seen more clearly.
[0038] like Figure 2 ,Network construction: Swin Transformer is the latest visual transformer network in the field of computer vision. It is an encoder-decoder structure with hierarchical feature maps. It can merge deep image blocks and has linear computational complexity.
[0039] The present invention uses a Mask RCNN network based on a Swin converter to train local images.
[0040] Small image mapping large image detection method: Using the trained network weights, for the original image actually detected, the present invention divides the 2448*2048 original image into 64 small images, including 56 256*256 small images and 8 656*256 small images, and detects the 64 small images. The detection is performed through the trained weight file, and finally the 2448*2048 original image is remapped to obtain the detection result for the original image.
[0041] Advantages Yes, it is much better than directly using the original high-resolution images for training and detection, and it solves the difficulty of small target detection.
[0042] Mask mechanism: To further improve the detection accuracy, mask is used to extract the region of interest. The extraction of the region of interest not only reduces the search time of the target area, but also enhances the detection effect.
[0043] (1) For the upper cover image, a rough mold of the region of interest is made, which contains three types of defects. The cylinder liner mold image is binarized by selecting an appropriate threshold. The morphological operation closing operation is used to remove the tiny black spots of the binarization, ensuring that the binarization area contains the entire region of interest. It is used as the region of interest.
[0044] (2) For the upper end surface image, which contains three types of defects, we measure the coordinates of the upper end surface image and determine the center of the circle and the maximum and minimum circle radii based on the area to be inspected in the upper end surface image. We draw a binary image of a ring of the same size to complete the production of the upper end surface image mold and use it as the area of interest of the upper end surface image.
[0045] (3) For the cylinder liner inner wall image, which contains three types of defects, we found that all the defects are distributed in the upper half. In order to better obtain defect information, we designed a specific mask based on the contour of the upper half. Similar to extracting the region of interest on the upper end face, we measured its coordinates and determined the contour information of the upper half (approximately ring-shaped) based on the area to be detected; we drew a binary image of the same shape to extract the region of interest.
[0046] The present invention denoises the image obtained by the “small image mapping large image detection method” by masking. The principle is to set the pixels of the interest area to 1 and the pixels of the non-interest area to 0, thereby removing the detection results of the non-interest area and improving the detection performance. The formula is as follows:
[0047] I R =I×M (3)
[0049] Among them, I is the detected pixel in the original image, M is the mask matrix column, and I R is the final detected pixel.
[0050] There are many ways to evaluate the capabilities of deep learning methods. This paper uses a common MAP value to demonstrate the detection performance of various deep learning algorithms. Among them, TP refers to the result that is correctly identified. FP refers to the result that is incorrectly identified. FN refers to the result that is not identified, but the system identifies it as other defects.
[0051]
[0052] The cylinder liner image has the characteristics of high resolution and small defect targets. According to the characteristics of the cylinder liner image, the present invention reduces the influence of cylinder liner noise through image preprocessing, constructs a local image of the original image, obtains a new batch of training data, and trains the network. By mapping a large image with a small image, the detection result of the original image is obtained. Finally, the noise area is filtered through the mask mechanism to further improve the accuracy of small target detection. Based on the proposed method, small target defects can be accurately identified and the detection performance can be improved.
[0053] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A cylinder liner defect detection method based on deep learning, characterized in that: The detection method comprises the following steps: 1) Collect cylinder liner images to construct an original data set, preprocess and annotate the images in the original data set, and then divide the original data set into a training set and a test set in proportion; 2) Obtain a local defect map of the training set; 3) Using the Mask R-CNN algorithm based on the Swin transformer to build a model, the model is trained through the local defect map of the training set image to obtain the network model; 4) Detect the images in the test set using the obtained network model; 5) extracting the region of interest from the detection result through a mask mechanism to enhance the detection effect in step 4); 6) Evaluate the detection performance of the network model; The method for establishing the network model in step 3) is: 301) Inputting the local defect map in the training set into the Swin transformer to obtain the corresponding feature map; 302) setting a predetermined number of ROIs for each pixel in the feature map to obtain multiple candidate ROIs; 303) Send the candidate ROI to the Region Proposal Network for processing, and perform Bounding box regression to obtain the corresponding Proposals to be detected area; 304) The obtained Proposals to be detected area uses the ROI Align method to accurately extract the ROI features of the original image, and then performs Classification, Boundingbox regression and Mask mask generation on it, and obtains the final network model after continuous iterative training; The detection method in step 4) is: divide each image in the test set into 64 small images, input the 64 small images of each image into the trained network model for detection and output the results, and finally reassemble the output 64 small images into the size of each image to obtain the detection result of each image; The method of extracting the region of interest using the mask mechanism in step 5) is: A. For the cylinder liner upper cover image, first select a suitable threshold for each image of the upper cover to perform binarization, and use morphological operation closing operation to remove the tiny black dots of the binarization, ensuring that the binarization area contains the entire region of interest, and the binarization area is taken as the region of interest; B. For the cylinder liner upper end surface image, firstly, coordinate measurement is performed on each upper end surface image, and the center of the circle and the radius of the maximum circle and the minimum circle are determined according to the area to be detected of the upper end surface image; a binary image of a ring of the same size is drawn and used as the region of interest of the upper end surface image; C. For the cylinder liner inner wall image, all its defects are distributed in the upper half. In order to better obtain defect information, a specific mask is designed according to the contour of the upper half. The coordinates are measured in the same way as the upper end face to extract the region of interest. The contour information of the upper half is determined according to the area to be detected; a binary image of the same shape is drawn to extract the region of interest.
2. A cylinder liner defect detection method based on deep learning as claimed in claim 1, characterized in that: In step 1), the original data set in the VOC file format is produced by collecting the cylinder liner images, and the images in the original data set are annotated by using the LabelImg image annotation tool to annotate the defect areas and types on the original data set images, generate an xml file, and divide the original data set into three types, namely sand mark defects, scratch defects and wear defects; the preprocessing method is to first randomly flip the images in the original data set, crop, normalize pixels, and enhance the images, and then perform 5*5 Gaussian filtering and noise reduction on the images.
3. A cylinder liner defect detection method based on deep learning as claimed in claim 2, characterized in that: The method for obtaining the local defect map in step 2) is to manually intercept the local defect map with a size of 256*256 through the annotation information of the image in the training set, and each local defect map contains defects.
4. A cylinder liner defect detection method based on deep learning as claimed in claim 3, characterized in that: The evaluation method in step 6) is: using the mean average precision MAP value to prove the detection performance of the network model, Accuracy Recall Average Precision Mean Average Precision Among them, TP refers to the correctly identified result, FP refers to the incorrectly identified result, FN refers to the unidentified result but the system identifies it as other defects, and the AP value is the area composed of the PR curve. The larger the area, the better the effect. The horizontal axis is the recall rate, the vertical axis is the precision rate, AP is the result obtained by integrating the precision, n is the total number of defect types, and i is the number of defects.
Citation Information
Cited By
Air cylinder air hole defect detection system and method based on positioning and matching fusion
CN122415584A
