A Deep Learning-Based Method for Detecting Surface Defects in Castings

CN115294072BActive Publication Date: 2026-08-11NANJING YUNTONG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-11
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

但基于人眼的视觉检测存在费时费力、漏检率高、效率低、可靠性低等问题难以满足实际的质量需求

Benefits of technology

[0033]本发明可实现铸件表面细微缺陷分析,准确率高,效率高,能显著降低人为主观性的干扰,保证产品生产的可靠性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115294072B_ABST
    Figure CN115294072B_ABST
Patent Text Reader

Abstract

This invention discloses a deep learning-based method for detecting surface defects in castings, comprising: Step 1, acquiring images of the surface of metal castings and performing image preprocessing; Step 2, constructing a metal casting surface defect detection dataset using the preprocessed metal casting surface images and labeling defect types, and training a deep learning-based casting surface defect detection network; Step 3, constructing a feature extraction network to extract features from the preprocessed images to obtain image feature information; Step 4, based on the image feature information, obtaining the classification and location detection results of defects in the metal casting surface images through the trained casting surface defect detection network. This invention can achieve analysis of minute surface defects in castings with high accuracy and efficiency, significantly reducing the interference of human subjectivity and ensuring the reliability of product production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of casting surface defect detection technology, specifically relating to a deep learning-based method for detecting casting surface defects. Background Technology

[0002] Castings are shaped metal objects obtained using various casting methods. For example, molten metal is poured, injected, sucked, or otherwise cast into a pre-prepared mold, and after cooling, it is processed through grinding and other techniques to obtain a metal object with a specific shape, size, and properties. Castings constitute a large proportion of machined products.

[0003] During the production of metal castings, defects inevitably appear on the surface of the castings due to factors such as production processes and personnel operation methods. These defects can cause serious safety hazards during subsequent processing and use of the castings. Therefore, defect detection on the surface of metal castings is a core foundation for ensuring casting quality.

[0004] In current production practices, defects are mainly detected manually. However, visual inspection based on the human eye suffers from problems such as being time-consuming and labor-intensive, having a high rate of missed detections, low efficiency, and low reliability, making it difficult to meet actual quality requirements. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to address the shortcomings of the prior art by providing a deep learning-based method for detecting surface defects in castings. This method can effectively identify minute defects on the surface of castings, and features high accuracy and efficiency. It can achieve real-time detection and analysis. Compared with traditional manual inspection methods, it can reduce the interference of human subjectivity and ensure the quality reliability of products during production and use.

[0006] To achieve the above-mentioned technical objectives, the technical solution adopted by the present invention is as follows:

[0007] A deep learning-based method for detecting surface defects in castings, comprising:

[0008] Step 1: Acquire images of the surface of the metal casting and perform image preprocessing;

[0009] Step 2: Construct a metal casting surface defect detection dataset using preprocessed metal casting surface images and label the defect types to train the feature extraction network and the casting surface defect detection network;

[0010] Step 3: Obtain the surface image of the metal casting to be inspected, perform the preprocessing in Step 1, input it into the feature extraction network, extract features, and output image feature information;

[0011] Step 4: Input the image feature information output in Step 3 into the casting surface defect detection network to obtain the classification and location detection results of defects in the surface image of the metal casting.

[0012] To optimize the above technical solution, the specific measures also include:

[0013] In step 1 above, the original image data is converted to grayscale and then image enhancement processing is performed. By adjusting the brightness in the original image, the contrast between the defective area and the background area in the image is enhanced.

[0014] The brightness adjustment formula in step 1 above is as follows:

[0015] I′=δI+α,

[0016] Where I represents the original image and I′ represents the enhanced image;

[0017] δ is a parameter used to adjust pixel brightness, and its calculation formula is as follows:

[0018]

[0019] Where Δ is the mean gray value of all pixels in the image;

[0020] α is a deviation value in the formula;

[0021] The types of defects mentioned in step 2 above include two categories: pits and bulges.

[0022] In step 2 above, the tool LabelImg is used to annotate the defect types of the metal casting surface defect detection dataset. The tool outputs annotation information in .xml format, and then the .xml file format is converted into the corresponding .json file to obtain the annotation file corresponding to the dataset.

