Optical fiber connector end face defect detection method and system based on mixed attention mechanism and dynamic enhancement
Through a multi-dimensional hybrid attention mechanism and a dynamic data enhancement strategy, combined with a quadratic Gaussian function fitting method, the speed and accuracy issues in the detection of tiny defects on the end face of optical fiber connectors are solved, and high-precision real-time detection is achieved, which is suitable for embedded devices.
Patent Information
- Application Number
- CN202510713921.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-19
AI Technical Summary
Existing technologies have problems with slow detection speed, low accuracy and high false detection rate in the detection of tiny defects on the end faces of optical fiber connectors. Traditional convolutional neural network models have insufficient classification accuracy in low-contrast scenarios, and fixed data enhancement strategies lack dynamic adjustment capabilities.
A multi-dimensional hybrid attention mechanism and dynamic data enhancement strategy are adopted, combined with the quadratic Gaussian function fitting method to extract the zero optical path difference position of the white light interference curve, construct a hybrid attention network, perform feature fusion, and generate a dynamic enhancement strategy through geometric transformation, illumination simulation and noise injection, which is deployed in combination with edge optimization technology.
It achieves high-precision, real-time detection of fiber optic connector end faces, reduces the false detection rate, improves the robustness and adaptability of the model, and is suitable for the real-time detection needs of embedded devices.
Smart Images

