Method and system for detecting surface defects of an explosion-proof membrane based on machine vision

CN122530188APending Publication Date: 2026-08-07GUANGDONG BICAN NEW MATERIALS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG BICAN NEW MATERIALS CO LTD
Filing Date
2026-06-16
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0003]本申请提供了基于机器视觉的防爆膜表面缺陷检测方法及系统,解决了现有技术中防爆膜表面微小缺陷漏检率较高的技术问题

Benefits of technology

首先,获取待测防爆膜的暗场图像,暗场图像是指向待测防爆膜的表面投射照明光后在镜面反射方向之外捕获散射光信号得到的图像。接着,对暗场图像依次进行灰度化、中值滤波去噪和直方图均衡化对比度拉伸,得到增强图像。然后,将增强图像输入至第一检测网络,由第一检测网络输出候选缺陷区域,并分析候选缺陷区域生成感兴趣区域掩码。进一步,对感兴趣区域掩码与增强图像进行融合裁剪后输入至第二检测网络,由第二检测网络进行像素级分割,输出缺陷区域二值掩码。最后,分析缺陷区域二值掩码得到缺陷区域几何参数,并将缺陷区域几何参数与预设缺陷阈值比较,得到待测防爆膜的表面缺陷检测结果。解决了现有技术中防爆膜表面微小缺陷漏检率较高的技术问题,达到了通过暗场成像结合双网络级联检测,实现缺陷区域精准定位与像素级分割,从而提升微小缺陷检出率的技术效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122530188A_ABST
    Figure CN122530188A_ABST
Patent Text Reader

Abstract

The application discloses a machine vision-based surface defect detection method and system for an explosion-proof film, and relates to the technical field of explosion-proof film detection. The method comprises the following steps: acquiring a dark-field image of the explosion-proof film to be detected; processing the dark-field image to obtain an enhanced image; inputting the enhanced image into a first detection network to output a candidate defect region and analyze the candidate defect region to generate a region of interest mask; inputting the region of interest mask and the enhanced image after fusion and cutting into a second detection network to output a defect region binary mask; analyzing the defect region binary mask to obtain a defect region geometric parameter, and comparing the defect region geometric parameter with a preset defect threshold to obtain a surface defect detection result of the explosion-proof film to be detected. The technical problem of a high missing detection rate of the surface micro defects of the explosion-proof film in the prior art is solved, the technical effect of improving the micro defect detection rate is achieved by means of dark-field imaging combined with double-network cascade detection to realize accurate positioning and pixel-level segmentation of the defect region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of explosion-proof film inspection technology, specifically to a method and system for detecting surface defects in explosion-proof films based on machine vision. Background Technology

[0002] Explosion-proof films are widely used in architectural glass, automotive glass, electronic display panels, and industrial transparent substrates, primarily to improve the impact resistance, splash resistance, and safety of the substrate. During production, lamination, coating, winding, and transportation, explosion-proof films are prone to defects such as scratches, bubbles, particulate impurities, indentations, pits, and surface deposits. These defects not only affect the appearance quality of the explosion-proof film but also reduce its light transmittance, adhesion, and protective performance. Therefore, it is necessary to inspect for surface defects during the production process to ensure product quality. Currently, the detection of surface defects in explosion-proof films mainly employs manual visual inspection or bright-field imaging inspection based on machine vision. Manual visual inspection is easily affected by the experience of the inspectors, visual fatigue, and environmental factors, resulting in low inspection efficiency, poor consistency, and a high rate of missed detections. While machine vision inspection based on bright-field imaging can improve the automation level of inspection, it is difficult to accurately identify defects such as small scratches, tiny bubbles, and transparent particles with small surface dimensions and low contrast due to the small grayscale difference between the defect area and the background area. Meanwhile, most existing testing methods adopt a single-stage testing strategy, which makes it difficult to balance testing speed and accuracy. For small defects with blurred boundaries and complex shapes, there are problems such as missed detection, false detection, and inaccurate positioning, which cannot meet the application requirements of high-precision quality testing of explosion-proof films. Summary of the Invention

[0003] This application provides a machine vision-based method and system for detecting surface defects in explosion-proof films, which solves the technical problem of high missed detection rate of minute defects on the surface of explosion-proof films in the prior art.

[0004] The first aspect of this application provides a machine vision-based method for detecting surface defects in explosion-proof films, the method comprising: A dark-field image of the explosion-proof film to be tested is acquired. The dark-field image is obtained by capturing the scattered light signal outside the specular reflection direction after illuminating the surface of the explosion-proof film. The dark-field image is then subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching to obtain an enhanced image. The enhanced image is input into a first detection network, which outputs candidate defect regions and analyzes these candidate defect regions to generate a region of interest (ROI) mask. The ROI mask and the enhanced image are then fused and cropped before being input into a second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region. The binary mask of the defect region is analyzed to obtain the geometric parameters of the defect region, which are then compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film to be tested.

[0005] A second aspect of this application provides a machine vision-based surface defect detection system for explosion-proof films, the system comprising: Image acquisition module: Acquires a dark-field image of the explosion-proof film under test. The dark-field image is obtained by capturing scattered light signals outside the specular reflection direction after illuminating the surface of the explosion-proof film under test. Image processing module: Performs grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching on the dark-field image in sequence to obtain an enhanced image. First detection module: Inputs the enhanced image into a first detection network, which outputs candidate defect regions and analyzes the candidate defect regions to generate a region of interest mask. Second detection module: Merges and crops the region of interest mask with the enhanced image and inputs it into a second detection network, which performs pixel-level segmentation and outputs a binary mask of the defect region. Defect determination module: Analyzes the binary mask of the defect region to obtain the geometric parameters of the defect region, and compares the geometric parameters of the defect region with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film under test.

