A coating abnormal area detection method based on semantic segmentation
Patent Information
- Application Number
- CN202611110477.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-10-30
AI Technical Summary
[0006]鉴于现有基于语义分割的涂层异常区域检测技术存在高光干扰区域与真实涂层异常区域难以区分、单一图像特征难以充分表征涂层偏振响应特性,以及异常区域边界定位精度不足、相邻异常区域易发生断裂或粘连的问题,提出了本发明
[0009]与现有技术相比,本发明有益效果为:通过生成偏振度分布图和偏振响应离散度分布图,从偏振程度与偏振方向响应一致性两个维度构建涂层表面的偏振响应指纹图谱,为检测过程提供对涂层微观结构变化敏感的物理特征输入;通过将偏振度分布图和偏振响应离散度分布图与基准涂层图像组合为涂层多通道检测数据并输入语义分割模型,使分割网络在特征学习阶段同时融合灰度形态特征与偏振物理特征,从源头上抑制了镜面高光区域在语义分割中被误判为异常区域的概率;通过为各初始异常区域独立构建外围环形邻域并基于区域与邻域之间的偏振响应参数差值计算区域偏振异常系数,以相对比较策略替代全局绝对阈值判定,克服了涂层表面空间不均匀性导致的阈值失配问题,并通过偏振度与偏振响应离散度的加权融合将镜面高光干扰区域与真实涂层异常区域有效分离,显著降低了误检率;通过利用概率梯度与偏振离散度梯度的归一化点积判定重合位置,并以重合位置作为锚点牵引边界移动,将语义分割边界约束至与偏振物理材质边界重合的空间坐标处,解决了渐进过渡带中单一语义信息无法精确定位边界的问题,再通过连通合并操作将断裂的离散子区域重新整合,保证了检测结果边界的像素级精度和区域完整性。
Smart Images

