A paint detection method and detection system based on multi-dimensional visual analysis

Through multi-dimensional visual analysis and machine learning model, combined with HSV value and coordinate information, the existing paint detection technology has been solved, and the paint detection with higher accuracy has been achieved.

CN118735915BActive Publication Date: 2024-11-22FITOW (TIANJIN) DETECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411215332.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-11-22
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

The existing paint detection technology is not color robust enough, and is easily affected by lighting conditions and changes in workpiece materials, resulting in a high misjudgment rate, making it difficult to deal with color variation, and only pay attention to the number or area ratio of pigments and ignores color distribution and spatial information.

Method used

Using a multi-dimensional visual analysis method, the workpiece image is detected through a machine learning model, combined with HSV value, coordinate information and local density characteristics, an array with paint and paint-free color is constructed, and a machine learning model is used for training to determine paint. Exist or not.

Benefits of technology

It significantly improves the accuracy and robustness of the detection, reduces the misjudgment rate, and can more comprehensively understand the paint conditions on the surface of the workpiece, enhancing the credibility of the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118735915B_ABST
    Figure CN118735915B_ABST
Patent Text Reader

Abstract

The present invention discloses a paint detection method and detection system based on multi-dimensional visual analysis, which belongs to the field of visual detection technology. The machine learning model is used to detect the image to be detected, and the detection result of whether the target component is painted is output; the construction method of the machine learning model includes: S1, obtaining a basic image set; S2, performing target detection and labeling on each basic image in the basic image set; S3, processing the recognition image; establishing an array with paint color and without paint color; S4, dividing the array into a training set and a test set, and using the machine learning model to learn the training set and the test set to obtain the machine learning model. The machine learning model in the present invention is obtained by training an array including coordinate points, HSV values, and whether there is a paint color mark. The trained machine learning model is used to perform intelligent detection on the image to be detected, and the detection result of whether the target component is painted can be quickly and accurately obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of visual inspection, and specifically relates to a paint inspection method and inspection system based on multi-dimensional visual analysis. Background Art

[0002] As we all know, in order to meet product quality requirements, most workpieces need to be quality inspected after processing. After the quality inspection is completed, paint needs to be applied to the surface of the workpiece. The paint is used as a sign of quality inspection. Subsequent staff can identify whether the workpiece has been inspected by color.

[0003] At present, the above color discrimination process mainly includes the following two technical means:

[0004] 1. Use the naked eye to confirm whether the surface of the workpiece is painted;

[0005] 2. Utilization Figure 1 The visual recognition algorithm shown performs automatic recognition;

[0006] Obviously, the first technical method requires a lot of manpower. At the same time, manual inspection is prone to fatigue, which leads to an increase in the misjudgment rate. In the process of implementing the second technical method, it is not limited to the detection of the number of pigments or the area ratio, but also involves the limitations of image processing and environmental interference. The specific technical problems are as follows:

[0007] Insufficient color robustness: Existing technologies mainly rely on the HSV algorithm to detect the number of pigments or area proportion of paint colors. However, this method is very sensitive to changes in the material of the workpiece itself and changes in the light conditions of the surrounding environment. Therefore, in the workpiece image taken under an optical environment, pigments with similar or equal values ​​may appear in the paint-free area, resulting in misjudgment.

[0008] Interference of lighting conditions: Changes in lighting conditions can seriously interfere with the performance of existing technologies. Uneven lighting, shadows or reflections may cause the color of the workpiece surface to change, thus affecting the accuracy of detection.

[0009] Challenges of color variation: In industrial production, the color of workpieces may vary greatly due to material differences, production batches, etc. Existing technologies are difficult to cope with the challenge of color variation, which can easily lead to missed detection or false detection.

[0010] High misjudgment rate: As existing technologies only focus on the number of pigments or the area ratio, without considering the distribution and spatial information of the color, misjudgment is prone to occur. In particular, when the color of the unpainted area on the workpiece is similar to that of the painted area, the misjudgment rate will increase significantly.

[0011] In summary, it is of great significance to redesign a paint inspection method and inspection system based on multi-dimensional visual analysis with higher detection accuracy. Summary of the invention

[0012] In order to solve the technical problems existing in the known technology, the present invention provides a paint detection method and detection system based on multi-dimensional visual analysis, which can quickly and accurately obtain the detection result of whether the workpiece is painted through intelligent detection of the workpiece image.