Figure CN120672676A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial visual inspection technology, specifically a method and system for detecting defects on the end face of optical fiber connectors based on a hybrid attention mechanism and dynamic enhancement. This method is applicable to automated production lines for various types of optical fiber connectors, and is particularly effective for high-precision, real-time detection of minor defects with end face diameters less than 50 μm, such as scratches, fiber height, and fiber vertex offset. This invention can also be applied to defect detection tasks in precision manufacturing applications, such as chip solder joints and precision bearing surfaces. Background Art
[0002] Minute defects on the end face of the optical fiber connector, such as scratches, curvature radius, and optical fiber height, can seriously affect the quality of optical signal transmission. Existing technologies mainly rely on manual visual inspection, traditional convolutional neural network models, and fixed data augmentation strategies.
[0003] Quadratic Gaussian function fitting: A fitting method that combines quadratic and Gaussian functions, suitable for fitting data with peak characteristics and nonlinear backgrounds. The Gaussian term describes local peaks in the data, such as spectral peaks and signal impulses; the quadratic term can be used to fit the overall baseline of the image to understand background noise or drift. It is suitable for analyzing spectra, performing image processing, and processing physical experimental data, and is particularly well-suited for scenarios requiring simultaneous separation of signal and background.
[0004] Traditional convolutional neural network models have speed and accuracy deficiencies in detecting tiny defects. For example, VGG16 has 138M parameters and an inference speed of only 29FPS, which cannot adapt to the real-time detection needs of edge devices. ResNet50 is not sensitive enough to tiny defects, and its classification accuracy is less than 88% in low-contrast scenarios. Although GoogLeNet has fewer parameters, its positioning error for linear scratches is as high as ±10 pixels.
[0005] Fixed data augmentation strategies, through random selection and flipping, can easily introduce irrelevant noise, leading to increased false positives and a lack of dynamic adjustment capabilities. In contrast, detection methods based on hybrid attention mechanisms and dynamic augmentation strategies may better address the accuracy and speed issues of traditional network models. Summary of the Invention
[0006] In order to address the above-mentioned deficiencies in the prior art, the present invention proposes a defect detection method that integrates a multi-dimensional hybrid attention mechanism, dynamic data enhancement, and edge optimization, specifically comprising:
[0007] The white light interference grayscale image of the fiber optic connector end face is obtained through the optical path interference system and transmitted to the computer for data processing.
[0008] Extract interference curves from white light interference grayscale images:
[0009] Hundreds of white light interference images are stacked up, and the grayscale value is extracted at the same pixel point in each image to form a white light interference curve with the horizontal axis being the number of images (displacement) and the vertical axis being the grayscale value. The number of curves is the total number of pixels.
[0010] Since white light has low coherence and often has interference, the processing of white light interference curve requires the extraction of the zero optical path difference position.
[0011] The quadratic Gaussian function fitting method is used to extract the maximum point of the white light interference curve, which is the position of zero optical path difference.
[0012] The formula for the quadratic Gaussian function fitting method is:
[0013] f(x)=a×exp(-(xb) 2 / 2c 2 )+dx 2 +ex+f
[0014] It is a combination of a standard Gaussian function and a quadratic polynomial.
[0015] The zero optical path difference position of the white light interference curve can be obtained by fitting the quadratic Gaussian function, which facilitates the calculation of the second part.
[0016] Construct a multi-dimensional hybrid attention network and build an adaptive one-dimensional convolution CID in the channel attention branch k , dynamically adjust the convolution kernel size according to the number of channels C, and finally calculate the weight ω c ;
[0017] An asymmetric convolution kernel is built in the spatial attention branch, and 1×3 and 3×1 convolution kernels are connected in series to capture the linear directionality of scratches and the local aggregation of burrs.
[0018] Then generate the spatial mask M s , and perform feature fusion.
[0019] In order to improve the dynamic adjustment capability, the present invention constructs dynamic adaptive data enhancement and dynamically adjusts the enhancement strategy based on reinforcement learning.
[0020] An enhancement strategy library is generated through three categories of operations: geometric transformation, lighting simulation, and noise injection.
[0021] Data enhancement can improve the robustness of the model and make it suitable for detecting more different types of noise.
[0022] Perform rotation, horizontal flip and translation operations in the geometric transformation with an angle range of ±15%:
[0023] Image brightness and contrast are adjusted in the illumination simulation, and the brightness and contrast operating ranges are controlled within ±30% and ±20%, respectively.
[0024] Gaussian noise and salt and pepper noise are performed in noise injection.
[0025] Gaussian noise is a continuous random noise that follows a normal distribution and is used to simulate environmental interference;
[0026] Salt and pepper noise is a randomly distributed black and white dot noise; it is used to simulate machine errors in equipment.
[0027] The Gaussian noise parameter used is σ=0.05, and the salt and pepper noise density is 0.02.
[0028] Then, edge optimization deployment is carried out, including two core technologies: layered pruning and dynamic quantization:
[0029] In layer-wise pruning, the number of parameters is reduced by pruning 20% of the redundant convolution kernels after channel attention.
[0030] The quantization function is then compressed and activated to 4-bit, and the Q(x) function is used for dynamic quantization. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 :MAF-Net structure diagram, showing the channel attention branch (including CID k module) and spatial attention branch;
[0032] Figure 2 : DAD-Aug flow chart, showing the dynamic selection process of enhancement strategy;
[0033] Figure 3 : Edge optimization flow chart, including pruning, quantization functions and embedded device adaptation. DETAILED DESCRIPTION
[0034] A CCD device was used to collect 600 original images (resolution 672×282), of which 300 were images of optical fiber connector end faces with defects.
[0035] Extract interference curves from white light interference grayscale images:
[0036] Hundreds of white light interference images are stacked up, and the grayscale value is extracted at the same pixel point in each image to form a white light interference curve with the horizontal axis being the number of images (displacement) and the vertical axis being the grayscale value. The number of curves is the total number of pixels.
[0037] Since white light has low coherence and often has interference, the processing of white light interference curve requires the extraction of the zero optical path difference position.
[0038] The quadratic Gaussian function fitting method is used to extract the maximum point of the white light interference curve, which is the position of zero optical path difference.
[0039] The formula for the quadratic Gaussian function fitting method is:
[0040] f(x)=a×exp(-(xb) 1 / 2c 2 )+dx 2 +ex+f
[0041] It is a combination of a standard Gaussian function and a quadratic polynomial.
[0042] The zero optical path difference position of the white light interference curve can be obtained by fitting the quadratic Gaussian function, which facilitates the calculation of the second part.
[0043] Perform Bayer interpolation on the RAW format image and convert it to RGB format.
[0044] Perform normalization operation, calculate the mean I and variance σ of the data set, and then scale the pixel values to the [0,1] interval
[0045] Formula I norm =(I-μ) / σ.
[0046] 1564 training samples are generated through DAD-Aug.
[0047] Use the fiber end face dataset (including burrs and scratches) and divide the training set, validation set, and test set into 7:2:1.
[0048] Initialize MAF-Net, receive the image at the input layer, set the convolution layer to 3×3 convolution, 96 output channels, stride 1, and activation function ReLU;
[0049] The improved inception module contains four serial modules, each of which contains 1×1 dimensionality reduction convolution and 3×3 feature extraction convolution.
[0050] In the hybrid attention branch, the channel attention branch performs global average pooling, adaptive one-dimensional convolution, and Sigmoid activation operations.
[0051] The spatial attention branch performs 1×3 convolution to 3×1 convolution and finally uses the Sigmoid activation function.
[0052] In the classification layer, a global average pooling operation is performed, and then it enters the fully connected layer with 256 neurons, and finally outputs with SoftMax.
[0053] A dynamic data augmentation strategy is used, and the augmentation combination is updated every 10 epochs.
[0054] Then the channel attention weights of all convolutional layers are calculated and arranged in descending order.
[0055] The pruning threshold is set to the last 20% of the channel attention weight, retaining the first 80% of the key channels;
[0056] Then delete the redundant convolution kernels and adjust the number of adjacent input and output channels.
[0057] The activation value is logarithmized to retain high dynamic range features.
[0058] Finally, we configure edge deployment, build the hardware and software platform, and convert the PyTorch model to ONNX format.
[0059] Then use TensorRT to generate an optimized inference engine, integrate it into the embedded device, and use GStreamer to implement image acquisition, processing and result display.
[0060] Through the above steps, combined with deep learning algorithms, the end face features of the optical fiber connector can be obtained, thereby identifying defects such as vertex offset or scratches.
[0061] In summary, a detection method and system processing process based on a hybrid attention mechanism and dynamic enhancement strategy is as follows: First, images are acquired using a CCD device and then normalized. A dynamic enhancement strategy is used to generate training samples, which are then trained in a pre-built multi-dimensional hybrid attention network (MAF-Net). The images are then recognized and verified using a neural network algorithm. Finally, the system is deployed in an embedded device to build a detection system for detecting defects on the end faces of optical fiber connectors.
Claims
1. A method for detecting defects on an optical fiber connector end face, characterized in that: The following steps are involved: Constructing a multi-dimensional hybrid attention model (MAF-Net), which includes a channel attention branch and a spatial attention branch; The channel attention branch uses adaptive one-dimensional convolution to dynamically allocate channel weights to enhance defect texture feature extraction; The spatial attention branch generates a spatial mask through an asymmetric convolution kernel to highlight the spatial distribution of the defect area; Through dynamic adaptive data enhancement strategy, the data enhancement combination is adjusted in real time based on the loss gradient during training and the performance of the validation set; Perform layered pruning and dynamic quantization on the trained model to adapt to edge computing device deployment.
2. The method according to claim 1, characterized in that The calculation formula of the channel attention branch is: c =σ(CID k (y)); Among them, CID k For adaptive one-dimensional convolution, the k value is dynamically adjusted according to the number of channels C:
3. The method according to claim 1, characterized in that The spatial attention branch uses a combination of 1×3 and 3×1 convolution kernels to capture the linear characteristics of scratches and the local aggregation of burrs.
4. The method according to claim 1, wherein The dynamic adaptive data enhancement strategy includes the following steps: Build a library of enhancement strategies, including geometric transformation, lighting simulation, and noise injection; Through reinforcement learning, the enhanced combination is dynamically selected to prioritize the samples misclassified by the enhanced model.
5. The method according to claim 1, characterized in that The layered pruning dynamically prunes redundant convolution kernels according to channel attention weights, retaining the key layers for feature extraction.
6. A fiber optic connector short surface defect detection system, characterized in that: include: An image acquisition module, used to obtain an image of the optical fiber end face; A preprocessing module that performs dynamic adaptive data augmentation; Hybrid attention network module to achieve defect feature extraction and classification; The edge optimization module compresses and quantizes the model and then deploys it to embedded devices.
Citation Information
Cited By
Method and device for detecting end face defects of optical fiber connector
CN121438007A