Iron accessory defect detection method and system

Clear iron attachment images are obtained through magnetic powder detection and wavelet noise reduction technology, and defect detection is used using random forest algorithms, which solves the problem of low accuracy and reliability of defect detection in traditional methods, and achieves more efficient iron attachment defect detection.

CN120163792AActive Publication Date: 2025-06-17HEBEI LUCHANG ELECTRICAL EQUIPMENT MANUFACTURING CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510262108.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-06-17
Estimated Expiration
2045-03-06

AI Technical Summary

Technical Problem

The traditional iron attachment defect detection method has low accuracy and reliability, which is mainly due to insufficient image preprocessing or single method, resulting in uneven image quality.

Method used

The iron attachment image is obtained by magnetic powder detection technology, image noise is removed through wavelet noise reduction method, and the processed image is input into the target random forest algorithm model for defect detection.

Benefits of technology

The accuracy and reliability of iron attachment defect detection are improved, and by highlighting the defects on the surface of iron attachment, the defects are more significant, thereby improving the detection effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120163792A_ABST
    Figure CN120163792A_ABST
Patent Text Reader

Abstract

The invention provides an iron accessory defect detection method and system, and belongs to the technical field of image processing, and the method comprises the steps: obtaining a first iron accessory image which is an image of an iron accessory after a target iron accessory is processed based on magnetic powder detection; performing noise reduction processing on the first iron attachment image based on a wavelet noise reduction method to obtain a target iron attachment image; and inputting the target iron attachment image into the target random forest algorithm model to obtain a defect detection result of the target iron attachment. According to the iron accessory defect detection method and system provided by the invention, the accuracy and reliability of iron accessory defect detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the technical field of image processing, and more particularly, relates to a method and system for detecting defects in iron accessories. Background Art

[0002] In modern industrial production, iron accessories, as key components of various mechanical equipment, building structures, etc., their quality and integrity are directly related to the safety and reliability of the entire system. For example, in the power transmission system, iron accessories are used to support and fix transmission lines. If there are defects, it may cause line failures and lead to large-scale power outages; in the construction field, iron accessories are important components connecting building structures, and defects may damage the stability of the building structure and threaten life and property safety. Therefore, it is crucial to perform efficient and accurate defect detection on iron accessories.

[0003] Traditional methods for detecting defects in iron accessories mainly rely on basic image inspection. However, the lack of preprocessing of images or the single preprocessing method of images results in uneven image quality after processing, and further leads to low accuracy and reliability in defect detection of iron accessories.

[0004] Therefore, there is an urgent need for an accurate and reliable method for detecting defects in iron accessories. Summary of the Invention

[0005] The purpose of the present disclosure is to provide a method and system for detecting defects in iron accessories to improve the accuracy and reliability of defect detection of iron accessories.

[0006] In the first aspect of the embodiments of the present disclosure, a method for detecting defects in iron accessories is provided, including: Obtaining a first iron accessory image, where the first iron accessory image is an image of the iron accessory after processing the target iron accessory based on magnetic particle testing; Performing noise reduction processing on the first iron accessory image based on the wavelet noise reduction method to obtain a target iron accessory image; Inputting the target iron accessory image into a target random forest algorithm model to obtain a defect detection result of the target iron accessory.

[0007] In the second aspect of the embodiments of the present disclosure, a system for detecting defects in iron accessories is provided, including: An image acquisition module for obtaining a first iron accessory image, where the first iron accessory image is an image of the iron accessory after processing the target iron accessory based on magnetic particle testing; An image processing module for performing noise reduction processing on the first iron accessory image based on the wavelet noise reduction method to obtain a target iron accessory image; A defect detection module for inputting the target iron accessory image into a target random forest algorithm model to obtain a defect detection result of the target iron accessory.

[0008] In the third aspect of the embodiments of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the steps of the above-mentioned iron accessory defect detection method are implemented.

[0009] In the fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned iron accessory defect detection method are implemented.

[0010] The beneficial effects of the iron accessory defect detection method and system provided by the embodiments of the present disclosure are as follows: By using magnetic particle testing technology to process the target iron accessories, the present disclosure can highlight the defects on the surface of the iron accessories, such as cracks, inclusions, etc. The present disclosure removes the noise that appears during the image acquisition process through noise reduction processing, thereby improving the clarity of the image, making the defects more prominent, and further improving the accuracy of iron accessory defect detection. The present disclosure uses the target random forest algorithm model to detect defects in the processed image, and improves the accuracy and stability of iron accessory defect detection by constructing multiple decision trees and synthesizing their output results. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0012] Figure 1 It is a schematic flowchart of the iron accessory defect detection method provided by an embodiment of the present disclosure; Figure 2 It is a structural block diagram of the iron accessory defect detection system provided by an embodiment of the present disclosure; Figure 3 It is a schematic block diagram of the electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0013] In the following description, specific details such as specific system structures and technologies are proposed for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present disclosure. However, those skilled in the art should clearly understand that the present disclosure can also be implemented in other embodiments without these specific details. In other cases, the detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present disclosure.