[0013] The first object of the present invention is to provide a paint detection method based on multi-dimensional visual analysis, which uses a machine learning model to detect an image to be detected and outputs a detection result of whether the target component is painted; the method for constructing the machine learning model includes:

[0014] S1, obtaining a basic image set; each basic image in the basic image set includes a target workpiece image, and the target workpiece image is a painted workpiece image;

[0015] S2, performing target detection and labeling on each basic image in the basic image set to obtain an identification image and position of the target workpiece in each basic image;

[0016] S3, processing the recognition image:

[0017] Convert each recognition image into HSV color space image format;

[0018] Extracting the target color part in the HSV color space image format, setting the pixel values ​​of the remaining elements to 0, and obtaining a first intermediate image;

[0019] Converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed area of ​​each target pigment portion;

[0020] A second intermediate image is obtained by calculating the local density characteristics of the target pigment;

[0021] Based on the second intermediate image, arrays with paint color and arrays without paint color are respectively established, each array including coordinate points, HSV values ​​and an identification of whether or not there is paint color;

[0022] S4. Divide the array into a training set and a test set, use a machine learning model to learn the training set and the test set, and construct a machine learning model after the learning is completed.

[0023] Preferably, the image preprocessing includes:

[0024] First, perform an opening operation on the grayscale image;

[0025] Then perform a closing operation on the grayscale image;

[0026] Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out.

[0027] Preferably, the specific process of the local density feature calculation method of the target pigment is: using the connected region analysis method to determine the connected components; dividing the maximum circumscribed rectangular area in each connected component by the number of masks in the connected component to obtain the density feature of a single connected component; and screening out the target pixels in the connected components whose density features are less than the density threshold.

[0028] Preferably, the connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one, if the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel, otherwise, it is considered that the adjacent pixel is connected to the target pixel.

[0029] Preferably, in S3:

[0030] Mark the pixels with paint color into the following array:

[0031] ;

[0032] in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors.

[0033] Mark the pixels without paint color as the following array:

[0034] ;

[0035] in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.

[0036] A second object of the present invention is to provide a paint detection system based on multi-dimensional visual analysis, comprising:

[0037] A machine learning model receives an image to be detected, detects the image to be detected, and outputs a detection result of whether the target component is painted; a system for constructing the machine learning model includes:

[0038] A basic database is used to obtain a basic image set; each basic image in the basic image set includes a target workpiece image, and the target workpiece image is a painted workpiece image;

[0039] The target detection model performs target detection and annotation on each basic image in the basic image set to obtain a recognition image and position of a target workpiece in each basic image;

[0040] Dataset building module to process the recognition images:

[0041] Convert each recognition image into HSV color space image format;

[0042] Extracting the target color part in the HSV color space image format, setting the pixel values ​​of the remaining elements to 0, and obtaining a first intermediate image;

[0043] Converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed area of ​​each target pigment portion;

[0044] A second intermediate image is obtained by calculating the local density characteristics of the target pigment;

[0045] Based on the second intermediate image, arrays with paint color and arrays without paint color are respectively established, each array including coordinate points, HSV values ​​and an identification of whether or not there is paint color;

[0046] The training module divides the array into a training set and a test set, uses a machine learning model to learn the training set and the test set, and constructs a machine learning model after the learning is completed.

[0047] Preferably, the image preprocessing includes:

[0048] First, perform an opening operation on the grayscale image;

[0049] Then perform a closing operation on the grayscale image;

[0050] Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out.

[0051] Preferably, the specific process of calculating the local density characteristics of the target pigment is: determining the connected components by the connected region analysis method; dividing the maximum circumscribed rectangular area in each connected component by the number of masks in the connected component to obtain the density characteristics of a single connected component; and screening out the target pixels in the connected components whose density is less than the density threshold.

[0052] Preferably, the connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one, if the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel, otherwise, it is considered that the adjacent pixel is connected to the target pixel.

[0053] Preferably, in the dataset construction module:

[0054] Mark the pixels with paint color into the following array:

[0055] ;

[0056] in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors.

[0057] Mark the pixels without paint color as the following array:

[0058] ;

[0059] in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.