[0006] One or more technical solutions provided in this application have at least the following technical effects or advantages: First, a dark-field image of the explosion-proof film under test is acquired. This dark-field image is obtained by capturing scattered light signals outside the specular reflection direction after illumination light is projected onto the surface of the film. Next, the dark-field image is sequentially subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching to obtain an enhanced image. Then, the enhanced image is input into a first detection network, which outputs candidate defect regions and analyzes these regions to generate a region of interest (ROI) mask. Further, the ROI mask and the enhanced image are fused and cropped before being input into a second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region. Finally, the binary mask of the defect region is analyzed to obtain the geometric parameters of the defect region, which are then compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film under test. This method solves the technical problem of high false negative rates for small defects on the surface of explosion-proof films in existing technologies. It achieves the technical effect of accurately locating and segmenting defect regions at the pixel level through dark-field imaging combined with dual-network cascaded detection, thereby improving the detection rate of small defects. Attached Figure Description

[0007] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0008] Figure 1 A schematic flowchart of a machine vision-based method for detecting surface defects in explosion-proof films provided in an embodiment of this application; Figure 2 This is a schematic diagram of dark-field imaging provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a machine vision-based explosion-proof film surface defect detection system provided in an embodiment of this application.

[0009] Explanation of reference numerals in the attached drawings: Image acquisition module 11, Image processing module 12, First detection module 13, Second detection module 14, Defect judgment module 15. Detailed Implementation

[0010] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.

[0011] Example 1, as Figure 1 As shown, this application provides a machine vision-based method for detecting surface defects in explosion-proof films, wherein the method includes: Acquire a dark field image of the explosion-proof film to be tested. The dark field image is an image obtained by capturing the scattered light signal outside the specular reflection direction after illuminating the surface of the explosion-proof film to be tested.

[0012] Specifically, firstly, the explosion-proof film to be tested is laid flat on the testing platform, and the surface of the explosion-proof film is positioned and fixed to ensure that the relative position between the explosion-proof film to be tested and the image acquisition device remains stable during the testing process. Then, the optical constants such as refractive index, transmittance, and reflectance of the explosion-proof film to be tested are obtained. Based on these optical constants, the target light source wavelength of the target illumination source is determined, and the lens aperture, working distance, and acquisition field of view of the image acquisition device are obtained. The target incident angle of the target illumination source is calculated based on the lens aperture, working distance, and acquisition field of view, ensuring that the target incident angle satisfies the dark-field imaging condition that specular reflection light will not enter the field of view of the image acquisition device. Next, the target illumination source is installed on one side of the surface of the explosion-proof film to be tested, and illumination light is projected onto the surface of the explosion-proof film to be tested according to the target incident angle. When the illumination light illuminates the surface of the explosion-proof film... When testing the surface of the explosion-proof film, specular reflection light from smooth areas propagates along the specular reflection direction. However, defects such as scratches, bubbles, particulate impurities, pits, and wrinkles, due to changes in their surface microstructure, scatter the incident light and generate scattered light signals. The image acquisition device is positioned outside the specular reflection direction to receive only the scattered light signals generated by the defective areas, while avoiding specular reflection light from entering the lens, thereby suppressing the brightness of the background area. Finally, the image acquisition device is used to expose and acquire the scattered light signals, converting the received scattered light intensity information into digital image data and outputting a dark-field image. In this dark-field image, defective areas exhibit high brightness characteristics, while non-defective areas exhibit a low-brightness background, thereby improving the contrast and distinguishability between defects and the background during subsequent defect detection.

[0013] Furthermore, such as Figure 2 As shown, a dark-field image of the explosion-proof film under test is obtained. This dark-field image is obtained by capturing scattered light signals outside the specular reflection direction after illumination light is projected onto the surface of the explosion-proof film under test. The preceding steps include: The optical constants of the explosion-proof film under test are obtained; the target light source wavelength of the target illumination source is determined based on the optical constants; the acquisition field of view of the image acquisition device of the explosion-proof film under test is obtained; the target incident angle of the target illumination source is determined based on the acquisition field of view; the scattered light signal is captured outside the specular reflection direction according to the target light source wavelength and the target incident angle; wherein, the target incident angle satisfies the following constraint: θ≥arc tan(D / 2H)+α, where D is the lens aperture of the image acquisition device, H is the vertical distance from the optical center of the image acquisition device to the surface of the explosion-proof film under test, and α is a preset safety margin angle.

[0014] Before acquiring a dark-field image of the explosion-proof film under test, the optical constants of the film are first obtained. These optical constants include at least one of refractive index, reflectivity, and transmittance. Specifically, they can be obtained by accessing a database of explosion-proof film material parameters or by measurement using optical testing equipment such as an ellipsometer or spectrophotometer. Then, based on the acquired optical constants, the optical response characteristics of the explosion-proof film under test at different wavelengths are analyzed to determine the target light source wavelength with the largest difference in scattered light intensity between the defect area and the normal area. An LED light source or laser light source of the corresponding wavelength is then configured as the target illumination source. Next, the field of view of the image acquisition device is acquired, and simultaneously, the lens aperture D of the image acquisition device and the vertical distance H from the optical center of the image acquisition device to the surface of the explosion-proof film under test are acquired. The lens field of view boundary angle is calculated based on the lens aperture D and the vertical distance H, and a preset safety margin angle α is introduced, according to θ≥arc The target incident angle of the target illumination source is determined by tan(D / 2H)+α, where the preset safety margin angle α is used to compensate for installation errors, mechanical vibration errors, and optical system adjustment errors, and is preferably set to 3°~10°. After the target incident angle is calculated, the target illumination source is installed above or to the side of the explosion-proof film to be tested, so that the illumination light shines on the surface of the explosion-proof film to be tested at the target incident angle. At this time, the specular reflection light formed by the flat surface area propagates along the specular reflection direction and does not enter the acquisition field of view of the image acquisition device. However, the surface scratches, bubbles, particulate impurities, pits and wrinkles will scatter the incident light and form a scattered light signal. Finally, the image acquisition device is controlled to be arranged outside the specular reflection direction, only receiving the scattered light signal generated by the defect area and performing image acquisition, thereby obtaining a dark field image with low background brightness and high defect area brightness, providing a high-contrast input image for subsequent defect detection.

[0015] The dark field image is sequentially subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization for contrast stretching to obtain an enhanced image.

