A machine vision-based fiber optic grating writing alignment method and apparatus

Through the fiber grating writing alignment method based on machine vision, the improved Ladong transform algorithm and deep learning model are used to detect and segment the fiber image tilt, which solves the problems of insufficient accuracy and low efficiency of fiber grating writing in the prior art. High-precision and high-efficiency fiber positioning and alignment are achieved.

CN118897351BActive Publication Date: 2025-02-07SUZHOU CITY UNIV

Patent Information

Application Number
CN202411381609.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-02-07
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

The existing fiber grating writing methods have problems of insufficient accuracy and low efficiency, especially when dealing with longer fibers and facing noise, it is difficult to achieve high-precision and high-efficiency alignment.

Method used

Using a fiber grating writing alignment method based on machine vision, the first inclination angle of the core is calculated through the improved Ladong transformation algorithm, and the fiber image is segmented using a deep learning model to calculate the second inclination angle of the core. When the error between the two is less than or equal to the preset error, tilt correction is performed, the midpoint coordinates of the target core and the tilt correction angle are obtained, and transmitted to the fiber grating writing system.

Benefits of technology

The precise correction of optical fiber images is achieved, ensuring the precise alignment and stability of the engraving position, significantly improving the efficiency and robustness of the engraving, and improving the optical performance of the optical fiber grating.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897351B_ABST
    Figure CN118897351B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of fiber grating writing technology, and in particular to a fiber grating writing alignment method and device based on machine vision, including: collecting fiber images, calculating the first tilt angle of the core in the fiber image; segmenting the core in the fiber image using a deep learning model, and calculating the second tilt angle of the core; calculating the target tilt correction angle, and performing tilt correction on the fiber core segmentation image; obtaining the target core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction; transmitting the target core midpoint coordinates and the target tilt correction angle to the fiber grating writing system. The present invention obtains the target core midpoint coordinates based on the core segmentation image after tilt correction, and transmits them to the fiber grating writing system in combination with the target tilt correction angle, providing key data for fiber grating writing, ensuring the precise alignment of the writing position and the stability of the writing, and significantly improving the efficiency and robustness of the writing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of fiber grating writing, and in particular to a fiber grating writing alignment method and device based on machine vision. Background Art

[0002] Fiber Bragg Grating (FBG), as an important fiber optic sensing and communication device, plays a key role in modern fiber optic technology. Fiber Bragg Grating is formed by periodically modulating the refractive index in the fiber core. Its unique optical properties make it widely used in fiber optic sensing, optical communication, lasers and other fields. Especially in the field of fiber optic sensing, Fiber Bragg Grating plays an irreplaceable role in artificial intelligence and sensing in extreme environments such as high temperature due to its advantages such as high signal-to-noise ratio, corrosion resistance, electromagnetic interference resistance and multiplexing.

[0003] However, the performance and reliability of FBGs depend heavily on the accuracy of their manufacturing process, especially the alignment accuracy during the writing process, where the optical fiber needs to be precisely aligned with the laser focus to ensure the quality and consistency of the grating.

[0004] The traditional fiber Bragg grating writing alignment method mainly relies on manual operation. This method has problems such as low efficiency, insufficient precision, inconsistent alignment results between different operators, and its accuracy has great limitations. In order to overcome the limitations of manual alignment, researchers began to explore automatic alignment technology based on machine vision. Early machine vision alignment methods were mainly based on traditional image processing technologies, such as edge detection and morphological processing. These methods have improved the efficiency and accuracy of alignment to a certain extent, but there are still problems such as sensitivity to light, insufficient adaptability, weak anti-interference ability, slow processing speed, and difficulty in handling low-contrast situations.

[0005] In order to make up for the above shortcomings, existing research proposes to use vertical scanning to detect and record optical fibers. A side view of the optical fiber is obtained by a CCD camera installed on one side of the optical fiber. The interfaces of the optical fiber core, cladding, and coating can be seen from the image. Through these interfaces, the laser focus and the core axis of the optical fiber can be preliminarily aligned. After determining the approximate position of the optical fiber, the focus height is gradually adjusted using the CCD camera and the light intensity distribution information in the optical fiber image. When scanning in the vertical direction, this method accurately identifies the center of the fiber core by adjusting the focus position. When the focus height reaches the center of the fiber core, the light intensity difference between the fiber core and the cladding interface is minimized, thereby determining the position of the fiber core. However, this method still has the following problems:

