Muffler surface material defect detection method and system
By performing wavelet transformation and FCM algorithm processing on the muffler image data, the surface defects of the muffler are automatically identified, solving the problems of low detection efficiency and low accuracy in the prior art, and achieving high-precision automated detection.
Patent Information
- Application Number
- CN202210255970.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-15
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-03-15
AI Technical Summary
In the prior art, the surface material defect detection efficiency and low accuracy of mufflers are low, and rely on manual visual inspection, making it difficult to be comprehensive and susceptible to human subjectivity.
By performing wavelet transformation, FCM algorithm processing and attention image analysis on muffler image data, surface defects are automatically identified, contact detection is avoided, and human subjectivity is reduced.
The accuracy and accuracy of surface defect detection of mufflers is improved, secondary damage to mufflers is reduced, and automated detection is achieved.
Smart Images

Figure CN114820438B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of muffler defect detection, and specifically to a method and system for detecting defects in muffler surface materials. Background Art
[0002] The muffler reduces the speed and power of exhaust by damping or increasing the exhaust area. When pressurized gas passes through the muffler, the airflow is resisted and the sound energy is partially absorbed and converted into heat energy, thereby reducing the intensity of the noise.
[0003] The surface of the muffler shell should be firm, smooth and tight. The surface material of the muffler should not have oil stains, damage, scratches, or uneven convex and concave defects, otherwise it will affect the air tightness of the muffler, thereby reducing the muffler's noise reduction effect. At the same time, the presence of surface defects on the muffler will also accelerate the rusting of the muffler surface, thereby reducing the service life of the muffler.
[0004] In the process of implementing the embodiments of the present invention, the inventors found that there are at least the following defects in the background technology: there is currently little research on the detection of surface material defects of mufflers, and visual inspection is generally performed manually, which has a large workload and low detection efficiency, low defect recognition accuracy, and is difficult to achieve comprehensive inspection. Summary of the Invention
[0005] To address the above technical issues, the present invention provides a method and system for detecting surface material defects in mufflers. This method performs targeted processing on muffler image data, eliminating the influence of irrelevant factors and improving the precision and accuracy of detecting surface defects. By processing and analyzing image data, the system determines whether a defect exists and, if so, identifies the defective area. This eliminates the need for contact with the muffler surface, reducing secondary damage to the muffler. Furthermore, the automated detection process avoids human subjectivity.
[0006] In a first aspect, the embodiments of the present invention provide a method for detecting surface material defects of a muffler, comprising:
[0007] The surface image of the muffler to be inspected is collected and preprocessed.
[0008] The pre-processed surface image is subjected to wavelet transformation to obtain a low-frequency sub-band and a plurality of high-frequency sub-bands after wavelet transformation.
[0009] The wavelet coefficients corresponding to each high-frequency sub-band are processed to obtain the processed wavelet coefficients corresponding to each high-frequency sub-band.
[0010] According to the updated wavelet coefficients of each high-frequency sub-band and the low-frequency sub-band, an inverse wavelet transform is performed to reconstruct the attention image, and the membership value of each pixel point in the attention image is obtained respectively using the FCM algorithm.
[0011] According to the range of the membership values of the pixels in the attention image, the pixels in the attention image are divided into two categories, and whether there is a defect is judged based on the ratio of the number of the two categories of pixels, and when it is determined that there is a defect, the category in which the defect exists is obtained, so that the pixels in the category in which the defect exists are organized into a defect area.
[0012] In a feasible embodiment, processing the wavelet coefficients corresponding to each high frequency sub-band to obtain the processed wavelet coefficients corresponding to each high frequency sub-band includes:
[0013] According to the similarity between any two wavelet coefficients in all high-frequency sub-band wavelet coefficients, a Laplacian matrix of the similarity of the wavelet coefficients is obtained.
[0014] The two largest eigenvectors of the eigenvectors of the Laplacian matrix are obtained, and the cosine similarities between different rows in the matrix composed of the two eigenvectors are calculated to cluster the cosine similarities between different rows into two categories, and the wavelet coefficients corresponding to the category with smaller cosine similarity in the two categories are set to 0 to obtain the wavelet coefficients corresponding to the processed high-frequency subbands.
[0015] In a feasible embodiment, according to the similarity between any two wavelet coefficients in all high-frequency sub-bands, a Laplacian matrix of the similarity of the wavelet coefficients is obtained, including:
[0016] According to the similarity between any two wavelet coefficients in all high-frequency sub-bands, a similarity matrix of the wavelet coefficients is obtained, and the similarity matrix includes the similarity between any two wavelet coefficients.
[0017] An accumulation matrix is obtained according to the similarity matrix, wherein the accumulation matrix is a diagonal matrix and the non-zero value of each row in the accumulation matrix is the accumulation of the value of the corresponding row in the similarity matrix.
[0018] The accumulation matrix is subtracted from the similarity matrix to obtain a Laplacian matrix of similarity of wavelet coefficients.
[0019] In a feasible embodiment, pre-processing the surface image of the muffler to be inspected includes:
[0020] The surface image of the muffler to be inspected is grayscaled to obtain a grayscale image.
[0021] Perform bilinear interpolation processing on the grayscale image to obtain an interpolated image.
[0022] The grayscale image is processed using a region growing algorithm to obtain a plurality of sub-blocks.
[0023] The frequency of occurrence of different grayscale values in the sub-blocks is used to obtain the characteristic values of the pixels in each sub-block.
[0024] A weighted sum is performed on the pixel value of the pixel point in the interpolated image and the eigenvalue in the corresponding sub-block to obtain the pixel value of the pixel point in the preprocessed surface image, wherein the weight value of the eigenvalue in the weighted summation process is greater than the weight of the pixel value of the pixel point in the interpolated image.
[0025] In a feasible embodiment, the characteristic values of the pixels in each sub-block are obtained using the frequencies of occurrence of different grayscale values in the sub-blocks, including:
[0026]
[0027] Among them, Q is the characteristic value of the pixel in the sub-block, G is the gray level of the pixel in the sub-block, and f i is the frequency of occurrence of gray value i in the sub-block.
[0028] In a feasible embodiment, pixels in the attention image are divided into two categories according to the range of membership values of the pixels in the attention image, including:
[0029] Determine whether the membership value of the pixel point in the attention image is greater than a preset first threshold value. If the judgment result is yes, classify the pixel point into the first category.
[0030] If the judgment result is no, then determine whether the membership value of the pixel point in the attention image is greater than the preset second threshold value. If the judgment result is yes, then classify the pixel point into the second category; otherwise, classify the pixel point into the third category.
[0031] For a pixel in the second category, when the number of pixels belonging to the first category in the neighborhood of the pixel is greater than the number of pixels belonging to the third category, the pixel is classified into the first category; otherwise, the pixel is classified into the third category.
[0032] In a feasible embodiment, determining whether a defect exists based on the ratio of the number of pixels in the two divided categories, and obtaining the category of the defect when it is determined that a defect exists, includes:
[0033] Obtain the ratio of the category with the larger number of pixels in the two divided categories to the number of pixels in the other category, and determine whether the ratio is greater than a preset ratio threshold. If the judgment result is yes, there is no defect on the muffler surface; otherwise, there is a defect on the muffler surface, and the category with the smaller number of pixels in the two categories is regarded as the category with defects.
[0034] In a feasible embodiment, before processing the wavelet coefficients corresponding to each high frequency sub-band, the method further includes:
[0035] Starting from the last wavelet transform, the high-frequency subband obtained by the next wavelet transform is upsampled, and the size after upsampling is equal to the high-frequency subband obtained by the previous wavelet transform in the same direction.
[0036] The high-frequency sub-band of the next level after upsampling is weightedly fused with the high-frequency sub-band of the previous level in the same direction.
[0037] The high-frequency sub-bands of adjacent levels in the same direction are up-sampled and weightedly fused until the weighted fusion of the high-frequency sub-bands of all levels is completed.
[0038] In a feasible embodiment, before performing wavelet transform on the pre-processed surface image, the method further includes performing Gaussian filtering to remove noise on the pre-processed surface image.
[0039] In a second aspect, an embodiment of the present invention proposes a muffler surface material defect detection system, comprising: a memory and a processor, characterized in that the processor executes a computer program stored in the memory to implement the muffler surface material defect detection method in an embodiment of the present invention.
[0040] The present invention provides a method and system for detecting surface material defects of a muffler.
[0041] Compared to existing technologies, the present invention offers the following advantages: targeted processing of muffler image data can avoid the influence of irrelevant factors, thereby improving the precision and accuracy of detecting muffler surface defects. By processing and analyzing image data, it is possible to determine whether a defect exists and, if so, to identify the defective area. This eliminates the need for contact with the muffler surface, reducing secondary damage to the muffler. Furthermore, the automated detection process avoids human subjectivity. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 paying any creative work.
[0043] Figure 1 The figure is a flow chart of a method for detecting surface material defects of a muffler provided by an embodiment of the present invention.
[0044] Figure 2 Schematic diagram of three-level wavelet decomposition of an image in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0046] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0047] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the technical features being referred to. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more of such features; and in the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0048] The embodiment of the present invention provides a method for detecting surface material defects of a muffler. Figure 1 Shown, including:
[0049] Step S101: Acquire a surface image of the muffler to be inspected and perform preprocessing.
[0050] Step S102: performing wavelet transform on the pre-processed surface image to obtain a low-frequency sub-band and multiple high-frequency sub-bands after wavelet transform.
[0051] Step S103 : Process the wavelet coefficients corresponding to each high frequency sub-band to obtain processed wavelet coefficients corresponding to each high frequency sub-band.
[0052] Step S104: Perform inverse wavelet transform reconstruction based on the updated wavelet coefficients of each high-frequency sub-band and the low-frequency sub-band to obtain an attention image, and use the FCM algorithm to obtain the membership value of each pixel in the attention image.
[0053] Step S105: Divide the pixels in the attention image into two categories according to the range of the membership values of the pixels in the attention image, and determine whether there is a defect based on the ratio of the number of the two categories of pixels. When it is determined that there is a defect, obtain the category in which the defect exists, and organize the pixels in the category in which the defect exists into a defect area.
[0054] The embodiment of the present invention mainly detects the surface defect conditions of the muffler through image data to accurately detect the defects on the muffler surface, processes and analyzes the collected image data to obtain image data that more highlights the surface defects of the muffler, and uses a defect detection model to achieve accurate detection of the surface defects of the muffler.
[0055] Furthermore, step S101 collects the surface image of the muffler to be inspected and performs pre-processing, which specifically includes:
[0056] First, an embodiment of the present invention sets up an image acquisition device for acquiring image data of the surface of the muffler, wherein the shooting range and angle of the camera are adjusted by the implementer according to actual conditions.
[0057] Specifically, the surface image of the muffler to be tested is an RGB image. The RGB image is a visible light image. At the same time, RGB is a color standard. Various colors are obtained by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents the colors of the three channels of red, green, and blue.
[0058] It should be noted that, considering that the muffler in the embodiment of the present invention is a cylindrical structure, in order to achieve comprehensive detection of the entire muffler, the present invention will combine a robot to convert the position of the muffler, and the robot can flip the muffler so that the camera can comprehensively collect image data on the surface of the muffler. The specific flipping angle and process implementer are set according to actual conditions, but it is necessary to ensure that the local images of the muffler collected before and after two adjacent flips have overlapping parts, so that the local images can be spliced and fused to obtain the overall image data of the muffler surface.
[0059] Secondly, after obtaining the surface image of the muffler, the surface image of the muffler to be inspected is grayscaled to obtain a grayscale image;
[0060] Bilinear interpolation is performed on the grayscale image to obtain an interpolated image, thereby increasing the local texture features of the muffler surface image. It should be noted that bilinear interpolation is also known as bilinear interpolation. Mathematically, bilinear interpolation is an extension of linear interpolation to an interpolation function with two variables. Its core concept is to perform linear interpolation in two directions. In the fields of computer vision and image processing, bilinear interpolation is a basic resampling technique.
[0061] Then, a region growing algorithm is used to process the grayscale image to obtain multiple sub-blocks. In the embodiments of the present invention, sub-blocks refer to small regions. It should be noted that the basic concept of the region growing algorithm is to aggregate similar data to form a target region. Specifically, at least one seed point is first found in the region to be segmented as the starting point for region growing. Based on pre-set growth conditions, it is determined whether the data in the preset neighborhood of the seed point has the same or similar properties as the seed point. Data that meets the growth conditions is added to the target region. The newly added data continues to grow into the neighborhood as a seed point until no data that meets the growth conditions can be found.
[0062] The characteristic values of the pixels in each sub-block are obtained by using the frequencies of occurrence of different grayscale values in the sub-blocks; including:
[0063] Among them, Q is the characteristic value of the pixel in the sub-block, G is the gray level of the pixel in the sub-block, and f i is the frequency of occurrence of grayscale value i in the sub-block. The larger the eigenvalue of a pixel in a sub-block, the more likely it is an edge or contour pixel. Conversely, the pixel contained in the sub-block is a smooth area pixel.
[0064] Optionally, the sub-blocks may be divided into grayscale levels, and the grayscale values of the pixels contained in the sub-blocks may be divided into 10 levels from the original 0 to 255. This may reduce the amount of computation required by the system, thereby improving processing efficiency.
[0065] Finally, a weighted sum is performed on the pixel value of the pixel point in the interpolated image and the eigenvalue in its corresponding sub-block to obtain the pixel value of the pixel point in the preprocessed surface image, wherein the weight value of the eigenvalue in the weighted summation process is greater than the weight of the pixel value of the pixel point in the interpolated image.
[0066] Specifically, the weighted summation process includes: F(x,y) = X(x,y) + γQ(x,y), where F(x,y) is the preprocessed surface image, X(x,y) is the linear interpolation image, and γ is the processing coefficient, which can be set by the implementer based on actual conditions. As an example, in this embodiment of the present invention, γ = 5. This can enhance texture feature information such as edges in the preprocessed surface image, facilitating the subsequent identification and classification of surface defect pixels.
[0067] Optionally, Gaussian filtering may be performed on the pre-processed surface image, thereby removing a large amount of noise in the image.
[0068] It should be noted that noise mainly includes salt and pepper noise, additive noise, multiplicative noise, and Gaussian noise. There are many image denoising algorithms, including those based on the partial differential heat conduction equation and those based on filtering. Filtering is widely used due to its high speed and mature algorithms. Common filtering denoising algorithms include median filtering, mean filtering, and Gaussian filtering.
[0069] Furthermore, step S102 is to perform wavelet transform on the pre-processed surface image to obtain a low-frequency sub-band and multiple high-frequency sub-bands after wavelet transform. Specifically, it includes:
[0070] The embodiment of the present invention uses wavelet transform to transform the pre-processed surface image, thereby obtaining a low-frequency sub-band and a plurality of high-frequency sub-bands in different directions.
[0071] It should be noted that the wavelet transform (also known as wavelet analysis) represents a signal using an oscillating waveform of finite length or rapidly decaying, called a "mother wavelet." This waveform is scaled and translated to match the input signal. Wavelet transforms are divided into two broad categories: discrete wavelet transform (DWT) and continuous wavelet transform (CWT). The main difference between the two is that continuous transforms operate on all possible scales and translations, while discrete transforms operate on a specific subset of all scales and translations. Performing a wavelet transform on a given signal involves expanding the signal according to a cluster of wavelet functions, representing the signal as a linear combination of wavelet functions at different scales and time shifts. The coefficient of each term is called a wavelet coefficient. After wavelet decomposition, each wavelet subband contains wavelet coefficients at different scales, and each wavelet coefficient has a corresponding value.
[0072] Figure 2 FIG. 4 shows a schematic diagram of three-level wavelet decomposition of an image in an embodiment of the present invention, as shown in FIG. Figure 2 As shown in the figure, after the first-level wavelet transform is performed on the image, 1 approximate subband and 3 detail subbands are obtained; the second-level wavelet transform of the image is specifically to continue to perform wavelet transform on the approximate subband after the first wavelet transform, and another approximate subband and three detail subbands corresponding to the approximate subband after the first wavelet transform are obtained, so that a total of 1 approximate subband and 6 detail subbands are obtained; the third-level wavelet transform of the image is specifically to perform wavelet transform on the approximate subband obtained by the second-level wavelet transform, and another approximate subband and three detail subbands corresponding to the approximate subband obtained by the second-level wavelet transform are obtained, so that a total of 1 approximate subband and 9 detail subbands are obtained. Similarly, after performing n-level wavelet transform, a total of 1 approximate subband and 3a detail subbands are obtained, that is, 3a+1 wavelet subbands, where a is a positive integer.
[0073] In this preferred embodiment of the present invention, the image is subjected to a three-level wavelet sub-generation decomposition. It should be readily understood that in other embodiments of the present invention, the image can also be subjected to other levels of decomposition. However, it should be noted that the more levels of decomposition, the greater the difficulty of subsequent image reconstruction. Furthermore, a higher level of decomposition also increases the computational complexity. Therefore, the level of image decomposition must be appropriately selected.
[0074] It should be noted that, in each wavelet subband obtained in the wavelet transform process in the embodiment of the present invention, the detail subband is a high-frequency subband, and the approximate subband is a low-frequency subband.
[0075] Optionally, high-frequency subbands in the same direction obtained during adjacent wavelet transforms can be fused, including: starting from the last wavelet transform, upsampling the high-frequency subband obtained from the subsequent wavelet transform, with the size of the upsampled subband equal to the high-frequency subband obtained from the previous wavelet transform in the same direction; weighted fusion of the upsampled high-frequency subband of the subsequent level with the high-frequency subband of the previous level in the same direction; upsampling and weighted fusion of high-frequency subbands of adjacent levels in the same direction, until the weighted fusion of high-frequency subbands of all levels is completed. In this way, it is possible to avoid the reduction of defect detection accuracy caused by abnormal noise points in the high-frequency subbands.
[0076] As an example, in the weighted fusion process in the embodiment of the present invention, the weights corresponding to high-frequency sub-bands at different levels are all 0.5.
[0077] Furthermore, step S103 processes the wavelet coefficients corresponding to each high-frequency sub-band to obtain the processed wavelet coefficients corresponding to each high-frequency sub-band. Specifically, the process includes:
[0078] First, according to the similarity between any two wavelet coefficients in all high-frequency sub-bands, the Laplace matrix of the similarity of the wavelet coefficients is obtained, including:
[0079] According to the similarity of any two wavelet coefficients in the wavelet coefficients of all high-frequency subbands, a similarity matrix of the wavelet coefficients is obtained, and the similarity matrix contains the similarity between each two wavelet coefficients; according to the similarity matrix, an accumulation matrix is obtained, wherein the accumulation matrix is a diagonal matrix and the non-zero value of each row in the accumulation matrix is accumulated by the value of the corresponding row in the similarity matrix; the accumulation matrix is subtracted from the similarity matrix to obtain a Laplace matrix of the similarity of the wavelet coefficients.
[0080] Secondly, the two largest eigenvectors among the eigenvectors of the Laplacian matrix are obtained, and the cosine similarities between different rows in the matrix composed of the two eigenvectors are calculated, so as to cluster the cosine similarities between different rows into two categories.
[0081] First, the present invention treats the wavelet coefficients corresponding to the processed high-frequency sub-band images as a set: V = {v1, v2, ..., v n}, n is the total number of wavelet coefficients, and then the wavelet coefficient similarity model is established: Wherein, k is a model parameter. As an example, in the embodiment of the present invention, k=5. The implementer can also set it by himself. bb =0, R bc Represents the wavelet coefficient v b 、v c degree of similarity;
[0082] Specifically, construct the wavelet coefficient similarity matrix Where n is the total number of wavelet coefficients in all high-frequency subbands, and then the elements of each row in the similarity matrix are summed up separately. D b Represents the sum of the elements in the bth row of the similarity matrix. Arrange n numbers according to the diagonal arrangement principle to obtain the diagonal matrix D n*n Finally, the Laplace matrix corresponding to the wavelet coefficients is obtained to classify the wavelet coefficients. The wavelet Laplace matrix is L n*n =D n*n -R n*n .
[0083] Finally, the present invention divides all the wavelet coefficients in the high-frequency subband into noise wavelet coefficients and image data wavelet coefficients, which are divided into two categories. Therefore, the eigenvector calculation is performed on the wavelet Laplace matrix, and the first two eigenvectors are taken to form an n×2 classification matrix. Each row in the matrix is equivalent to the characteristic information of a point in the wavelet coefficient set. The present invention uses a clustering algorithm to perform cluster analysis on each row of the classification matrix, and regards each row as a 1×2 row vector. The n row vectors are divided into 2 categories. The present invention calculates the cosine similarity of any two rows. uv As a clustering determination indicator, Similarity uv Represents the cosine similarity between the row vectors in row u and row v.
[0084] As an example, the clustering algorithm used in the embodiment of the present invention is the K-means algorithm.
[0085] Finally, the wavelet coefficients corresponding to the class with smaller cosine similarity between the two classes are set to 0, and the wavelet coefficients corresponding to each high-frequency sub-band after processing are obtained. In this way, high-frequency feature information can be highlighted.
[0086] Furthermore, step S104 is to perform inverse wavelet transform reconstruction based on the updated wavelet coefficients of each high-frequency sub-band and the low-frequency sub-band to obtain an attention image, and use the FCM algorithm to obtain the membership value of each pixel in the attention image. Specifically, it includes:
[0087] After processing the high-frequency sub-band, the wavelet coefficients of the processed high-frequency sub-band and the wavelet coefficients corresponding to the original low-frequency sub-band are inversely transformed in the frequency domain to obtain an attention image. In this way, the attention image of the muffler surface can be extracted. The attention image obtained in the embodiment of the present invention can effectively reduce the impact of abnormal noise on the subsequent defect detection process, and at the same time, the defect feature information on the muffler surface can be highlighted to improve the attention to texture details and edge information in the image, thereby extracting defective pixels more quickly and accurately.
[0088] Secondly, in order to achieve accurate classification of defective pixels, the embodiment of the present invention calculates the membership matrix through the FCM algorithm, calculates the membership of each pixel, and facilitates the classification of pixels.
[0089] It should be noted that the FCM (Fuzzy C-means) algorithm is a fuzzy clustering algorithm based on an objective function, which is mainly used for cluster analysis of data.
[0090] Furthermore, step S105 divides the pixels in the attention image into two categories based on the range of the membership values of the pixels in the attention image, and determines whether there is a defect based on the ratio of the number of pixels in the two categories. When it is determined that there is a defect, the category of the defect is obtained, and the pixels in the defect category are grouped into a defect area. Specifically, the process includes:
[0091] First, according to the range of the membership values of the pixels in the attention image, the pixels in the attention image are divided into two categories, including: judging whether the membership value of the pixel in the attention image is greater than a preset first threshold value, if the judgment result is yes, the pixel is divided into the first category; if the judgment result is no, judging whether the membership value of the pixel in the attention image is greater than a preset second threshold value, if the judgment result is yes, the pixel is divided into the second category, otherwise, the pixel is divided into the third category; for the pixel in the second category, when the number of pixel points belonging to the first category in the neighborhood of the pixel point is greater than the number of pixel points belonging to the third category, the pixel is divided into the first category, otherwise, the pixel is divided into the third category.
[0092] Specifically, the classification process of pixels in the attention image includes:
[0093] Wherein, l1>l2, l1 is the preset first threshold, l2 is the preset second threshold, U(x,y) represents the membership of the pixel point at (x,y), and Atten1(x,y) is the classified image obtained after classification.
[0094] Finally, for a pixel point in the classified image whose pixel value is the preset second value, when the number of pixel points in the neighborhood of the pixel point whose pixel value is the preset first value is greater than the number of pixel points whose pixel value is the preset third value, the pixel value of the pixel point is updated to the preset first value; otherwise, the pixel value of the pixel point is updated to the preset third value.
[0095] The pixels that need to be further judged, that is, the pixels belonging to the second category, can be further judged. In this way, the pixels in the muffler surface image can be classified into categories, so as to subsequently realize defect detection on the muffler surface.
[0096] Finally, whether there is a defect is determined based on the ratio of the number of the two divided pixel points, and when it is determined that there is a defect, the category of the defect is obtained, so that the pixels in the defective category are combined into a defect area.
[0097] Obtain the category with the larger number of pixels in the two categories after division, and calculate the ratio of the number of pixels contained in this category to the number of pixels contained in the other category of the two divided categories, and determine whether the ratio is greater than the preset ratio threshold. If the judgment result is yes, there is no defect on the muffler surface, otherwise there is a defect on the muffler surface.
[0098] The class with the smaller number of pixels in the two resulting classes is considered the defective class. This allows for the detection and recognition of pixels on the muffler surface, allowing for automatic detection of surface defects.
[0099] Based on the same inventive concept as the above method, this embodiment also provides a muffler surface material defect detection system. In this embodiment, the muffler surface material defect detection system includes a memory and a processor. The processor executes the computer program stored in the memory to realize the detection of defects in the muffler surface material as described in the embodiment of the muffler surface material defect detection method.
[0100] Since the method for detecting defects in the surface material of a muffler has been described in the embodiment of the method for detecting defects in the surface material of a muffler, it will not be repeated here.
[0101] In summary, the embodiments of the present invention can accurately extract the attention image corresponding to the muffler surface, thereby effectively reducing the adverse effects of irrelevant factors on the muffler defect detection process and further improving the accuracy of muffler defect detection. Furthermore, the embodiments of the present invention classify the pixels on the muffler surface through the constructed defect detection model, enabling the detection and identification of defective pixels, with high detection accuracy, low computational complexity, and fast detection speed.
[0102] The words "including," "comprising," "having," and the like in this disclosure are open-ended words, meaning "including but not limited to," and are used interchangeably therewith. The words "or" and "and" used herein mean the words "and / or" and are used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein means the phrase "such as but not limited to," and is used interchangeably therewith.
[0103] It should also be noted that in the method and system of the present invention, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0104] The above embodiments are merely examples for clarity of description and do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description, and it is not necessary or possible to enumerate all embodiments here. Any design that is identical or similar to the present invention falls within the scope of protection of the present invention.
Claims
1. A method for detecting surface material defects of a muffler, characterized in that: include: Collect the surface image of the muffler to be inspected and perform preprocessing; Performing wavelet transform on the pre-processed surface image to obtain a low-frequency sub-band and a plurality of high-frequency sub-bands after wavelet transform; Processing the wavelet coefficients corresponding to each high-frequency sub-band to obtain processed wavelet coefficients corresponding to each high-frequency sub-band; The wavelet coefficients are obtained by: obtaining a Laplace matrix of similarity between any two wavelet coefficients in all high-frequency sub-band wavelet coefficients; Obtaining the two largest eigenvectors of the Laplacian matrix, and calculating the cosine similarity between different rows in the matrix composed of the two eigenvectors, so as to cluster the cosine similarities between different rows into two categories, and setting the wavelet coefficients corresponding to the category with smaller cosine similarity among the two categories to 0, thereby obtaining the wavelet coefficients corresponding to each high-frequency subband after processing; Performing inverse wavelet transform reconstruction based on the updated wavelet coefficients of each high-frequency subband and the low-frequency subband to obtain an attention image, and using the FCM algorithm to obtain the membership value of each pixel in the attention image; According to the range of the membership values of the pixels in the attention image, the pixels in the attention image are divided into two categories, and whether there is a defect is judged based on the ratio of the number of the two categories of pixels, and when it is determined that there is a defect, the category in which the defect exists is obtained, so that the pixels in the category in which the defect exists are organized into a defect area.
2. The method for detecting surface material defects of a muffler according to claim 1, characterized in that: According to the similarity of any two wavelet coefficients in all high-frequency sub-bands, the Laplace matrix of the similarity of the wavelet coefficients is obtained, including: Obtaining a similarity matrix of wavelet coefficients according to the similarity between any two wavelet coefficients in all high-frequency sub-bands, wherein the similarity matrix includes the similarity between any two wavelet coefficients; Obtaining an accumulation matrix according to the similarity matrix, wherein the accumulation matrix is a diagonal matrix and the non-zero value of each row in the accumulation matrix is the accumulation of the values of the corresponding row in the similarity matrix; The accumulation matrix is subtracted from the similarity matrix to obtain a Laplacian matrix of similarity of wavelet coefficients.
3. The method for detecting surface material defects of a muffler according to claim 1, characterized in that: Preprocess the surface image of the muffler to be inspected, including: Grayscale the surface image of the muffler to be inspected to obtain a grayscale image; Performing bilinear interpolation processing on the grayscale image to obtain an interpolated image; Processing the grayscale image using a region growing algorithm to obtain a plurality of sub-blocks; The frequency of occurrence of different grayscale values in the sub-blocks is used to obtain the characteristic values of the pixels in each sub-block; A weighted sum is performed on the pixel value of the pixel point in the interpolated image and the eigenvalue in the corresponding sub-block to obtain the pixel value of the pixel point in the preprocessed surface image, wherein the weight value of the eigenvalue in the weighted summation process is greater than the weight of the pixel value of the pixel point in the interpolated image.
4. The method for detecting surface material defects of a muffler according to claim 3, characterized in that: The frequency of occurrence of different grayscale values in the sub-blocks is used to obtain the characteristic values of the pixels in each sub-block, including: Among them, Q is the characteristic value of the pixel in the sub-block, G is the gray level of the pixel in the sub-block, and f i is the frequency of occurrence of gray value i in the sub-block.
5. The method for detecting surface material defects of a muffler according to claim 1, characterized in that: According to the range of the membership values of the pixels in the attention image, the pixels in the attention image are divided into two categories, including: Determining whether a membership value of a pixel point in the attention image is greater than a preset first threshold, and if the determination result is yes, classifying the pixel point into a first category; If the judgment result is no, then determining whether the membership value of the pixel point in the attention image is greater than a preset second threshold; if the judgment result is yes, then classifying the pixel point into the second category; otherwise, classifying the pixel point into the third category; For a pixel in the second category, when the number of pixels belonging to the first category in the neighborhood of the pixel is greater than the number of pixels belonging to the third category, the pixel is classified into the first category; otherwise, the pixel is classified into the third category.
6. The method for detecting surface material defects of a muffler according to claim 1 or 5, characterized in that: Determine whether there is a defect based on the ratio of the number of pixels in the two categories, and obtain the category of the defect when it is determined that there is a defect, including: Obtain the ratio of the category with the larger number of pixels in the two divided categories to the number of pixels in the other category, and determine whether the ratio is greater than a preset ratio threshold. If the judgment result is yes, there is no defect on the muffler surface; otherwise, there is a defect on the muffler surface, and the category with the smaller number of pixels in the two categories is regarded as the category with defects.
7. The method for detecting surface material defects of a muffler according to claim 1, characterized in that: Before processing the wavelet coefficients corresponding to each high-frequency sub-band, the method further includes: Starting from the last wavelet transform, the high-frequency subband obtained by the next wavelet transform is upsampled, and the size after upsampling is equal to the high-frequency subband obtained by the previous wavelet transform in the same direction; The high-frequency sub-band of the next level after upsampling is weightedly fused with the high-frequency sub-band of the previous level in the same direction; The high-frequency sub-bands of adjacent levels in the same direction are up-sampled and weightedly fused until the weighted fusion of the high-frequency sub-bands of all levels is completed.
8. The method for detecting surface material defects of a muffler according to claim 1, characterized in that: Before performing wavelet transform on the pre-processed surface image, the method further comprises performing Gaussian filtering to remove noise on the pre-processed surface image.
9. A muffler surface material defect detection system comprising: A memory and a processor, characterized in that the processor executes a computer program stored in the memory to implement the muffler surface material defect detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Visual detection method for mechanical component defect
CN109580630A
Paper product defect detection method based on artificial intelligence
CN114170208A