[0016] Specifically, firstly, the dark-field image is converted to grayscale, transforming the color information of each pixel in the original color image into single-channel grayscale values. This reduces the dimensionality of the image data and eliminates the impact of color variations on defect detection. For RGB format images, the pixel values ​​of the red, green, and blue channels are converted to their corresponding grayscale values ​​using a preset weighting method to generate a grayscale image. Next, the grayscale image undergoes median filtering for noise reduction. A neighborhood window of a preset size is established centered on the current pixel. The grayscale values ​​of all pixels within the neighborhood window are extracted and sorted in order of size. The median value of the sorted pixels replaces the current pixel's grayscale value, thereby suppressing salt-and-pepper noise, random noise, and interference from isolated bright spots generated during image acquisition, while preserving the defect edge contour information. The size of the neighborhood window can be set to 3×3, 5×5, or 7×7 depending on the image resolution. After median filtering, histogram equalization and contrast stretching are performed on the filtered image. The pixel distribution corresponding to each gray level in the image is statistically analyzed, and a gray-level histogram and cumulative probability distribution function are constructed. The original gray values ​​are then remapped according to the cumulative probability distribution function, expanding the pixel values ​​that were originally concentrated in local gray-level intervals to a wider gray-level dynamic range. This enhances the gray-level difference between the defect area and the background area, improving the recognizability of defect features such as micro-scratches, bubbles, particulate impurities, and pits. Finally, an enhanced image is output and used as input data for the subsequent first detection network.

[0017] The enhanced image is input into a first detection network, which outputs candidate defect regions and analyzes the candidate defect regions to generate a region of interest mask.

[0018] Furthermore, the enhanced image is input into a first detection network, which outputs candidate defect regions. The candidate defect regions are then analyzed to generate a region of interest mask, including: The feature extraction backbone network in the first detection network is extracted; a channel attention component is introduced to assign channel weights to the initial feature map extracted by the feature extraction backbone network to obtain a weighted feature map; a multi-scale feature fusion structure is invoked to perform multi-scale feature aggregation on the weighted feature map to obtain a fused feature map; based on the fused feature map, boundary regression and classification analysis are performed to output the bounding box and confidence score of the candidate defect region, and the region of interest mask is generated.

[0019] First, the feature extraction backbone network in the first detection network is extracted, and multi-layer convolutional feature extraction is performed on the enhanced image using the feature extraction backbone network. Edge texture features, scattered bright spot features, and defect morphology features in the image are extracted layer by layer through continuous convolution operations and non-linear activation operations to generate an initial feature map. Then, a channel attention component is introduced to assign channel weights to the initial feature map. Specifically, global spatial feature compression is performed on the initial feature map to obtain the global response information corresponding to each feature channel. The corresponding channel weight coefficient is calculated based on the response intensity of each channel, and then the channel weight coefficients are used to weight each channel of the initial feature map to obtain a weighted feature map, thereby enhancing the feature responses related to defects such as scratches, bubbles, particulate impurities, and pits. Afterward, a multi-scale feature fusion structure is invoked to perform multi-scale feature aggregation on the weighted feature map, unifying the scale of feature maps at different levels. Finally, a feature fusion structure is established to integrate shallow detail features with deep semantic features through feature splicing and information fusion. The correlation between the elements is analyzed to generate a fused feature map, which simultaneously contains detailed information about the defect edges and overall semantic information about the defect. After obtaining the fused feature map, the detection head performs boundary regression and classification analysis on it. Boundary regression is used to predict the position coordinates, width, and height of candidate defect regions in the enhanced image, while classification analysis is used to calculate the probability value of the corresponding candidate region belonging to the defect target, outputting the bounding boxes and confidence scores of multiple candidate defect regions. Subsequently, the confidence scores are compared with a preset confidence threshold, and candidate defect regions with confidence scores greater than the preset confidence threshold are retained, and the corresponding bounding boxes are mapped to the coordinate space of the enhanced image. Finally, a binary mask image with the same size as the enhanced image is constructed based on the position range of the retained bounding boxes. The regions inside the bounding boxes are marked as regions of interest, and the regions outside the bounding boxes are marked as regions of non-interest, generating the region of interest mask for subsequent second detection networks to perform pixel-level defect segmentation within the defined region.

[0020] Preferably, the first detection network is constructed using the YOLO object detection network to quickly detect candidate defect regions from the enhanced image and output the bounding boxes and confidence scores corresponding to the candidate defect regions.

[0021] Specifically, firstly, multiple sets of dark field image samples of explosion-proof film are collected, and scratch defects, bubble defects, particle defects, indentation defects, and wrinkle defects in the images are manually labeled to obtain the bounding box annotation information corresponding to the defect locations, thus establishing a training dataset for explosion-proof film defects. Subsequently, uniform size scaling, random flipping, random cropping, brightness perturbation, and contrast perturbation processing are performed on the images in the training dataset to generate data augmentation samples. Then, a YOLO object detection network is constructed, which includes a feature extraction backbone network, a channel attention component, a feature fusion network, and a detection head. The feature extraction backbone network employs a multi-layer convolutional structure to extract features from the input enhanced image layer by layer, obtaining initial feature maps at different scales. A channel attention component is introduced at the output of the feature extraction backbone network to assign weights to the feature responses of each channel, thereby enhancing defect scattering features and suppressing background noise features. Subsequently, a feature fusion network is used to upsample, downsample, and fuse the feature maps at different scales, establishing a multi-scale defect feature representation space. The fused features are then input into the detection head, which outputs the target class probability, bounding box center coordinates, bounding box width, and bounding box height. After completing the network structure, the training dataset is input into the YOLO object detection network for iterative training. During training, a total loss function is constructed using bounding box localization loss, target confidence loss, and target classification loss, and the network parameters are updated using the gradient backpropagation algorithm. When the decrease in validation set loss is less than a preset convergence threshold for multiple consecutive training epochs, or when the preset maximum number of training epochs is reached, training stops, and the first detection network after training is completed is output.

[0022] The enhanced image is input into the first detection network after training. The feature extraction backbone network extracts defect features, which are then enhanced by the channel attention component and input into the feature fusion network for multi-scale feature aggregation. The detection head then performs bounding box regression and defect classification, outputting the bounding boxes and confidence scores of the candidate defect regions. Subsequently, low-confidence detection results are filtered out according to the preset confidence threshold, and high-confidence candidate defect regions are retained. A region of interest mask is generated based on the retained bounding boxes.

