Titanium alloy bar visual detection method based on image segmentation

Through the titanium alloy rod detection method based on image segmentation, the shortcomings of defect identification and quantitative analysis in the prior art are solved, and efficient, accurate identification and causal analysis of surface defects of titanium alloy rods are achieved, which improves the accuracy of detection and the scientificity of process optimization.

CN119991670AActive Publication Date: 2025-05-13SHAANXI TMT TITANIUM IND CO LTD

Patent Information

Application Number
CN202510466906.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-05-13
Estimated Expiration
2045-04-15

AI Technical Summary

Technical Problem

Existing titanium alloy rod detection methods are difficult to accurately identify and classify defects, especially under small defects or complex textures, and there is a lack of quantitative analysis of defect severity and in-depth research on causal correlation.

Method used

The visual detection method of titanium alloy rods based on image segmentation is adopted, including image preprocessing, adaptive segmentation algorithm, defect feature extraction, classification model construction, severity quantification and causal chain model, to achieve efficient and accurate identification and classification of surface defects of titanium alloy rods.

Benefits of technology

It improves the accuracy and robustness of defect detection, realizes quantitative analysis and causal derivation of defect severity, enhances the detection ability of complex defects, and provides scientific support for the quality control and process optimization of titanium alloy rods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991670A_ABST
    Figure CN119991670A_ABST
Patent Text Reader

Abstract

The invention provides a titanium alloy bar visual detection method based on image segmentation. The method comprises the following steps: carrying out pretreatment and feature enhancement operation on an acquired titanium alloy bar surface image; constructing an adaptive segmentation algorithm based on region growth to carry out defect region segmentation on the surface image of the titanium alloy bar; performing defect feature extraction on the segmented defect region; a defect classification model is constructed, and titanium alloy bar defect types are classified based on defect features; performing quantitative analysis on the defect severity through a defect severity quantitative model; establishing a defect causal chain model, and carrying out defect traceability analysis and causal derivation; after defect traceability analysis is completed, fusion analysis is carried out on the multi-scale features, and decision suggestions are given. According to the method, the surface defects of the titanium alloy bar can be efficiently and accurately recognized and classified, the accuracy and robustness of defect detection are improved, and the defects of a traditional detection method in the aspects of efficiency, recognition capability, quantitative analysis and the like are effectively overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of metal detection, and in particular to a titanium alloy bar visualization detection method based on image segmentation. Background Art

[0002] Titanium alloy bars are widely used in aerospace, medical equipment, chemical industry and other fields due to their excellent mechanical properties and corrosion resistance. However, during the production and processing, defects such as cracks, inclusions, pores and abnormal structures are prone to occur on the surface of titanium alloy bars, which seriously affect their mechanical properties and service life. Therefore, how to accurately detect and identify the defects of titanium alloy bars has become a technical problem that needs to be solved urgently.

[0003] At present, traditional titanium alloy bar inspection methods mostly rely on ultrasonic testing, X-ray testing or manual visual inspection. These methods have the following shortcomings: Insufficient defect recognition capabilities: Due to the variety of defect types, a single detection method is often difficult to detect comprehensively, especially in the case of tiny defects or complex textures.

[0004] Insufficient quantitative analysis of defects: Existing methods usually only make simple judgments on defects and lack quantitative analysis and classification assessment of the severity of defects.

[0005] Insufficient defect tracing and cause analysis: There is currently a lack of in-depth research on the causes of defects and causal relationships, making it difficult to optimize processes and prevent defects. Summary of the invention

[0006] In view of the problem that it is difficult to perform process optimization and defect prevention in the prior art, the present invention proposes a titanium alloy bar visualization detection method based on image segmentation.

[0007] The technical solution of the present invention is a titanium alloy bar visualization detection method based on image segmentation, which specifically comprises the following steps: Step 1: Preprocessing and feature enhancement operations are performed on the collected surface image of the titanium alloy bar; Step 2: Construct an adaptive segmentation algorithm based on region growing to segment the defective area of ​​the titanium alloy bar surface image; Step 3: Extract defect features from the segmented defect area; Step 4: Construct a defect classification model to classify the defect types of titanium alloy bars based on defect characteristics; Step 5: Quantitatively analyze the severity of the defect through the defect severity quantification model; Step 6: Establish a defect causal chain model and conduct defect source analysis and causal deduction; Step 7: After completing the defect source analysis, perform a fusion analysis of the multi-scale features to provide decision-making recommendations and operational guidance; Preferably, the pretreatment in step 1 is specifically as follows: Adaptive median filtering is used to remove noise, local contrast equalization is used to improve brightness uniformity, and the edge of defect features is highlighted by combining the difference enhancement operator; The adaptive median filtering removes noise, specifically as follows: The filter kernel size is adaptively adjusted according to the noise level, defining the pixel value of the original image at position (x, y) Denoising and enhancing pixel values for: ; in, : The weighting coefficient of the filter window at the i-th pixel in the horizontal direction and the j-th pixel in the vertical direction, adjusted according to the noise level; : filter window size; and They represent the pixel indexes of the filter window in the horizontal and vertical directions, that is, the position coordinates of the pixels in the window.