[0060] Preferably, the paint detection system based on multi-dimensional visual analysis also includes:

[0061] The image acquisition module is used to acquire the image to be detected.

[0062] The advantages and positive effects of the present invention are:

[0063] The machine learning model in the present invention is learned through the HSV value of the target component image, the position coordinates corresponding to each HSV value, and the presence or absence of paint marks. Therefore, compared with the traditional method of only considering the area, the detection result has a higher credibility.

[0064] The present invention not only considers the number of paint colors, but also combines HSV values ​​and coordinate information, and finally uses a machine learning model to determine whether the target workpiece is painted. The specific effects and advantages are concentrated in the following points:

[0065] High robustness: Since there will always be inconsistencies in pigment distribution when paint is applied manually or by machine, the traditional technology has a high misjudgment rate due to the influence of lighting and material changes during image acquisition. This application comprehensively considers the number of pigment points, HSV value and position information, and analyzes factors such as color distribution, connectivity and shape. It can significantly reduce the interference of lighting and material changes on the detection results, making the detection process more robust, and the paint detection results have higher credibility, while significantly reducing the probability of misjudgment.

[0066] Comprehensive detection: The present invention not only focuses on the number of colors, which can be obtained by the area of ​​the connected domain, but also analyzes the distribution of pigment positions, connectivity, shape and other aspects. This enables the machine learning model to obtain more comprehensive and accurate painting information, which helps to more fully understand the painting conditions on the workpiece surface and improve the overall performance of the detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 It is a flow chart of visual inspection in the prior art;

[0068] Figure 2 A flowchart of constructing a machine learning model in a preferred embodiment of the present invention;

[0069] Figure 3 This is a specific flow chart of S3 in a preferred embodiment of the present invention;

[0070] Figure 4 A system block diagram of a machine learning model in a preferred embodiment of the present invention;

[0071] Figure 5 A system block diagram of a third preferred embodiment of the preferred embodiments of the present invention;

[0072] Figure 6 This is a flow chart of the fourth preferred embodiment of the preferred embodiments of the present invention. DETAILED DESCRIPTION

[0073] In order to further understand the content, features and effects of the present invention, the following embodiments are listed and described in detail with reference to the accompanying drawings:

[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the technical solutions in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0075] First embodiment:

[0076] See also Figure 2 A paint detection method based on multi-dimensional visual analysis uses a machine learning model to detect an image to be detected and outputs a detection result of whether the target component is painted; the method for constructing the machine learning model includes:

[0077] S1. Obtain a basic image set; batch collect images containing target workpieces with paint colors: a rich training data set is established by collecting a large number of images containing target workpieces with paint colors;

[0078] Building an accurate and powerful model often requires a high-quality training dataset. This application is dedicated to the image recognition problem of paint color target artifacts. The first thing to do is to obtain a basic image set and collect images containing paint color target artifacts in batches.

[0079] When collecting images, it is important to consider not only the quantity of images, but also the quality, diversity, and representativeness of the images. Try to collect images from as many angles, lighting conditions, paint colors, and backgrounds as possible to ensure that the training dataset covers a variety of possible scenarios and situations. At the same time, you can also filter and preprocess the images to remove blurry, duplicate, or irrelevant images to improve the purity and effectiveness of the dataset.

[0080] S2. Target detection and labeling are performed on each basic image in the basic image set to obtain the recognition image and position of the target workpiece in each basic image; in this application, target detection and labeling of each basic image in the basic image set is a crucial preliminary work. Through this process, the target workpiece in the image can be accurately identified, and the location of its recognition image can be obtained, providing strong support for subsequent image analysis and processing.

[0081] The specific process of obtaining the recognition image is:

[0082] First, target positioning is performed, that is, the target workpiece in each basic image is positioned; target positioning refers to determining the specific position of the target workpiece in the image;

[0083] Then, according to the target positioning information, an image of the target workpiece in the image to be detected is obtained;

[0084] In this step, the target detection algorithm can be used to mark and train the workpiece to be detected in the image, so as to obtain the recognition image of the target workpiece in the basic image and the accurate position of the target workpiece;

[0085] S3. Please refer to Figure 3 , the recognition image is processed as follows:

[0086] S301, converting each recognition image into an HSV color space image format;