[0023] Preferably, the channel attention component is constructed using an SE channel attention structure, which is used to perform channel importance analysis and weight allocation on the initial feature map output by the feature extraction backbone network.

[0024] Specifically, the initial feature map output from the feature extraction backbone network is input into the channel attention component. The initial feature map is sized C×H×W, where C represents the number of feature channels, H represents the feature map height, and W represents the feature map width. First, global average pooling is performed on each channel to spatially compress all pixel features within each channel, obtaining the global statistical feature value of the corresponding channel, thus forming a channel description vector of length C. Then, the channel description vector is input into a fully connected mapping network for nonlinear feature learning. The first fully connected layer compresses the channel dimension, extracting the correlation between channels. A nonlinear mapping is then performed using an activation function, and the original channel dimension is restored using a second fully connected layer, generating the weight response value corresponding to each channel. Next, the Sigmoid activation function is used to map the channel weight response value to the 0-1 interval, obtaining the channel weight coefficient corresponding to each feature channel. Finally, the channel weight coefficient is multiplied channel-by-channel with the corresponding channel of the initial feature map to complete the channel recalibration process, resulting in a weighted feature map. Among them, the weight coefficients of feature channels that generate strong responses to defect areas such as scratches, bubbles, particulate impurities and indentations are increased; the weight coefficients of feature channels that generate responses to background areas, light fluctuation areas and random noise areas are decreased, thereby increasing the proportion of defect features in the overall feature expression and realizing defect feature enhancement and background noise suppression.

[0025] Furthermore, the channel attention component extracts global spatial information from the initial feature map and maps it to weight coefficients for each channel to form the channel weight allocation.

[0026] Specifically, the process involves obtaining an initial feature map output by the feature extraction backbone network, wherein the initial feature map contains C feature channels; performing global average pooling on the initial feature map to compress the spatial features corresponding to each feature channel into a single channel feature value, generating a channel description vector; inputting the channel description vector into a first fully connected layer for channel dimension compression to obtain channel-related features; performing activation processing on the channel-related features and then inputting them into a second fully connected layer for channel dimension recovery to generate weight response values ​​corresponding to each feature channel; mapping the weight response values ​​using the Sigmoid normalization function to obtain channel weight coefficients corresponding to each feature channel; and performing a channel-by-channel weighted operation on the channel weight coefficients and the corresponding channels of the initial feature map to generate a weighted feature map. The output dimension of the first fully connected layer is C / r, the output dimension of the second fully connected layer is C, and r is the channel compression ratio, preferably 16; the activation processing uses the ReLU activation function; and the Sigmoid normalization function is used to constrain the channel weight coefficients to between 0 and 1. When a certain feature channel in the initial feature map has a high response to scratch defects, bubble defects, particle defects or indentation defects, the corresponding channel weight coefficient is increased; when a certain feature channel mainly represents the background area or noise area, the corresponding channel weight coefficient is decreased, thereby achieving defect feature enhancement and background noise suppression.

[0027] The region of interest mask is fused and cropped with the enhanced image and then input into the second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region.

[0028] Furthermore, the region of interest mask and the enhanced image are fused and cropped before being input into the second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region, including: The second detection network adopts an encoder-decoder structure, which includes an encoder branch, a decoder branch, and skip connection paths. The encoder branch receives the target scattering image and performs downsampling processing, extracting and outputting deep semantic feature maps at different scales step by step. The deep semantic feature maps at different scales include target feature maps, and the target scattering image refers to the image after fusing and cropping the region of interest mask and the enhanced image. The decoder branch receives the target feature map output by the encoder branch and performs upsampling processing, restoring the spatial resolution of the feature map step by step to obtain a restored feature map. The skip connection paths are activated to fuse the target feature map and the restored feature map, generating a fused feature map, and obtaining the binary mask of the defect region.

[0029] First, the target scattering image is received through the encoder branch, and convolution, nonlinear activation and downsampling operations are performed on the target scattering image in sequence to gradually reduce the feature map spatial size and gradually enhance the feature representation capability. In the downsampling process at each level, deep semantic feature maps of the corresponding scale are extracted to characterize the texture features, edge features, morphological features and scattering features of the defect region, and finally the target feature map corresponding to the highest scale is obtained. The target feature map contains global semantic information of the defect region. Subsequently, the target feature map output by the encoder branch is received through the decoder branch. Upsampling and convolutional feature reconstruction are sequentially performed on the target feature map to restore the spatial resolution of the feature map step by step, and a restored feature map corresponding to the spatial structure of the input image is obtained. During each level of feature restoration, the corresponding skip connection path is activated, and the feature information output by the downsampling stage of the same scale in the encoder branch is introduced into the decoder branch. It is then combined with the current restored feature map for feature splicing or feature fusion to compensate for the edge details and spatial location information lost during downsampling, generating a fused feature map. After feature fusion at all scales is completed, pixel-level classification calculation is performed on the final fused feature map to determine the probability value of each pixel position belonging to the defect region or the background region. The probability value is then binarized according to a preset segmentation threshold. When the defect probability of the corresponding pixel is greater than the preset segmentation threshold, the pixel is marked as a defect pixel; otherwise, it is marked as a background pixel, thereby generating a binary mask of the defect region. The binary mask of the defect region is used to characterize the actual contour boundary and spatial distribution of the defect region, providing basic data for subsequent defect geometric parameter extraction and product quality judgment.

[0030] Preferably, the second detection network is constructed using a defect segmentation network based on the U-Net architecture. Specifically, multiple explosion-proof film samples are acquired under dark-field imaging conditions to obtain dark-field images, and pixel-level contour annotations are performed on scratch defects, bubble defects, particle defects, pit defects, and wrinkle defects in the images to generate defect annotation masks that correspond one-to-one with the dark-field images. The dark-field images and defect annotation masks are processed to a uniform size to form training samples with a size of 512×512 pixels, and data augmentation processing is performed with random rotation ±15°, random horizontal flip, random vertical flip, 0.8 to 1.2 times random scaling, and ±20% brightness perturbation to construct training datasets, validation datasets, and test datasets.