[0006] (1) By gradually scanning the entire length of the optical fiber, relying on manual adjustment of the focus and positioning of the optical fiber core position, this manual or semi-automatic alignment method is susceptible to operational errors, especially when dealing with longer optical fibers, errors are easy to accumulate, resulting in insufficient accuracy;

[0007] (2) When faced with noise in the image (such as oil contamination or interference in the optical system), the lack of an effective processing mechanism may lead to inaccurate scanning results, especially for the detection of the edge of the optical fiber;

[0008] (3) Since it is necessary to gradually scan the entire length of the optical fiber, adjust the focus and determine the core of the fiber at each position, this process is not only time-consuming but also inefficient. It is difficult to meet the high efficiency requirements, especially in large-scale production or long optical fiber processing.

[0009] In summary, existing fiber Bragg grating writing methods all have the problems of insufficient accuracy and low efficiency. Summary of the invention

[0010] Therefore, the technical problem to be solved by the present invention is to overcome the problems of insufficient accuracy and low efficiency of the fiber grating writing method in the prior art.

[0011] In order to solve the above technical problems, the present invention provides a fiber Bragg grating writing alignment method based on machine vision, comprising:

[0012] Collect optical fiber images;

[0013] Calculate the first tilt angle of the fiber core in the optical fiber image;

[0014] Input the optical fiber image into the deep learning model to obtain the optical fiber core segmentation image;

[0015] The upper and lower edge coordinates of the fiber core are obtained based on the fiber core segmentation image, and the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image are calculated;

[0016] Performing linear fitting on the midpoint of the fiber core of each column of pixels in the fiber core segmentation image to calculate the second tilt angle of the fiber core;

[0017] When the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to the preset error, a target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the optical fiber core segmentation image is tilt-corrected according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, return to re-acquire the optical fiber image and calculate the first tilt angle of the fiber core and the second tilt angle of the fiber core;

[0018] Obtain the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction;

[0019] The target fiber core midpoint coordinates and the target tilt correction angle are transmitted to the controller of the moving platform in the fiber grating writing system.

[0020] Preferably, the first tilt angle of the fiber core in the optical fiber image is calculated using an improved Radon transform algorithm, including:

[0021] Preprocessing the optical fiber image;

[0022] In the range of [-10°, 10°], with a step size of 0.1°, the preprocessed fiber image is subjected to Radon transform, and the cumulative projection of each angle in the t-axis direction is calculated;

[0023] The minimum angle value of the cumulative projection of all pixel values ​​of the optical fiber image in the t-axis direction is obtained as the first tilt angle of the fiber core in the optical fiber image.

[0024] Preferably, the preprocessed optical fiber image is subjected to Radon transform to calculate the cumulative projection of each angle in the t-axis direction, and the formula includes:

[0025] ;

[0026] ;

[0027] in, Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, is the result of Radon transform, which indicates that the fiber image is along the angle Project to Projection integral of the axis; Represents the optical fiber image, represents the pixel coordinates of the optical fiber image in the Cartesian coordinate system; represents the Dirac delta function.

[0028] Preferably, the minimum angle value of the cumulative projection of all pixel values ​​of the optical fiber image in the t-axis direction is obtained as the first tilt angle of the fiber core in the optical fiber image, and the formula is:

[0029] ;

[0030] in, represents the first tilt angle of the fiber core, Indicates the angle, Indicates that all pixel values ​​of the optical fiber image are at an angle The sum of the cumulative projections under Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, Indicates solution The angle value when the minimum value is taken .