[0014] To make the objectives, technical solutions, and advantages of the present disclosure clearer, the following will be described through specific embodiments with reference to the accompanying drawings.

[0015] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a method for detecting defects in iron accessories provided in an embodiment of the present disclosure. The method includes: S101: Obtain a first iron accessory image, where the first iron accessory image is an image of an iron accessory after processing a target iron accessory based on magnetic particle testing.

[0016] In this embodiment, the first iron accessory image can be obtained through a camera. The first iron accessory image is an image of an iron accessory after processing the target iron accessory through magnetic particle testing.

[0017] Magnetic particle testing is a non-destructive testing method. When a ferromagnetic material is magnetized, if there are defects (such as cracks, pores, inclusions, etc.) on its surface or near the surface, the magnetic lines of force at the defect will be distorted and leak to the surface, forming a leakage magnetic field. At this time, magnetic powder is sprinkled on the material surface, and the magnetic powder will aggregate under the action of the leakage magnetic field, thereby showing information such as the position and shape of the defect.

[0018] The target iron accessory refers to an iron component that needs to be defect-detected, such as an iron connector in a power system, an iron component in a building structure, etc.

[0019] S102: Perform noise reduction processing on the first iron accessory image based on the wavelet denoising method to obtain a target iron accessory image.

[0020] In this embodiment, the wavelet denoising method is a technology for image denoising using the characteristics of wavelet transform. Wavelet transform can decompose an image into different scales and frequencies. By processing the wavelet coefficients at different scales, the wavelet coefficients representing noise are removed, and the wavelet coefficients representing useful information of the image are retained. Then, the image is reconstructed through inverse transform to achieve the purpose of denoising.

[0021] This process involves the selection of wavelet basis functions, the determination of the decomposition level, and the determination of the discrimination threshold, etc. The above three parameters will affect the denoising effect of the wavelet denoising method.

[0022] The image after wavelet denoising is the target iron accessory image. The target iron accessory image contains various information on the surface or near the surface of the iron accessory, such as shape, texture, whether there are magnetic marks, etc., and is the basic data for subsequent defect detection.

[0023] S103: Input the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory.

[0024] In this embodiment, the target random forest algorithm model is obtained through training. For example, in an embodiment of the present disclosure, before inputting the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory, it further includes: Training a random forest algorithm model based on a first data set to obtain a target random forest algorithm model, where the number of decision trees in the target random forest algorithm model is a target number; Wherein, the first data set includes iron accessory image data that has undergone magnetic particle inspection and its corresponding defect type data.

[0025] In this embodiment, the first data set is a data set composed of a large number of iron accessories that have undergone magnetic particle inspection and their corresponding defect types, and also includes iron accessory images that have undergone magnetic particle inspection without defects and their corresponding defect types.

[0026] The random forest algorithm model is an ensemble learning model composed of multiple decision trees. By synthesizing the prediction results of a large number of decision trees, the final prediction result is obtained. The prediction result can be whether there are defects and the type of defects, etc. The output result depends on the annotation of the data set during training.

[0027] It can be concluded from the above that the present disclosure can highlight the defects on the surface of the iron accessory, such as cracks, inclusions, etc. by using the magnetic particle inspection technology to process the target iron accessory. The present disclosure removes the noise that appears during the image acquisition process through noise reduction processing, thereby improving the clarity of the image, making the defects more prominent, and further improving the accuracy of iron accessory defect detection. The present disclosure uses the target random forest algorithm model to perform defect detection on the processed image, and improves the accuracy and stability of iron accessory defect detection by constructing multiple decision trees and synthesizing their output results.

[0028] In an embodiment of the present disclosure, performing noise reduction processing on the first iron accessory image based on the wavelet noise reduction method includes: Determining the wavelet basis function of the wavelet noise reduction method based on the edge features of the first iron accessory image and the image detail features of the first iron accessory image; Determining the decomposition level of the wavelet noise reduction method based on the noise of the first iron accessory image and the characteristic scale of the first iron accessory image; Determining the discrimination threshold of the wavelet noise reduction method based on the noise of the first iron accessory image and the required detection accuracy; Performing noise reduction processing on the first iron accessory image based on the wavelet basis function, the decomposition level, and the discrimination threshold.

[0029] In this embodiment, the edge of an image refers to the area where the gray value changes sharply in the image, which contains the contour information of the object in the image. For the iron accessory image, the edge features can reflect important information such as the external contour of the iron accessory and the boundary of the internal structure. The edge detection method can be the Sobel operator, Canny edge detection operator, etc. Through these methods, the edge information of the image can be extracted.