[0008] When denoising, first determine the filter window size based on the noise level. ; Then calculate the weight To control the influence of different pixels on the enhancement results; Through the sliding window operation, the original image is convolved pixel by pixel to obtain the enhanced image after denoising. ; The local contrast equalization is used to improve the brightness uniformity, specifically as follows: Calculate the gradient value of the homogenized image , used to extract prominent edge features in images; By adjusting the enhancement factor , amplifying the gradient response, making the defect edge more prominent in the image, especially when the background is complex, which can further highlight the difference of the defect area; The local contrast equalization is specifically as follows: ; in, : The homogenized image pixel value at position (x, y); : The local mean of the pixel at position (x, y); : The local standard deviation of the pixel at position (x,y).

[0009] The core of brightness uniformity is to adjust local brightness changes to avoid uneven brightness caused by reflections or shadows. and standard deviation , can dynamically adjust brightness levels to improve image contrast and uniformity; The combined difference enhancement operator is used to highlight the edge of the defect feature, as follows: ; in, : The image pixel value after feature enhancement at position (x, y); : Enhancement factor; : The image gradient at position (x,y).

[0010] Preferably, in step 2, an adaptive segmentation algorithm based on region growing is constructed to segment the defect region of the titanium alloy bar surface image, as follows: Automatic seed point selection: image after feature enhancement Calculate pixel intensity mutation points and define seed point sets : ; in, is the threshold, which is adaptively determined by the statistical characteristics of the image.

[0011] Represents the gradient amplitude of the image at position (x, y), which measures the degree of change in the pixel intensity at that point.

[0012] Calculate the gradient value of the enhanced image and filter the gradient value greater than the threshold The pixel is used as the seed point. The threshold is calculated by the image gradient distribution characteristics to ensure that the starting point of the representative defect area can be selected in the case of uneven brightness and noise. Region growing criteria: Region growing is based on the similarity of adjacent pixels. The growth criteria are as follows: ; in, Representing coordinates The result of judging whether the pixel belongs to the growth area. A value of 1 indicates that the pixel belongs to the growth area, and a value of 0 indicates that the pixel does not belong to the growth area. : Pixel coordinates of the grown region, i.e., the similarity judgment criterion of the new pixel (x, y) used for comparison in the region growing process relative to the pixel (x', y') of the grown region; Otherwise: In the process of region growing, if the candidate pixel (x, y) does not meet the growing conditions, the pixel will not be added to the grown region.

[0013] : Similarity threshold, determined by statistical analysis; Region growing is expanded based on the similarity of pixel intensity. By comparing the intensity difference between the seed point and the adjacent pixels, it is determined whether to add the growth region. Similarity Threshold Adaptive adjustment to cope with different defect characteristics. During the growth process, the boundaries of the grown area are dynamically adjusted by gradually expanding the neighborhood to ensure complete coverage of the defect area; Regional growth stop condition: The growth stop criterion is defined as the regional change rate, and the regional change rate is as follows: ; in, : Regional change rate, indicating the relative proportion of regional changes during the growth process; : The total number of pixels or area of ​​the current growth area; : The total number of pixels or area of ​​the last round of growth area; : Convergence threshold, controlling the accuracy requirement for growth stop; During the growth process, the change rate of new and old areas is calculated in real time , to determine whether the growth has entered a stable state. When the rate of change is lower than the convergence threshold When , the growth process is considered to have reached convergence and stopped expanding; This strategy effectively prevents the region from overgrowing, ensuring that the segmentation results are accurate and the boundaries are clear; Preferably, in step 3, defect feature extraction is performed on the segmented defect area, including geometric feature extraction and texture feature extraction; The geometric feature extraction includes extracting the area, perimeter and shape factor of each defect area; calculating the area and perimeter of the defect area by counting the pixels of the defect area; The texture feature extraction includes extracting texture features including energy, contrast, entropy and correlation using a gray-level co-occurrence matrix; by constructing a gray-level co-occurrence matrix, calculating the joint probability distribution of pixel pairs in an image block, and extracting four features including energy, contrast, entropy and correlation; After defect feature extraction, feature vector is formed , providing input data for the defect classification model; Preferably, the step 4 is specifically as follows: The feature vector As input, deep features are extracted through multi-layer convolution and pooling operations to effectively improve the classification effect. At the same time, the weighted cross entropy loss function is introduced to make weighted adjustments for category imbalance, thus having significant advantages in rare defect identification; The defect classification model uses a convolutional neural network (CNN) and combines feature vectors for training and prediction; The input layer of the CNN receives the feature vector , deep features are extracted through multi-layer convolution and pooling operations, the formula is as follows: ; in, is the convolution kernel weight; is the bias term; As the activation function, ReLU is used; The multi-layer convolution operation performs weighted summation and bias correction on the input features through the convolution kernel, and mines the nonlinear features through the activation function to form a deep feature representation; A weighted cross entropy loss function is used to optimize the classification accuracy of rare defect categories: ; in, : The classification loss function value, that is, the weighted cross entropy loss value used to measure the difference between the model prediction result and the true label; : Number of defect categories; : The category weight of the c-th defect is adjusted according to the category imbalance; : The true category label of the c-th defect; : The model predicted probability of the cth defect.