[0031] A second detection network is constructed, which adopts an encoder-decoder structure, including an encoder branch, a decoder branch, and skip connection paths. The encoder branch is configured with N levels of downsampling units, preferably N=4. The first-level downsampling unit includes two consecutive 3×3 convolutional layers, a batch normalization layer, and a ReLU activation layer, and performs the first downsampling through a 2×2 max pooling layer, outputting a 64-dimensional feature map. The second-level downsampling unit receives the feature map output from the first-level downsampling unit as input, performs the second downsampling through two consecutive 3×3 convolutional layers and a 2×2 max pooling layer, outputting a 128-dimensional feature map. The third-level downsampling unit receives the feature map output from the second-level downsampling unit as input, outputting a 256-dimensional feature map. The fourth-level downsampling unit receives the feature map output from the third-level downsampling unit as input, outputting a 512-dimensional feature map, which serves as the target feature map.

[0032] The decoder branch is configured with M-level upsampling units, preferably M=4; the first-level upsampling unit receives the target feature map as input, restores the spatial resolution through a 2x upsampling layer, and outputs a 256-dimensional upsampling feature map after passing through two consecutive 3×3 convolutional layers; the second-level upsampling unit receives the feature map output by the first-level upsampling unit as input and outputs a 128-dimensional upsampling feature map; the third-level upsampling unit receives the feature map output by the second-level upsampling unit as input and outputs a 64-dimensional upsampling feature map; the fourth-level upsampling unit receives the feature map output by the third-level upsampling unit as input and restores the spatial resolution to the same level as the input image.

[0033] Four skip connection paths are established between the encoder branch and the decoder branch. The i-th skip connection path concatenates the feature map output by the i-th downsampling unit of the encoder branch with the upsampling feature map of the corresponding scale of the decoder branch, and generates a fused feature map through convolution. The skip connection paths are used to compensate for the edge detail information and position information lost during downsampling, thereby improving the accuracy of small defect boundary recognition.

[0034] After completing the network structure construction, the target scattering image is input into the second detection network, and the corresponding defect label mask is used as the supervision label. The predicted segmentation result is obtained through forward propagation. The joint loss function is calculated based on the predicted segmentation result and the defect label mask, where: the loss function L is composed of the weighted cross-entropy loss Lce and the Dice loss Ldice; L = 0.5 × Lce + 0.5 × Ldice. The Adam optimizer is used to update the network parameters, with the initial learning rate set to 0.001, the batch size set to 16, and the number of training epochs set to 200. When the loss value of the validation dataset decreases by less than 0.001 for 10 consecutive training epochs, or the average intersection-union ratio of the validation dataset reaches more than 95%, the network is deemed to have reached the convergence condition, training is stopped, and the trained second detection network is obtained.

[0035] The target scattering image, obtained by fusing and cropping the region of interest mask with the enhanced image, is input into the trained second detection network. Deep semantic features are extracted through the encoder branch, spatial resolution is restored through the decoder branch, and feature fusion is performed using skip connection paths. Finally, a defect probability map is output through a 1×1 convolutional classification layer. The defect probability map is binarized according to a segmentation threshold of 0.5. Pixels with a probability value greater than 0.5 are marked as defect pixels, and pixels with a probability value less than or equal to 0.5 are marked as background pixels, thus generating a binary mask for the defect region.

[0036] Furthermore, the encoder branch receives the target scattering image and performs downsampling processing to extract and output deep semantic feature maps of different scales step by step, including: the encoder branch is configured with N-level downsampling units; wherein the input of the first-level downsampling unit is the target scattering image after fusion and cropping, the input of the k-th-level downsampling unit is the output feature map of the (k-1)-th-level downsampling unit, and k takes values ​​from 2 to N in sequence.

[0037] N downsampling units are configured in the encoder branch. The first-level downsampling unit receives the fused and cropped target scattering image as input, performs convolutional feature extraction on the target scattering image, and reduces the spatial resolution of the feature map through stride convolution, pooling operations, or other downsampling methods to obtain the first-level output feature map. The first-level output feature map is then input to the second-level downsampling unit, which continues to perform convolutional feature extraction and downsampling processing to obtain the second-level output feature map. Feature data is then passed level by level in the same manner. The input to the k-th level downsampling unit is the feature map output by the (k-1)-th level downsampling unit, where k ranges from 2 to N. Each downsampling unit performs feature enhancement and spatial compression on the input feature map, gradually reducing the feature map size while gradually increasing the channel dimension, thereby improving the network's ability to express semantic information of the defect region. During the stepwise downsampling process, each downsampling unit outputs a deep semantic feature map at the corresponding scale and saves it to the feature buffer for subsequent skip connection paths. Finally, the Nth-level downsampling unit outputs the target feature map corresponding to the highest scale. The target feature map contains global defect semantic information after multi-layer feature abstraction, which is used to characterize the defect location, defect morphology, and defect distribution features in the target scattering image, and serves as input data for feature recovery in the decoder branch.

[0038] Furthermore, the decoder branch receives the target feature map output by the encoder branch and performs upsampling processing to restore the spatial resolution of the feature map step by step to obtain the restored feature map. This includes: the decoder branch is configured with M-level upsampling units; wherein the input of the first-level upsampling unit is the target feature map output by the encoder branch, the input of the j-th level upsampling unit is the upsampled feature map output by the (j-1)-th level upsampling unit, and j takes values ​​from 2 to M sequentially.

[0039] An M-level upsampling unit is configured in the decoder branch. The first-level upsampling unit receives the target feature map output from the encoder branch as input and performs upsampling processing on the target feature map. This upsampling is achieved by performing deconvolution, interpolation, or other feature recovery methods to enhance the spatial resolution of the feature map, and then combines this with convolutional feature reconstruction processing to generate a first-level upsampled feature map. The first-level upsampled feature map is then input to the second-level upsampling unit, which continues to perform spatial size expansion and feature reconstruction processing to generate a second-level upsampled feature map. Feature recovery is then performed level by level in the same manner, where the input of the j-th level upsampling unit is the output of the (j-1)-th level upsampling unit. The upsampled feature map is generated, with j ranging from 2 to M. Each upsampling unit gradually expands the spatial size of the feature map and restores the spatial structure information of the target region, so that the resolution of the feature map gradually approaches the original resolution of the target scattering image. During the step-by-step restoration process, each upsampling unit outputs an upsampled feature map of the corresponding scale and transmits the upsampled feature map to the corresponding skip connection path for feature fusion. Finally, the M-th upsampling unit outputs a restored feature map. The restored feature map restores the defect edge contour, spatial position relationship and local structural details while maintaining the deep semantic expression ability of the defect region, providing a feature basis for subsequent fusion feature map construction and defect region binary mask generation.