[0031] Preferably, the deep learning model adopts a U-Net network, and the Adam algorithm is used to optimize the U-Net network; the optical fiber image is input into the deep learning model, and each pixel in the optical fiber image is classified into two categories to obtain an optical fiber core segmentation image, wherein the classification categories include background and core, the background pixels are set to 0, and the core pixels are set to 1; when training the deep learning model, the difference between the predicted classification result and the label of each pixel in the optical fiber image is minimized through continuous iteration.

[0032] Preferably, when training the deep learning model, a loss function combining Wasserstein distance and binary cross entropy loss is used, and the formula is expressed as:

[0033] ;

[0034] in, is the loss function of the deep learning model, represents the loss weight, Indicates the batch size, represents the label of the i-th pixel, represents the predicted classification result of the i-th pixel, represents the Wasserstein distance loss, and Represent the Gaussian distribution of the gray value of the predicted fiber core result and label respectively.

[0035] Preferably, the formula of the Wasserstein distance loss is expressed as:

[0036] ;

[0037] ;

[0038] in, represents the Wasserstein distance, is a constant, Indicates and is the set of all joint probability distributions of marginal distributions, It means taking the lower bound. In the joint distribution Next, label And predict the classification results Expected value between.

[0039] Preferably, the preset error is set to 0.1°.

[0040] Preferably, the target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the formula is:

[0041] ;

[0042] in, represents the target tilt correction angle, represents the first tilt angle of the fiber core, Represents the second tilt angle of the fiber core.

[0043] The present invention also provides a fiber grating writing alignment device based on machine vision, comprising:

[0044] An acquisition module, used for acquiring optical fiber images;

[0045] A first tilt angle calculation module, used to calculate a first tilt angle of a fiber core in an optical fiber image;

[0046] A segmentation module is used to input the optical fiber image into the deep learning model to obtain an optical fiber core segmentation image;

[0047] A second tilt angle calculation module is used to obtain the upper and lower edge coordinates of the fiber core based on the fiber core segmentation image, and calculate the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image; perform linear fitting on the fiber core midpoint of each column of pixels in the fiber core segmentation image to calculate the second tilt angle of the fiber core;

[0048] A tilt correction module, for calculating a target tilt correction angle based on the first tilt angle of the fiber core and the second tilt angle of the fiber core when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to a preset error, and performing tilt correction on the fiber core segmentation image according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, returning to re-acquire the fiber image and calculating the first tilt angle of the fiber core and the second tilt angle of the fiber core;

[0049] A fiber core position calculation module is used to obtain the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction;

[0050] The transmission module is used to transmit the target fiber core midpoint coordinates and the target tilt correction angle to the controller of the mobile platform in the fiber grating writing system.

[0051] The above technical solution of the present invention has the following beneficial effects compared with the prior art:

[0052] The present invention discloses a method for aligning fiber grating writing based on machine vision. First, the global fiber image is tilted by an improved Radon transform algorithm to obtain the first tilt angle of the fiber core. Then, the fiber core in the fiber image is segmented by a deep learning model. The midpoint of the fiber core is linearly fitted to calculate the second tilt angle of the fiber core. When the error between the first tilt angle and the second tilt angle of the fiber core is less than or equal to the preset error, the target tilt correction angle is calculated. The core segmentation image is tilt-corrected. The mutual verification of the first tilt angle and the second tilt angle of the fiber core provides an effective guarantee for accurately calculating the target tilt correction angle, thereby achieving accurate correction of the fiber image. In addition, the present invention obtains the coordinates of the midpoint of the target fiber core based on the tilt-corrected core segmentation image, and transmits the coordinates to the fiber grating writing system in combination with the target tilt correction angle, thereby providing key data for fiber grating writing, ensuring the precise alignment of the writing position and the stability of the writing, significantly improving the efficiency and robustness of the writing, ensuring that the fiber grating has the required periodic refractive index modulation, and improving the optical performance of the fiber grating.

[0053] The present invention can achieve high-precision and high-efficiency optical fiber positioning and alignment, adapt to various types of optical fibers and production environments, and is easy to integrate with existing fiber grating writing systems. It is of great significance to improve the automation level of fiber grating manufacturing, improve product quality and production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:

[0055] Figure 1 It is a flow chart of a fiber grating writing and alignment method based on machine vision of the present invention;