[0014] All defect categories are cumulatively calculated to obtain the final classification loss value, and the optimization goal is to minimize the loss; Preferably, in step 5, the quantitative analysis includes: Construct defect severity quantification model; Determination of defect weight coefficient; Severity level classification; The defect severity quantification model uses defect feature weighting for comprehensive evaluation: ; in, : Comprehensive value of defect severity; : defect feature number; : Defect weight coefficient; : Defect characteristic function, for the characteristic vector Middle Quantify the features; By weighting and summing different defect characteristics, a comprehensive value of defect severity is formed ; Each defect characteristic function They all reflect the quantitative value of an independent feature; Weight coefficient Calculated by analytic hierarchy process (AHP); According to different defect categories and characteristics, the defect weight coefficient is calculated using the hierarchical analysis method : ; in, : Feature importance coefficient, which is calculated by domain expert scoring and statistical analysis, reflecting the weight of the feature in defect identification; : No. The importance coefficient of each feature; : The sum of all defect feature importance coefficients, used for weight normalization.

[0015] The relative weight of the defect features is formed by calculating the normalized value of each feature importance coefficient.

[0016] According to the comprehensive value of defect severity , set thresholds to divide into different levels: ; in, is the upper limit of the experience threshold, is the lower limit of the empirical threshold, determined by historical data; Preferably, the step 6 is specifically as follows: Based on the causal chain model of Bayesian network, the causes and influencing factors of defects are systematically and quantitatively derived; By comprehensively considering multiple process and material factors, the main causes of defects are deduced using maximum a posteriori probability; Assuming that defects are caused by a combination of multiple process and material factors, a defect causal chain model is constructed using a Bayesian network: ; in, : Defect cause, that is, the process link that may cause the current defect, indicating multiple candidate processing or manufacturing process steps, such as heat treatment, machining, surface treatment, etc.; : Feature vector, a set of defect-related features obtained by image analysis, including size, shape, edge features, color change, surface roughness, etc.; : The posterior probability of the defect cause under a given feature vector; : The conditional probability of observing the feature vector under the defect cause; : Prior probability of defect cause; : The total probability of the feature vector appearing; The defect causal chain model is used to calculate the potential process links for defect formation, and the main influencing factors and their weights are output. The causal deduction adopts the maximum a posteriori probability principle: ; : operator, indicating that The defect cause with the highest probability value , i.e. the most likely defect formation process; By analyzing the correlation strength between Bayesian network nodes, the key defect formation process and its corresponding parameters are determined to guide process optimization; By calculating the posterior probability , that is, given the feature vector In the case of defects, the cause The posterior probability of causing the defect indicates the degree of relevance of the process to the current defect, and selects the defect cause with the largest probability value , the most likely process causes and influencing factors of defect formation can be obtained; Preferably, the step 7 is specifically as follows: The scale-adaptive weighted fusion method is adopted, and the optimal weight is found through the particle swarm optimization algorithm to obtain the fusion features after weighted fusion. Based on the fusion features and the comprehensive value of defect severity, decision-making suggestions and operability guidance are given; The beneficial effects of the present invention are as follows: This titanium alloy bar visualization detection method based on image segmentation can efficiently and accurately identify and classify surface defects of titanium alloy bars, and realize defect cause tracing and multi-scale feature fusion through severity quantification and causal chain analysis. Through defect segmentation, feature extraction and classification algorithms based on convolutional neural networks and Bayesian causal chain models, not only the accuracy and robustness of defect detection are improved, but also the shortcomings of traditional detection methods in terms of efficiency, recognition ability and quantitative analysis are effectively solved. In addition, through multi-scale fusion and adaptive weight optimization, the present invention further enhances the detection capability of complex defects, providing scientific support for quality control and process optimization of titanium alloy bars. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 : A schematic diagram of a method flow chart of an embodiment of the present invention; Figure 2 : A schematic diagram of a flow chart of an adaptive segmentation algorithm according to an embodiment of the present invention; DETAILED DESCRIPTION

[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.

[0020] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0021] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor is it a separate or selective embodiment that is mutually exclusive with other embodiments.

[0022] Embodiment 1: Reference Figure 1-2 , which is the first embodiment of the present invention, provides a titanium alloy bar visualization detection method based on image segmentation, comprising the following steps: S1. Preprocess and enhance the features of the collected titanium alloy bar surface images.

[0023] In the existing technology, simple filtering and global contrast enhancement methods, such as Gaussian filtering and histogram equalization, are often used in image preprocessing for titanium alloy bar defect detection. However, these methods are prone to loss of feature details or insufficient enhancement when faced with complex defect textures and background noise, especially for subtle defects that are difficult to effectively highlight.

[0024] In this embodiment, while removing noise through adaptive median filtering, local contrast equalization (LCE) is used to improve brightness uniformity, and the edge of defect features is highlighted in combination with a difference enhancement operator. The overall method has significant advantages in multi-scale and multi-feature fusion, and can maintain a high defect feature resolution capability under complex backgrounds and subtle defects.

