Defect identification method based on X-ray
Through X-ray-based defect recognition methods, image processing and machine learning technology, the problems of low accuracy and efficiency of existing casting defect recognition methods are solved, and rapid and accurate defect recognition of castings of different thicknesses and materials are achieved.
Patent Information
- Application Number
- CN202411692948.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-21
AI Technical Summary
The existing casting defect identification methods have low accuracy and efficiency, especially when dealing with castings of different thicknesses and materials, it is difficult to accurately identify and locate defects.
Using X-ray-based defect recognition method, the X-ray images of sample castings of different thicknesses and materials are obtained for pre-processing, edge images are extracted and defect features are marked, and the defect recognition model is trained to identify defects of the target casting.
It realizes the rapid and accurate identification of casting defects, reduces the subjectivity of human judgment, improves the efficiency and accuracy of defect detection, and is suitable for castings of different thicknesses and materials.
Smart Images

Figure CN119671954A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of X-ray nondestructive testing, and in particular to a defect recognition method based on X-rays. Background Art
[0002] In the foundry industry, quality control of castings is crucial, because any tiny defect may lead to product performance degradation or even safety accidents. Traditional casting inspection methods, such as visual inspection and tapping inspection, are simple and easy to use, but their accuracy and reliability are often limited by the skill level of the inspectors, and they cannot detect internal defects. With the advancement of science and technology, X-ray non-destructive testing technology has gradually become an important means of detecting internal defects in castings. X-ray non-destructive testing technology uses X-rays to penetrate the object being tested. Due to the different degrees of absorption of X-rays by different materials, images are formed on films or detectors. By analyzing these images, defects such as cracks, pores, and inclusions inside the casting can be intuitively observed. This method can not only detect defects on the surface of the casting, but also detect defects hidden inside, greatly improving the control level of casting quality.
[0003] However, X-ray nondestructive testing technology still faces some challenges in the practical application of casting defect identification. Specifically, castings of different thicknesses have different absorption rates for X-rays, and castings of different materials also have different absorption rates for X-rays. These will affect the contrast and clarity of the image presented on the X-ray film, making it difficult for inspectors to accurately distinguish the defects presented on the X-ray film, and the identification and judgment of internal defects in castings becomes difficult. In addition, the identification and positioning of defects in complex castings also need to rely on the experience and skills of the operator, and often require a long period of learning and training to improve the accuracy of identifying defects presented on the X-ray film. Therefore, the development of a casting defect identification method based on X-ray nondestructive testing that is not dependent on the operator's experience and can be efficient and accurate is of great significance to improving casting quality and production efficiency. Summary of the invention
[0004] In view of the above analysis, an embodiment of the present invention aims to provide an X-ray-based defect recognition method to solve the problem of low accuracy and efficiency of existing casting defect recognition methods.
[0005] On the one hand, an embodiment of the present invention provides a defect recognition method based on X-rays, the method comprising:
[0006] Acquire X-ray images of sample castings of different thicknesses and / or different materials, and preprocess the X-ray images of the sample castings to acquire edge images thereof;
[0007] Marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and defect characteristics of the contour;
[0008] Using the labeled edge image of the sample casting to train a defect recognition model to obtain a trained defect recognition model;
[0009] Acquiring an X-ray image of a target casting, and preprocessing the X-ray image of the target casting to obtain an edge image thereof;
[0010] The edge image of the target casting is input into a trained defect recognition model to identify whether the target casting has defects and the type of defects.
[0011] Based on the further improvement of the above method, the step of marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and contour features of the contour includes:
[0012] Find all contours in the edge image;
[0013] Traverse and calculate the area of each contour;
[0014] Determine whether the area of each of the contours is less than a preset area threshold;
[0015] If the area of the contour is smaller than the preset area threshold, the contour is determined to be a defect, and the contour is marked as defective on the edge image;
[0016] If the area of the contour is greater than or equal to the preset area threshold, the contour is determined to be not a defect, and the contour is marked as defect-free on the sample edge image.
[0017] Based on a further improvement of the above method, the step of marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and contour features of the contour, further includes:
[0018] After determining that the contour is a defect, the image of the contour is compared with typical X-ray images of each defect type to determine the defect type corresponding to the contour, and the defect type of the contour is marked on the edge image.
[0019] Based on the further improvement of the above method, the X-ray image is preprocessed, including the following steps:
[0020] Converting the X-ray image into a grayscale image, and adjusting the pixel value of the grayscale image within a preset range;
[0021] Performing Gaussian blur on the grayscale image to obtain a Gaussian blurred image;
[0022] Edge detection is performed on the Gaussian blurred image to obtain an edge image.
[0023] Based on the further improvement of the above method, edge detection is performed on the Gaussian blurred image to obtain an edge image, which includes the following steps:
[0024] Using an edge detection algorithm to extract the contour in the Gaussian blurred image;
[0025] A morphological closing operation is performed on the extracted contour to fill small holes or gaps on the contour, thereby obtaining an edge image.
[0026] Based on the further improvement of the above method, the method further includes:
[0027] Before acquiring X-ray images of sample castings of different thicknesses and / or different materials or acquiring X-ray images of target castings, setting exposure parameters according to the thickness and material of the castings;
[0028] The sample casting or the target casting is transilluminated according to the exposure parameters to obtain a corresponding X-ray image.
[0029] Based on the further improvement of the above method, the exposure parameters are set according to the casting thickness and material, including:
[0030] The exposure parameters include: transillumination voltage;
[0031] The transillumination voltage of the target casting and / or the sample casting is set according to a curve of the relationship between the maximum transillumination voltage and the transillumination thickness allowed by the material.
[0032] Based on the further improvement of the above method, the exposure parameters are set according to the casting thickness and material, including:
[0033] The exposure parameters also include: the distance between the transilluminated surface and the X-ray source;
[0034] Wherein, the distance between the transillumination surface of the target casting and / or the sample casting and the X-ray source is set according to the nomogram of the distance from the focus to the workpiece surface.
[0035] Based on the further improvement of the above method, the defect recognition model is a neural network model, which includes:
[0036] The first convolutional layer is used to perform convolution processing on the input image;
[0037] A first pooling layer, used to perform maximum pooling processing on the image output by the first convolutional layer;
[0038] The first Dropout layer is used to randomly discard the output of some neurons during model training;
[0039] A second convolutional layer performs convolution processing on the image output by the first Dropout layer;
[0040] A second pooling layer, performing maximum pooling processing on the image output by the second convolutional layer;
[0041] The second Dropout layer is used to randomly discard the output of some neurons during model training;
[0042] The fully connected layer performs fully connected processing on the image output by the second Dropout layer and outputs the defect recognition result.
[0043] Based on the further improvement of the above method, the loss function of the neural network model is:
[0044]
[0045] In the formula, loss is the loss value, t[i] is the label of the i-th sample, o[i] is the predicted value of the i-th sample, and n is the number of samples; d(a i ,p i ) is the anchor sample a i With positive sample p i The distance between i ,n i ) is the anchor sample a i With negative samples n i The distance between them, margin is a hyperparameter used to control the minimum distance between positive and negative sample pairs, and α is a weight parameter.
[0046] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0047] 1. The present invention provides an efficient and accurate casting defect detection method by combining X-ray imaging technology, image processing technology and machine learning technology. The method of the present invention obtains image information inside the casting through X-ray technology, and uses image processing, recognition technology and a trained defect recognition model to analyze the processed image, thereby realizing rapid and accurate recognition of internal defects of the casting.
[0048] Specifically, in the present invention, firstly, X-ray images of sample castings of different thicknesses and different materials are obtained, then the edge images are obtained after preprocessing the X-ray images, and then the contours on the edge images are annotated and used as training data to train the defect recognition model, and the model is corrected through continuous iterative updates to obtain a model that can accurately identify defects. After the defect recognition model is trained, the edge images of the preprocessed X-ray images of the target castings are input into the trained defect recognition, thereby realizing fast and accurate automatic detection of casting defects, avoiding the misjudgment and omission caused by the traditional method of operators using naked eyes and experience to judge the defects of X-ray films, and greatly improving the efficiency and accuracy of defect recognition.
[0049] 2. When defect marking is performed in the present invention, by presetting the area threshold, the defect and non-defect contours can be distinguished more accurately, reducing the subjectivity of human judgment. The unified marking standard ensures the consistency of the data, which is beneficial to subsequent model training. Moreover, through the automated marking process, a large number of sample castings can be processed quickly, significantly improving the efficiency of defect detection.
[0050] 3. In the present invention, considering that castings of different thicknesses and materials may have different absorption rates of X-rays, exposure parameters are set according to the thickness and material of the casting to be inspected during X-ray radiography, so that high-quality and consistent X-ray images can be obtained, which is beneficial to improving the accuracy of defect identification.
[0051] 4. In the present invention, by performing preprocessing steps such as grayscale conversion, pixel value adjustment, Gaussian blur, edge detection, etc. on the X-ray image, the quality of the X-ray image is effectively improved, and important visual features - contour features are extracted from the image, providing clear, consistent and optimized image data for subsequent defect identification, providing a solid foundation for defect identification, and improving the automation and accuracy of the entire detection process.
[0052] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.
[0054] Figure 1 is a flow chart of an X-ray-based defect recognition method according to an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a curve showing the relationship between the maximum transillumination voltage and transillumination thickness allowed by the material of an embodiment of the present invention;
[0056] Figure 3 4 is a nomogram of the distance from the focus to the workpiece surface according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0058] A specific embodiment of the present invention discloses a defect recognition method based on X-rays, such as Figure 1 The method comprises:
[0059] Acquire X-ray images of sample castings of different thicknesses and / or different materials, and preprocess the X-ray images of the sample castings to acquire edge images thereof;
[0060] Marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and defect characteristics of the contour;
[0061] Using the labeled edge image of the sample casting to train a defect recognition model to obtain a trained defect recognition model;
[0062] Acquiring an X-ray image of a target casting, and preprocessing the X-ray image of the target casting to obtain an edge image thereof;
[0063] The edge image of the target casting is input into a trained defect recognition model to identify whether the target casting has defects and the type of defects.
[0064] Compared with the prior art, in an embodiment of the present invention, an efficient and accurate casting defect detection method is provided by combining X-ray imaging technology, image processing technology and machine learning technology. The method of the embodiment of the present invention obtains image information inside the casting through X-ray technology, and uses image processing, recognition technology and a trained defect recognition model to analyze the processed image, thereby realizing rapid and accurate recognition of internal defects of the casting.
[0065] Specifically, in the present invention, firstly, X-ray images of sample castings of different thicknesses and different materials are obtained, then the edge images are obtained after preprocessing the X-ray images, and then the contours on the edge images are annotated and used as training data to train the defect recognition model, and the model is corrected through continuous iterative updates to obtain a model that can accurately identify defects. After the defect recognition model is trained, the edge images of the preprocessed X-ray images of the target castings are input into the trained defect recognition, thereby realizing fast and accurate automatic detection of casting defects, avoiding the misjudgment and omission caused by the traditional method of operators using naked eyes and experience to judge the defects of X-ray films, and greatly improving the efficiency and accuracy of defect recognition.
[0066] In one embodiment, the step of marking whether there is a defect and the type of defect of each contour in the edge image of the sample casting according to the area and contour features of the contour includes:
[0067] Find all contours in the edge image;
[0068] Traverse and calculate the area of each contour;
[0069] Determine whether the area of each of the contours is less than a preset area threshold;
[0070] If the area of the contour is smaller than the preset area threshold, the contour is determined to be a defect, and the contour is marked as defective on the edge image;
[0071] If the area of the contour is greater than or equal to the preset area threshold, the contour is determined to be not a defect, and the contour is marked as defect-free on the sample edge image.
[0072] During implementation, the findContours function is used to find all contours in the edge image, and each contour is traversed. The cv2.contourArea function is used to calculate the area of the detected contour. If the area is less than the preset area threshold, the contour is considered to correspond to a defect and is marked on the original image.
[0073] Compared with the prior art, when defect marking is performed in the embodiment of the present invention, by presetting the area threshold, the defect and non-defect contours can be distinguished more accurately, reducing the subjectivity of human judgment. The unified marking standard ensures the consistency of the data, which is beneficial to subsequent model training. Moreover, through the automated marking process, a large number of sample castings can be processed quickly, significantly improving the efficiency of defect detection.
[0074] More specifically, the step of marking whether there is a defect and the type of defect of each contour in the edge image of the sample casting according to the area and contour features of the contour, further includes:
[0075] After determining that the contour is a defect, the image of the contour is compared with typical X-ray images of each defect type to determine the defect type corresponding to the contour, and the defect type of the contour is marked on the edge image.
[0076] In the present invention, by comparing the image of the contour with the typical X-ray image of each defect type, accurate judgment and labeling of the defect type is achieved, thereby improving the recognition accuracy of the trained defect recognition model.
[0077] In a specific embodiment, the image of the contour is compared with a typical X-ray image of each defect type to determine the defect type corresponding to the contour. The defect characteristics include: the position, size, shape and gray value of the contour.
[0078] In this embodiment, the accuracy of marking is ensured by comparing defect features.
[0079] In another embodiment, the similarities between the image of the contour and the typical X-ray images of each defect type are calculated respectively, and the defect type with the highest similarity is selected as the defect type corresponding to the contour.
[0080] In this embodiment, in order to further improve the labeling efficiency, the automatic labeling of defect types is achieved by calculating the similarity of images.
[0081] During implementation, the similarity between the image of the contour and the typical X-ray image of each defect type can be calculated by using Euclidean distance, structural similarity coefficient (SSIM) or Jaccard similarity coefficient.
[0082] Among them, the defect types include: cracks, pores, inclusions and other defects.
[0083] In one embodiment, preprocessing the X-ray image includes the following steps:
[0084] Converting the X-ray image into a grayscale image, and adjusting the pixel value of the grayscale image within a preset range;
[0085] Performing Gaussian blur on the grayscale image to obtain a Gaussian blurred image;
[0086] Edge detection is performed on the Gaussian blurred image to obtain an edge image.
[0087] During implementation, after the X-ray image is converted into a grayscale image, the normalize function is used to adjust the pixel values of the image to a uniform range, and the GaussianBlur function is used to apply Gaussian blur to the grayscale image.
[0088] In the embodiment of the present invention, by performing preprocessing steps such as grayscale conversion, pixel value adjustment, Gaussian blur, edge detection, etc. on the X-ray image, the quality of the X-ray image is effectively improved, and important visual features - contour features are extracted from the image, providing clear, consistent and optimized image data for subsequent defect identification, providing a solid foundation for defect identification, and improving the automation and accuracy of the entire detection process.
[0089] Among them, converting X-ray images into grayscale images can enhance the contrast of the image, making the details in the image more obvious, which is helpful for subsequent edge detection and feature extraction, and the grayscale image reduces color information, making the image processing algorithm more efficient; adjusting the pixel value to a preset range can standardize the brightness and contrast of the image, so that the image remains consistent under different lighting and exposure conditions; Gaussian blur is a commonly used denoising technology, which can smooth the image, reduce random noise in the image, and make the image clearer. While denoising, Gaussian blur can retain important edge information in the image, which is beneficial for subsequent edge detection and feature recognition.
[0090] Specifically, edge detection is performed on the Gaussian blurred image to obtain an edge image, comprising the following steps:
[0091] Using an edge detection algorithm to extract the contour in the Gaussian blurred image;
[0092] A morphological closing operation is performed on the extracted contour to fill small holes or gaps on the contour, thereby obtaining an edge image.
[0093] During implementation, the Canny edge detection algorithm is applied to extract the contours in the image, and the morphologyEx function is used to perform morphological closing operations (first dilation and then erosion) on the edge image to fill the small holes or gaps in the contours.
[0094] In the embodiment of the present invention, a morphological closing operation is performed on the contour after it is extracted, which effectively improves the quality of the image, provides a solid foundation for defect identification, and improves the automation and accuracy of the entire detection process.
[0095] By extracting the contours in the image through edge detection, the edges of the object can be identified more completely. The morphological closing operation can effectively fill the small holes or gaps on the contour, enhance the continuity of the edge, make the edge image smoother and more continuous, and reduce the misjudgment caused by the omission of small holes or gaps, thus helping to more accurately identify and locate defects.
[0096] In one embodiment, the method further comprises:
[0097] Before acquiring X-ray images of sample castings of different thicknesses and / or different materials or acquiring X-ray images of target castings, setting exposure parameters according to the thickness and material of the castings;
[0098] The sample casting or the target casting is transilluminated according to the exposure parameters to obtain a corresponding X-ray image.
[0099] In the present invention, considering that castings of different thicknesses and materials may have different absorption rates of X-rays, exposure parameters are set according to the thickness and material of the casting to be inspected during X-ray radiography, so that high-quality and consistent X-ray images can be obtained, which is beneficial to improving the accuracy of defect identification.
[0100] The exposure parameters include: exposure voltage. According to the relationship curve between the maximum exposure voltage allowed by the material and the exposure thickness (such as Figure 2 ) to set the transillumination voltage of the target casting and / or the sample casting.
[0101] The exposure parameters also include: the distance between the transillumination surface and the X-ray source. Figure 3 ) to set the distance between the transilluminated surface of the target casting and / or the sample casting and the X-ray source.
[0102] In the embodiment of the present invention, selecting appropriate exposure parameters according to the thickness and material of the casting can ensure that a high-quality X-ray image is obtained.
[0103] In addition, the exposure parameters also include exposure amount. After determining the exposure voltage and the exposure thickness (casting thickness), the exposure amount is set according to the exposure curve.
[0104] Among them, the exposure curve describes the relationship between the exposure voltage, exposure amount and exposure thickness.
[0105] In actual testing, the exposure amount can be adjusted by changing the transillumination current and exposure time. The transillumination current and exposure time of castings of different thicknesses and materials must be determined based on actual testing requirements and material characteristics.
[0106] In one embodiment, the defect recognition model is a neural network model, which includes:
[0107] The first convolutional layer is used to perform convolution processing on the input image;
[0108] A first pooling layer, used to perform maximum pooling processing on the image output by the first convolutional layer;
[0109] The first Dropout layer is used to randomly discard the output of some neurons during model training;
[0110] A second convolutional layer performs convolution processing on the image output by the first Dropout layer;
[0111] A second pooling layer, performing maximum pooling processing on the image output by the second convolutional layer;
[0112] The second Dropout layer is used to randomly discard the output of some neurons during model training;
[0113] The fully connected layer performs fully connected processing on the image output by the second Dropout layer and outputs the defect recognition result.
[0114] In an embodiment of the present invention, in a neural network model, through a combination of multiple convolutional layers and pooling layers, the model can extract multi-level features from the input image, which is very effective for identifying complex defects. The Dropout layer randomly discards the outputs of some neurons during the training process, which helps to reduce overfitting of the model and improve the generalization ability of the model on unseen data.
[0115] Specifically, the neural network model uses a sigmoid activation function.
[0116] Specifically, the loss function of the neural network model is:
[0117]
[0118] In the formula, loss is the loss value, t[i] is the label of the i-th sample, o[i] is the predicted value of the i-th sample, and n is the number of samples; d(a i ,p i ) is the anchor sample a i With positive sample p i The distance between i ,n i ) is the anchor sample a i With negative samples n i The distance between them, margin is a hyperparameter used to control the minimum distance between positive and negative sample pairs, and α is a weight parameter.
[0119] Among them, the anchor sample is a reference sample used to compare with the positive sample and the negative sample; the positive sample is a sample belonging to the same category as the anchor sample, and the negative sample is a sample belonging to a different category from the anchor sample.
[0120] In the embodiment of the present invention, the loss function of the model is improved, and the loss function allows the model to optimize the classification performance and the quality of feature representation simultaneously during the training process, thereby improving the accuracy of defect recognition. By adjusting the value of α, the importance of classification and feature learning can be adjusted according to the requirements of the detection task.
[0121] It should be noted that during the model training process, the value of the loss function is used to guide the update of the model parameters. By minimizing the loss function, the model learns how to better fit the training data. The optimizer adjusts the parameters according to the gradient of the loss function to minimize the loss function. In the specific implementation, the optimizer used is AdamOptimizer, and the learning rate is 0.0001.
[0122] Specifically, during the model training process, by comparing the predicted labels of multiple sample castings of the model with the true labels, the performance of the model can be evaluated, and the model can be further adjusted to improve the accuracy of detection.
[0123] The calculation method of the model evaluation indicator Accuracy is as follows:
[0124]
[0125] In the formula, TP (True Positives) represents the true positives, that is, the number of samples correctly predicted by the model as positive;
[0126] (TN) (True Negatives): True negative examples, that is, the number of samples correctly predicted by the model as negative;
[0127] (FP) (False Positives): False positive examples, that is, the number of samples that the model incorrectly predicts as positive;
[0128] (FN) (False Negatives): False negative examples, that is, the number of samples that the model incorrectly predicts as negative.
[0129] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0130] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A defect recognition method based on X-ray, characterized in that: The method comprises: Acquire X-ray images of sample castings of different thicknesses and / or different materials, and preprocess the X-ray images of the sample castings to acquire edge images thereof; Marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and defect characteristics of the contour; Using the labeled edge image of the sample casting to train a defect recognition model to obtain a trained defect recognition model; Acquiring an X-ray image of a target casting, and preprocessing the X-ray image of the target casting to obtain an edge image thereof; The edge image of the target casting is input into a trained defect recognition model to identify whether the target casting has defects and the type of defects.
2. The defect identification method according to claim 1, characterized in that: The step of marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and contour features of the contour, comprises: Find all contours in the edge image; Traverse and calculate the area of each contour; Determine whether the area of each of the contours is less than a preset area threshold; If the area of the contour is smaller than the preset area threshold, the contour is determined to be a defect, and the contour is marked as defective on the edge image; If the area of the contour is greater than or equal to the preset area threshold, the contour is determined to be not a defect, and the contour is marked as defect-free on the sample edge image.
3. The defect identification method according to claim 2, characterized in that: The step of marking whether there is a defect and the defect type of each contour in the edge image of the sample casting according to the area and contour features of the contour, further includes: After determining that the contour is a defect, the image of the contour is compared with typical X-ray images of each defect type to determine the defect type corresponding to the contour, and the defect type of the contour is marked on the edge image.
4. The defect identification method according to any one of claims 1 to 3, characterized in that: The X-ray image is preprocessed, including the following steps: Converting the X-ray image into a grayscale image, and adjusting the pixel value of the grayscale image within a preset range; Performing Gaussian blur on the grayscale image to obtain a Gaussian blurred image; Edge detection is performed on the Gaussian blurred image to obtain an edge image.
5. The defect identification method according to claim 4, characterized in that: Performing edge detection on the Gaussian blurred image to obtain an edge image comprises the following steps: Using an edge detection algorithm to extract the contour in the Gaussian blurred image; A morphological closing operation is performed on the extracted contour to fill small holes or gaps on the contour, thereby obtaining an edge image.
6. The defect identification method according to any one of claims 1 to 3, characterized in that: The method further comprises: Before acquiring X-ray images of sample castings of different thicknesses and / or different materials or acquiring X-ray images of target castings, setting exposure parameters according to the thickness and material of the castings; The sample casting or the target casting is transilluminated according to the exposure parameters to obtain a corresponding X-ray image.
7. The defect identification method according to claim 6, characterized in that: The exposure parameters are set according to the casting thickness and material, including: The exposure parameters include: transillumination voltage; The transillumination voltage of the target casting and / or the sample casting is set according to a curve of the relationship between the maximum transillumination voltage and the transillumination thickness allowed by the material.
8. The defect identification method according to claim 6, characterized in that: The exposure parameters are set according to the casting thickness and material, including: The exposure parameters also include: the distance between the transilluminated surface and the X-ray source; Wherein, the distance between the transillumination surface of the target casting and / or the sample casting and the X-ray source is set according to the nomogram of the distance from the focus to the workpiece surface.
9. The defect identification method according to any one of claims 1 to 3, characterized in that: The defect recognition model is a neural network model, which includes: The first convolutional layer is used to perform convolution processing on the input image; A first pooling layer, used to perform maximum pooling processing on the image output by the first convolutional layer; The first Dropout layer is used to randomly discard the output of some neurons during model training; A second convolutional layer performs convolution processing on the image output by the first Dropout layer; A second pooling layer, performing maximum pooling processing on the image output by the second convolutional layer; The second Dropout layer is used to randomly discard the output of some neurons during model training; The fully connected layer performs fully connected processing on the image output by the second Dropout layer and outputs the defect recognition result.
10. The defect identification method according to claim 9, characterized in that: The loss function of the neural network model is: In the formula, loss is the loss value, t[i] is the label of the i-th sample, o[i] is the predicted value of the i-th sample, and n is the number of samples; d(a i ,p i ) is the anchor sample a i With positive sample p i The distance between i ,n i ) is the anchor sample a i With negative samples n i The distance between them, margin is a hyperparameter used to control the minimum distance between positive and negative sample pairs, and α is a weight parameter.
Citation Information
Cited By
Defect extraction and three-dimensional reconstruction method of pipeline digital X-ray image
CN121169861A
Connector internal defect detection method, device and medium
CN121505226A