[0056] Figure 2 It is a schematic diagram of the basic principle of Radon transform algorithm;

[0057] Figure 3 It is the optical fiber structure diagram and its corresponding CMO image;

[0058] Figure 4 is a U-Net network structure diagram for optical fiber core segmentation in Example 1;

[0059] Figure 5 is the optical fiber image and its label diagram in the first embodiment, wherein Figure 5 (a) and (c) are optical fiber images. Figure 5 (b) in the figure is the label map of (a). Figure 5 (d) in the figure is the label map of (c);

[0060] Figure 6is a schematic diagram of the tilt correction of the fiber core segmentation image, where Figure 6 (a) is a schematic diagram of calculating the second tilt angle of the fiber core using linear fitting. Figure 6 (b) is the fiber core segmentation image. Figure 6 (c) in the figure is the fiber core segmentation image after tilt correction. DETAILED DESCRIPTION

[0061] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention. Embodiment 1

[0062] Reference Figure 1 As shown, the present invention provides a fiber grating writing alignment method based on machine vision, the steps comprising:

[0063] S1, collecting optical fiber images;

[0064] S2, calculating a first tilt angle of the fiber core in the optical fiber image;

[0065] S3, inputting the optical fiber image into the deep learning model to obtain an optical fiber core segmentation image;

[0066] S4, obtaining the upper and lower edge coordinates of the fiber core based on the fiber core segmentation image, and calculating the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image;

[0067] S5, performing linear fitting on the midpoint of the fiber core of each column of pixels in the optical fiber core segmentation image to calculate the second tilt angle of the fiber core;

[0068] S6. When the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to the preset error, a target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the optical fiber core segmentation image is tilt-corrected according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, return to S1 to re-acquire the optical fiber image and calculate the first tilt angle of the fiber core and the second tilt angle of the fiber core;

[0069] S7, obtaining the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction;

[0070] S8. Transmit the target fiber core midpoint coordinates and the target tilt correction angle to the controller of the mobile platform in the fiber grating writing system.

[0071] In this embodiment, an improved Radon transform algorithm is used in S2 to calculate the first tilt angle of the fiber core in the optical fiber image, which is described in detail below.

[0072] Reference Figure 2 As shown, the basic principle of the Radon transform algorithm is to rotate the image coordinate axis by an angle ,angle The value range of is 0°-180°. The origin of the image coordinate axis is taken as the geometric center of the image. The integral of each bin of the image matrix at each angle is calculated to find the angle corresponding to the maximum or minimum integral value. The formula is expressed as:

[0073] ;

[0074] in, is the result of Radon transform, indicating that the input image is along the angle Project to The projection integral of the axis, represents the input image, Represents the pixel coordinates of the input image in the Cartesian coordinate system; Denotes the Dirac delta function, which is used to find all the values ​​that satisfy The points are integrated to map each pixel of the input image from Cartesian coordinates to a new coordinate system, that is, at an angle The projection value below.

[0075] Through in-depth analysis of the fiber image, the applicant found that the fiber tilt angle in the fiber image is usually within the range of ±10°. However, in order to ensure that the laser writes accurately within the effective range, the accuracy of angle detection must be controlled within ±0.1 degrees. In the fiber image, due to the presence of refractive index matching oil, peak noise is difficult to avoid, and the traditional Radon transform algorithm has low sensitivity to random peak noise in the fiber image, and performs poorly in the calculation of the fiber tilt angle, which affects the correct identification of the fiber core. Therefore, this embodiment improves the Radon transform algorithm, and the specific steps are as follows:

[0076] S2-1, preprocessing the optical fiber image, including graying and edge enhancement; Figure 3 The optical fiber structure diagram and its corresponding CMO image;

[0077] S2-2. In the range of [-10°, 10°], with a step size of 0.1°, perform Radon transform on the preprocessed fiber image and calculate the cumulative projection of each angle in the t-axis direction. The formula is:

[0078] ;

[0079] in, Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, is the result of Radon transform, which indicates that the fiber image is along the angle Project to The projected integral about the axis.