[0025] Preprocessing includes denoising and brightness uniformity, and feature enhancement uses a difference enhancement operator to highlight the defect edges; De-noising uses an adaptive median filter algorithm to remove noise. The filter kernel size is adaptively adjusted according to the noise level, defining the pixel value of the original image at position (x, y). Denoising and enhancing pixel values for: ; in, : The weighting coefficient of the filter window at the i-th pixel in the horizontal direction and the j-th pixel in the vertical direction, adjusted according to the noise level; : filter window size; and They represent the pixel indexes of the filter window in the horizontal and vertical directions, that is, the position coordinates of the pixels in the window.

[0026] When denoising, first determine the filter window size based on the noise level. . Then calculate the weight To control the influence of different pixels on the enhancement result. Through the sliding window operation, the original image is convolved pixel by pixel to obtain the enhanced image after denoising. This operation effectively removes background noise while maintaining the clarity of defect features.

[0027] Due to the uneven reflection of the surface, the local contrast equalization method is used to equalize the brightness: ; in, : The homogenized image pixel value at position (x, y); : The local mean of the pixel at position (x, y); : The local standard deviation of the pixel at position (x,y).

[0028] The core of brightness uniformity is to adjust local brightness changes to avoid uneven brightness caused by reflections or shadows. and standard deviation , which can dynamically adjust the brightness level to improve the contrast and uniformity of the image.

[0029] The feature enhancement formula is as follows: ; in, : The image pixel value after feature enhancement at position (x, y); : Enhancement factor; : The image gradient at position (x,y).

[0030] In the feature enhancement stage, the gradient value of the homogenized image is first calculated , used to extract prominent edge features in the image. By adjusting the enhancement factor , amplifying the gradient response, making the defect edge more prominent in the image, especially when the background is complex, and further highlighting the differences in the defect area.

[0031] S2. Construct an adaptive segmentation algorithm based on region growing to segment the defective area of ​​the titanium alloy bar surface image.

[0032] In the existing technology of titanium alloy bar defect detection, methods based on threshold segmentation or traditional region growing algorithms are often used. The disadvantage is that the threshold selection depends on manual adjustment and is sensitive to noise, which leads to over-segmentation or under-segmentation in complex defects and non-uniform backgrounds. In addition, the traditional region growing algorithm performs poorly when dealing with multi-scale defects and cannot adapt to different defect shapes and characteristics.

[0033] In this embodiment, an adaptive segmentation algorithm based on region growing is used to achieve multi-layer optimization of automatic seed point selection, region growth judgment and growth stop conditions. Specifically, the seed point is automatically selected using pixel intensity mutation points, which reduces manual intervention; growth judgment and stop control are performed through adjacent pixel similarity and region change rate, making the algorithm highly robust and adaptive in multi-scale and complex backgrounds.

[0034] The adaptive segmentation algorithm further comprises: Automatic seed point selection: image after feature enhancement Calculate pixel intensity mutation points and define seed point sets : ; in, is the threshold, which is adaptively determined by the statistical characteristics of the image.

[0035] Represents the gradient amplitude of the image at position (x, y), which measures the degree of change in the pixel intensity at that point.

[0036] After image preprocessing and feature enhancement, calculate the gradient value of the enhanced image and filter the gradient values ​​greater than the threshold The pixel of is taken as the seed point. The threshold is obtained by calculating the image gradient distribution characteristics to ensure that the starting point of the representative defect area can be selected in the case of uneven brightness and noise.

[0037] Region growing criteria: Region growing is based on the similarity of adjacent pixels. The growth criteria are as follows: ; in, Representing coordinates The result of judging whether the pixel belongs to the growth area. A value of 1 indicates that the pixel belongs to the growth area, and a value of 0 indicates that the pixel does not belong to the growth area. : Pixel coordinates of the grown region, i.e., the similarity judgment criterion of the new pixel (x, y) used for comparison in the region growing process relative to the pixel (x', y') of the grown region; Otherwise: In the process of region growing, if the candidate pixel (x, y) does not meet the growing conditions, the pixel will not be added to the grown region.

[0038] : Similarity threshold, determined by statistical analysis.

[0039] Region growing is based on the similarity of pixel intensity. By comparing the intensity difference between the seed point and the adjacent pixels, it is determined whether to add the growth region. Adaptive adjustment to cope with different defect characteristics. During the growth process, the neighborhood is gradually expanded and the boundaries of the grown area are dynamically adjusted to ensure complete coverage of the defect area.

[0040] Regional growth stop condition: The growth stop criterion is defined as the regional change rate, and the regional change rate is as follows: ; in, : Regional change rate, indicating the relative proportion of regional changes during the growth process; : The total number of pixels or area of ​​the current growth area; : The total number of pixels or area of ​​the last round of growth area; : Convergence threshold, which controls the accuracy requirement for stopping growth.

[0041] During the growth process, the change rate of new and old areas is calculated in real time , to determine whether the growth has entered a stable state. When the rate of change is lower than the convergence threshold When , the growth process is considered to have reached convergence and stops expanding. This strategy effectively prevents excessive growth of the region and ensures that the segmentation results are accurate and the boundaries are clear.

[0042] S3. Extract defect features from the segmented defect area.