[0030] The image detail feature refers to the richness of the image details in the image. The image can be transformed from the spatial domain to the frequency domain through Fourier transform, and the richness of the image details can be determined according to the energy ratio of the high-frequency part in the frequency-domain image. If the energy ratio of the high-frequency part in the frequency-domain image is relatively large, it indicates that the image details are rich.

[0031] Considering that different iron accessory images have different edge features and image detail features, and the wavelet basis function is the core of wavelet transform, different wavelet basis functions have different characteristics. Selecting a suitable wavelet basis function is very important for effectively separating the signals and noises in the image. Selecting the wavelet basis function according to the edge features and image detail features of the first iron accessory image is to enable wavelet transform to better retain the important features of the image while removing noises.

[0032] The noise in the image will interfere with the extraction of useful information in the image. The noise level of the image can be evaluated by calculating statistical quantities such as the signal-to-noise ratio or the noise variance and mean of the image. More noise will cause the noise to exhibit multi-scale characteristics in the image, and noises of different frequencies are distributed at different scales. Therefore, the noise in the image is related to the decomposition level in the wavelet denoising method.

[0033] The characteristic scale refers to the scale corresponding to features of different sizes in the image. For example, in the iron accessory image, there may be large-scale overall contour features and small-scale local detail features. Features of different scales will be distributed at different decomposition levels in wavelet transform.

[0034] For example, in the magnetic particle inspection image, there are both macroscopic defects such as casting pores of larger sizes and microscopic defects such as tiny cracks. If the decomposition level is too low, it may lead to the inability to effectively distinguish the features of macroscopic defects and microscopic defects from the noise when removing the noise, thus the noise around the macroscopic defects may not be removed thoroughly, or the microscopic defects may be over-smoothed during the denoising process and are difficult to identify.

[0035] Therefore, this embodiment considers the influence of the noise and characteristic scale of the image on the decomposition level in the wavelet denoising method.

[0036] Secondly, noise and demand detection accuracy also affect the discrimination threshold. When the noise intensity increases, the threshold should be increased to better suppress noise; when the noise intensity decreases, the threshold can be appropriately decreased to avoid excessive removal of useful signals in the image. The demand detection accuracy refers to the strictness of noise removal. If very subtle defects need to be detected, that is, higher detection accuracy is required, then the threshold setting should be more stringent to remove as much noise as possible.

[0037] As can be seen from the above description, the edge features and image detail features of the image affect the selection of the wavelet basis function, the noise and feature scale affect the decomposition level of the wavelet basis function, and the noise and demand detection accuracy affect the discrimination threshold.

[0038] In this embodiment, the wavelet basis function can be determined in the following manner: In an embodiment of the present disclosure, determining the wavelet basis function of the wavelet denoising method based on the edge features of the first iron accessory image and the image detail features of the first iron accessory image includes: Detecting the edge features of the first iron accessory image based on an edge detection algorithm to obtain the edge intensity; Performing frequency domain analysis on the image detail features of the first iron accessory image based on a frequency domain analysis algorithm to obtain the energy proportion of the high-frequency components; Performing weighted calculation on the edge intensity and the energy proportion of the high-frequency components to obtain the wavelet basis value; In response to the wavelet basis value being greater than the first wavelet basis threshold, taking the first wavelet basis function as the wavelet basis function of the wavelet denoising method; In response to the wavelet basis value being less than or equal to the first wavelet basis value, taking the second wavelet basis function as the wavelet basis function of the wavelet denoising method.

[0039] In this embodiment, the edge detection algorithm can be the Canny algorithm. The Canny algorithm can determine the edge intensity by calculating the gradient amplitude and direction of the image and performing non-maximum suppression and double-threshold processing on the gradient amplitude , calculating the energy proportion of the high-frequency components based on the frequency domain analysis algorithm .

[0040] For example, for the first iron accessory image , with the number of rows and columns being , performing discrete Fourier transform to obtain the frequency domain image , where , , first performing centering processing on the frequency domain image, that is, , then presetting a cut-off frequency according to experience, and dividing the frequency domain image into low-frequency and high-frequency parts. For the frequency domain point calculating its distance to the frequency domain center distance 。

[0041] Energy of high-frequency component ,total energy , 。

[0042] Before performing the weighted calculation, the energy ratio of the high-frequency energy can be preprocessed to obtain a value. For example, multiply by 100, or it can be calculated in the form of a ratio. However, it should be noted that the subsequent setting of the first wavelet basis threshold should also be adjusted according to whether preprocessing is performed. In this embodiment, no preprocessing is performed because the edge strength calculated by the Canny algorithm is a value between 0 and 1, and the energy ratio of the high-frequency energy is also a value between 0 and 1. The orders of magnitude of the two data are the same. Therefore, no preprocessing is performed in this embodiment.