[0080] S2-3. Obtain the minimum angle value of the cumulative projection of all pixel values ​​of the optical fiber image in the t-axis direction as the first tilt angle of the fiber core in the optical fiber image. The formula is:

[0081] ;

[0082] in, represents the first tilt angle of the fiber core, Indicates the angle, Indicates that all pixel values ​​of the optical fiber image are at an angle The sum of the cumulative projections under Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, the value range of k is -0.5 to 0.5, Indicates solution The angle value when the minimum value is taken .

[0083] In this embodiment, the deep learning model in S3 adopts the U-Net network.

[0084] Traditional edge detection methods, such as those combined with Hough transform technology, are easily interfered by noise when detecting the fiber core, especially in the face of common speckle noise. These methods rely heavily on manual feature extraction and require a large number of preprocessing steps to improve accuracy, but have limited effects in noisy backgrounds. Although some researchers have proposed core extraction methods based on image intensity distribution, due to the diversity of fiber types and the influence of peak noise, these methods are still difficult to accurately extract the core position in practical applications. In order to solve these problems, the U-Net network is selected in this embodiment. The U-Net network can automatically learn and extract features, and has higher robustness when processing images with complex backgrounds and noise, making it the preferred method for fiber core identification. Figure 4 FIG. 4 is a diagram of the U-Net network structure used for optical fiber core segmentation in this embodiment.

[0085] The traditional U-Net network consists of an encoder-decoder structure. The encoder performs downsampling, capturing the context of the fiber image through a series of convolutional layers, followed by a maximum pooling layer to reduce the spatial dimension. The decoder performs upsampling, reconstructing the spatial dimensions of the feature map using transposed convolutions, and skipping connections from the encoder layer to preserve high-resolution features.

[0086] Preferably, when training the deep learning model, this embodiment further uses the Adam algorithm to optimize the U-Net network.

[0087] The Adam algorithm uses square gradient and exponential move estimation, and performs well in parameter optimization of deep learning models. It can adaptively adjust the learning rate and adjust the learning rate according to the size and stability of the gradient, thereby improving the convergence speed and stability of the model.

[0088] The principle of Adam algorithm is as follows:

[0089] The hyperparameter calculation formula for the model's t+1th iteration is:

[0090] ;

[0091] in, and denote the hyperparameters of the t+1th iteration and the tth iteration respectively, represents the learning rate, It is a relative constant with a small value, used to avoid the denominator being 0; represents the bias-corrected first-order moment estimate of the t-th iteration, i.e., the moving average of the gradient; represents the bias-corrected second-order moment estimate at iteration t, i.e., the moving average of the squared gradient.

[0092] and The formula is:

[0093] ;

[0094] ;

[0095] in, represents the moving average of the first-order moment of the t-th iteration, represents the moving average of the second-order moment of the t-th iteration, and They are the attenuation coefficients of the first-order moment and the second-order moment, respectively, used to control the update rates of the first-order moment and the second-order moment. Usually, their values ​​are close to 1, such as 0.9 and 0.999; and They are and to the power of t, where t is the number of iterations.

[0096] and The formula is:

[0097] ;

[0098] ;

[0099] in, represents the moving average of the first-order moment of the t-1th iteration, which is the exponentially weighted moving average of the gradient, Represents the moving average of the second-order moment of the t-1th iteration, which is the exponentially weighted moving average of the square of the gradient, and is mainly used to control the adaptive adjustment of the learning rate. represents the loss function, Represents the gradient.

[0100] gradient The formula is:

[0101] ;

[0102] in, and denote the error rates of the t-th iteration and the t-1-th iteration, respectively. and They represent the hyperparameters of the t-th iteration and the t-1-th iteration respectively, and t is the number of iterations.

[0103] The optical fiber image is input into the deep learning model, and each pixel in the optical fiber image is classified into two categories to obtain an optical fiber core segmentation image, wherein the classification categories include background and core, the background pixels are set to 0, and the core pixels are set to 1; when training the deep learning model, the difference between the predicted classification result and the label of each pixel in the optical fiber image is minimized through continuous iteration to obtain the parameters of each layer in the network.