[0023] In step 2 above, the metal casting surface defect detection dataset is divided into three subsets in a 5:2:2 ratio: training, validation, and testing, which are used for training, validation, and testing of the feature extraction network and the casting surface defect detection network, respectively.

[0024] The aforementioned feature extraction network includes residual units and a multi-scale feature pyramid;

[0025] The multi-scale feature pyramid adds feature fusion coefficients to the original feature pyramid.

[0026] The feature fusion coefficients mentioned above are calculated using statistical methods, specifically:

[0027]

[0028] in, This represents the feature fusion coefficient between the (i+1)th layer and the i-th layer;

[0029] N represents the number of predicted bounding boxes that match the ground truth annotations at the feature layer;

[0030] i represents the index of the feature layer. According to the feature pyramid {C2, C3, C4, C5}, there are four layers in total, and its value can take the range of {4, 3, 2}.

[0031] iou n This represents the IoU matching value between the nth predicted bounding box and its corresponding ground truth label.

[0032] The present invention has the following beneficial effects:

[0033] This invention can analyze minute defects on the surface of castings with high accuracy and efficiency, significantly reducing the interference of human subjectivity and ensuring the reliability of product production.

[0034] The feature extraction network constructed in this invention employs a multi-scale feature pyramid under a fine fusion mechanism. To enable the feature layer pyramid to better learn the surface defect feature information of castings at different scales during the downward feature fusion process, a feature fusion coefficient is added to the original feature pyramid. This coefficient enables the multi-scale features to adaptively learn target features at different scales, especially micro-targets, during the downward fusion process. Therefore, it can effectively improve the detection performance of the feature extraction network for minute defects on the surface of castings. Attached Figure Description

[0035] Figure 1 This is a flowchart of the casting surface defect detection process in this invention;

[0036] Figure 2 This is a schematic diagram of the types of significant surface defects in castings in this invention;

[0037] Figure 3 This is a diagram showing the brightness adjustment results of the casting surface image in this invention;

[0038] Figure 4 This is a schematic diagram of the feature extraction network in this invention.

[0039] Figure 5 This is a schematic diagram of the defect detection network in this invention. Detailed Implementation

[0040] The embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0041] collection Figure 1-4This invention discloses a deep learning-based method for detecting surface defects in castings, comprising:

[0042] Step 1: Acquire images of the surface of the metal casting and perform image preprocessing;

[0043] The collected surface image data of the casting has the disadvantage of weak light intensity and inconspicuous small defects. Therefore, the original data is first enhanced to adjust its image brightness. The enhanced image data is then used for subsequent detection of surface defects of the casting.

[0044] In step 1, the original image data is converted to grayscale and then image enhancement processing is performed. By adjusting the brightness in the original image, the contrast between the defective area and the background area in the image is enhanced.

[0045] The brightness adjustment formula is as follows:

[0046] I′=δI+α,

[0047] Where I represents the original image and I′ represents the enhanced image;

[0048] δ is a parameter used to adjust pixel brightness, and its calculation formula is as follows:

[0049]

[0050] Where Δ is the mean gray value of all pixels in the image;

[0051] α is a deviation value in the formula;

[0052] Specifically, the image was converted to grayscale during the enhancement process, and all three channels of the image underwent image enhancement processing.

[0053] Step 2: Construct a metal casting surface defect detection dataset using the preprocessed metal casting surface images and label the defect types;

[0054] All images in the defect dataset have undergone image enhancement processing in step 1.

[0055] The defects are classified into two types: pits and bulges.

[0056] LabelImg was used to annotate the defect types in the metal casting surface defect detection dataset. The tool outputs annotation information in .xml format. Then, the .xml file format was converted into the corresponding .json file to obtain the annotation file corresponding to the dataset.

[0057] The metal casting surface defect detection dataset is divided into three subsets—training, validation, and testing—in a 5:2:2 ratio, which are used for training, validation, and testing of the feature extraction network and the casting surface defect detection network, respectively.

[0058] The feature extraction network includes residual units and a multi-scale feature pyramid under a fine fusion mechanism;

[0059] Specifically, in order to enable the feature pyramid under the refined fusion mechanism to better learn the surface defect feature information of the casting at different scales during the downward feature fusion process, a feature fusion coefficient is added to the original feature pyramid.