[0043] Defect feature extraction includes geometric feature extraction and texture feature extraction. The combination of geometric features and texture features can not only describe the morphological characteristics of defects, but also characterize the texture differences on the defect surface, thus improving the comprehensiveness and accuracy of feature expression.

[0044] Geometric feature extraction includes extracting the area, perimeter and shape factor of each defect area; calculating the area and perimeter by counting the pixels of the defect area. The shape factor comprehensively reflects the morphological characteristics of the defect through the area and perimeter, which helps to distinguish regular defects (such as holes) from irregular defects (such as cracks).

[0045] Texture feature extraction includes using gray-level co-occurrence matrix to extract texture features, including energy, contrast, entropy and correlation; by constructing the gray-level co-occurrence matrix (GLCM), calculating the joint probability distribution of pixel pairs in the image block, and extracting four features: energy, contrast, entropy and correlation. These features can reflect the texture characteristics of the defect area, such as: Larger energy indicates that the defect surface is smooth and uniform; A higher contrast ratio means a dramatic change in grayscale, which is suitable for detecting scratches or cracks; Higher entropy indicates complex textures, often corresponding to rough surfaces; A lower correlation indicates that the texture in the defect area is disordered or more random.

[0046] After defect feature extraction, feature vector is formed , providing input data for the defect classification model.

[0047] S4. Construct a defect classification model to classify the defect types of titanium alloy bars based on defect characteristics.

[0048] The feature vector As input, deep features are extracted through multi-layer convolution and pooling operations to effectively improve the classification effect. At the same time, the weighted cross entropy loss function is introduced to make weighted adjustments for category imbalance, thus having significant advantages in rare defect identification.

[0049] The defect classification model uses a convolutional neural network (CNN) combined with feature vectors for training and prediction; The input layer of CNN receives the feature vector , deep features are extracted through multi-layer convolution and pooling operations, the formula is as follows: ; in, is the convolution kernel weight; is the bias term; As the activation function, ReLU is used; The convolution operation performs weighted summation and bias correction on the input features through the convolution kernel, and mines the nonlinear features through the activation function to form a deep feature representation.

[0050] A weighted cross entropy loss function is used to optimize the classification accuracy of rare defect categories: ; in, : The classification loss function value, that is, the weighted cross entropy loss value used to measure the difference between the model prediction result and the true label; : Number of defect categories; : The category weight of the c-th defect is adjusted according to the category imbalance; : The true category label of the c-th defect; : The model predicted probability of the cth defect.

[0051] All defect categories are cumulatively calculated to obtain the final classification loss value, and the optimization goal is to minimize the loss.

[0052] The classification results of the defect classification model are directly used as input for subsequent severity quantification analysis.

[0053] S5. After completing the defect classification, the defect severity is quantitatively analyzed through the defect severity quantification model.

[0054] In terms of defect severity assessment, existing technologies usually use a single feature index or simple threshold judgment, lacking comprehensive quantitative analysis of multiple features. For example, some methods only classify based on defect area or depth, ignoring comprehensive features such as defect morphology and texture, making it difficult to fully reflect the impact of defects on material properties. At the same time, in terms of defect weight determination, existing methods mostly rely on subjective experience and lack a scientific and reasonable weight allocation mechanism.

[0055] In step S5, the severity quantitative analysis includes: Construct defect severity quantification model; Determination of defect weight coefficient; Severity levels.

[0056] The defect severity quantification model uses defect feature weighting for comprehensive evaluation: ; in, : Comprehensive value of defect severity; : defect feature number; : Defect weight coefficient; : Defect characteristic function, for the characteristic vector Middle The features are quantified.

[0057] This formula forms a comprehensive value of defect severity by weighted summation of different defect characteristics. .

[0058] Each defect characteristic function They all reflect the quantitative value of an independent feature, such as defect area, morphological complexity, surface texture changes, etc.

[0059] Weight coefficient Calculated by the analytic hierarchy process (AHP), it can scientifically reflect the contribution of each feature to the severity and avoid the one-sidedness of simple average.

[0060] Through weighted synthesis, a unified severity index is formed, which solves the problem of inconsistency of different feature scales.

[0061] According to different defect categories and characteristics, the defect weight coefficient is calculated using the hierarchical analysis method : ; in, : Feature importance coefficient, which is calculated by domain expert scoring and statistical analysis, reflecting the weight of the feature in defect identification; : No. The importance coefficient of each feature; : The sum of all defect feature importance coefficients, used for weight normalization.

[0062] The relative weight of the defect features is formed by calculating the normalized value of each feature importance coefficient.

[0063] According to the comprehensive value of defect severity , set thresholds to divide into different levels: ; in, is the upper limit of the experience threshold, It is the lower limit of the empirical threshold, determined by historical data.

[0064] By dividing the thresholds into different levels, the severity of defects can be intuitively classified.

[0065] S6. After completing the quantitative analysis of defect severity, establish a defect causal chain model and conduct defect source tracing analysis and causal deduction.

[0066] In terms of defect cause analysis, existing technologies usually use empirical methods, rely on the experience of process experts and historical data for speculation, and lack quantitative analysis models. For example, existing technologies may use simple cause-and-effect or rule-based methods, but these methods often fail to fully consider the multiple factors and complex relationships in defect formation, which can easily lead to one-sidedness or deviation in analysis results. In addition, existing methods lack a systematic derivation process and often rely on manual judgment or incomplete statistical reasoning, which cannot accurately reveal the deep relationship between different process parameters and defects.

