An elevator car weld defect detection method based on image processing
Through image processing-based methods, including deep training of color segmentation and convolutional neural network models, the problem of missing detection of cracks in elevator car welds is solved, and the detection accuracy and elevator safety are improved.
Patent Information
- Application Number
- CN202510429877.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-08
AI Technical Summary
In the prior art, the detection and missed detection of crack defects in the weld of elevator car leads to problems such as low detection accuracy and low safety of elevator car.
Using an image-based processing method, welded areas of the elevator car are collected, converted to Lab color space, color clusters and quantities are determined using K-mean clustering, color differences are calculated for segmentation, color areas are marked and replaced, and deep training is used for use with convolutional neural network model to improve detection accuracy.
It improves the accuracy of crack detection in the elevator car weld, reduces the leakage detection rate, enhances the safety of the elevator, promptly detects potential defects, prevents unexpected events, and ensures the safety of passengers and maintenance personnel.
Smart Images

Figure CN119941732B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and particularly to a method for detecting weld defects of an elevator car based on image processing. Background Art
[0002] In the safety evaluation of elevators, weld cracks are an important consideration factor. The evaluation of an elevator car includes the quality and integrity of the welds. If cracks appear in the welds, this may be regarded as a risk factor, affecting the overall safety evaluation level of the elevator. In addition, the user unit of the elevator should conduct regular inspections and maintenance on the welds to ensure their safety and reliability. If serious corrosion, deformation, cracks and other defects are found in the welds, measures should be taken in a timely manner. When necessary, the parts should be scrapped and replaced with new ones to ensure the safe operation of the elevator. Therefore, the accuracy of weld crack detection is very important, and the undetected of subtle weld crack defects is an urgent problem to be solved.
[0003] Chinese Patent Publication No. CN 115082444B discloses a method and system for detecting weld defects of copper pipes based on image processing. This prior art realizes the judgment of whether there are welding defects on the surface of the weld according to the gray value information corresponding to the surface image of the copper pipe weld to be detected, and further realizes the judgment of the defect position in the case of judging that there are welding defects on the surface of the weld, that is, realizes the positioning of the welding defect position; the present invention realizes the detection of copper pipe welding defects, solves the problem that it is difficult to detect subtle defects on the surface of the weld in the prior art, but does not involve how to solve the problem of undetected of subtle cracks. Summary of the Invention
[0004] Therefore, the present invention provides a method for detecting weld defects of an elevator car based on image processing to overcome the problems of low detection accuracy caused by undetected of weld crack defects of the elevator car and low safety of the elevator car in the prior art.
[0005] To achieve the above object, the present invention provides a method for detecting weld defects of an elevator car based on image processing, including,
[0006] Collecting an image of the weld area of the elevator car and converting the weld area image from the RGB color space to the Lab color space;
[0007] For the Lab color space, using K-means clustering to determine the color clusters and the number of color clusters of the weld area image;
[0008] Calculating the color difference degree between each color cluster according to the color clusters and the number of color clusters;
[0009] Determine whether to segment the weld region image according to the color difference degree to output a number of blocks, and the number of blocks of the weld region image is jointly determined according to the number of color clusters of the weld region image and the color characteristics of the blocks of the weld region image after segmentation;
[0010] Mark the cracks in the weld crack region image of the elevator car after segmentation to determine the color of the weld crack region of the elevator car;
[0011] Change the color of the elevator car weld crack region image to the complementary color of the background color of the weld region image;
[0012] Collect an image set of the colors of the weld crack region image after changing the color, and mark the contour lines of the weld crack regions in the image set;
[0013] Use a convolutional neural network model to train the marked weld region image set to complete the crack defect detection of the weld region.
[0014] Further, for the Lab color space, using K-means clustering to determine the color clusters and the number of color clusters of the weld region image includes:
[0015] Use K-means clustering in the Lab color space to cluster the colors in the image and determine the original cluster centers;
[0016] Collect the distances from the original individual pixel points to the original cluster centers respectively;
[0017] Update the positions of the original cluster centers according to the distances from the original cluster centers to determine the target cluster centers, and perform clustering;
[0018] Determine the color clusters and the number of color clusters according to the chromaticity of the target cluster centers after clustering.
[0019] Further, updating the positions of the original cluster centers according to the distances from the original cluster centers includes:
[0020] Calculate the distribution density of several pixel points within the central circle of the original cluster center according to several of the distances within the central circle of the original cluster center;
[0021] Compare the distribution density with a preset distribution density;
[0022] If the distribution density is less than or equal to the preset distribution density, move the position of the original cluster center in the direction of the original cluster center of the distribution density core point;
[0023] Among them, the moving distance of the original cluster center is jointly determined according to the distribution density and the initial distance from the original cluster center of the distribution density core point.
[0024] Further, calculating the color difference degree between color clusters according to the color clusters and the number of color clusters includes:
[0025] Collecting the average chromaticity values of all pixels in a single color cluster;
[0026] Using the Euclidean distance formula in the color space to calculate the color difference degree between color clusters;
[0027] Among them, the process of segmenting the image according to the color difference degree includes
[0028] Segmenting the image using the gray-scale threshold segmentation method;
[0029] Merging 10 separate segmented regions into the same segmented region according to the color difference degree.
[0030] Further, the process of determining the weld crack region of the elevator car according to the number of blocks of the segmented weld region image and the color characteristics of each block includes:
[0031] Extracting the weld region image of a single block and the color characteristics of each block;
[0032] Comparing the color characteristics of each block of the segmented weld region image with the weld crack region;
[0033] Marking the color characteristic region of the weld crack region according to the color characteristic comparison and determining whether to adjust the number of blocks of the weld region image.
[0034] Further, the process of determining whether to adjust the number of blocks of the weld region image includes
[0035] Comparing the number of color clusters of the weld region image with the preset number of color clusters;
[0036] If the number of color clusters of the weld region image is greater than the preset number of color clusters, it is determined to adjust the number of blocks of the weld region image.
[0037] Further, the adjustment range of the number of blocks of the weld region image is determined by the difference between the number of color clusters and the preset number of color clusters.
[0038] Further, the process of replacing the color of the elevator car weld crack region with the contrast color of the background color of the weld region image includes
[0039] Extracting the images of the elevator car weld region and the elevator car weld crack region;
[0040] Obtaining the color of the elevator car weld crack region and the background color according to the gray-scale threshold of the crack;
[0041] Replace the color of the weld crack area of the elevator car with the complementary color of the background color of the weld area image;
[0042] In implementation, the complementary color is the inverse of the brightness of the background color to ensure that the replaced color forms a distinct contrast with the original background.
[0043] Further, the process of marking the contour lines of the weld crack areas in the image set includes,
[0044] Collect an image set containing the colors of prominent weld cracks;
[0045] Use an image marking tool to mark the contour lines of the weld cracks in the weld crack areas of the image.
[0046] Further, the process of using a convolutional neural network model to deeply train the marked image set includes:
[0047] Construct an image set containing the marks;
[0048] Denoise and grayscale the image set;
[0049] Construct a convolutional neural network model for image segmentation tasks;
[0050] Use the convolutional neural network model to train the marked image set to complete the detection of crack defects in the weld area.
[0051] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention collects images of the weld areas of the elevator car, can perform color segmentation on the images through the color difference degree, can accurately determine the weld crack areas of the elevator car through the colors of the segmented images, can accurately highlight the colors of the cracks by replacing the colors of the weld crack areas of the elevator car with the complementary colors of the backgrounds of the weld crack areas of the elevator car, improves the accuracy of detecting weld cracks in the elevator car, and can further improve the accuracy of detecting weld crack defects in the elevator car by deeply training the marked image set with a convolutional neural network model; By detecting weld defects in the elevator car, potential crack hazards on the elevator surface can be discovered in a timely manner, which helps to prevent accidents and ensure the safety of passengers and maintenance personnel.
[0052] Further, the present invention calculates the color difference degree between color clusters through the color clusters, and segments the images through the color difference degree, thereby reducing the problem of missed detection of weld defects with small sizes due to image resolution limitations, reducing the problem of missed detection of internal cracks due to image acquisition color limitations, and improving the accuracy of detecting weld cracks in the elevator car.
[0053] Furthermore, by replacing the color of the crack area of the elevator car weld with a contrasting color to the background image color of the elevator car weld crack area, the present invention can accurately highlight the color of the crack, thereby reducing the occurrence of missed detection of cracks caused by the background color and improving the accuracy of detecting elevator car weld cracks.
[0054] Furthermore, through the detection of elevator car weld defects, the present invention can timely discover potential crack hazards on the elevator surface, which helps prevent accidents and ensure the safety of passengers and maintenance personnel; by timely detecting car defects, potential problems can be discovered in time, preventive maintenance measures can be taken, the failure rate of elevator equipment can be reduced, and the reliability and stability of the equipment can be improved.
[0055] Furthermore, by enhancing the contrast and performing gray-scale processing on the crack area of the elevator car weld, the present invention can prominently display the crack and improve the image quality. Converting the color image to a gray-scale image can simplify the processing process. By enhancing the contrast of the image and stretching the gray levels of the image, different regions in the image can have a wider gray-scale range. Eliminating noise interference can make the weld crack clearer, binarization can highlight the characteristics of the weld crack, and morphological reconstruction can fill the crack area to make the crack clearer.
[0056] Furthermore, by replacing the color of the crack area of the elevator car weld with a color that matches the background image of the elevator car weld crack area, the present invention can accurately highlight the color of the crack. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is a flowchart of the steps for detecting elevator car weld defects based on image processing according to an embodiment of the present invention;
[0058] Figure 2 It is a flowchart of the steps for determining color clusters and the number of color clusters according to an embodiment of the present invention;
[0059] Figure 3 It is a flowchart of the steps for segmenting an image according to color difference degree according to an embodiment of the present invention;
[0060] Figure 4 It is a flowchart of the steps for determining the crack area of the elevator car weld according to the number of blocks of the segmented weld area image and the color characteristics of each block according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0061] In order to make the objectives and advantages of the present invention clearer and more understandable, the present invention will be further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0062] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and do not limit the protection scope of the present invention.
[0063] It should be noted that in the description of the present invention, the terms indicating directions or positional relationships such as "upper", "lower", "left", "right", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings. This is only for convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention.
[0064] In addition, it should also be noted that in the description of the present invention, unless otherwise clearly specified and defined, the terms "installation", "connection", and "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0065] Please refer to Figure 1 , which is the step flow chart of the elevator car weld defect detection based on image processing in the embodiment of the present invention; a method for detecting elevator car weld defects based on image processing according to the present invention includes:
[0066] Step S1, collecting an image of the weld area of the elevator car and converting the weld area image from the RGB color space to the Lab color space;
[0067] Step S2, using K-means clustering in the Lab color space to determine the color clusters and the number of color clusters of the weld area image;
[0068] Step S3, calculating the color difference degree between each color cluster according to the color clusters and the number of color clusters;
[0069] Step S4, determining whether to segment the weld area image according to the color difference degree, and the number of blocks of the weld area image is jointly determined by the number of color clusters of the weld area image and the block color characteristics of the segmented weld area image;
[0070] Step S5, marking the cracks in the segmented weld crack area image of the elevator car to determine the color of the weld crack area of the elevator car;
[0071] Step S6, changing the color of the weld crack area image of the elevator car to the contrast color of the background color of the weld area image;
[0072] Step S7, collect an image set of the colors of the weld cracks in the elevator car after color replacement, and mark the contour lines of the weld crack areas in the image set;
[0073] Step S8, use a convolutional neural network model to train the marked image set of the weld area to complete the detection of crack defects in the weld area.
[0074] Among them, K-means clustering is the clustering algorithm in this implementation.
[0075] Specifically, determine whether to segment the weld area image into equal-area segments according to the color difference degree. The single area after the equal-area segmentation of the weld area image, and the color feature of the divided block is one of brightness and saturation.
[0076] Specifically, the weld crack area image is an image of the weld crack area obtained by segmenting the weld area image.
[0077] Specifically, the background color of the weld area image is all other colors in the weld area image after removing the crack area color; the contrast color is one of yellow and blue, purple and green, red and cyan.
[0078] In the implementation, the process of converting the weld area image from the RGB color space to the Lab color space includes:
[0079] Convert the RGB color value to a linear RGB value;
[0080] Multiply the linear RGB value by a conversion matrix to convert the linear RGB value to XYZ values;
[0081] Convert the XYZ color space to the Lab color space, including using a conversion matrix to convert the XYZ values of each pixel to the corresponding L, a, and b components in the Lab color space. L represents brightness, and a and b represent two axes of color information, representing the ranges from red to green and from yellow to blue respectively.
[0082] Specifically, the conversion matrix is calculated according to the chromaticity coordinates of the three primary colors (red, green, blue) in the RGB color space and the chromaticity coordinates of the white point. The calculation process includes:
[0083] Determine the chromaticity coordinates of the RGB primary colors: completed by measuring the coordinates of the primary colors of the RGB display device in the XYZ color space;
[0084] Determine the chromaticity coordinates of the white point: according to the coordinates of white (including D65) in the XYZ color space.
[0085] Construct a transformation matrix: Using the chromaticity coordinates of the RGB primary colors and the chromaticity coordinates of the white point, construct a 3x3 transformation matrix that can be used to convert linear RGB values to XYZ values.
[0086] The present invention collects images of the weld area of the elevator car. Color segmentation of the images can be performed through color difference degrees. The crack area of the elevator car weld can be accurately determined through the colors of the segmented images. By replacing the color of the elevator car weld crack area with a contrasting color to the background color of the elevator car weld crack area, the color of the crack can be accurately highlighted, improving the accuracy of elevator car weld crack detection. Through deep training of the convolutional neural network model on the marked image set, the accuracy of elevator car weld crack defect detection can be further improved; through the detection of elevator car weld defects, potential crack hazards on the elevator surface can be discovered in a timely manner, which helps to prevent accidents and ensure the safety of passengers and maintenance personnel.
[0087] Through the detection of elevator car weld defects, the present invention can discover potential crack hazards on the elevator surface in a timely manner, which helps to prevent accidents and ensure the safety of passengers and maintenance personnel; by detecting car defects in a timely manner, potential problems can be discovered in a timely manner, preventive maintenance measures can be taken, the failure rate of elevator equipment can be reduced, and the reliability and stability of the equipment can be improved.
[0088] In implementation, images of the elevator car weld crack area are collected and converted from the RGB color space to the Lab color space. Among them, the RGB color space is based on red, green, and blue as basic elements and constructs a three-dimensional space. Among them, each color is divided into 256 levels according to brightness. The Lab color space is a color space based on the human visual system's perception of color. L represents brightness, and a and b represent the two dimensions of green-red and blue-yellow respectively. Then, K-means clustering is used for the Lab color space to cluster the colors in the image and determine the color clusters and the number of color clusters. Then, the color difference degree between the color clusters is calculated according to the color clusters; color segmentation is performed on the image according to the color difference degree; the problem of missed detection of weld defects with small sizes due to image resolution limitations is reduced, and the problem of missed detection of internal cracks due to image acquisition color limitations is reduced, improving the accuracy of elevator car weld crack detection.
[0089] Please refer to Figure 2 As shown, it is a step flow chart for the present invention embodiment to determine the color clusters and the number of color clusters; for the Lab color space, using K-means clustering to determine the color clusters and the number of color clusters of the weld area image includes:
[0090] Step S21: Use K-means clustering in the Lab color space to cluster the colors in the image and determine the original cluster centers;
[0091] Step S22: Collect the distances from the original individual pixel points to the original cluster centers respectively;
[0092] Step S23: Update the positions of the original cluster centers according to the distances from the original cluster centers to determine the target cluster centers, and perform clustering;
[0093] Step S24: Determine the color clusters and the number of color clusters according to the chromaticity of the target cluster centers after clustering.
[0094] Specifically, calculating the color difference degree between color clusters according to the color clusters and the number of color clusters includes:
[0095] Collect the average chromaticity values of all pixels in a single color cluster;
[0096] Calculate the color difference degree between any two color clusters according to the Euclidean distance formula in the color space.
[0097] In implementation, the calculation formula of the Euclidean distance is:
[0098] ,
[0099] where S is the color difference degree between any two color clusters. For any two color points A and B in the Lab color space, the coordinates of point A in the embodiment are (A L , A a , A b ), and the coordinates of point B are (B L , B a , B b ). The Euclidean distance measures the overall difference between any two colors. In this embodiment, the color difference between any two pixels is measured according to the Euclidean distance. Therefore, the greater the distance between the Lab color points represented by any two pixels, the greater the color difference degree between any two pixels.
[0100] Specifically, updating the positions of the original cluster centers according to the distances from the original cluster centers includes:
[0101] Calculate the distribution density of several pixel points within the central circle of the original cluster center according to several of the distances within the central circle of the original cluster center;
[0102] Compare the distribution density with a preset distribution density;
[0103] If the distribution density is less than or equal to the preset distribution density, move the position of this original cluster center in the direction of the original cluster center of the distribution density core point;
[0104] Among them, the moving distance of the original clustering center is jointly determined according to the distribution density and the initial distance between the original clustering center and the core point of the distribution density.
[0105] In implementation, the central circle of the original clustering center is a central circle that can be simulated as a point with a single cluster as the center, the core point of the distribution density is the point with the maximum distribution density, and the preset distribution density is 163 ppi.
[0106] Please refer to Figure 3 as shown. It is a flowchart of the steps for segmenting an image according to the color difference degree in an embodiment of the present invention; segmenting the image according to the color difference degree includes
[0107] Step S31: Use the gray threshold segmentation method to segment the image into equal areas;
[0108] Step S32: Merge 10 separate segmented regions into the same segmented region according to the color difference degree.
[0109] In implementation, the color difference degree uses the Euclidean distance in the Lab color space to measure the color similarity. The preset number of segments is 10. It can be understood that the preset number of segments can be adjusted according to the actual situation, and the threshold range is [5, 20].
[0110] Please refer to Figure 4 as shown. It is a flowchart of the steps for determining the weld crack area of the elevator car according to the number of blocks of the segmented weld area image and the color characteristics of each block; determining the weld crack area of the elevator car according to the number of blocks of the segmented weld area image and the color characteristics of each block includes:
[0111] Step S41: Extract the weld area image of a single block and the color characteristics of each block;
[0112] Step S42: Compare the color characteristics of each block of the segmented weld area image with the weld crack area;
[0113] Step S43: Mark the color characteristic area of the weld crack area according to the color characteristic comparison, and determine whether to adjust the number of blocks of the weld area image.
[0114] In implementation, first determine the color characteristics of the weld crack area of the elevator car. This color characteristic includes the range of the color of the crack area, which is one of brightness and saturation in this implementation. Then, for the segmented image, perform color characteristic matching on each segmented area to determine the area that conforms to the color characteristics of the weld crack area. Finally, according to the color characteristic matching result, mark the areas that match the color characteristics of the weld crack area, and these areas include potential weld cracks.
[0115] Specifically, the process of determining whether to adjust the number of blocks of the weld region image includes
[0116] comparing the number of color clusters of the weld region image with a preset number of color clusters;
[0117] If the number of color clusters of the weld region image is less than or equal to the preset number of color clusters, it is determined to maintain the existing number of blocks of the weld region image;
[0118] If the number of color clusters of the weld region image is greater than the preset number of color clusters, it is determined to adjust the number of blocks of the weld region image.
[0119] In implementation, the preset number of color clusters is 30. Because in visual design, the quantity and distribution of colors will directly affect the visual effect. 30 color clusters is a practical and efficient choice, which can quickly find the required colors and reduce the time consumption in color selection. In this implementation, 30 color clusters are sufficient to cover most design requirements, while maintaining visual balance and harmony and avoiding colors being too chaotic.
[0120] Specifically, the adjustment range of the number of blocks of the weld region image is determined by the difference between the number of color clusters and the preset number of color clusters, where:
[0121] If the difference between the number of color clusters and the preset number of color clusters is less than or equal to a preset first color cluster number difference, use a first quantity adjustment coefficient to adjust the number of blocks of the weld region image;
[0122] If the difference between the number of color clusters and the preset number of color clusters is greater than the preset first color cluster number difference and less than or equal to a preset second color cluster number difference, use a second quantity adjustment coefficient to adjust the number of blocks of the weld region image;
[0123] If the difference between the number of color clusters and the preset number of color clusters is greater than the preset second color cluster number difference, use a third quantity adjustment coefficient to adjust the number of blocks of the weld region image;
[0124] In implementation, the preset difference in the number of the first color clusters is 5; the preset difference in the number of the second color clusters is 8; the formula for adjusting the number of blocks of the weld region image is T = t×αn, where T is the number of blocks of the weld region image after adjustment, t is the number of blocks of the weld region image before adjustment, αn is the nth adjustment coefficient, the number of blocks of the weld region image before adjustment is 60, α1 = 1.1; α2 = 1.2; α3 = 1.3; when the number of color clusters is 36, the difference between the number of color clusters and the preset number of color clusters is 6, and the number of blocks of the weld region image after adjustment is T = t×αn = 60×α2 = 60×1.2 = 72, that is, the number of blocks after adjusting the number of blocks of the weld region image is 72.
[0125] In implementation, enhancing the contrast and performing grayscale processing on the weld crack region of the elevator car can highlight the cracks and improve the image quality. Converting the color image to a grayscale image can simplify the processing process. By enhancing the contrast of the image, the gray levels of the image are stretched, so that different regions in the image have a wider gray range. Eliminating noise interference factors can make the weld cracks clearer, binarization can highlight the characteristics of the weld cracks, and morphological reconstruction can fill the crack region to make the cracks clearer.
[0126] Specifically, the process of replacing the color of the weld crack region of the elevator car with the complementary color of the background color of the weld region image to highlight the color of the cracks includes,
[0127] Extracting the color of the weld region image and the image of the weld crack region;
[0128] Obtaining the color and background color of the weld crack region image respectively according to the gray threshold of the crack;
[0129] Extracting the color of the weld crack of the elevator car;
[0130] Replacing the color of the weld crack region image with the complementary color of the background color of the weld region image;
[0131] Among them, the complementary color is the inverse of the brightness of the background color to ensure that the replaced color forms an obvious contrast with the original background.
[0132] In implementation, it can be achieved not only by using OpenCV, but also by using Python. Both can accurately highlight the color of the cracks by replacing the color of the weld crack region of the elevator car with the color that matches the background image of the weld crack region of the elevator car.
[0133] Specifically, the process of marking the contour lines of the weld crack regions of the image set includes,
[0134] Collecting an image set containing the color that highlights the weld cracks;
[0135] Use the image marking tool to mark the weld crack area and the contour of the weld crack in the image.
[0136] In the implementation, first, a set of images containing prominent crack colors is collected, and the image set has 1,000 data, ensuring that there are obvious weld cracks in each image; then, the image is marked using an image marking tool to mark the weld crack area, and the number of marked crack areas in each area is not less than 5. The image marking tools include one or both of Labelmg and VGG ImageAnnotator; finally, a total of not less than 5,000 marked information is saved in XML format for subsequent model training.
[0137] Specifically, the process of training the labeled image set using a convolutional neural network model includes:
[0138] Build a set of labeled images;
[0139] Preprocess the image set;
[0140] Build a convolutional neural network model for image segmentation tasks;
[0141] The labeled image set is trained using a convolutional neural network model to complete crack defect detection in the weld area.
[0142] In the implementation, first, a set of images containing marked contours is constructed to ensure that each image and crack area and contour can be used for model training. Then, the image data is preprocessed, including one or more of scaling, normalization, and data enhancement to facilitate model training. Then, a convolutional neural network model suitable for image segmentation tasks is constructed, and an existing architecture can be selected, including one or two of U-Net and DeepLab. Then, the convolutional neural network model is trained using the image set, and the hyperparameters of the model are adjusted according to the performance of the validation set. Then, the performance of the model is evaluated using the test set, including one or more of accuracy, recall, and F1 score.
[0143] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A method for detecting weld defects in an elevator car based on image processing, characterized in that: include: Collecting a weld area image of an elevator car, and converting the weld area image from an RGB color space to a Lab color space; For the Lab color space, K-means clustering is used to determine the color clusters and the number of color clusters of the weld area image; Calculating the color difference between each color cluster according to the color clusters and the number of color clusters; Determining whether to segment the weld region image to output a plurality of blocks according to the color difference, wherein the number of blocks of the weld region image is determined according to the number of color clusters of the weld region image and the color features of the blocks of the weld region image after segmentation; Marking the cracks in the segmented image of the weld crack region of the elevator car to determine the color of the weld crack region of the elevator car; The color of the elevator car weld crack area image is changed to a contrasting color of the background color of the weld area image; An image set of the color of the weld crack region image after the color is changed is collected, and the contour line of the weld crack region in the image set is marked; The convolutional neural network model is used to train the labeled weld area image set to complete crack defect detection in the weld area.
2. The elevator car weld defect detection method based on image processing according to claim 1 is characterized in that: For the Lab color space, using K-means clustering to determine the color clusters and the number of color clusters of the weld area image includes: Clustering the colors in the image using K-means clustering in the Lab color space and determining the original cluster centers; Collect the distances from the original single pixel points to the original cluster centers; Update the position of the original cluster center according to the distance of the original cluster center to determine the target cluster center, and perform clustering; The color cluster and the number of color clusters are determined according to the chromaticity of the target cluster center after clustering.
3. The elevator car weld defect detection method based on image processing according to claim 2 is characterized in that: Updating the position of the original cluster center according to the distance of the original cluster center includes: Calculate the distribution density of a plurality of pixel points in the central circle according to the plurality of distances in the central circle of the original cluster center; comparing the distribution density with a preset distribution density; If the distribution density is less than or equal to the preset distribution density, the position of the original cluster center is moved toward the direction of the original cluster center of the core point of the distribution density; The moving distance of the original cluster center is determined based on the distribution density and the initial distance of the original cluster center from the core point of the distribution density.
4. The elevator car weld defect detection method based on image processing according to claim 3 is characterized in that: Calculating the color difference between the color clusters according to the color clusters and the number of color clusters includes: Collect the average chromaticity value of all pixels in a single color cluster; Calculates the color difference between color clusters.
5. The elevator car weld defect detection method based on image processing according to claim 4 is characterized in that: According to the number of blocks of the weld area image after segmentation and the color characteristics of each block, the weld crack area of the elevator car is determined to include: Extract the weld area image of a single block and the color features of each block; The color features of each block of the segmented weld area image are compared with the color features of the weld crack area; The color feature area of the weld crack area is marked according to the color brightness feature comparison, and it is determined whether the number of blocks of the weld area image is adjusted.
6. The elevator car weld defect detection method based on image processing according to claim 5 is characterized in that: Determine whether to adjust the number of blocks of the weld area image, including: If the number of color clusters of the weld area image is greater than the preset number of color clusters, the number of blocks of the weld area image is adjusted.
7. The elevator car weld defect detection method based on image processing according to claim 6 is characterized in that: The adjustment range of the number of blocks of the weld area image is determined by the difference between the number of color clusters and the preset number of color clusters.
8. The elevator car weld defect detection method based on image processing according to claim 7 is characterized in that: Replace the color of the elevator car weld crack area with a contrasting color of the background color of the weld area image including, Extracting images of the weld area and images of the weld crack area; The color and background color of the weld crack area image are obtained respectively according to the gray threshold of the crack; Replace the color of the elevator car weld crack area image with a contrasting color of the weld area image's background color.
9. The elevator car weld defect detection method based on image processing according to claim 8, characterized in that: The process of marking the contours of the weld crack area in the image set includes: Collect a set of images containing the colors of weld cracks; The contour line of the weld crack in the weld crack area of the image is marked.
10. The elevator car weld defect detection method based on image processing according to claim 9, characterized in that: The process of training the labeled image set using a convolutional neural network model includes: Build a set of labeled images; De-noise and grayscale the image set; Build a convolutional neural network model for image segmentation tasks; The labeled image set is trained using a convolutional neural network model to complete crack defect detection in the weld area.
Citation Information
Patent Citations
A method and system for detecting defects in copper pipe welds based on image processing
CN115082444B
Easy-to-distinguish detection process used for electronic tube
CN105372019A
Steel structure welding crack defect detection method based on image processing technology
CN113989280A