[0043] The formula for the weighted calculation of the two can be ,where represents the wavelet basis value, represents the weight corresponding to the edge strength, represents the weight corresponding to the energy ratio.

[0044] The first wavelet basis threshold can be set according to experience or the actual scenario. When the wavelet basis value is greater than the first wavelet basis threshold, it indicates that the edge features and details of the image have specific distributions and characteristics, the edges of the image are relatively clear, the details are rich and regular, etc. At this time, a wavelet basis function with good edge-preserving characteristics and high-frequency detail capture ability can be selected. For example, the first wavelet basis function can be used as the wavelet basis function of the wavelet denoising method. The first wavelet basis function can be some wavelet basis functions in the Daubechies wavelet family, such as db6. When the wavelet basis value is less than or equal to the first wavelet basis threshold, it indicates that the image edges are relatively blurred, the details are not obvious, or there is more noise, etc. In this case, a wavelet basis function that focuses more on denoising and smoothing is selected. For example, the second wavelet basis function is used as the wavelet basis function of the wavelet denoising method, such as the Symlets wavelet, which can suppress noise to a certain extent and appropriately enhance and extract relatively weak edges and details for subsequent accurate analysis and processing of the image.

[0045] Secondly, the noise of the first iron fitting image can be obtained by calculating the signal-to-noise ratio, and the characteristic scale of the first iron fitting image can be obtained by processing the image with multi-scale analysis tools such as wavelet transform. Similar to the method of determining the wavelet basis function of the wavelet denoising method, for example: Perform a weighted calculation on the signal-to-noise ratio of the first iron fitting image and the characteristic scale of the first iron fitting image to obtain a decomposition value; In response to the decomposition value being less than the first decomposition threshold, the first decomposition level is used as the decomposition level of the wavelet denoising method; In response to the decomposition value being greater than or equal to the first decomposition threshold, the second decomposition level is used as the decomposition level of the wavelet denoising method; the first decomposition level is less than the second decomposition level.

[0046] In this embodiment, the first decomposition threshold can be obtained by fitting during the experiment, the first decomposition level can be 3, and the second decomposition level can be 5.

[0047] Finally, based on the noise of the first iron accessory image and the required detection accuracy, the discrimination threshold of the wavelet denoising method is determined, which can be obtained through a preset mapping table, as shown in Table 1.

[0048]

[0049] After determining the wavelet basis function, the decomposition level, and the discrimination threshold, the wavelet denoising method with determined parameters can be used to perform denoising processing on the first iron accessory image.

[0050] As can be seen from the above, the present disclosure can select the most suitable wavelet basis function based on the edge features and detail features of the iron accessory image, ensuring that the denoising processing can retain the useful information in the image to the greatest extent while effectively removing noise, thereby improving the overall quality of the image and further enhancing the stability and reliability of the iron accessory defect detection. The present disclosure considers the influence of the noise level and feature scale of the image on the decomposition level, obtains the decomposition value through weighted calculation, and adjusts the decomposition level, ensuring that the denoising processing can not only effectively remove noise but also fully retain the key features in the image, improving the stability and reliability of the iron accessory defect detection.

[0051] In an embodiment of the present disclosure, the iron accessory defect detection method further includes: In response to the resolution of the first iron accessory image being greater than the first resolution and the contrast of the first iron accessory image being less than or equal to the first contrast, the weight corresponding to the energy ratio is increased based on the first detail step, and the weight corresponding to the edge intensity is decreased based on the first detail step; In response to the contrast of the first iron accessory image being greater than the first contrast and the resolution of the first iron accessory image being less than or equal to the first resolution, the weight corresponding to the edge intensity is increased based on the first edge step, and the weight corresponding to the energy ratio is decreased based on the first edge step.

[0052] In this embodiment, the resolution of the first iron accessory image is the basic information of an image, which can be directly obtained or obtained through an image viewing software or tool, and the contrast can be obtained through the histogram of the first iron accessory image.

[0053] Considering that the improvement of image resolution is more significant for image details, because details cover more abundant information in the image, high resolution can increase the information content of the image in a wider range, enabling various details to be presented more clearly. Edge features mainly focus on the boundaries of objects. Although the improvement of resolution helps, from the perspective of information richness, the improvement of image details is more prominent. And image contrast has a more significant impact on edge features, because contrast mainly works by enhancing the differences between pixels, and the edge itself is where the pixel values change drastically in the image, so the highlighting effect of contrast on edges is more direct and obvious. Although image details can also become clearer through the improvement of contrast, for some details with relatively small contrast differences, the improvement effect is relatively limited.