[0067] In this embodiment, a causal chain model based on a Bayesian network is proposed to systematically and quantitatively derive the causes and influencing factors of defects. By comprehensively considering multiple process and material factors and using the maximum a posteriori probability to derive the main causes of defects, the subjectivity and incomplete information problems existing in the prior art are avoided. This method not only achieves scientific cause derivation, but also has strong adaptability and can be dynamically updated as data and process conditions change.

[0068] Assuming that defects are caused by a combination of multiple process and material factors, a defect causal chain model is constructed using a Bayesian network: ; in, : Defect cause, that is, the process link that may cause the current defect, indicating multiple candidate processing or manufacturing process steps, such as heat treatment, machining, surface treatment, etc.; : Feature vector, a set of defect-related features obtained by image analysis, including size, shape, edge features, color change, surface roughness, etc.; : The posterior probability of the defect cause under a given feature vector; : The conditional probability of observing the feature vector under the defect cause; : Prior probability of defect cause; : The total probability of the feature vector appearing; The defect causal chain model is used to calculate the potential process links for defect formation, and the main influencing factors and their weights are output. The causal deduction adopts the maximum a posteriori probability principle: ; : operator, indicating that The defect cause with the highest probability value , which is the most likely defect formation process.

[0069] By analyzing the correlation strength between Bayesian network nodes, the key defect formation process and its corresponding parameters are determined to guide process optimization.

[0070] By calculating the posterior probability , that is, given the feature vector In the case of defects, the cause The posterior probability of causing the defect indicates the degree of relevance of the process to the current defect, and selects the defect cause with the largest probability value , the most likely process causes and influencing factors of defects can be obtained. This process can scientifically locate the key links of defects and help process optimization and quality improvement.

[0071] S7. After completing the defect tracing analysis, perform a fusion analysis of multi-scale features to provide decision-making recommendations and operational guidance.

[0072] Taking into account the different scale distributions of defect features, the scale-adaptive weighted fusion method in the existing technology is adopted, and the optimal weight is found through the particle swarm optimization algorithm to obtain the fusion features after weighted fusion. Based on the fusion features and the comprehensive value of defect severity, decision-making suggestions and operational guidance are given, such as process adjustment or surface repair suggestions.

[0073] Table 1 Comparison results of titanium alloy bar visual inspection experiment

[0074] In order to verify the effectiveness of the proposed visual inspection method for titanium alloy bars based on image segmentation, a comparative experiment was designed to analyze the performance of this method in terms of defect recognition accuracy, defect location accuracy, detection time consumption, and defect traceability. In this experiment, 5 groups of artificially prepared titanium alloy bar samples with defects were used, including typical defect types such as pores, inclusions, cracks, etc. This method was compared with the traditional grayscale threshold segmentation method and Canny edge detection method, as shown in Table 1.

[0075] Experimental results analysis: From the experimental results, it can be seen that the titanium alloy bar visualization detection method based on image segmentation proposed in the present invention is significantly superior to traditional methods in terms of recognition accuracy, defect location accuracy and defect traceability. Especially in terms of defect recognition accuracy, the average is 96.7%, which is about 8.6% higher than the Canny edge detection method and more than 14% higher than the grayscale threshold method. In terms of defect location deviation, this method is controlled within 2 pixels and has higher detail segmentation capabilities, which is helpful for subsequent defect size calculation and three-dimensional reconstruction. At the same time, the detection time is controlled within 1 second, with good real-time performance. In summary, this method can significantly improve the intelligence level and process diagnosis capabilities of online detection of titanium alloy bars.

[0076] Embodiment 2: This embodiment also provides a computer device, which is suitable for a method for visual detection of titanium alloy bars based on image segmentation, and includes a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement a method for visual detection of titanium alloy bars based on image segmentation as proposed in the above embodiment.

[0077] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, a visual detection method for titanium alloy bars based on image segmentation as proposed in the above embodiment is implemented.

[0078] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0079] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0080] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0081] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk case (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0082] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit with a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit with a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0083] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A titanium alloy bar visualization detection method based on image segmentation, characterized in that: The following steps are involved: Step 1: Preprocessing and feature enhancement operations are performed on the collected surface image of the titanium alloy bar; Step 2: Construct an adaptive segmentation algorithm based on region growing to segment the defective area of ​​the titanium alloy bar surface image; Step 3: Extract defect features from the segmented defect area; Step 4: Construct a defect classification model. The defect classification model uses a convolutional neural network (CNN) and combines feature vectors for training and prediction, and classifies the defect types of titanium alloy bars based on defect features. Step 5: Through the defect severity quantification model, weighted sum of different defect features is performed to form a comprehensive defect severity value, and the defect severity is quantitatively analyzed based on the comprehensive defect severity value; Step 6: Establish a defect causal chain model. The defect causal chain model is based on the Bayesian network. It systematically and quantitatively derives the causes and influencing factors of defects. By comprehensively considering process and material factors, the maximum a posteriori probability is used to deduce the causes of defects, and defect traceability analysis and causal deduction are carried out; Step 7: After completing the defect tracing analysis, perform a fusion analysis of the multi-scale features to provide decision-making recommendations and operational guidance.