[0060] The feature fusion coefficient enables multi-scale features to adaptively learn target features of different scales, especially micro-targets, during the downward fusion process, thus effectively improving the detection performance of the feature extraction network for minute defects on the surface of castings.

[0061] This coefficient is calculated using statistical methods.

[0062]

[0063] in, This represents the feature fusion coefficient between the (i+1)th layer and the i-th layer;

[0064] N represents the number of predicted bounding boxes that match the ground truth annotations at the feature layer;

[0065] i represents the index of the feature layer. According to the feature pyramid {C2, C3, C4, C5}, there are four layers in total, and its value can take the range of {4, 3, 2}.

[0066] iou n This represents the IoU matching value between the nth predicted bounding box and its corresponding ground truth label.

[0067] Step 3: Obtain the surface image of the metal casting to be inspected, perform the preprocessing in Step 1, input it into the feature extraction network, extract features, and output image feature information;

[0068] Step 4: Input the image feature information output in Step 3 into the casting surface defect detection network to obtain the classification and location detection results of defects in the surface image of the metal casting.

[0069] like Figure 5As shown, the casting surface defect detection network comprises two parts: a classification branch and a localization branch. Specifically, both branches receive the same input: feature information output from a feature extraction network. Based on this feature information, a fixed number of prediction boxes are generated. The classification branch outputs the classification confidence score for each prediction box containing a defect, while the localization branch outputs the regression bias for each prediction box. Finally, all results are filtered to obtain the final defect classification and localization detection results.

[0070] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should be considered within the scope of protection of the present invention.

Claims

1. A method for detecting surface defects in castings based on deep learning, characterized in that, include: Step 1: Acquire images of the surface of the metal casting and perform image preprocessing; In step 1, the original image data is converted to grayscale and then image enhancement processing is performed. By adjusting the brightness in the original image, the contrast between the defective area and the background area in the image is enhanced. The brightness adjustment formula in step 1 is as follows: in, Represents the original image. ; This is a parameter used to adjust pixel brightness, and the calculation formula is as follows: in, It is the average gray value of all pixels in the image; It is a deviation value in the formula; Step 2: Construct a metal casting surface defect detection dataset using preprocessed metal casting surface images and label the defect types to train the feature extraction network and the casting surface defect detection network; the feature extraction network includes residual units and multi-scale feature pyramids; The multi-scale feature pyramid adds feature fusion coefficients to the original feature pyramid. ; The feature fusion coefficients are calculated using statistical methods, specifically: in, This represents the feature fusion coefficient between the (i+1)th layer and the i-th layer; N represents the number of predicted bounding boxes that match the ground truth annotations at the feature layer; i represents the index of the feature layer. According to the feature pyramid {C2, C3, C4, C5}, there are four layers in total, and its value can take the range of {4, 3, 2}. This represents the IoU matching value between the nth predicted bounding box and its corresponding ground truth label; Step 3: Obtain the surface image of the metal casting to be inspected, perform the preprocessing in Step 1, input it into the feature extraction network, extract features, and output image feature information; Step 4: Input the image feature information output in Step 3 into the casting surface defect detection network to obtain the classification and location detection results of defects in the surface image of the metal casting.

2. The method for detecting surface defects in castings based on deep learning according to claim 1, characterized in that, The types of defects mentioned in step 2 include two categories: pits and bulges.

3. The method for detecting surface defects in castings based on deep learning according to claim 1, characterized in that, In step 2, the tool LabelImg is used to label the defect types of the metal casting surface defect detection dataset. The tool outputs label information in .xml format, and then the .xml file format is converted into the corresponding .json file to obtain the label file corresponding to the dataset.

4. The method for detecting surface defects in castings based on deep learning according to claim 1, characterized in that, In step 2, the metal casting surface defect detection dataset is divided into three subsets—training, validation, and testing—in a 5:2:2 ratio, which are used for training, validation, and testing of the feature extraction network and the casting surface defect detection network, respectively.

Citation Information

Patent Citations

  • Workpiece surface defect detection method based on deep learning

    CN111415329A

  • X-ray weld defect detection method based on convolutional neural network

    CN113674247A