[0040] The geometric parameters of the defect region are obtained by analyzing the binary mask of the defect region, and the geometric parameters of the defect region are compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film to be tested.

[0041] Furthermore, the geometric parameters of the defect region are obtained by analyzing the binary mask of the defect region, and the geometric parameters of the defect region are compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film under test, including: Connectivity analysis is performed on the binary mask of the defect region to extract the contours of any independent connected components; arbitrary geometric parameters of the arbitrary independent connected components are obtained, wherein the arbitrary geometric parameters include arbitrary areas; it is determined whether the arbitrary area is within a preset defect area threshold; if not, the defect corresponding to the arbitrary independent connected component is determined to be a valid defect, and the total number and total area of ​​the valid defects are counted; if the total number does not exceed a preset number threshold and the total area does not exceed a preset total area threshold, the explosion-proof film under test is determined to be a qualified product; if the total number exceeds the preset number threshold or the total area exceeds the preset total area threshold, the explosion-proof film under test is determined to be a non-qualified product.

[0042] First, connected component analysis is performed on the binary mask of the defect region. The defect pixels in the binary mask are divided into regions according to pixel connectivity. Sets of interconnected defect pixels are identified as independent connected components, and the closed contours corresponding to each independent connected component are extracted. Then, the corresponding geometric parameters are calculated based on the contour coordinates of each independent connected component. These geometric parameters include one or more of area, perimeter, aspect ratio, equivalent diameter, and roundness, with at least an area parameter. Next, the area value corresponding to any independent connected component is obtained and compared with a preset defect area threshold. If the area value is within the preset defect area threshold range, the defect corresponding to the connected component is determined to be an allowable defect or noise region and is not included in subsequent quality evaluation. If the area value is not within the preset defect area threshold range, the defect corresponding to the independent connected component is determined to be... For each valid defect, its location coordinates, area value, and contour information are recorded. After completing the analysis of all independent connected components, all valid defects are summarized and statistically analyzed to obtain the total number of valid defects and the total area of ​​valid defects, where the total area of ​​valid defects is the sum of the area values ​​of all valid defects. Finally, the total number of valid defects is compared with a preset number threshold, and the total area of ​​valid defects is compared with a preset total area threshold. When the total number of valid defects does not exceed the preset number threshold and the total area of ​​valid defects does not exceed the preset total area threshold, the explosion-proof film under test is determined to meet the quality requirements and is a qualified product. When the total number of valid defects exceeds the preset number threshold or the total area of ​​valid defects exceeds the preset total area threshold, the explosion-proof film under test is determined to not meet the quality requirements and is a non-qualified product, and the corresponding defect statistics and test results are output.

[0043] The preset defect area threshold can be set to 0.01mm. 2 ~0.10mm 2 Preferably 0.05mm 2 When the area corresponding to an independent connected component is less than 0.05 mm 2 If a defect is identified as a noise area or a minor defect that is permissible, it will not be included in the statistics of valid defects.

[0044] The preset quantity threshold can be set to 5 to 20, preferably 10; that is, within a unit detection area, the quantity requirement is met when the total number of valid defects does not exceed 10.

[0045] The preset total area threshold can be set to 0.5mm. 2 ~5mm 2 Preferably 2mm 2 That is, when the cumulative area of ​​all valid defects within a unit detection area does not exceed 2mm. 2 The total area requirement must be met.

[0046] Specifically, when the total number of valid defects is ≤10 and the total area of ​​valid defects is ≤2mm 2 When the total number of valid defects is greater than 10 or the total area of ​​valid defects is greater than 2mm, the explosion-proof film under test is determined to be a qualified product; when the total number of valid defects is greater than 10 or the total area of ​​valid defects is greater than 2mm. 2 If the test is conducted, the explosion-proof film to be tested is determined to be a substandard product.

[0047] Furthermore, it also includes: Extract any equivalent diameter from the arbitrary geometric parameters; if the arbitrary equivalent diameter exceeds a preset scratch defect threshold, then determine that the arbitrary independent connected region is a surface scratch defect.

[0048] After obtaining the geometric parameters corresponding to any independent connected domain, an arbitrary equivalent diameter is extracted from the arbitrary geometric parameters, and the defect type is identified based on the equivalent diameter. The equivalent diameter is a circular diameter equal to the area of ​​the current independent connected domain, which can be calculated based on the area of ​​the independent connected domain. Specifically, first, the area value corresponding to any independent connected domain is obtained, and the corresponding equivalent diameter is calculated based on the area value. Then, the equivalent diameter is compared with a preset scratch defect threshold. The preset scratch defect threshold is pre-set according to the quality standards of explosion-proof film products, for example, it can be set to 0.20mm to 1.00mm, preferably 0.50mm. When the equivalent diameter exceeds the preset scratch defect threshold, it indicates that the defect has a large spatial extension range and obvious surface damage characteristics. The defect corresponding to the independent connected domain is then determined to be a surface scratch defect, and the position coordinates, area parameters, and equivalent diameter parameters of the corresponding scratch defect are recorded. When the equivalent diameter does not exceed the preset scratch defect threshold, the current defect category determination result remains unchanged, and statistical analysis continues as for valid defects. Finally, the scratch defect information and defect quantity statistics are output together for the quality evaluation and product classification management of explosion-proof film.