[0087] The HSV color space is a color space based on human visual perception. It consists of three components: hue, saturation, and value. It can more intuitively reflect the visual characteristics of color. By converting to the HSV color space, different color areas in the image can be more accurately identified, and subsequent image processing and analysis can be performed.

[0088] For example, you can use the cvtColor function in the OpenCV library to convert from RGB color space to HSV color space. The specific steps are as follows: first read the recognition image and load it into memory; then call the cvtColor function, specify the input image, conversion type, and output image; finally, get the converted HSV color space image.

[0089] During the conversion process, the value range of the HSV color space can be adjusted according to specific needs.

[0090] S302, extracting the target color part in the HSV color space image format, setting the remaining elements to 0, and obtaining a first intermediate image; in this embodiment, the target color is the color of paint, such as red, yellow, or blue;

[0091] S303, converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed region area of ​​each target pigment part;

[0092] The specific process of image preprocessing includes:

[0093] First, the grayscale image is opened to remove noise, and the closed operation is used to fill the small holes inside the target color area.

[0094] Then perform a closing operation on the grayscale image;

[0095] Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out. For example, the area threshold can be selected as 10 pixels squared.

[0096] In the process of image preprocessing, opening and closing operations on grayscale images are two important steps. Opening operation is a process of first corrosion and then expansion, which is mainly used to remove noise and small holes in the image. Through opening operation, small particles and burrs in the image can be effectively weakened to make the image smoother. At the same time, opening operation can also disconnect narrow connections and separate independent objects.

[0097] The closing operation is a process of dilation followed by erosion, which is mainly used to fill small holes and cracks in the image. In grayscale images, the closing operation can effectively fill small holes and holes inside the target color area, making the target area more complete. This is crucial for subsequent image analysis and recognition tasks, because the complete target area can provide more features and context information.

[0098] After performing the opening and closing operations on the grayscale image, the next step is to calculate the closed area of ​​each target pigment part. This can usually be achieved by using functions in image processing libraries such as OpenCV. By calculating the closed area, the interference areas with an area less than the area threshold can be further filtered out. These interference areas may be caused by factors such as noise and uneven lighting, which may have a negative impact on subsequent image analysis and recognition tasks. Therefore, by filtering out these interference areas, the accuracy and reliability of image processing can be further improved.

[0099] It is worth noting that in the process of image preprocessing, it is also necessary to select appropriate parameters and methods according to specific application scenarios and requirements. For example, parameters such as the kernel size and number of iterations of the opening and closing operations need to be adjusted according to the actual situation of the image.

[0100] S304, obtaining a second intermediate image by calculating the local density characteristics of the target pigment;

[0101] The local density feature calculation method of the target pigment is to extract the local density feature of the target area by analyzing the gray value of the image. The specific process of the local density feature calculation method of the target pigment is as follows: the connected component is determined by the connected region analysis method; the maximum circumscribed rectangular area in each connected component is divided by the number of masks in the connected component to obtain the density feature of a single connected component; and the target pixels in the connected component whose density feature is less than the density threshold are screened out.

[0102] The connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one to determine whether they are connected to the target pixel. If the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel. On the contrary, if the gray value of the adjacent pixel is not 0, it is considered that the adjacent pixel is connected to the target pixel. Through this method, the area connected to the target pixel can be effectively determined, providing a basis for the subsequent calculation of density features.

[0103] The connected region analysis method is as follows:

[0104] First, the pixels adjacent to each target pigment are analyzed one by one. For example, the target pigment pixels adjacent to the target pigment in the middle, above, below, left, right, and in any of the four diagonal directions are classified as elements in the same connected component. The connected components in the entire image are calculated.

[0105] Then the maximum circumscribed rectangular area in each connected component is divided by the number of masks in the component to obtain the density feature of a single connected component;

[0106] Finally, the target pixels in the connected domain whose density is less than the density threshold are screened out to obtain a second intermediate image. For example, in this embodiment, the density threshold is preferably 0.1, and the unit is number.

[0107] S305, based on the second intermediate image, respectively establish arrays with paint color and arrays without paint color, each array including coordinate points, HSV values ​​and identification of paint color or not; specifically:

[0108] Arrays with paint color and without paint color are established respectively, each array includes coordinate points, HSV values ​​and whether there is paint color identification; wherein, whether there is paint color identification is realized by manual labeling;