[0104] Since the accurate extraction of the optical fiber core is extremely important for the subsequent upper and lower edge extraction and the midpoint connection and tilt angle identification based on this, and the edge of the optical fiber core contains multiple extremely small pixels, ordinary loss functions are difficult to apply to the identification and extraction of the core.

[0105] Therefore, when training the deep learning model, this embodiment uses the Wasserstein distance as the loss function of the deep learning model. After experimentation, it is found that simply using the Wasserstein distance as the loss function will affect the convergence speed of the network. Finally, this embodiment uses a loss function that combines the Wasserstein distance with the binary cross entropy loss, and the formula is expressed as:

[0106] ;

[0107] in, is the loss function of the deep learning model, represents the loss weight, Indicates the batch size, represents the label of the i-th pixel, represents the predicted classification result of the i-th pixel, represents the Wasserstein distance loss, and Represent the Gaussian distribution of the gray value of the predicted fiber core result and label respectively.

[0108] Figure 5 is the optical fiber image and its label diagram used in this embodiment, where Figure 5 (a) and (c) are optical fiber images. Figure 5 (b) in the figure is the label map of (a). Figure 5 (d) in the figure is the label map of (c).

[0109] The formula of Wasserstein distance loss is expressed as:

[0110] ;

[0111] ;

[0112] in, represents the Wasserstein distance, is a constant, Indicates and is the set of all joint probability distributions of marginal distributions, It means taking the lower bound. In the joint distribution Next, label And predict the classification results Expected value between.

[0113] The applicant used confusion matrix to evaluate the above deep learning model in the experiment. The experimental results clearly showed that the prediction accuracy of the fiber core reached 99.2% in both categories. The accuracy of the segmentation of fiber core pixels by the U-Net network optimized by the Adam algorithm increased from 93.44% to 98.82%, an increase of 5.38% over the traditional method.

[0114] Specifically, in S4, the coordinates of the midpoint of the fiber core of each column of pixels in the fiber core segmentation image are calculated according to the upper and lower edge coordinates of the fiber core, and the formula is:

[0115] ;

[0116] in, is the maximum value of the core coordinates of each column of pixels in the fiber core segmentation image, is the minimum value of the core coordinates of each column of pixels in the fiber core segmentation image, The coordinates of the midpoint of the fiber core in each column of pixels in the fiber core segmentation image.

[0117] Preferably, after experiments, the preset error in S6 is set to 0.1°.

[0118] Specifically, in S6, the target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the formula is:

[0119] ;

[0120] in, represents the target tilt correction angle, represents the first tilt angle of the fiber core, Represents the second tilt angle of the fiber core.

[0121] Reference Figure 6 As shown, Figure 6 Schematic diagram of the tilt correction of the fiber core segmentation image, where Figure 6 (a) is a schematic diagram of calculating the second tilt angle of the fiber core using linear fitting. Figure 6 (b) is the fiber core segmentation image. Figure 6 (c) in the figure is the fiber core segmentation image after tilt correction.

[0122] In summary, the fiber grating writing alignment method based on machine vision described in the present invention first detects the tilt of the global fiber image through the improved Radon transform algorithm to obtain the first tilt angle of the core, and then uses the deep learning model to segment the core in the fiber image, linearly fits the midpoint of the core, and calculates the second tilt angle of the core. When the error between the first tilt angle and the second tilt angle of the core is less than or equal to the preset error, the target tilt correction angle is calculated, and the core segmentation image is tilt-corrected. The mutual verification of the first tilt angle and the second tilt angle of the core provides an effective guarantee for accurately calculating the target tilt correction angle, and realizes the accurate correction of the fiber image. In addition, the present invention obtains the coordinates of the midpoint of the target core based on the tilt-corrected core segmentation image, and transmits them to the fiber grating writing system in combination with the target tilt correction angle, which provides key data for fiber grating writing, ensures the precise alignment of the writing position and the stability of the writing, significantly improves the efficiency and robustness of the writing, ensures that the fiber grating has the required periodic refractive index modulation, and improves the optical performance of the fiber grating.