[0049] In summary, the embodiments of this application have at least the following technical effects: First, a dark-field image of the explosion-proof film under test is acquired. This dark-field image is obtained by capturing scattered light signals outside the specular reflection direction after illumination light is projected onto the surface of the film. Next, the dark-field image is sequentially subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching to obtain an enhanced image. Then, the enhanced image is input into a first detection network, which outputs candidate defect regions and analyzes these regions to generate a region of interest (ROI) mask. Further, the ROI mask and the enhanced image are fused and cropped before being input into a second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region. Finally, the binary mask of the defect region is analyzed to obtain the geometric parameters of the defect region, which are then compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film under test. This method solves the technical problem of high false negative rates for small defects on the surface of explosion-proof films in existing technologies. It achieves the technical effect of accurately locating and segmenting defect regions at the pixel level through dark-field imaging combined with dual-network cascaded detection, thereby improving the detection rate of small defects.

[0050] Example 2, based on the same inventive concept as the machine vision-based explosion-proof film surface defect detection method in the foregoing examples, such as... Figure 3 As shown, this application provides a machine vision-based explosion-proof film surface defect detection system, wherein the system includes: Image acquisition module 11: Acquires a dark field image of the explosion-proof film under test, wherein the dark field image is obtained by capturing the scattered light signal outside the specular reflection direction after the illumination light is projected onto the surface of the explosion-proof film under test; Image processing module 12: Performs grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching on the dark field image in sequence to obtain an enhanced image; First detection module 13: Inputs the enhanced image into a first detection network, which outputs candidate defect regions and analyzes the candidate defect regions to generate a region of interest mask; Second detection module 14: Merges and crops the region of interest mask with the enhanced image and inputs it into a second detection network, which performs pixel-level segmentation and outputs a binary mask of the defect region; Defect determination module 15: Analyzes the binary mask of the defect region to obtain the geometric parameters of the defect region, and compares the geometric parameters of the defect region with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film under test.

[0051] Furthermore, the image acquisition module 11 is used to perform the following methods: The optical constants of the explosion-proof film under test are obtained; the target light source wavelength of the target illumination source is determined based on the optical constants; the acquisition field of view of the image acquisition device of the explosion-proof film under test is obtained; the target incident angle of the target illumination source is determined based on the acquisition field of view; the scattered light signal is captured outside the specular reflection direction according to the target light source wavelength and the target incident angle; wherein, the target incident angle satisfies the following constraint: θ≥arc tan(D / 2H)+α, where D is the lens aperture of the image acquisition device, H is the vertical distance from the optical center of the image acquisition device to the surface of the explosion-proof film under test, and α is a preset safety margin angle.

[0052] Furthermore, the first detection module 13 is used to perform the following method: The feature extraction backbone network in the first detection network is extracted; a channel attention component is introduced to assign channel weights to the initial feature map extracted by the feature extraction backbone network to obtain a weighted feature map; a multi-scale feature fusion structure is invoked to perform multi-scale feature aggregation on the weighted feature map to obtain a fused feature map; based on the fused feature map, boundary regression and classification analysis are performed to output the bounding box and confidence score of the candidate defect region, and the region of interest mask is generated.

[0053] Furthermore, the first detection module 13 is used to perform the following method: The channel attention component extracts global spatial information from the initial feature map and maps it to weight coefficients for each channel, thus forming the channel weight allocation.

[0054] Furthermore, the second detection module 14 is used to perform the following method: The second detection network adopts an encoder-decoder structure, which includes an encoder branch, a decoder branch, and skip connection paths. The encoder branch receives the target scattering image and performs downsampling processing, extracting and outputting deep semantic feature maps at different scales step by step. The deep semantic feature maps at different scales include target feature maps, and the target scattering image refers to the image after fusing and cropping the region of interest mask and the enhanced image. The decoder branch receives the target feature map output by the encoder branch and performs upsampling processing, restoring the spatial resolution of the feature map step by step to obtain a restored feature map. The skip connection paths are activated to fuse the target feature map and the restored feature map, generating a fused feature map, and obtaining the binary mask of the defect region.

[0055] Furthermore, the second detection module 14 is used to perform the following method: The encoder branch receives the target scattering image and performs downsampling processing, extracting and outputting deep semantic feature maps of different scales step by step. The encoder branch is configured with N-level downsampling units. The input of the first-level downsampling unit is the target scattering image after fusion and cropping, and the input of the k-th level downsampling unit is the output feature map of the (k-1)-th level downsampling unit, where k takes values ​​from 2 to N.

[0056] Furthermore, the second detection module 14 is used to perform the following method: The decoder branch receives the target feature map output by the encoder branch and performs upsampling processing to restore the spatial resolution of the feature map step by step, thereby obtaining the restored feature map. This includes: the decoder branch is configured with M-level upsampling units; wherein the input of the first-level upsampling unit is the target feature map output by the encoder branch, the input of the j-th level upsampling unit is the upsampled feature map output by the (j-1)-th level upsampling unit, and j takes values ​​from 2 to M sequentially.

[0057] Furthermore, the defect determination module 15 is used to perform the following method: Connectivity analysis is performed on the binary mask of the defect region to extract the contours of any independent connected components; arbitrary geometric parameters of the arbitrary independent connected components are obtained, wherein the arbitrary geometric parameters include arbitrary areas; it is determined whether the arbitrary area is within a preset defect area threshold; if not, the defect corresponding to the arbitrary independent connected component is determined to be a valid defect, and the total number and total area of ​​the valid defects are counted; if the total number does not exceed a preset number threshold and the total area does not exceed a preset total area threshold, the explosion-proof film under test is determined to be a qualified product; if the total number exceeds the preset number threshold or the total area exceeds the preset total area threshold, the explosion-proof film under test is determined to be a non-qualified product.

[0058] Furthermore, the defect determination module 15 is used to perform the following method: Extract any equivalent diameter from the arbitrary geometric parameters; if the arbitrary equivalent diameter exceeds a preset scratch defect threshold, then determine that the arbitrary independent connected region is a surface scratch defect.