2. The titanium alloy bar visualization detection method based on image segmentation according to claim 1 is characterized in that: The pretreatment in step 1 is specifically as follows: Adaptive median filtering is used to remove noise, local contrast equalization is used to improve brightness uniformity, and the edge of defect features is highlighted in combination with the difference enhancement operator.

3. The titanium alloy bar visualization detection method based on image segmentation according to claim 2 is characterized in that: The adaptive median filtering removes noise, specifically as follows: The filter kernel size is adaptively adjusted according to the noise level, defining the pixel value of the original image at position (x, y) Denoising and enhancing pixel values for: ; in, : The weighting coefficient of the filter window at the i-th pixel in the horizontal direction and the j-th pixel in the vertical direction, adjusted according to the noise level; : filter window size; and Respectively represent the pixel index of the filter window in the horizontal and vertical directions, that is, the position coordinates of the pixels in the window; When denoising, first determine the filter window size based on the noise level. ; Then calculate the weight To control the influence of different pixels on the enhancement results; Through the sliding window operation, the original image is convolved pixel by pixel to obtain the enhanced image after denoising. ; The local contrast equalization is used to improve the brightness uniformity, specifically as follows: Calculate the gradient value of the homogenized image , used to extract prominent edge features in images; By adjusting the enhancement factor , amplifying the gradient response, making the defect edge more prominent in the image, and highlighting the differences in the defect area when the background is complex; The local contrast equalization is specifically as follows: ; in, : The homogenized image pixel value at position (x, y); : The local mean of the pixel at position (x, y); : local standard deviation of the pixel at position (x, y); The core of brightness uniformity is to adjust local brightness changes to avoid uneven brightness caused by reflections or shadows; by calculating the average value in each window area and standard deviation , can dynamically adjust brightness levels to improve image contrast and uniformity; The combined difference enhancement operator is used to highlight the edge of the defect feature, as follows: ; in, : The image pixel value after feature enhancement at position (x, y); : enhancement factor; : The image gradient at position (x,y).

4. The titanium alloy bar visualization detection method based on image segmentation according to claim 3 is characterized in that: Step 2 constructs an adaptive segmentation algorithm based on region growing to segment the defect region of the titanium alloy bar surface image, as follows: Automatic seed point selection: image after feature enhancement Calculate pixel intensity mutation points and define seed point sets : ; in, is the threshold, which is adaptively determined by the statistical characteristics of the image; Represents the gradient amplitude of the image at position (x, y), which measures the degree of change in the pixel intensity at that point; Calculate the gradient value of the enhanced image and filter the gradient value greater than the threshold The pixel is used as the seed point; the threshold is obtained by calculating the image gradient distribution characteristics to ensure that the starting point of the representative defect area can be selected in the case of uneven brightness and noise; Region growing criteria: Region growing is based on the similarity of adjacent pixels. The growth criteria are as follows: ; in, Representing coordinates The result of judging whether the pixel belongs to the growth area. A value of 1 indicates that the pixel belongs to the growth area, and a value of 0 indicates that the pixel does not belong to the growth area. : Pixel coordinates of the grown region, i.e., the similarity judgment criterion of the new pixel (x, y) used for comparison in the region growing process relative to the pixel (x', y') of the grown region; Otherwise: In the process of region growing, if the candidate pixel (x, y) does not meet the growing conditions, the pixel will not be added to the grown region; : Similarity threshold, determined by statistical analysis; Region growing is expanded based on the similarity of pixel intensity. By comparing the intensity difference between the seed point and the adjacent pixels, it is determined whether to add the growth region. Similarity Threshold Adaptive adjustment to cope with different defect characteristics; during the growth process, the boundaries of the grown area are dynamically adjusted by gradually expanding the neighborhood to ensure complete coverage of the defect area; Regional growth stop condition: The growth stop criterion is defined as the regional change rate, and the regional change rate is as follows: ; in, : Regional change rate, indicating the relative proportion of regional changes during the growth process; : The total number of pixels or area of ​​the current growth area; : The total number of pixels or area of ​​the last round of growth area; : Convergence threshold, controlling the accuracy requirement for growth stop; During the growth process, the change rate of new and old areas is calculated in real time , to determine whether the growth has entered a stable state; when the rate of change is lower than the convergence threshold When , the growth process is considered to have reached convergence and stopped expanding; This strategy effectively prevents region overgrowth and ensures that the segmentation results are accurate and the boundaries are clear.

5. The titanium alloy bar visualization detection method based on image segmentation according to claim 4 is characterized in that: In step 3, defect feature extraction is performed on the segmented defect area, including geometric feature extraction and texture feature extraction; The geometric feature extraction includes extracting the area, perimeter and shape factor of each defect area; calculating the area and perimeter of the defect area by counting the pixels of the defect area; The texture feature extraction includes extracting texture features using a gray level co-occurrence matrix, including energy, contrast, entropy and correlation; By constructing the gray-level co-occurrence matrix, the joint probability distribution of pixel pairs in the image block is calculated, and four features, namely energy, contrast, entropy and correlation, are extracted; After defect feature extraction, feature vector is formed , providing input data for the defect classification model.