[0054] Therefore, in this embodiment, different adjustment methods are set for image resolution and contrast respectively. When the resolution of the first iron accessory image is greater than the first resolution and the contrast of the first iron accessory image is less than or equal to the first contrast, it indicates that the resolution of the image has a greater impact on the image at this time. Referring to the aforementioned logic and description, it can be known that the improvement of image resolution on image details is relatively more significant. Therefore, at this time, the weight of the image detail features (represented by the energy ratio of high-frequency energy) should also be appropriately increased, so that the image detail features have a greater impact on the wavelet basis value, thereby determining a more accurate wavelet basis value, and then selecting a suitable wavelet basis function. So at this time, the weight corresponding to the energy ratio can be increased based on the first detail step size, and the weight corresponding to the edge strength can be reduced based on the first detail step size. The first resolution and the first contrast can be set according to experience.

[0055] On the contrary, when the contrast of the first iron accessory image is greater than the first contrast and the resolution of the first iron accessory image is less than or equal to the first resolution, it indicates that the contrast of the image has a greater impact on the image at this time. Referring to the aforementioned logic and description, it can be known that the improvement of image contrast on edge features is more significant. Therefore, at this time, the weight of the edge features (represented by the edge strength) should also be increased, so that the edge features have a greater impact on the wavelet basis value, thereby determining a more accurate wavelet basis value, and then selecting a suitable wavelet basis function. So at this time, the weight corresponding to the edge strength can be increased based on the first edge step size, and the weight corresponding to the energy ratio can be reduced based on the first edge step size.

[0056] In an embodiment of the present disclosure, the method for detecting iron accessory defects further includes: Determining a first detail step size based on the resolution of the first iron accessory image and the contrast of the first iron accessory image; Determining a first edge step size based on the resolution of the first iron accessory image and the contrast of the first iron accessory image.

[0057] In this embodiment, as can be seen from the foregoing description, the first detail step size and the first edge step size are used to adjust the weight distribution, and they should also be related to the resolution and contrast of the first iron fitting image. Therefore, the first detail step size can be determined by the first formula. The first formula: .

[0058] The first edge step size can be determined by the second formula. The second formula: .

[0059] Wherein, represents the first detail step size, represents the first edge step size, represents the resolution of the first iron fitting image, represents the contrast of the first iron fitting image, represents the first resolution, represents the first contrast, represents the resolution index coefficient, which is used to adjust the influence degree of resolution change on the step size, represents the contrast attenuation coefficient, which is used to control the attenuation effect of contrast on the detail step size, represents the contrast index coefficient, which is used to adjust the influence degree of contrast change on the step size, represents the resolution attenuation coefficient, which is used to control the attenuation effect of resolution on the edge step size. , , , can be determined according to the fitting process.

[0060] For the numerator part of the first formula, reflects the change of the resolution relative to the first resolution, represents the attenuation effect of contrast on the detail step size. For the denominator part of the first formula is for normalizing the numerator.

[0061] For the numerator part of the second formula, reflects the change of the contrast relative to the first contrast, represents the attenuation effect of resolution on the edge step size. For the denominator part of the second formula normalizes the numerator.

[0062] In this embodiment, it is also considered that when the differences in resolution and contrast are relatively large, only through the determined , , , the formula may be unbalanced due to uneven distribution. Therefore, the following method can be used to adjust the parameters: In an embodiment of the present disclosure, in response to the absolute value of the resolution difference degree of the first iron accessory image being greater than the first difference degree, the resolution index coefficient is reduced based on the first difference step, and the contrast index coefficient is reduced based on the third difference step; In response to the absolute value of the contrast difference degree of the first iron accessory image being greater than the second difference degree, the contrast attenuation coefficient is reduced based on the second difference step, and the resolution attenuation coefficient is reduced based on the fourth difference step.

[0063] In this embodiment, adjusting the resolution index coefficient and the contrast attenuation coefficient according to the difference degrees of resolution and contrast is to enable the formula to adapt to the characteristics of different images. The absolute value of the resolution difference degree is , and the absolute value of the contrast difference degree , when the absolute value of the resolution difference degree of the first iron accessory image is greater than the first difference degree, it indicates that the resolution of the current image differs significantly from the set first resolution. If the resolution index coefficient is not adjusted, it will cause this term to dominate absolutely in the formula, ignoring the influence of other factors. Therefore, at this time, the resolution index coefficient can be reduced based on the first difference step. The first difference degree and the first difference step can be set according to experience. To avoid the resolution from dominating, it should be ensured that is larger, so the contrast attenuation coefficient is reduced. However, since the resolution index coefficient is of an exponential type, the influence of the resolution index coefficient on the formula result is relatively significant. Especially when the resolution or contrast changes greatly, it will significantly change the relationship between the detail step and the resolution or contrast. Therefore, the first difference step is less than the second difference step, and the third difference step is less than the fourth difference step.