[0109] In this embodiment, the pixel points with paint color can be marked as the following array:

[0110] ;

[0111] in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors.

[0112] ;

[0113] in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.

[0114] S4, dividing the array into a training set and a test set, the ratio of the training set to the test set is artificially set, such as 7:3 or 8:2 or 9:1, using the training set and the test set to import the machine learning model for learning, and after the learning is completed, the machine learning model can be constructed;

[0115] In this embodiment, the machine learning model selected is a gradient boosting classifier, the coordinate points and HSV values ​​in the array are used as inputs of the gradient boosting classifier, and the presence or absence of paint color identification is used as output; through learning and training, a trained machine learning model is obtained;

[0116] This embodiment uses a Gradient Boosting Classifier machine learning algorithm to train the array, and uses HSV values ​​and coordinate values ​​as input data for training to establish an efficient machine learning model.

[0117] Second embodiment: Please refer to Figure 4 , a paint inspection system based on multi-dimensional visual analysis, comprising:

[0118] A machine learning model receives an image to be detected, detects the image to be detected, and outputs a detection result of whether the target component is painted; a system for constructing the machine learning model includes:

[0119] Basic database, obtain basic image set; batch collect images containing paint color target workpieces: By collecting a large number of images of paint color target workpieces, a rich training data set is established;

[0120] Building an accurate and powerful model usually requires a high-quality training dataset. This application is dedicated to the image recognition problem of paint color target artifacts. The first thing to do is to obtain a basic image set and collect images containing paint color target artifacts in batches.

[0121] When collecting images, it is important to consider not only the quantity of images, but also the quality, diversity, and representativeness of the images. Try to collect images from as many angles, lighting conditions, paint colors, and backgrounds as possible to ensure that the training dataset covers a variety of possible scenarios and situations. At the same time, you can also filter and preprocess the images to remove blurry, duplicate, or irrelevant images to improve the purity and effectiveness of the dataset.

[0122] The target detection model performs target detection and annotation on each basic image in the basic image set to obtain a recognition image and position of a target workpiece in each basic image;

[0123] The specific process of obtaining the recognition image is:

[0124] First, target positioning is performed, that is, the target workpiece in each basic image is positioned;

[0125] Then, according to the target positioning information, an image of the target workpiece in the image to be detected is obtained;

[0126] The present application can use the target detection algorithm to mark and train the workpiece to be detected in the image, and obtain the recognition image of the target workpiece in the base image and the accurate position of the target workpiece;

[0127] The dataset construction module processes the recognition images as follows:

[0128] Convert each recognition image into the HSV color space image format; for example, when the recognition image is an RGB image, convert the RGB image into the HSV color space image format;

[0129] Extract the target color part in the HSV color space image format, set the remaining elements to 0, and obtain a first intermediate image; in this embodiment, the target color is the color of paint, such as red, yellow, or blue;

[0130] Converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed area of ​​each target pigment portion;

[0131] The specific process of image preprocessing includes:

[0132] First, the grayscale image is opened to remove noise, and the closed operation is used to fill the small holes inside the target color area.

[0133] Then perform a closing operation on the grayscale image;

[0134] Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out. For example, the area threshold can be selected as 10 pixels squared.

[0135] In the process of image preprocessing, opening and closing operations on grayscale images are two important steps. Opening operation is a process of first corrosion and then expansion, which is mainly used to remove noise and small holes in the image. Through opening operation, small particles and burrs in the image can be effectively weakened to make the image smoother. At the same time, opening operation can also disconnect narrow connections and separate independent objects.

[0136] The closing operation is a process of dilation followed by erosion, which is mainly used to fill small holes and cracks in the image. In grayscale images, the closing operation can effectively fill small holes and holes inside the target color area, making the target area more complete. This is crucial for subsequent image analysis and recognition tasks, because the complete target area can provide more features and context information.

[0137] After performing the opening and closing operations on the grayscale image, the next step is to calculate the closed area of ​​each target pigment part. This can usually be achieved by using functions in image processing libraries such as OpenCV. By calculating the closed area, the interference areas with an area less than the area threshold can be further filtered out. These interference areas may be caused by factors such as noise and uneven lighting, which may have a negative impact on subsequent image analysis and recognition tasks. Therefore, by filtering out these interference areas, the accuracy and reliability of image processing can be further improved.