6. The titanium alloy bar visualization detection method based on image segmentation according to claim 5 is characterized in that: The step 4 is specifically as follows: The feature vector As input, deep features are extracted through multi-layer convolution and pooling operations to effectively improve the classification effect. At the same time, the weighted cross entropy loss function is introduced to make weighted adjustments for category imbalance, thus having significant advantages in rare defect identification. The input layer of the CNN receives the feature vector , deep features are extracted through multi-layer convolution and pooling operations, the formula is as follows: ; in, is the convolution kernel weight; is the bias term; As the activation function, ReLU is used; The multi-layer convolution operation performs weighted summation and bias correction on the input features through the convolution kernel, and mines the nonlinear features through the activation function to form a deep feature representation; A weighted cross entropy loss function is used to optimize the classification accuracy of rare defect categories: ; in, : The classification loss function value, that is, the weighted cross entropy loss value used to measure the difference between the model prediction result and the true label; : Number of defect categories; : The category weight of the c-th defect is adjusted according to the category imbalance; : The true category label of the c-th defect; : The model prediction probability of the cth defect; All defect categories are cumulatively calculated to obtain the final classification loss value, and the optimization goal is to minimize the loss.

7. The titanium alloy bar visualization detection method based on image segmentation according to claim 6 is characterized in that: In step 5, the quantitative analysis includes: Construct defect severity quantification model; Determination of defect weight coefficient; Severity levels.

8. The titanium alloy bar visualization detection method based on image segmentation according to claim 7 is characterized in that: The defect severity quantification model uses defect feature weighting for comprehensive evaluation: ; in, : Comprehensive value of defect severity; : defect feature number; : Defect weight coefficient; : Defect characteristic function, for the characteristic vector Middle Quantify the features; Each defect characteristic function They all reflect the quantitative value of an independent feature; Weight coefficient Calculated by AHP; According to different defect categories and characteristics, the defect weight coefficient is calculated using the hierarchical analysis method : ; in, : Feature importance coefficient, which is calculated by domain expert scoring and statistical analysis, reflecting the weight of the feature in defect identification; : No. The importance coefficient of each feature; : The sum of all defect feature importance coefficients, used for weight normalization; By calculating the normalized value of each feature importance coefficient, the relative weight of the defect feature is formed; According to the comprehensive value of defect severity , set thresholds to divide into different levels: ; in, is the upper limit of the experience threshold, It is the lower limit of the empirical threshold, determined by historical data.

9. The titanium alloy bar visualization detection method based on image segmentation according to claim 8 is characterized in that: The step 6 is specifically as follows: Assuming that defects are caused by a combination of multiple process and material factors, a defect causal chain model is constructed using a Bayesian network: ; in, : Defect cause, that is, the process link that may cause the current defect, indicating multiple candidate processing or manufacturing process steps, such as heat treatment, machining, and surface treatment; : Feature vector, a set of defect-related features obtained by image analysis, including size, shape, edge features, color change, and surface roughness; : The posterior probability of the defect cause under a given feature vector; : The conditional probability of observing the feature vector under the defect cause; : Prior probability of defect cause; : The total probability of the feature vector appearing; The defect causal chain model is used to calculate the potential process links for defect formation, and the main influencing factors and their weights are output. The causal deduction adopts the maximum a posteriori probability principle: ; : operator, indicating that The defect cause with the highest probability value , i.e. the most likely defect formation process; By analyzing the correlation strength between Bayesian network nodes, the key defect formation process and its corresponding parameters are determined to guide process optimization; By calculating the posterior probability , that is, given the feature vector In the case of defects, the cause The posterior probability of causing the defect indicates the degree of relevance of the process to the current defect, and selects the defect cause with the largest probability value , the most likely process causes and influencing factors of defect formation can be obtained.

10. The titanium alloy bar visualization detection method based on image segmentation according to claim 9, characterized in that: The step 7 is specifically as follows: The scale-adaptive weighted fusion method is adopted, and the particle swarm optimization algorithm is used to find the optimal weight to obtain the fusion features after weighted fusion. Based on the fusion features and the comprehensive value of defect severity, decision-making suggestions and operational guidance are given.

Citation Information

Patent Citations

  • Method for predicting position change of internal defect of titanium alloy forge piece in forging process

    CN116359467A

  • Casting material scanning electron microscope image defect identification and quantification method

    CN116953006A

  • Track defect detection method and device based on deep learning and electronic equipment

    CN119007174A

  • Titanium alloy forming defect detection method

    CN119643567A

  • Surface defect inspection method of aluminum alloy bar material

    JP2006258737A

Cited By

  • Construction engineering intelligent template processing and production method

    CN120219393A

  • A method for processing and producing intelligent templates for construction projects

    CN120219393B

  • Aluminum profile processing quality detection method and system

    CN120446430A

  • Method for monitoring glue melting state of nozzle of injection molding machine based on machine vision

    CN120747083A

  • Injection molding machine nozzle melt state monitoring method based on machine vision

    CN120747083B