[0123] The present invention can achieve high-precision and high-efficiency optical fiber positioning and alignment, adapt to various types of optical fibers and production environments, and is easy to integrate with existing fiber grating writing systems. It is of great significance to improve the automation level of fiber grating manufacturing, improve product quality and production efficiency. Embodiment 2

[0124] Based on the fiber Bragg grating writing alignment method based on machine vision in the first embodiment, this embodiment provides a fiber Bragg grating writing alignment device based on machine vision, including:

[0125] A first tilt angle calculation module, used to calculate a first tilt angle of a fiber core in an optical fiber image;

[0126] A segmentation module is used to input the optical fiber image into the deep learning model to obtain an optical fiber core segmentation image;

[0127] A second tilt angle calculation module is used to obtain the upper and lower edge coordinates of the fiber core based on the fiber core segmentation image, and calculate the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image; perform linear fitting on the fiber core midpoint of each column of pixels in the fiber core segmentation image to calculate the second tilt angle of the fiber core;

[0128] A tilt correction module, for calculating a target tilt correction angle based on the first tilt angle of the fiber core and the second tilt angle of the fiber core when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to a preset error, and performing tilt correction on the fiber core segmentation image according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, returning to re-acquire the fiber image and calculating the first tilt angle of the fiber core and the second tilt angle of the fiber core;

[0129] A fiber core position calculation module is used to obtain the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction;

[0130] A transmission module is used to transmit the target core midpoint coordinates and the target tilt correction angle to the controller of the mobile platform in the fiber grating writing system. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0131] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0134] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A fiber Bragg grating writing alignment method based on machine vision, characterized in that: include: Collect optical fiber images; The improved Radon transform algorithm is used to calculate the first tilt angle of the fiber core in the optical fiber image, including: Preprocessing the optical fiber image; In the range of [-10°, 10°], with a step size of 0.1°, the preprocessed fiber image is subjected to Radon transform, and the cumulative projection of each angle in the t-axis direction is calculated. The formula includes: ; ; in, Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, is the result of Radon transform, which indicates that the fiber image is along the angle Project to Projection integral of the axis; Represents the optical fiber image, represents the pixel coordinates of the optical fiber image in the Cartesian coordinate system; represents the Dirac delta function; The minimum angle value of the cumulative projection of all pixel values ​​of the optical fiber image in the t-axis direction is obtained as the first tilt angle of the fiber core in the optical fiber image. The formula is: ; in, represents the first tilt angle of the fiber core, Indicates the angle, Indicates that all pixel values ​​of the optical fiber image are at an angle The sum of the cumulative projections under Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, Indicates solution The angle value when the minimum value is taken ; The optical fiber image is input into a deep learning model to obtain an optical fiber core segmentation image; the deep learning model adopts a U-Net network, and the U-Net network is optimized by an Adam algorithm; the optical fiber image is input into the deep learning model, and each pixel in the optical fiber image is classified into two categories to obtain an optical fiber core segmentation image, wherein the classification categories include background and core, the background pixels are set to 0, and the core pixels are set to 1; when training the deep learning model, the difference between the predicted classification result and the label of each pixel in the optical fiber image is minimized through continuous iteration; The upper and lower edge coordinates of the fiber core are obtained based on the fiber core segmentation image, and the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image are calculated; Performing linear fitting on the midpoint of the fiber core of each column of pixels in the fiber core segmentation image to calculate the second tilt angle of the fiber core; When the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to the preset error, a target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the optical fiber core segmentation image is tilt-corrected according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, return to re-acquire the optical fiber image and calculate the first tilt angle of the fiber core and the second tilt angle of the fiber core; Obtain the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction; The target fiber core midpoint coordinates and the target tilt correction angle are transmitted to the controller of the moving platform in the fiber grating writing system.

2. The method for aligning fiber grating writing based on machine vision according to claim 1, characterized in that: When training the deep learning model, a loss function combining Wasserstein distance and binary cross entropy loss is used, and the formula is expressed as: ; in, is the loss function of the deep learning model, represents the loss weight, Indicates the batch size, represents the label of the i-th pixel, represents the predicted classification result of the i-th pixel, represents the Wasserstein distance loss, and Represent the Gaussian distribution of the gray value of the predicted fiber core result and label respectively.