[0138] It is worth noting that in the process of image preprocessing, it is also necessary to select appropriate parameters and methods according to specific application scenarios and requirements. For example, parameters such as the kernel size and number of iterations of the opening and closing operations need to be adjusted according to the actual situation of the image.

[0139] A second intermediate image is obtained by calculating the local density characteristics of the target pigment;

[0140] The local density feature calculation method of the target pigment is to extract the local density feature of the target area by analyzing the gray value of the image. The specific process of the local density feature calculation method of the target pigment is as follows: the connected component is determined by the connected region analysis method; the maximum circumscribed rectangular area in each connected component is divided by the number of masks in the connected component to obtain the density feature of a single connected component; and the target pixels in the connected component whose density feature is less than the density threshold are screened out.

[0141] The connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one to determine whether they are connected to the target pixel. If the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel. On the contrary, if the gray value of the adjacent pixel is not 0, it is considered that the adjacent pixel is connected to the target pixel. Through this method, the area connected to the target pixel can be effectively determined, providing a basis for the subsequent calculation of density features.

[0142] The connected region analysis method is as follows:

[0143] First, the pixels adjacent to each target pigment are analyzed one by one. For example, the target pigment pixels adjacent to the target pigment in the middle, above, below, left, right, and in any of the four diagonal directions are classified as elements in the same connected component. The connected components in the entire image are calculated.

[0144] Then the maximum circumscribed rectangular area in each connected component is divided by the number of masks in the component to obtain the density feature of a single connected component;

[0145] Finally, the target pixels in the connected domain whose density is less than the density threshold are screened out to obtain a second intermediate image. For example, in this embodiment, the density threshold is preferably 0.1, and the unit is number.

[0146] Based on the second intermediate image, arrays with paint color and without paint color are respectively established, each array including coordinate points, HSV values ​​and whether there is paint color identification; specifically:

[0147] Arrays with paint color and without paint color are established respectively, each array includes coordinate points, HSV values ​​and whether there is paint color identification; wherein, whether there is paint color identification is realized by manual labeling;

[0148] In this embodiment, the pixel points with paint color can be marked as the following array:

[0149] ;

[0150] in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors.

[0151] The pixels without paint color can be marked as the following array:

[0152] ;

[0153] in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.

[0154] The training module divides the array into a training set and a test set, uses a machine learning model to learn the training set and the test set, and constructs a machine learning model after the learning is completed.

[0155] Third embodiment: Please refer to Figure 5 , a paint inspection system based on multi-dimensional visual analysis, comprising:

[0156] An image acquisition module is used to acquire an image to be detected; an image containing a target component is acquired by using an image acquisition device such as a camera;

[0157] The machine learning model obtained in the first embodiment above learns the target component image and outputs a result of whether the target component is painted.

[0158] Fourth embodiment: Please refer to Figure 6 , a paint detection method based on multi-dimensional visual analysis, comprising:

[0159] Step 1: Obtain the image to be detected;

[0160] Step 2: Use the machine learning model obtained in the first embodiment to learn the image to be detected and output a result of whether the target component is painted.

[0161] This application uses HSV values ​​and their positions in the image as training data, so that the training data has more information and higher dimensions, and the detection results will also have higher reliability. Because the position distribution of pigments applied to paint is different from the position distribution of similar pigments due to light or material, by analyzing the number of pigments, pigment values, and position distribution of pigments, the problem of identifying the pigments in the workpiece paint can be solved, and the problem of false detection caused by similar pigments that cannot be solved in traditional solutions can be solved.

[0162] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When the use is implemented in whole or in part in the form of a computer program product, the computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode) to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk (SSD)), etc.

[0163] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are within the scope of the technical solution of the present invention.

Claims