[0064] Similarly, when the contrast difference is greater than the second difference degree, adjusting the contrast attenuation coefficient can make the influence of the contrast more reasonable, avoiding its influence on the step being too large or too small. The second difference degree and the second difference step can be set according to experience. The principle of reducing the contrast index coefficient and the resolution attenuation coefficient is the same. The third difference step and the fourth difference step can be determined according to the actual application scenario or experience.

[0065] It can be concluded from the above that the present disclosure adjusts the weights of the image detail features and edge features through the resolution and contrast of the first iron accessory image, ensuring that the key features of the image can be captured more accurately under different image conditions, and improving the accuracy and reliability of iron accessory defect detection. In this embodiment, when the image resolution is high and the contrast is low, by increasing the weight of the image detail features and reducing the weight of the edge features, more emphasis is placed on retaining the detail information in the image. Conversely, when the image contrast is high and the resolution is low, more emphasis is placed on extracting the edge features, ensuring the clarity and accuracy of the image contour. The present disclosure realizes the adjustment of the first detail step and the first edge step through the first formula and the second formula. Further, by introducing the concepts of resolution difference degree and contrast difference degree, and the corresponding difference step adjustment mechanism, the present disclosure avoids the imbalance of the formula when the resolution and contrast differences are large or small, and improves the accuracy and reliability of iron accessory defect detection.

[0066] In an embodiment of the present disclosure, the number of decision trees in the target random forest algorithm model is the target number; Inputting the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory, including: In response to the dimension of the target iron accessory image being greater than or equal to the first dimension, calling the target number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain the defect detection result of the target iron accessory; In response to the dimension of the target iron accessory image being less than the first dimension, calling the first number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain the defect detection result of the target iron accessory; Wherein, the first number is less than the target number.

[0067] In this embodiment, the dimension of the target iron accessory image refers to the number of elements contained in the vector describing the image features, or the number of independent variables used to represent the image features. It reflects the complexity of the image features and the amount of information contained, and can be calculated through the gray-level co-occurrence matrix or local binary pattern. When the dimension of the target iron accessory image is greater than or equal to the first dimension, it indicates that the image has a high complexity and contains rich feature information. To make full use of this information and accurately detect defects, it is necessary to call all the decision trees with the target number in the target random forest algorithm model. Because more decision trees can analyze and judge the features of the image from different angles, and integrating the results of multiple decision trees can improve the accuracy and reliability of detection to cope with the complex situations brought by high-dimensional images. The first dimension can be obtained based on the data in the experimental process. For example, it is found that when the dimension is 256×256, the evaluation of the results by the first number of decision trees is no longer accurate. For example, there are some decision tree results that are different from other decision trees, and the number of different outputs is greater than the preset proportion of the total number of decision trees. At this time, the first dimension can be set at 256×256.

[0068] When the dimension of the target iron accessory image is less than the first dimension, it means that the image has relatively few features and little information. Too many decision trees will increase the computational cost and time. Therefore, a smaller first number of decision trees in the target random forest algorithm model is selected for invocation. This can not only effectively analyze the image and detect defects to a certain extent, but also avoid the model from being too complex, improve the detection efficiency, and at the same time reduce unnecessary consumption of computing resources. The first number can be used as a reference based on the number of decision trees when solving related technical problems in this field, or can be obtained through evaluation during the experiment.

[0069] From the above, it can be concluded that in this embodiment, the appropriate number of decision trees in the target random forest algorithm model is selected according to the dimension of the target iron accessory image. When the image dimension is high, all the decision trees are called to make full use of the rich feature information in the image, improve the accuracy and reliability of iron accessory defect detection, and ensure that the algorithm can perform optimal processing for images with different complexities. This embodiment dynamically adjusts the number of decision trees through the image dimension, enhancing the flexibility and adaptability of the present disclosure.

[0070] Corresponding to the iron accessory defect detection method in the above embodiment, Figure 2 is a structural block diagram of an iron accessory defect detection system provided by an embodiment of the present disclosure. For the sake of convenience of description, only the parts related to the embodiments of the present disclosure are shown. Refer to Figure 2 The iron accessory defect detection system 20 includes: an image acquisition module 21, an image processing module 22, and a defect detection module 23.

[0071] Among them, the image acquisition module 21 is used to obtain the first iron accessory image, and the first iron accessory image is an image of the iron accessory after processing the target iron accessory based on magnetic particle detection; The image processing module 22 is used to perform noise reduction processing on the first iron accessory image based on the wavelet noise reduction method to obtain the target iron accessory image; The defect detection module 23 is used to input the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory.