3. The method for aligning fiber grating writing based on machine vision according to claim 2, characterized in that: The formula of the Wasserstein distance loss is expressed as: ; ; in, represents the Wasserstein distance, is a constant, Indicates and is the set of all joint probability distributions of marginal distributions, It means taking the lower bound. In the joint distribution Next, label And predict the classification results Expected value between.

4. The method for aligning fiber grating writing based on machine vision according to claim 1, characterized in that: The preset error is set to 0.1°.

5. The method for aligning fiber grating writing based on machine vision according to claim 4, characterized in that: The target tilt correction angle is calculated based on the first tilt angle of the fiber core and the second tilt angle of the fiber core, and the formula is: ; in, represents the target tilt correction angle, represents the first tilt angle of the fiber core, Represents the second tilt angle of the fiber core.

6. A fiber grating writing alignment device based on machine vision, characterized in that: include: An acquisition module, used for acquiring optical fiber images; The first tilt angle calculation module is used to calculate the first tilt angle of the fiber core in the optical fiber image by using an improved Radon transform algorithm, including: Preprocessing the optical fiber image; In the range of [-10°, 10°], with a step size of 0.1°, the preprocessed fiber image is subjected to Radon transform, and the cumulative projection of each angle in the t-axis direction is calculated. The formula includes: ; ; in, Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, is the result of Radon transform, which indicates that the fiber image is along the angle Project to Projection integral of the axis; Represents the optical fiber image, represents the pixel coordinates of the optical fiber image in the Cartesian coordinate system; represents the Dirac delta function; The minimum angle value of the cumulative projection of all pixel values ​​of the optical fiber image in the t-axis direction is obtained as the first tilt angle of the fiber core in the optical fiber image. The formula is: ; in, represents the first tilt angle of the fiber core, Indicates the angle, Indicates that all pixel values ​​of the optical fiber image are at an angle The sum of the cumulative projections under Indicates the optical fiber image along the angle Project to The cumulative projection of the axis, Indicates solution The angle value when the minimum value is taken ; A segmentation module is used to input the optical fiber image into a deep learning model to obtain an optical fiber core segmentation image; the deep learning model adopts a U-Net network, and the U-Net network is optimized by an Adam algorithm; the optical fiber image is input into the deep learning model, and each pixel in the optical fiber image is classified into two categories to obtain an optical fiber core segmentation image, wherein the classification categories include background and core, the background pixels are set to 0, and the core pixels are set to 1; when training the deep learning model, the difference between the predicted classification result and the label of each pixel in the optical fiber image is minimized through continuous iteration; A second tilt angle calculation module is used to obtain the upper and lower edge coordinates of the fiber core based on the fiber core segmentation image, and calculate the fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image; perform linear fitting on the fiber core midpoint of each column of pixels in the fiber core segmentation image to calculate the second tilt angle of the fiber core; A tilt correction module, for calculating a target tilt correction angle based on the first tilt angle of the fiber core and the second tilt angle of the fiber core when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is less than or equal to a preset error, and performing tilt correction on the fiber core segmentation image according to the target tilt correction angle; when the error between the first tilt angle of the fiber core and the second tilt angle of the fiber core is greater than the preset error, returning to re-acquire the fiber image and calculating the first tilt angle of the fiber core and the second tilt angle of the fiber core; A fiber core position calculation module is used to obtain the target fiber core midpoint coordinates of each column of pixels in the fiber core segmentation image after tilt correction; The transmission module is used to transmit the target fiber core midpoint coordinates and the target tilt correction angle to the controller of the mobile platform in the fiber grating writing system.

Citation Information

Patent Citations

  • Fiber bragg grating precision inscribing system and method with nonlinear effect inhibiting function

    CN114019603A

  • Automatic position device is inscribed to detection fibers grating

    CN208269936U

Cited By

  • Optical fiber inclination angle calculation method based on image algorithm

    CN121163472A