1. A paint detection method based on multi-dimensional visual analysis, characterized in that: Use the machine learning model to detect the image to be detected and output the detection result of whether the target part is painted; The method for constructing the machine learning model includes: S1, obtaining a basic image set; each basic image in the basic image set includes a target workpiece image, and the target workpiece image is a painted workpiece image; S2, performing target detection and labeling on each basic image in the basic image set to obtain an identification image and position of the target workpiece in each basic image; S3, processing the recognition image: Convert each recognition image into HSV color space image format; Extracting the target color part in the HSV color space image format, setting the pixel values ​​of the remaining elements to 0, and obtaining a first intermediate image; Converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed area of ​​each target pigment portion; The second intermediate image is obtained by a local density feature calculation method of the target pigment; the specific process of the local density feature calculation method of the target pigment is: using a connected region analysis method to determine connected components; dividing the maximum circumscribed rectangular area in each connected component by the number of masks in the connected component to obtain a density feature of a single connected component; screening out target pixels in connected components whose density features are less than a density threshold; Based on the second intermediate image, arrays with paint color and arrays without paint color are respectively established, each array including coordinate points, HSV values ​​and an identification of whether there is paint color; S4. Divide the array into a training set and a test set, use a machine learning model to learn the training set and the test set, and construct a machine learning model after the learning is completed.

2. The paint detection method based on multi-dimensional visual analysis according to claim 1 is characterized in that: The image preprocessing comprises: First, perform an opening operation on the grayscale image; Then perform a closing operation on the grayscale image; Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out.

3. The paint detection method based on multi-dimensional visual analysis according to claim 1 is characterized in that: The connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one, if the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel, otherwise, it is considered that the adjacent pixel is connected to the target pixel.

4. The paint detection method based on multi-dimensional visual analysis according to claim 1 is characterized in that: In S3: Mark the pixels with paint color into the following array: ; in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors. Mark the pixels without paint color as the following array: ; in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.

5. A paint inspection system based on multi-dimensional visual analysis, characterized in that: include: A machine learning model receives an image to be detected, detects the image to be detected, and outputs a detection result of whether a target component is painted; The system for building the machine learning model includes: A basic database is used to obtain a basic image set; each basic image in the basic image set includes a target workpiece image, and the target workpiece image is a painted workpiece image; The target detection model performs target detection and annotation on each basic image in the basic image set to obtain a recognition image and position of a target workpiece in each basic image; Dataset building module to process the recognition images: Convert each recognition image into HSV color space image format; Extracting the target color part in the HSV color space image format, setting the pixel values ​​of the remaining elements to 0, and obtaining a first intermediate image; Converting the first intermediate image into a grayscale image; performing image preprocessing on the grayscale image to obtain the closed area of ​​each target pigment portion; The second intermediate image is obtained by a local density feature calculation method of the target pigment; the specific process of the local density feature calculation method of the target pigment is: using a connected region analysis method to determine connected components; dividing the maximum circumscribed rectangular area in each connected component by the number of masks in the connected component to obtain a density feature of a single connected component; screening out target pixels in connected components whose density features are less than a density threshold; Based on the second intermediate image, arrays with paint color and arrays without paint color are respectively established, each array including coordinate points, HSV values ​​and an identification of whether there is paint color; The training module divides the array into a training set and a test set, uses a machine learning model to learn the training set and the test set, and constructs a machine learning model after the learning is completed.

6. The paint detection system based on multi-dimensional visual analysis according to claim 5, characterized in that: The image preprocessing comprises: First, perform an opening operation on the grayscale image; Then perform a closing operation on the grayscale image; Finally, the closed area of ​​each target pigment part in the grayscale image is calculated, and the interference area with an area smaller than the area threshold is filtered out.

7. The paint detection system based on multi-dimensional visual analysis according to claim 5, characterized in that: The connected region analysis method refers to: analyzing multiple pixels adjacent to each target pixel one by one, if the gray value of the adjacent pixel is 0, it is considered that the adjacent pixel is not connected to the target pixel, otherwise, it is considered that the adjacent pixel is connected to the target pixel.

8. The paint detection system based on multi-dimensional visual analysis according to claim 5, characterized in that: In the dataset building module: Mark the pixels with paint color into the following array: ; in, Represents the horizontal coordinates of different pixels with paint colors, The vertical coordinates of different pixels with paint colors are represented. The rightmost 1 in the array represents the paint color, and n represents the number of pigments with paint colors. Mark the pixels without paint color as the following array: ; in, The horizontal coordinates of different pixels representing the color without paint, The vertical coordinates of different pixel points representing the unpainted color. The rightmost 0 in the array represents the unpainted color, and m represents the number of pigments in the unpainted color.