Figure CN123016433A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision and coating surface quality inspection technology, and in particular to a method for detecting abnormal areas in coatings based on semantic segmentation. Background Technology
[0002] With the development of machine vision, deep learning, and industrial automation inspection technologies, image analysis-based coating surface anomaly detection is increasingly being applied to the quality inspection of metal components, composite materials, automotive parts, aerospace structural components, and precision equipment. Existing coating anomaly detection methods typically acquire visible light images of the coating surface and identify abnormal areas such as scratches, peeling, blistering, cracks, missed coatings, and localized color differences through grayscale differences, texture features, edge features, or semantic segmentation models. Compared to manual visual inspection, semantic segmentation-based detection methods can perform pixel-level classification of abnormal areas, offering higher detection efficiency, finer region localization, and suitability for batch inspection. However, coating surfaces typically exhibit strong specular reflection characteristics. Changes in the detection light source, imaging angle, and coating curvature can easily create localized highlights, abrupt brightness changes, and reflective bands in the image. These optical interferences are similar to some coating anomalies in terms of grayscale, texture, and edge morphology, making them easily identified as abnormal areas by semantic segmentation models. Meanwhile, the surface reflection information contained in a single visible light image is limited, making it difficult to distinguish between real anomalies caused by changes in the state of the coating material and specular interference caused by changes in the viewing angle. The boundaries of the abnormal regions output by the semantic segmentation model may also be affected by downsampling, feature fusion and probability thresholds, resulting in boundary shifts, breaks between adjacent abnormal regions or adhesion of local abnormal regions, which restricts the accuracy of the coating abnormal region detection results.
[0003] CN110321905A discloses an anomaly region detection method based on semantic segmentation, comprising: acquiring sample images and extracting the saliency map of each sample image; sequentially inputting each training sample into a preset convolutional neural network model for semantic segmentation to train the convolutional neural network model; wherein each training sample includes a labeled sample image and the saliency map of that sample image; inputting the test image and the saliency map of the test image into the trained convolutional neural network model, obtaining the output result of the convolutional neural network model, and determining the anomaly region in the test image based on the label in the output result. Applying the scheme of this application can avoid the situation where only a limited number of anomaly regions can be detected, thus reducing the probability of missed detections. This application also provides an anomaly region detection system and related components based on semantic segmentation, which have corresponding technical effects. This method mainly identifies anomaly regions based on the test image and its saliency map. The saliency map focuses on characterizing visually prominent areas in the image, but does not analyze the changes in the reflection response of the coating surface under different polarization angles. When the highlight areas on the coating surface are highly significant in the image, the highlight areas may be assigned a high probability of anomalousness by the semantic segmentation model at the same time as the real coating anomalous areas. Therefore, it is difficult to further distinguish between the highlight interference areas and the effective anomalous areas based on the polarization response characteristics of the coating material.
[0004] CN112288741A discloses a product surface defect detection method based on semantic segmentation, comprising: acquiring sample images containing product surfaces and dividing them into training sample images and images to be detected; inputting the images to be detected into a semantic segmentation model trained on the training sample images, and outputting a semantic segmentation image; inputting the semantic segmentation image into an image synthesis model, and outputting a synthesized image; using a judgment model to calculate the difference between the images to be detected and the synthesized image, and judging whether the product surface corresponding to the images to be detected has defects; if so, outputting the area where the defects are located. This invention introduces a self-supervised training method, which requires only a small number of defective samples to improve defect detection accuracy. Combined with semantic segmentation algorithms and generative adversarial networks, it can accurately extract defect features, greatly improving the accuracy of product surface defect detection. However, this method judges whether there are defects on the product surface by the difference between the semantic segmentation image, the synthesized image, and the image to be detected. Its detection results still mainly come from the image appearance differences under a single imaging condition, and it does not utilize the pixel responses of the same detection area under multiple polarization angles to construct a polarization degree distribution map and a polarization response dispersion distribution map. Therefore, for coating anomalies with weak appearance differences but significant changes in polarization response, there may be insufficient feature representation. Furthermore, this method does not set up an outer ring neighborhood for local comparison of the initial abnormal region, nor does it eliminate specular interference based on the difference in polarization response parameters between the abnormal region and the outer ring neighborhood; it also lacks a processing mechanism to correct the region boundary by combining physical optical features for the boundary offset, region breakage and separation of adjacent abnormal regions output by the semantic segmentation model. Summary of the Invention
[0005] The purpose of this section is to outline some aspects of the embodiments of the present invention and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this section, the abstract and title of the invention. Such simplifications or omissions shall not be used to limit the scope of the present invention.
[0006] In view of the problems of existing coating anomaly detection technology based on semantic segmentation, such as difficulty in distinguishing between high-light interference areas and real coating anomaly areas, the inability of a single image feature to fully characterize the polarization response characteristics of the coating, insufficient accuracy in the localization of anomaly area boundaries, and the easy breakage or adhesion of adjacent anomaly areas, this invention is proposed.
[0007] Therefore, the problem to be solved by this invention is how to improve the ability to suppress high light interference during the detection of abnormal areas in coatings, and improve the accuracy of abnormal area boundary positioning and the reliability of detection results.
[0008] To solve the above-mentioned technical problems, the present invention provides the following technical solution: This invention provides a method for detecting abnormal regions in coatings based on semantic segmentation, comprising: The same detection area of the target coating surface is acquired according to multiple preset polarization angles. The polarization images of each coating are spatially registered, and a polarization degree distribution map and a polarization response dispersion distribution map are generated based on the pixel intensity of the same pixel position in each coating polarization image. One of the polarization images of each coating is selected as the reference coating image. The reference coating image, polarization degree distribution map and polarization response dispersion distribution map are combined in the channel dimension to form coating multi-channel detection data. The coating multi-channel detection data is input into the pre-trained semantic segmentation model to obtain the anomaly probability distribution map and determine the initial anomaly region. The polarization response parameters of each initial anomalous region and its surrounding annular neighborhood are extracted from the polarization degree distribution map and the polarization response discreteness distribution map, respectively. The regional polarization anomalous coefficient is calculated based on the difference in polarization response parameters between the initial anomalous region and the surrounding annular neighborhood to determine the high-light interference region and the effective anomalous candidate region. The probability gradient in the probability distribution map and the polarization discreteness gradient in the polarization response discreteness distribution map are extracted along the region boundaries of each valid anomaly candidate region. The region boundaries are corrected according to the spatial overlap of the probability gradient and the polarization discreteness gradient, and a connectivity merging operation is performed on the adjacent regions after boundary correction to obtain the coating anomaly region on the target coating surface.
[0009] Compared with existing technologies, the advantages of this invention are as follows: By generating polarization degree distribution maps and polarization response discreteness distribution maps, a polarization response fingerprint spectrum of the coating surface is constructed from two dimensions: polarization degree and polarization direction response consistency, providing physical feature input sensitive to changes in the coating's microstructure for the detection process; by combining the polarization degree distribution map and polarization response discreteness distribution map with the reference coating image to form multi-channel coating detection data and inputting it into the semantic segmentation model, the segmentation network simultaneously integrates grayscale morphological features and polarization physical features during the feature learning stage, thereby suppressing the probability of specular highlight areas being misclassified as abnormal areas in semantic segmentation from the source; by independently constructing an outer ring neighborhood for each initial abnormal area and based on the difference in polarization response parameters between the area and the neighborhood... The method calculates the regional polarization anomaly coefficient and replaces the global absolute threshold determination with a relative comparison strategy, overcoming the threshold mismatch problem caused by the spatial inhomogeneity of the coating surface. By weighted fusion of polarization degree and polarization response dispersion, the specular highlight interference region is effectively separated from the real coating anomaly region, significantly reducing the false detection rate. By using the normalized dot product of probability gradient and polarization dispersion gradient to determine the overlapping position, and using the overlapping position as an anchor point to guide the boundary movement, the semantic segmentation boundary is constrained to the spatial coordinates that coincide with the polarization physical material boundary. This solves the problem that single semantic information cannot accurately locate the boundary in the progressive transition zone. Then, the broken discrete sub-regions are reintegrated through connectivity merging operation, ensuring the pixel-level accuracy and regional integrity of the detection result boundary. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart of a coating anomaly region detection method based on semantic segmentation. Detailed Implementation
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0012] Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without inventive effort should fall within the scope of protection of this invention.
[0013] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0014] As mentioned in the background section, existing technologies mainly rely on single images or single visual features for semantic segmentation detection. They lack comprehensive utilization of the polarization response characteristics of coating surfaces at multiple polarization angles, fail to combine polarization response parameters to determine the authenticity of initial anomalous regions, and do not utilize the anomalous probability gradient and polarization dispersion gradient to collaboratively correct anomalous region boundaries. This leads to problems such as false detection of highlights, missed detection of weak anomalous regions, and anomalous region boundary shifts during the detection process. To address these issues, this invention provides a semantic segmentation-based method for detecting anomalous regions in coatings.
[0015] Reference Figure 1 , Figure 1 This is a flowchart of a coating anomaly region detection method based on semantic segmentation according to an embodiment of the present invention. Figure 1 As shown, a method for detecting coating anomalies based on semantic segmentation includes: S1: Acquire polarization images of the same detection area on the target coating surface according to multiple preset polarization angles, perform spatial registration on each coating polarization image, and generate a polarization degree distribution map and a polarization response dispersion distribution map based on the pixel intensity of the same pixel position in each coating polarization image.
[0016] S1: Acquire polarization images of the same detection area on the target coating surface according to multiple preset polarization angles, perform spatial registration on each coating polarization image, and generate a polarization degree distribution map and a polarization response dispersion distribution map based on the pixel intensity of the same pixel position in each coating polarization image.
[0017] S1.1: Define the detection area on the target coating surface and set the acquisition position relationship between the image acquisition device and the target coating surface.
[0018] It should be noted that the detection area is a continuous surface area on the target coating surface where anomaly detection is to be performed; the image acquisition device includes an industrial camera, a polarization component, and a detection light source. The polarization component is set on the light-incident side of the industrial camera, and the imaging range of the industrial camera covers the detection area; the acquisition position relationship includes the acquisition distance between the industrial camera and the detection area, the optical axis direction of the industrial camera, and the illumination direction of the detection light source relative to the detection area; during the acquisition of polarization images of each coating, the relative spatial position of the industrial camera, the detection light source, and the target coating surface remains unchanged.
[0019] S1.2: Set multiple preset polarization angles according to preset angle intervals, and collect coating polarization images of the detection area under each preset polarization angle to obtain a set of coating polarization images that correspond one-to-one with each preset polarization angle.
[0020] Preferably, the multiple preset polarization angles include 0°, 45°, 90° and 135°, with a preset angle interval of 45°; the polarization component is a rotatable linear polarizer, and the rotatable linear polarizer is rotated sequentially according to each preset polarization angle.
[0021] In an optional embodiment, a coating polarization image is acquired after the rotatable linear polarizer reaches each preset polarization angle; or, the polarization component is a focal plane polarization image sensor, which synchronously acquires the pixel intensity corresponding to each preset polarization angle, and reconstructs each coating polarization image according to each preset polarization angle.
[0022] S1.3: Calculate the image quality evaluation parameters for each coating polarization image, and filter each coating polarization image according to the image quality evaluation parameters. Determine the coating polarization images that meet the preset image quality conditions as the coating polarization images to be registered.
[0023] In this embodiment, the image quality evaluation parameters include image sharpness, overexposed pixel ratio, and underexposed pixel ratio. Image sharpness is determined based on the Laplacian variance of the coated polarized image. The overexposed pixel ratio is the ratio between the number of pixels with pixel intensity greater than a preset high brightness intensity threshold and the total number of pixels in the coated polarized image. The underexposed pixel ratio is the ratio between the number of pixels with pixel intensity less than a preset low brightness intensity threshold and the total number of pixels in the coated polarized image. When the image sharpness is greater than a preset sharpness threshold, the overexposed pixel ratio is less than a preset overexposed ratio threshold, and the underexposed pixel ratio is less than a preset underexposed ratio threshold, the corresponding coated polarized image is determined as the coated polarized image to be registered.
[0024] It should be noted that the preset sharpness threshold is adaptively determined based on the image resolution of the coating polarization image. When the image resolution of the coating polarization image is 1920×1080, the preset sharpness threshold is set to a value between 100 and 300.
[0025] Preferably, the preset overexposure ratio threshold and the preset underexposure ratio threshold are both set to values between 1% and 5%; the preset overexposure ratio threshold is set to 3%, and the preset underexposure ratio threshold is set to 3%.
[0026] S1.4: Select one of the polarization images of each coating to be registered as the polarization registration reference image, extract the coating surface feature points in each polarization image of the coating to be registered, and calculate the spatial transformation parameters of each polarization image of the coating to be registered relative to the polarization registration reference image based on the matching relationship between the coating surface feature points in each polarization image of the coating to be registered and the coating surface feature points in the polarization registration reference image.
[0027] In this embodiment, the coating surface feature points are edge intersections, coating texture corners, or pre-set calibration points in the detection area whose positions remain unchanged at each preset polarization angle. The coating surface feature points in each polarization image of the coating to be registered are matched with the corresponding coating surface feature points in the polarization registration reference image to obtain feature point matching pairs. Based on the coordinate positions of each feature point matching pair in the polarization image of the coating to be registered and the polarization registration reference image, the corresponding affine transformation matrix is calculated, and the affine transformation matrix is used as a spatial transformation parameter.
[0028] The matching method is as follows: An image pyramid is constructed for both the polarization registration reference image and the polarization images of each coating to be registered. Feature points on the coating surface are detected in each layer of the image pyramid. A scale-invariant feature transformation algorithm or an accelerated robust feature transformation algorithm is used to generate feature descriptors for each detected coating surface feature point. The feature descriptors of each coating surface feature point in each polarization image to be registered are compared with the feature descriptors of each coating surface feature point in the polarization registration reference image. The Euclidean distance between each feature descriptor is calculated. The coating surface feature points corresponding to the feature descriptors whose Euclidean distance to the current feature descriptor is closest and whose second closest Euclidean distance ratio is less than a preset ratio threshold are determined as a matching point pair. The preset ratio threshold is set to a value between 0.6 and 0.8. All matching point pairs constitute a feature point matching pair.
[0029] S1.5: Based on each spatial transformation parameter, each coating polarization image to be registered is mapped to the image coordinate system of the polarization registration reference image to obtain each coating polarization image after spatial registration. The common overlapping area of each spatially registered coating polarization image is then cropped so that each spatially registered coating polarization image has the same image size and the pixel positions correspond to each other.
[0030] In this embodiment, coordinate transformation is performed on each coating polarization image to be registered according to each spatial transformation parameter, and bilinear interpolation is used to determine the pixel intensity of non-integer pixel positions after coordinate transformation; the overlapping range with effective pixel values in each spatially registered coating polarization image is determined as the common overlapping region, and the common overlapping region is cropped from each spatially registered coating polarization image to obtain each coating polarization image with the same image size and each pixel position corresponding to the same physical position of the detection area in each coating polarization image.
[0031] S1.6: Within the common overlapping area, for each pixel position, read the pixel intensity corresponding to that pixel position in the spatially registered coating polarization image according to the arrangement order of each preset polarization angle, and construct the polarization intensity sequence of that pixel position.
[0032] In this embodiment of the application, the number of multiple preset polarization angles is N, and the i-th preset polarization angle is... If the coordinates of any pixel are (x, y), then the polarization intensity sequence at that pixel position is represented as: ; in, Indicates the i-th preset polarization angle The pixel intensity corresponding to the pixel with coordinates (x, y); N is 4, and each preset polarization angle... , , , These correspond to 0°, 45°, 90°, and 135° respectively.
[0033] S1.7: Calculate the pixel polarization degree and pixel polarization response dispersion at each pixel position based on the polarization intensity sequence corresponding to each pixel position.
[0034] In this embodiment of the application, the coordinate position of any pixel is set to (x, y), and the formula for calculating the pixel polarization degree is: ; in, , and The Stokes parameters corresponding to the pixel position are determined by the pixel intensity corresponding to 0°, 45°, 90°, and 135° from multiple preset polarization angles. , , and calculate:
[0035]
[0036] ; in, The default positive number is used to prevent the denominator from being zero. This indicates the degree of pixel polarization at coordinate position (x, y).
[0037] The formula for calculating the pixel polarization response dispersion is:
[0038] ; in, This represents the average pixel intensity at each preset polarization angle at the pixel location. This represents the pixel polarization response dispersion at coordinate position (x, y). Pixel polarization degree is used to characterize the proportion of polarization component in the reflected light at the corresponding pixel position, and pixel polarization response dispersion is used to characterize the degree of fluctuation of pixel intensity at the corresponding pixel position with each preset polarization angle.
[0039] S1.8: Arrange the pixel positions according to their coordinates in the common overlapping area, write the pixel polarization degree corresponding to each pixel position into the corresponding coordinate position in the polarization degree distribution map, and write the pixel polarization response dispersion corresponding to each pixel position into the corresponding coordinate position in the polarization response dispersion distribution map to generate the polarization degree distribution map and the polarization response dispersion distribution map.
[0040] It should be noted that the image size of the polarization degree distribution map and the polarization response discreteness distribution map are the same as the image size of the common overlapping area, and there is a pixel-by-pixel positional correspondence between the polarization degree distribution map, the polarization response discreteness distribution map and the spatially registered polarization images of each coating; the polarization degree distribution map, the polarization response discreteness distribution map and the spatially registered polarization images of each coating are transferred to step S2.
[0041] S2: Select one of the polarization images of each coating as the reference coating image. Combine the reference coating image, polarization degree distribution map and polarization response dispersion distribution map in the channel dimension to form coating multi-channel detection data. Input the coating multi-channel detection data into the pre-trained semantic segmentation model to obtain the anomaly probability distribution map and determine the initial anomaly region.
[0042] S2.1: Select one image from the spatially registered polarization images of each coating as the reference coating image.
[0043] In an optional embodiment, each spatially registered coating polarization image corresponds to a preset polarization angle, including a coating polarization image with a polarization angle of 0°, a coating polarization image with a polarization angle of 45°, a coating polarization image with a polarization angle of 90°, and a coating polarization image with a polarization angle of 135°; the coating polarization image with a polarization angle of 0° is selected as the reference coating image; the reference coating image, the polarization degree distribution map, and the polarization response discreteness distribution map have the same image size, and there is a pixel-by-pixel positional correspondence between the three, wherein the polarization degree distribution map is generated by S1.8, and the polarization response discreteness distribution map is generated by S1.8.
[0044] S2.2: The reference coating image, polarization degree distribution map, and polarization response dispersion distribution map are cascaded and combined in the channel dimension to generate multi-channel detection data of the coating.
[0045] In this embodiment, the reference coating image is used as the first channel, the polarization degree distribution map is used as the second channel, and the polarization response discreteness distribution map is used as the third channel. At the same pixel position, the pixel values of the first channel, the second channel, and the third channel are arranged in channel order to form a three-channel feature vector for that pixel position. By traversing all pixel positions, all three-channel feature vectors are arranged according to their respective pixel positions to form multi-channel detection data of the coating.
[0046] In an optional embodiment, the height and width of the coating multichannel detection data are consistent with the height and width of the reference coating image, and the number of channels in the coating multichannel detection data is 3.
[0047] S2.3: Construct a semantic segmentation model, which adopts an encoder-decoder architecture. The encoder is used to perform multi-level downsampling operations on the input data and output encoded feature maps with different spatial resolutions. The decoder is used to perform upsampling and feature fusion operations on each encoded feature map step by step and output pixel-level classification results with the same spatial resolution as the input data.
[0048] In this embodiment, the encoder includes four downsampling modules connected in sequence. Each downsampling module performs a convolution operation with a stride of 2 on the feature map input to that module, so that the spatial resolution of the feature map is gradually reduced to 1 / 2, 1 / 4, 1 / 8 and 1 / 16 of the input image size. Each downsampling module outputs a first coded feature map, a second coded feature map, a third coded feature map and a fourth coded feature map, respectively. Each downsampling module is composed of two 3×3 convolutional layers, a batch normalization layer, a ReLU activation function layer and a 2×2 max pooling layer connected in sequence. The number of convolutional kernels in each 3×3 convolutional layer is 64, 128, 256 and 512, respectively.
[0049] The decoder comprises four upsampling modules connected in sequence. These modules receive the fourth, third, second, and first encoded feature maps, respectively. Each upsampling module performs a transposed convolution operation with a stride of 2 on the received feature maps to expand the spatial resolution. The expanded feature maps are then fused with the corresponding resolution-level encoded feature maps via skip connections. Each upsampling module consists of a 2×2 transposed convolutional layer, a 3×3 convolutional layer, a batch normalization layer, and a ReLU activation function layer, connected sequentially. The number of kernels in each 3×3 convolutional layer is 256, 128, 64, and 32, respectively. The decoder ultimately outputs a classification feature map with the same spatial resolution as the input data. The classification feature map has two channels, corresponding to the normal and abnormal categories, respectively.
[0050] S2.4: Pre-train the semantic segmentation model to obtain a pre-trained semantic segmentation model.
[0051] In this embodiment, a coating surface sample image dataset is obtained. This dataset contains multiple sets of sample data. Each set of sample data is processed according to steps S1.1 to S2.2 to obtain corresponding multi-channel detection data of the sample coating. Category labels are assigned to each pixel position in each set of multi-channel detection data, including normal and abnormal category labels. The coating surface sample image dataset contains at least 2000 sets of sample data, each covering four coating defect types: cracks, blistering, corrosion, and scratches. The multi-channel detection data of each set of sample coating is used as input... The category labels at each corresponding pixel position are used as supervision signals. The cross-entropy loss function is used to calculate the loss value between the predicted output of the semantic segmentation model and the category label. Based on the loss value, the network parameters of the semantic segmentation model are updated through the backpropagation algorithm. The backpropagation algorithm uses the Adam optimizer, with a learning rate of 0.001 and a batch size of 8. Iterative training is performed until the loss value converges, resulting in a pre-trained semantic segmentation model. The criterion for iterative training until the loss value converges is that the decrease in the loss value is less than a preset magnitude threshold within 10 consecutive training epochs. The preset magnitude threshold is set to 0.01.
[0052] S2.5: Input the multi-channel detection data of the coating into the pre-trained semantic segmentation model. The encoder performs downsampling operation on the multi-channel detection data of the coating layer by layer and outputs each encoded feature map. The decoder performs upsampling and skip connection fusion operation on each encoded feature map level by level and outputs a classification feature map with the same spatial resolution as the multi-channel detection data of the coating. The channel response value of the abnormal category corresponding to each pixel position in the classification feature map is used as the abnormal probability value of that pixel position. The abnormal probability distribution map is composed of the abnormal probability values of all pixel positions.
[0053] It should be noted that the pixel value of each pixel in the anomaly probability distribution map is the predicted probability that the pixel location belongs to the coating anomaly area, and the predicted probability ranges from 0 to 1.
[0054] S2.6: Perform a binarization segmentation operation on the anomaly probability distribution map to obtain an initial binary segmentation map.
[0055] In this embodiment of the application, pixel positions with predicted probabilities greater than a preset probability threshold in the abnormal probability distribution map are classified as abnormal pixels, and pixel positions with predicted probabilities less than or equal to the preset probability threshold are classified as normal pixels.
[0056] It should be noted that the preset probability threshold is set to 0.5; in the initial binary segmentation image, the pixel value of abnormal pixels is marked as 1, and the pixel value of normal pixels is marked as 0.
[0057] S2.7: Perform connected component marking operation on all pixel positions marked with pixel value 1 in the initial binary segmentation image, and determine each connected component as the initial abnormal region.
[0058] In this embodiment, the connected component labeling operation adopts the eight-neighbor connectivity rule. That is, when any pixel position and the pixel positions in the eight directions (up, down, left, right, upper left, upper right, lower left, and lower right) are all abnormal pixels, the pixel position and the pixel positions in the eight directions are classified into the same connected component. A unique identifier is assigned to each connected component, and the coordinate set of all pixel positions contained in each connected component is recorded. Each connected component is determined as an initial abnormal region. All initial abnormal regions and their corresponding pixel position coordinate sets are passed to step S3.
[0059] S3: Extract the polarization response parameters of each initial anomalous region and its surrounding annular neighborhood from the polarization degree distribution map and the polarization response discreteness distribution map, respectively. Calculate the regional polarization anomaly coefficient based on the difference in polarization response parameters between the initial anomalous region and the surrounding annular neighborhood to determine the high-light interference region and the effective anomalous candidate region.
[0060] S3.1: Select one unprocessed initial abnormal region from each initial abnormal region as the current processing region, and obtain the coordinate set of all pixel positions contained in the current processing region.
[0061] Preferably, the initial abnormal regions are selected sequentially according to the order in which they are assigned unique identifiers. Each initial abnormal region is assigned a corresponding unique identifier in S2.7 and each initial abnormal region corresponds to a set of pixel position coordinates. The currently selected initial abnormal region is taken as the current processing region, and the coordinates of all pixel positions are read from the set of pixel position coordinates corresponding to the current processing region.
[0062] S3.2: Construct an outer ring neighborhood outside the boundary of the current processing region, wherein the outer ring neighborhood is a ring of pixels that surrounds the current processing region and does not intersect with the boundary of the current processing region.
[0063] In this embodiment, the centroid coordinates of the current processing region are calculated. The x-coordinate of the centroid coordinates is the arithmetic mean of the x-coordinates of all pixel positions in the current processing region, and the y-coordinate of the centroid coordinates is the arithmetic mean of the y-coordinates of all pixel positions in the current processing region. The equivalent radius of the current processing region is calculated. The equivalent radius is equal to the square root of the total number of pixels contained in the current processing region divided by pi. With the centroid coordinates as the center, and with an inner diameter of 1.2 times the equivalent radius and an outer diameter of 2.0 times the equivalent radius, all pixel positions contained within the annular region enclosed by the inner and outer diameters are determined as the set of pixel positions in the outer annular neighborhood. The set of pixel positions in the outer annular neighborhood does not include any pixel position inside the current processing region.
[0064] It should be noted that when the pixel position of the outer ring neighborhood exceeds the image boundary of the common overlapping area, only the pixel positions within the common overlapping area are included in the pixel position set of the outer ring neighborhood, and the total number of pixels in the outer ring neighborhood is updated to the actual number of included pixel positions.
[0065] S3.3: Extract the polarization degree values of all pixel positions in the polarization degree distribution map of the current processing area, and calculate the mean value of the polarization degree region of the current processing area in the polarization degree distribution map.
[0066] In this embodiment, each pixel position within the current processing area is traversed, and the polarization degree value corresponding to each pixel position is read from the polarization degree distribution map generated in S1.8. The sum of all read polarization degree values is then divided by the total number of pixels in the current processing area to obtain the average polarization degree of the region, denoted as . .
[0067] S3.4: Extract the polarization degree values of all pixel positions in the polarization degree distribution map of the outer ring neighborhood, and calculate the mean value of the polarization degree neighborhood of the outer ring neighborhood in the polarization degree distribution map.
[0068] In this embodiment, each pixel position contained in the outer annular neighborhood is traversed, and the polarization degree value corresponding to each pixel position is read from the polarization degree distribution map generated in S1.8. The sum of all read polarization degree values is then divided by the total number of pixels in the outer annular neighborhood to obtain the polarization degree neighborhood mean, denoted as . .
[0069] S3.5: Extract the polarization response dispersion values of all pixel positions in the polarization response dispersion distribution map of the current processing area, and calculate the mean of the dispersion region of the current processing area in the polarization response dispersion distribution map.
[0070] In this embodiment, each pixel position within the current processing region is traversed, and the polarization response dispersion value corresponding to each pixel position is read from the polarization response dispersion distribution map generated in S1.8. The sum of all read polarization response dispersion values is then divided by the total number of pixels in the current processing region to obtain the mean of the dispersion region, denoted as . .
[0071] S3.6: Extract the polarization response dispersion values of all pixel positions in the polarization response dispersion distribution map of the outer ring neighborhood, and calculate the mean of the dispersion neighborhood of the outer ring neighborhood in the polarization response dispersion distribution map.
[0072] In this embodiment, each pixel position contained in the outer annular neighborhood is traversed, and the polarization response dispersion value corresponding to each pixel position is read from the polarization response dispersion distribution map generated in S1.8. The sum of all read polarization response dispersion values is then divided by the total number of pixels in the outer annular neighborhood to obtain the neighborhood mean of the dispersion, denoted as . .
[0073] S3.7: Calculate the regional polarization anomaly coefficient of the current processing area based on the first difference between the mean of the polarization degree region and the mean of the polarization degree neighborhood, and the second difference between the mean of the dispersion region and the mean of the dispersion neighborhood.
[0074] Furthermore, the specific formula for the regional polarization anomaly coefficient K is as follows: ; in, This represents the average value of the polarization degree region. The mean value of the polarization degree neighborhood. The mean of the dispersion region. α is the neighborhood mean of the discreteness; α is the polarization degree weighting coefficient, β is the discreteness weighting coefficient, α and β are both preset positive numbers and α+β=1, α is set to 0.5, β is set to 0.5; the regional polarization anomaly coefficient K is a dimensionless scalar used to characterize the degree of deviation of the current processing area from its surrounding coating area in polarization response characteristics.
[0075] S3.8: Compare the regional polarization anomaly coefficient of the current processing area with the preset polarization anomaly threshold: when the regional polarization anomaly coefficient is less than or equal to the preset polarization anomaly threshold, the current processing area is marked as a high-light interference area; when the regional polarization anomaly coefficient is greater than the preset polarization anomaly threshold, the current processing area is determined as a valid anomaly candidate area.
[0076] It should be noted that the preset polarization anomaly threshold is set to a value between 0.1 and 0.3, and preferably, the preset polarization anomaly threshold is set to 0.2.
[0077] S3.9: Determine whether all initial abnormal regions have been processed; if there are unprocessed initial abnormal regions, return to S3.1 to select the next unprocessed initial abnormal region as the current processing region and repeat S3.1 to S3.8; if all initial abnormal regions have been processed, remove all initial abnormal regions marked as specular interference regions from the subsequent processing flow, and output all initial abnormal regions determined as valid abnormal candidate regions to step S4.
[0078] It should be noted that each specular interference area is a false detection area caused by specular reflection of specular highlights on the target coating surface; each valid anomaly candidate area is a suspected area on the target coating surface where coating anomalies actually exist.
[0079] S4: Extract the probability gradient from the anomaly probability distribution map and the polarization discreteness gradient from the polarization response discreteness distribution map along the region boundaries of each valid anomaly candidate region. Correct the region boundaries based on the spatial overlap of the probability gradient and the polarization discreteness gradient, and perform a connectivity merging operation on the adjacent regions after boundary correction to obtain the coating anomaly region on the target coating surface.
[0080] S4.1: Select one unprocessed valid anomaly candidate region from each valid anomaly candidate region as the current region to be corrected, and obtain the set of region boundary pixel positions of the current region to be corrected.
[0081] In this embodiment, each valid anomaly candidate region is selected sequentially according to the unique identifier corresponding to it when it is determined in S3.9; a morphological erosion operation is performed on the binary mask image of the current region to be corrected to obtain the eroded region.
[0082] It should be noted that the morphological erosion operation uses a square structuring element with a side length of 3 pixels; the original region and the eroded region of the current region to be corrected are XORed pixel by pixel to obtain all the pixel positions on the outermost contour of the current region to be corrected, which are used as the set of region boundary pixel positions.
[0083] S4.2: For each boundary pixel position in the set of boundary pixel positions of the region, expand by a preset step size along the normal direction of the boundary pixel position in both the positive and negative directions of the normal direction to determine the boundary neighborhood pixel band corresponding to each boundary pixel position; the boundary neighborhood pixel bands corresponding to all boundary pixel positions constitute the boundary expansion neighborhood set of the current region to be corrected.
[0084] In this embodiment, the normal direction is perpendicular to the tangent of the boundary where the boundary pixel is located. For any boundary pixel, the tangent direction of the region boundary at that location is calculated. The tangent direction is obtained by curve fitting the set of boundary pixel locations and taking the first derivative. The normal direction and the tangent direction are perpendicular to each other. Starting from the boundary pixel, the normal direction is extended by 5 pixels in the positive direction and by 5 pixels in the negative direction. All pixel locations within the extension range in the positive and negative directions are determined as the boundary neighborhood pixel band of the boundary pixel location. The boundary neighborhood pixel band includes inward neighboring pixels located inside the current region to be corrected and outward neighboring pixels located outside the current region to be corrected.
[0085] S4.3: For each pixel location in the boundary extended neighborhood set, read the anomalous probability value of that pixel location from the anomalous probability distribution map, and calculate the probability gradient magnitude and probability gradient direction of that pixel location in the anomalous probability distribution map.
[0086] In this embodiment, the Sobel gradient operator is used to calculate the partial derivatives of the anomaly probability distribution map in the horizontal and vertical directions respectively; in the horizontal direction, a horizontal Sobel convolution kernel is used to perform a convolution operation on the anomaly probability distribution map to obtain the horizontal partial derivative at that pixel location. The anomaly probability distribution map is convolved using a vertical Sobel convolution kernel to obtain the vertical partial derivative at that pixel location. ; partial derivative in the horizontal direction and vertical partial derivatives Combined into probability gradient vector The magnitude of the probability gradient vector is calculated as the probability gradient magnitude, which is equal to the horizontal partial derivative. and vertical partial derivatives The square root of the sum of squares; the direction angle of the probability gradient vector is used as the direction of the probability gradient, which is equal to the partial derivative in the vertical direction. Divided by the horizontal partial derivative The arctangent value of the quotient of P.
[0087] S4.4: For each pixel location in the boundary extended neighborhood set, read the polarization response discrete value of that pixel location from the polarization response discrete distribution map, and calculate the polarization discrete gradient magnitude and polarization discrete gradient direction of that pixel location in the polarization response discrete distribution map.
[0088] In this embodiment, the Sobel gradient operator is used to calculate the partial derivatives of the polarization response dispersion distribution map in the horizontal and vertical directions, respectively; in the horizontal direction, a horizontal Sobel convolution kernel is used to perform a convolution operation on the polarization response dispersion distribution map to obtain the horizontal partial derivative at that pixel location. The polarization response dispersion distribution map is convolved using a vertical Sobel convolution kernel to obtain the vertical partial derivative at that pixel location. ; partial derivative in the horizontal direction and vertical partial derivatives Combined into polarization discreteness gradient vector The magnitude of the polarization discreteness gradient vector is calculated as the magnitude of the polarization discreteness gradient, which is equal to the horizontal partial derivative. and vertical partial derivatives The square root of the sum of squares; the direction angle of the polarization discreteness gradient vector is used as the polarization discreteness gradient direction, which is equal to the partial derivative in the perpendicular direction. Divided by the horizontal partial derivative The arctangent value of the quotient.
[0089] S4.5: For each pixel location in the boundary extended neighborhood set, calculate the vector similarity between the probability gradient vector and the polarization discreteness gradient vector at that pixel location. Pixel locations with vector similarity greater than a preset similarity threshold are identified as overlapping locations, and all overlapping locations form an overlapping location set.
[0090] In this embodiment, the vector similarity is calculated as follows: the normalized dot product of the probability gradient vector and the polarization discreteness gradient vector is calculated. The normalized dot product is equal to the product of the transpose of the probability gradient vector and the polarization discreteness gradient vector divided by the product of the magnitude of the probability gradient vector and the magnitude of the polarization discreteness gradient vector. When the normalized dot product is greater than a preset similarity threshold, the pixel position is determined to be an overlapping position.
[0091] It should be noted that the preset similarity threshold is determined based on the Gaussian fitting method: A distribution histogram of the normalized dot product values of all pixel positions is plotted within the boundary extended neighborhood set, with the number of intervals in the distribution histogram set set to 50; a second-order Gaussian mixture model is fitted to the distribution histogram, which consists of a first Gaussian component and a second Gaussian component. The mean, variance, and weight coefficients of each Gaussian component are estimated iteratively using the expectation-maximization algorithm, with the number of iterations set to 100 or until the change in the log-likelihood function is less than 0.001; the normalized dot product value corresponding to the intersection of the first Gaussian component and the second Gaussian component is used as the preset similarity threshold.
[0092] Preferably, the preset similarity threshold is set to a value between 0.7 and 0.85; the preset similarity threshold is set to 0.75.
[0093] S4.6: Traverse the boundary pixel positions along the current region boundary to be corrected. When traversing to the current boundary pixel position, determine whether there is a pixel in the preset neighborhood window centered on the current boundary pixel position that belongs to the set of overlapping positions. If there is, move the current boundary pixel position along the probability gradient direction to the spatial coordinates of the overlapping pixel. If there is no pixel, keep the current boundary pixel position unchanged. After traversing all boundary pixel positions, obtain the corrected region boundary.
[0094] In this embodiment, the preset neighborhood window is a square window with a side length of 9 pixels centered on the current boundary pixel position. When there are multiple overlapping pixels in the preset neighborhood window, the overlapping pixel with the highest vector similarity is selected as the target moving position. Moving the current boundary pixel position along the probability gradient direction means updating the coordinates of the current boundary pixel position to the coordinates of the overlapping pixel, so that the corrected boundary pixel is pulled to a spatial position where the semantic boundary and the physical material boundary highly coincide.
[0095] S4.7: Determine whether the boundary of the corrected region forms a closed contour; if the boundary of the corrected region does not meet the closure condition, then perform boundary closure processing on the boundary of the corrected region using morphological closing operation to obtain the closed region after boundary correction; after performing boundary correction on the current region to be corrected, the region corresponding to the current region to be corrected after boundary correction is obtained.
[0096] In this embodiment, the closure condition is that the pixels within the region enclosed by the corrected region boundary are connected to each other and the pixels at the region boundary are connected end to end; the morphological closing operation is to first perform a dilation operation on the pixel region enclosed by the corrected region boundary and then perform an erosion operation. Both the dilation and erosion operations use a square structuring element with a side length of 3 pixels; the closed region after boundary correction is taken as the boundary-corrected region corresponding to the current region to be corrected.
[0097] S4.8: Determine whether all valid anomaly candidate regions have been corrected; if there are unprocessed valid anomaly candidate regions, return to S4.1 to select the next unprocessed valid anomaly candidate region as the current region to be corrected, and repeat S4.1 to S4.7; if all valid anomaly candidate regions have been corrected, obtain the boundary-corrected region corresponding to each valid anomaly candidate region.
[0098] S4.9: Traverse all boundary-corrected regions according to their spatial location, calculate the spatial distance between any two adjacent boundary-corrected regions, merge adjacent boundary-corrected regions with a spatial distance less than the preset merging distance threshold into one region, repeat the merging operation until the spatial distance between any two adjacent boundary-corrected regions is greater than or equal to the preset merging distance threshold, and output the final merged regions as the coating abnormality regions on the target coating surface.
[0099] In this embodiment, the spatial distance is the shortest Euclidean distance between the boundaries of two boundary-corrected regions; the preset merging distance threshold is set to 5 pixels; the merging operation is to perform a union operation on the pixel position coordinate sets of two adjacent boundary-corrected regions to form a new region; the coating abnormal region is in the form of a binary mask image, where the pixel position with a pixel value of 1 belongs to the coating abnormal region, and the pixel position with a pixel value of 0 belongs to the coating normal region; the coating abnormal region is output as the final coating abnormal region detection result of the target coating surface.
[0100] In summary, this invention constructs a polarization response fingerprint spectrum of the coating surface from two dimensions: polarization degree distribution map and polarization response discreteness distribution map. This provides a physical feature input sensitive to changes in the coating's microstructure for the detection process. By combining the polarization degree distribution map and the polarization response discreteness distribution map with a reference coating image to form multi-channel coating detection data and inputting it into a semantic segmentation model, the segmentation network simultaneously integrates grayscale morphological features and polarization physical features during the feature learning stage. This fundamentally suppresses the probability of specular highlight areas being misclassified as abnormal areas in semantic segmentation. Furthermore, by independently constructing an outer ring neighborhood for each initial abnormal area and calculating the region based on the difference in polarization response parameters between the region and its neighborhood, this invention provides a more comprehensive and accurate representation of the region. The polarization anomaly coefficient, using a relative comparison strategy instead of a global absolute threshold determination, overcomes the threshold mismatch problem caused by the spatial inhomogeneity of the coating surface. Furthermore, by weighted fusion of polarization degree and polarization response dispersion, it effectively separates specular highlight interference areas from real coating anomaly areas, significantly reducing the false detection rate. By using the normalized dot product of the probability gradient and the polarization dispersion gradient to determine the overlapping position, and using this overlapping position as an anchor point to guide boundary movement, the semantic segmentation boundary is constrained to a spatial coordinate coinciding with the polarization physical material boundary. This solves the problem of single semantic information being unable to accurately locate the boundary in the progressive transition zone. Finally, through a connectivity and merging operation, the broken discrete sub-regions are reintegrated, ensuring pixel-level accuracy and regional integrity of the detection result boundary.
[0101] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for detecting abnormal regions in coatings based on semantic segmentation, characterized in that, include: The same detection area of the target coating surface is acquired according to multiple preset polarization angles. The polarization images of each coating are spatially registered, and a polarization degree distribution map and a polarization response dispersion distribution map are generated based on the pixel intensity of the same pixel position in each coating polarization image. One of the polarization images of each coating is selected as the reference coating image. The reference coating image, the polarization degree distribution map, and the polarization response discreteness distribution map are combined in the channel dimension to form coating multi-channel detection data. The coating multi-channel detection data is input into a pre-trained semantic segmentation model to obtain an anomaly probability distribution map and determine the initial anomaly region. The polarization response parameters of each initial abnormal region and its surrounding annular neighborhood are extracted from the polarization degree distribution map and the polarization response discreteness distribution map, respectively. The regional polarization anomaly coefficient is calculated based on the difference in polarization response parameters between the initial abnormal region and the surrounding annular neighborhood to determine the high-light interference region and the effective anomaly candidate region. The probability gradient in the anomaly probability distribution map and the polarization discreteness gradient in the polarization response discreteness distribution map are extracted along the region boundaries of each of the effective anomaly candidate regions. The region boundaries are corrected according to the spatial overlap of the probability gradient and the polarization discreteness gradient, and a connectivity merging operation is performed on the adjacent regions after boundary correction to obtain the coating anomaly region on the target coating surface.
2. The coating anomaly region detection method based on semantic segmentation as described in claim 1, characterized in that, The method for obtaining the abnormal area of the coating includes: The entire boundary-corrected region is traversed according to its spatial location. The spatial distance between any two adjacent boundary-corrected regions is calculated. Adjacent boundary-corrected regions with a spatial distance less than a preset merging distance threshold are merged into one region. The merging operation is repeated until the spatial distance between any two adjacent boundary-corrected regions is greater than or equal to the preset merging distance threshold. The entire merged region is then output as the coating abnormal region on the target coating surface.
3. The coating anomaly region detection method based on semantic segmentation as described in claim 2, characterized in that, The method for obtaining the boundary-corrected region includes: Determine whether the boundary of the corrected region forms a closed contour; if the boundary of the corrected region does not meet the closure condition, then perform boundary closure processing on the boundary of the corrected region using morphological closing operation to obtain the closed region after boundary correction; after performing boundary correction on the current region to be corrected, obtain the boundary-corrected region corresponding to the current region to be corrected. Determine whether all valid anomaly candidate regions have been corrected; if there are unprocessed valid anomaly candidate regions, return to S4.1 to select the next unprocessed valid anomaly candidate region as the current region to be corrected, and repeat S4.1 to S4.7; if all valid anomaly candidate regions have been corrected, obtain the boundary-corrected region corresponding to each valid anomaly candidate region.
4. The coating anomaly region detection method based on semantic segmentation as described in claim 3, characterized in that, The closure condition is that pixels within the region enclosed by the corrected region boundary are interconnected and the region boundary pixels are connected end to end.
5. The coating anomaly region detection method based on semantic segmentation as described in claim 3, characterized in that, The method for obtaining the corrected region boundary includes: Traverse the boundary pixel positions along the current region boundary to be corrected. When traversing to the current boundary pixel position, determine whether there is a pixel in the preset neighborhood window centered on the current boundary pixel position that belongs to the set of overlapping positions. If there is, move the current boundary pixel position along the probability gradient direction to the spatial coordinates of the overlapping pixel. If there is no pixel, keep the current boundary pixel position unchanged. After traversing all boundary pixel positions, obtain the corrected region boundary.
6. The coating anomaly region detection method based on semantic segmentation as described in claim 5, characterized in that, The method for constructing the set of overlapping positions includes: Select one unprocessed valid anomaly candidate region from each valid anomaly candidate region as the current region to be corrected, and obtain the set of region boundary pixel positions of the current region to be corrected. For each boundary pixel position in the set of boundary pixel positions of the region, the boundary pixel position is extended by a preset step size along the normal direction of the boundary pixel position in both the positive and negative directions of the normal direction to determine the boundary neighborhood pixel band corresponding to each boundary pixel position; the boundary neighborhood pixel bands corresponding to all boundary pixel positions constitute the boundary extended neighborhood set of the current region to be corrected. For each pixel location in the boundary extended neighborhood set, the anomalous probability value of that pixel location is read from the anomalous probability distribution map, and the probability gradient magnitude and probability gradient direction of that pixel location in the anomalous probability distribution map are calculated. For each pixel location in the boundary extended neighborhood set, the polarization response discreteness value of the pixel location is read from the polarization response discreteness distribution map, and the polarization discreteness gradient magnitude and polarization discreteness gradient direction of the pixel location in the polarization response discreteness distribution map are calculated. For each pixel location in the boundary extended neighborhood set, the vector similarity between the probability gradient vector and the polarization discreteness gradient vector at that pixel location is calculated. Pixel locations with vector similarity greater than a preset similarity threshold are determined as overlapping locations, and all such overlapping locations constitute an overlapping location set.
7. The coating anomaly region detection method based on semantic segmentation as described in claim 1, characterized in that, The method for determining the high-light interference region and the effective anomaly candidate region includes: The polarization anomaly coefficient of the current processing area is compared with a preset polarization anomaly threshold: when the polarization anomaly coefficient is less than or equal to the preset polarization anomaly threshold, the current processing area is marked as a specular interference area; when the polarization anomaly coefficient is greater than the preset polarization anomaly threshold, the current processing area is determined as a valid anomaly candidate area.
8. The coating anomaly region detection method based on semantic segmentation as described in claim 7, characterized in that, The regional polarization anomaly coefficient includes: Select one unprocessed initial abnormal region from each initial abnormal region as the current processing region, and obtain the coordinate set of all pixel positions contained in the current processing region; Construct an outer ring neighborhood outside the boundary of the current processing area; Extract the polarization degree values of all pixel positions in the polarization degree distribution map of the current processing area, and calculate the average polarization degree of the current processing area in the polarization degree distribution map; Extract the polarization degree values of all pixel positions of the outer ring neighborhood in the polarization degree distribution map, and calculate the mean value of the polarization degree neighborhood of the outer ring neighborhood in the polarization degree distribution map; Extract the polarization response dispersion values of all pixel positions in the polarization response dispersion distribution map of the current processing area, and calculate the mean value of the dispersion region of the current processing area in the polarization response dispersion distribution map; Extract the polarization response dispersion values of all pixel positions of the outer ring neighborhood in the polarization response dispersion distribution map, and calculate the mean of the dispersion neighborhood of the outer ring neighborhood in the polarization response dispersion distribution map; The regional polarization anomaly coefficient of the current processing region is calculated based on the first difference between the mean of the polarization degree region and the mean of the polarization degree neighborhood and the second difference between the mean of the discrete degree region and the mean of the discrete degree neighborhood.
9. The coating anomaly region detection method based on semantic segmentation as described in claim 8, characterized in that, The method for determining the initial abnormal region includes: Perform a binarization segmentation operation on the anomaly probability distribution map to obtain an initial binary segmentation map; A connected component marking operation is performed on all pixel positions marked with a pixel value of 1 in the initial binary segmentation image, and each connected component is determined as an initial abnormal region.
10. The coating anomaly region detection method based on semantic segmentation as described in claim 9, characterized in that, The anomaly probability distribution map includes: The multi-channel detection data of the coating is input into a pre-trained semantic segmentation model, wherein the semantic segmentation model adopts an encoder-decoder architecture; the encoder performs downsampling operation on the multi-channel detection data of the coating layer by layer and outputs each encoded feature map; the decoder performs upsampling and skip connection fusion operation on each encoded feature map level by level and outputs a classification feature map with the same spatial resolution as the multi-channel detection data of the coating; the channel response value of the abnormal category corresponding to each pixel position in the classification feature map is used as the abnormal probability value of that pixel position, and the abnormal probability values of all pixel positions constitute an abnormal probability distribution map.
Citation Information
Patent Citations
Abnormal region detection method and system based on semantic segmentation and related components
CN110321905A
Product surface defect detection method and system based on semantic segmentation
CN112288741A