[0072] In an embodiment of the present disclosure, the image processing module 22 is specifically used to determine the wavelet basis function of the wavelet noise reduction method based on the edge features of the first iron accessory image and the image detail features of the first iron accessory image; Determine the decomposition layer number of the wavelet noise reduction method based on the noise of the first iron accessory image and the characteristic scale of the first iron accessory image; Determine the discrimination threshold of the wavelet noise reduction method based on the noise of the first iron accessory image and the required detection accuracy; Perform noise reduction processing on the first iron accessory image based on the wavelet basis function, the decomposition layer number, and the discrimination threshold.

[0073] In an embodiment of the present disclosure, the image processing module 22 is specifically further used to detect the edge features of the first iron accessory image based on the edge detection algorithm to obtain the edge intensity; Perform frequency domain analysis on the image detail features of the first iron accessory image based on the frequency domain analysis algorithm to obtain the energy ratio of the high-frequency components; Perform weighted calculation on the edge intensity and the energy ratio of the high-frequency components to obtain the wavelet basis value; In response to the wavelet basis value being greater than the first wavelet basis threshold, use the first wavelet basis function as the wavelet basis function of the wavelet noise reduction method; In response to the wavelet basis value being less than or equal to the first wavelet basis value, use the second wavelet basis function as the wavelet basis function of the wavelet noise reduction method.

[0074] In an embodiment of the present disclosure, the iron accessory defect detection system 20 further includes: a weight adjustment module, which is used to, in response to the resolution of the first iron accessory image being greater than the first resolution and the contrast of the first iron accessory image being less than or equal to the first contrast, increase the weight corresponding to the energy ratio based on the first detail step and decrease the weight corresponding to the edge intensity based on the first detail step; In response to the image contrast of the first iron accessory being greater than the first contrast and the resolution of the first iron accessory image being less than or equal to the first resolution, increase the weight corresponding to the edge intensity based on the first edge step and decrease the weight corresponding to the energy ratio based on the first edge step.

[0075] In an embodiment of the present disclosure, the iron accessory defect detection system 20 further includes: a step size determination module for determining a first detail step size based on the resolution of the first iron accessory image and the contrast of the first iron accessory image; Determine a first edge step size based on the resolution of the first iron accessory image and the contrast of the first iron accessory image.

[0076] In an embodiment of the present disclosure, the iron accessory defect detection system 20 further includes: a model training module for training a random forest algorithm model based on a first data set to obtain a target random forest algorithm model, and the number of decision trees in the target random forest algorithm model is the target number; Wherein, the first data set includes iron accessory image data detected by magnetic particle testing and its corresponding defect type data.

[0077] In an embodiment of the present disclosure, the number of decision trees in the target random forest algorithm model is the target number; The defect detection module 23 is configured to, in response to the dimension of the target iron accessory image being greater than or equal to the first dimension, call the target number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain a defect detection result of the target iron accessory; In response to the dimension of the target iron accessory image being less than the first dimension, call the first number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain a defect detection result of the target iron accessory; Wherein, the first number is less than the target number.

[0078] See Figure 3 , Figure 3 is a schematic block diagram of an electronic device provided by an embodiment of the present disclosure. As Figure 3 shown, the electronic device 300 in this embodiment may include: one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The above-mentioned processors 301, input devices 302, output devices 303, and memories 304 complete communication with each other through a communication bus 305. The memory 304 is used to store a computer program, and the computer program includes program instructions. The processor 301 is configured to execute the program instructions stored in the memory 304. Wherein, the processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above system embodiments, such as Figure 2 the functions of the modules 21 to 23 shown.

[0079] It should be understood that in the embodiments of the present disclosure, the so-called processor 301 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0080] The input device 302 may include a touchpad, a fingerprint acquisition sensor (for acquiring the fingerprint information and the direction information of the fingerprint of the user), a microphone, etc., and the output device 303 may include a display (such as an LCD), a speaker, etc.

[0081] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A part of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.

[0082] In specific implementation, the processor 301, the input device 302, and the output device 303 described in the embodiments of the present disclosure may execute the implementation manners described in the first embodiment and the second embodiment of the iron accessory defect detection method provided by the embodiments of the present disclosure, and may also execute the implementation manner of the electronic device described in the embodiments of the present disclosure, which will not be elaborated herein.

[0083] In another embodiment of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, all or part of the processes in the methods of the above embodiments are implemented. It can also be completed by instructing relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0084] The computer-readable storage medium can be the internal storage unit of the electronic device in any of the foregoing embodiments, such as the hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on the electronic device. Further, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the electronic device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store the data that has been output or will be output.

[0085] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.

[0086] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described electronic devices and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0087] In several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces or units, or can also be electrical, mechanical or other forms of connection.