[0059] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A machine vision-based method for detecting surface defects in explosion-proof films, characterized in that, The method includes: Acquire a dark field image of the explosion-proof film to be tested. The dark field image is an image obtained by capturing the scattered light signal outside the specular reflection direction after illuminating the surface of the explosion-proof film to be tested. The dark field image is sequentially subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching to obtain an enhanced image. The enhanced image is input into a first detection network, which outputs candidate defect regions and analyzes the candidate defect regions to generate a region of interest mask. After fusing and cropping the region of interest mask with the enhanced image, the image is input into the second detection network, which performs pixel-level segmentation and outputs a binary mask of the defect region. The geometric parameters of the defect region are obtained by analyzing the binary mask of the defect region, and the geometric parameters of the defect region are compared with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film to be tested.

2. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 1, characterized in that, Acquire a dark-field image of the explosion-proof film to be tested. The dark-field image is an image obtained by capturing the scattered light signal outside the specular reflection direction after illuminating the surface of the explosion-proof film to be tested. This includes: Obtain the optical constants of the explosion-proof film to be tested; The target light source wavelength of the target illumination source is determined based on the optical constants; Obtain the field of view of the image acquisition device for the explosion-proof film under test; The target incident angle of the target illumination source is determined based on the acquired field of view. Based on the target light source wavelength and the target incident angle, the scattered light signal is captured outside the specular reflection direction; The target incident angle satisfies the following constraint: θ≥arc tan(D / 2H)+α, where D is the lens aperture of the image acquisition device, H is the vertical distance from the optical center of the image acquisition device to the surface of the explosion-proof film to be tested, and α is the preset safety margin angle.

3. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 1, characterized in that, The enhanced image is input into a first detection network, which outputs candidate defect regions. The candidate defect regions are then analyzed to generate a region of interest mask, including: Extract the feature extraction backbone network from the first detection network; A channel attention component is introduced to assign channel weights to the initial feature map extracted by the feature extraction backbone network to obtain a weighted feature map; The multi-scale feature fusion structure is retrieved to perform multi-scale feature aggregation on the weighted feature map, resulting in a fused feature map; Based on the fused feature map, boundary regression and classification analysis are performed to output the bounding box and confidence score of the candidate defect region, and the region of interest mask is generated.

4. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 3, characterized in that, The channel attention component extracts global spatial information from the initial feature map and maps it to weight coefficients for each channel, thus forming the channel weight allocation.

5. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 1, characterized in that, The region of interest mask is fused and cropped with the enhanced image and then input into the second detection network. The second detection network performs pixel-level segmentation and outputs a binary mask of the defect region, including: The second detection network adopts an encoder-decoder structure, which includes encoder branches, decoder branches, and jump connection paths; The encoder branch receives the target scattering image and performs downsampling processing, extracting and outputting deep semantic feature maps at different scales step by step. The deep semantic feature maps at different scales include target feature maps, and the target scattering image refers to the image after fusing and cropping the region of interest mask and the enhanced image. The decoder branch receives the target feature map output by the encoder branch and performs upsampling processing to restore the spatial resolution of the feature map step by step, thus obtaining the restored feature map. The skip connection path is activated to perform feature fusion on the target feature map and the restored feature map, generating a fused feature map and obtaining the binary mask of the defect region.

6. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 5, characterized in that, The encoder branch receives the target scattering image and performs downsampling processing, extracting and outputting deep semantic feature maps of different scales step by step, including: the encoder branch is configured with N-level downsampling units; The input to the first-level downsampling unit is the target scattering image after fusion and cropping, and the input to the k-th-level downsampling unit is the output feature map of the (k-1)-th-level downsampling unit, where k takes values ​​from 2 to N.

7. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 5, characterized in that, The decoder branch receives the target feature map output by the encoder branch and performs upsampling processing to restore the spatial resolution of the feature map step by step, thereby obtaining the restored feature map. This includes configuring an M-level upsampling unit in the decoder branch. The input of the first-level upsampling unit is the target feature map output by the encoder branch, and the input of the j-th level upsampling unit is the upsampled feature map output by the (j-1)-th level upsampling unit, where j ranges from 2 to M.

8. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 1, characterized in that, Analyzing the binary mask of the defect region yields the geometric parameters of the defect region, and comparing these parameters with a preset defect threshold, the surface defect detection results of the explosion-proof film under test are obtained, including: Connectivity analysis is performed on the binary mask of the defect region to extract the contours of any independent connected components; Obtain arbitrary geometric parameters of the arbitrary independent connected domain, wherein the arbitrary geometric parameters include arbitrary areas; Determine whether the arbitrary area is within a preset defect area threshold; If not, then the defect corresponding to any independent connected domain is determined to be a valid defect, and the total number and total area of ​​the valid defects are counted. If the total quantity does not exceed a preset quantity threshold and the total area does not exceed a preset total area threshold, then the explosion-proof film to be tested is determined to be a qualified product. If the total quantity exceeds a preset quantity threshold or the total area exceeds a preset total area threshold, the explosion-proof film to be tested is determined to be a substandard product.

9. The machine vision-based method for detecting surface defects in explosion-proof films as described in claim 8, characterized in that, Also includes: Extract any equivalent diameter from the given arbitrary geometric parameters; If any equivalent diameter exceeds a preset scratch defect threshold, then any independent connected region is determined to be a surface scratch defect.

10. A machine vision-based explosion-proof film surface defect detection system, characterized in that, The system is used to implement the machine vision-based explosion-proof film surface defect detection method according to any one of claims 1-9, the system comprising: Image acquisition module: acquires dark field images of the explosion-proof film under test. The dark field image is obtained by capturing the scattered light signal outside the specular reflection direction after the illumination light is projected onto the surface of the explosion-proof film under test. Image processing module: The dark field image is sequentially subjected to grayscale conversion, median filtering for noise reduction, and histogram equalization and contrast stretching to obtain an enhanced image; First detection module: Inputs the enhanced image into a first detection network, outputs candidate defect regions from the first detection network, and analyzes the candidate defect regions to generate a region of interest mask; The second detection module: after fusing and cropping the region of interest mask and the enhanced image, it is input into the second detection network, which performs pixel-level segmentation and outputs a binary mask of the defect region. Defect determination module: Analyzes the binary mask of the defect area to obtain the geometric parameters of the defect area, and compares the geometric parameters of the defect area with a preset defect threshold to obtain the surface defect detection result of the explosion-proof film to be tested.