[0088] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present disclosure.

[0089] In addition, in each embodiment of the present disclosure, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0090] The above is only the specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present disclosure can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A method for detecting defects in iron accessories, characterized in that: include: Acquire a first iron attachment image, where the first iron attachment image is an image of the iron attachment after the target iron attachment is processed based on magnetic particle detection; Performing denoising processing on the first iron attachment image based on a wavelet denoising method to obtain a target iron attachment image; The target iron accessory image is input into a target random forest algorithm model to obtain a defect detection result of the target iron accessory.

2. The iron accessory defect detection method according to claim 1, characterized in that: The performing denoising processing on the first iron attachment image based on the wavelet denoising method comprises: Determine the wavelet basis function of the wavelet denoising method based on the edge features of the first iron attachment image and the image detail features of the first iron attachment image; Determining the number of decomposition layers of the wavelet denoising method based on the noise of the first iron attachment image and the characteristic scale of the first iron attachment image; Determining a discrimination threshold of the wavelet denoising method based on the noise of the first iron accessory image and the required detection accuracy; The first iron attachment image is subjected to denoising processing based on the wavelet basis function, the number of decomposition levels and the distinction threshold.

3. The iron accessory defect detection method according to claim 2, characterized in that: The step of determining the wavelet basis function of the wavelet denoising method based on the edge feature of the first iron attachment image and the image detail feature of the first iron attachment image comprises: Detecting edge features of the first iron accessory image based on an edge detection algorithm to obtain edge strength; Performing frequency domain analysis on the image detail features of the first iron attachment image based on a frequency domain analysis algorithm to obtain the energy proportion of high-frequency components; Performing weighted calculation on the edge strength and the energy proportion of the high-frequency component to obtain a wavelet basis value; In response to the wavelet basis value being greater than a first wavelet basis threshold, using the first wavelet basis function as the wavelet basis function of the wavelet denoising method; In response to the wavelet basis value being less than or equal to the first wavelet basis value, a second wavelet basis function is used as the wavelet basis function of the wavelet denoising method.

4. The iron accessory defect detection method according to claim 3, characterized in that: Also includes: In response to a resolution of the first iron attachment image being greater than a first resolution and a contrast of the first iron attachment image being less than or equal to a first contrast, increasing a weight corresponding to the energy proportion based on a first detail step, and decreasing a weight corresponding to the edge strength based on the first detail step; In response to the image contrast of the first iron attachment being greater than the first contrast and the resolution of the first iron attachment image being less than or equal to the first resolution, the weight corresponding to the edge strength is increased based on the first edge step, and the weight corresponding to the energy proportion is reduced based on the first edge step.

5. The iron accessory defect detection method according to claim 4, characterized in that: Also includes: determining the first detail step size based on a resolution of the first iron attachment image and a contrast of the first iron attachment image; The first edge step size is determined based on a resolution of the first iron attachment image and a contrast of the first iron attachment image.

6. The iron attachment defect detection method according to claim 1, characterized in that: Before inputting the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory, the method further includes: Training a random forest algorithm model based on the first data set to obtain the target random forest algorithm model, wherein the number of decision trees in the target random forest algorithm model is the target number; The first data set includes image data of iron accessories after magnetic particle inspection and corresponding defect type data.

7. The iron attachment defect detection method according to claim 1, characterized in that: The number of decision trees in the target random forest algorithm model is the target number; The step of inputting the target iron accessory image into a target random forest algorithm model to obtain a defect detection result of the target iron accessory includes: In response to the dimension of the target iron accessory image being greater than or equal to the first dimension, calling a target number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain a defect detection result of the target iron accessory; In response to the dimension of the target iron accessory image being smaller than the first dimension, calling a first number of decision trees in the target random forest algorithm model to process the target iron accessory image to obtain a defect detection result of the target iron accessory; The first quantity is smaller than the target quantity.

8. An iron accessory defect detection system, characterized in that: include: An image acquisition module, used for acquiring a first iron attachment image, wherein the first iron attachment image is an image of the iron attachment after the target iron attachment is processed based on magnetic particle detection; An image processing module, used for performing noise reduction processing on the first iron attachment image based on a wavelet noise reduction method to obtain a target iron attachment image; The defect detection module is used to input the target iron accessory image into the target random forest algorithm model to obtain the defect detection result of the target iron accessory.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Municipal road detection method and system

    CN115272174A

  • Defect identification method and device and storage medium

    CN118333939A

  • Casting product appearance defect detection method and system based on machine vision

    CN119223984A

  • Nondestructive inspection method for enhancing defect detection efficiency through deep learning

    CN119295827A

  • Power grid fault detecting and positioning method and system for intelligent power grid system

    CN119492958A