Fiber bragg grating flexible rod shape reconstruction method based on double-branch neural network

By constructing a dual-branch neural network and combining 1D-CNN, 2D-CNN and BiLSTM, the network attention level is dynamically adjusted, which solves the problem of low shape reconstruction accuracy in existing fiber Bragg grating sensing technology and realizes high-precision, real-time deformation sensing of flexible structures.

CN121576940APending Publication Date: 2026-02-27QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511482855.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing deep learning methods struggle to simultaneously model channel differences and temporal dependencies in fiber Bragg grating (FBG) spectra in fiber Bragg grating (FBG) sensing technology. They neglect the frequency domain distribution and inter-channel response information in the spectra and lack a mechanism to focus on key wavelength points, resulting in low shape reconstruction accuracy.

Method used

A dual-branch neural network approach is adopted. The 1D-CNN branch processes the spectral sequence of one-dimensional light intensity signals, while the 2D-CNN branch reconstructs the three-channel spectral data into a two-dimensional image for feature extraction. The feature fusion module and BiLSTM network are combined, and the channel attention module and sequence attention module are integrated to dynamically adjust the network’s attention to spectral channels and time steps, and shape reconstruction is performed directly using real-time spectral data.

Benefits of technology

It significantly improves shape reconstruction accuracy, reduces prediction error, enhances the model's ability to model spatial continuity and structural dependence, and meets the needs of high-precision, real-time flexible structure deformation perception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121576940A_ABST
    Figure CN121576940A_ABST
Patent Text Reader

Abstract

The invention provides a fiber bragg grating flexible rod shape reconstruction method based on a double-branch neural network, and relates to the technical field of optical fiber sensing, and the method comprises the steps: laying an FBG array with the node spacing of 20 mm on a flexible rod, synchronously collecting the spectral signal of the FBG array and a two-dimensional coordinate obtained by an industrial camera, and constructing a spectrum-coordinate pairing data set. Constructing a double-branch neural network comprising a 1D-CNN and a 2D-CNN, and respectively extracting a time sequence feature and a channel space feature of the spectrum; after weighted fusion and full-connection compression, features are reconstructed into a time sequence, the time sequence is input into BiLSTM for time sequence modeling, and a channel and a sequence attention mechanism are integrated to dynamically focus key information. After training is completed, the model can directly output the two-dimensional coordinates of all monitoring points of the flexible rod for the real-time spectrum, and high-precision and end-to-end shape reconstruction is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of optical fiber sensing, and particularly relates to a fiber grating flexible rod shape reconstruction method based on a double-branch neural network. BACKGROUND

[0002] The fiber Bragg grating (FBG) sensing technology has been widely applied in the fields of structural health monitoring, medical interventional instruments, flexible mechanical arms, aviation composite materials and the like due to its small size, high sensitivity, anti-electromagnetic interference, distributed deployment and the like. In the flexible structure shape reconstruction task, the traditional method mainly relies on a physical model, such as an arc length splicing method, a Frenet frame method or a Bishop translation frame method, converts the FBG center wavelength drift into a strain, calculates the curvature from the strain, and finally reconstructs the spatial shape of the flexible structure through recursive integration.

[0003] In recent years, with the development of artificial intelligence technology, the coordinate prediction method based on deep learning has been gradually introduced into the optical fiber shape reconstruction task, forming an "end-to-end" data-driven technology route. However, the existing deep learning method mainly adopts a single convolutional neural network (CNN) or a long short-term memory network (LSTM), and the structure is simple, which is difficult to model the channel difference and time sequence dependence in the FBG spectrum image; and the FBG reflection wavelength or strain sequence is taken as a static input, and the frequency domain distribution and response information between channels in the spectrum image are ignored; at the same time, the model lacks a focusing mechanism for key wavelength points, and it is difficult for the model to focus on key information. SUMMARY

[0004] The application provides a fiber grating flexible rod shape reconstruction method based on a double-branch neural network to solve one of the above technical problems.

[0005] The technical scheme adopted by the application is as follows: The application provides a fiber grating flexible rod shape reconstruction method based on a double-branch neural network, comprising: The fiber grating array is arranged on the flexible rod, and the fiber grating array comprises a plurality of FBG nodes, and the node spacing is 20 mm; The spectrum signal of the fiber grating array is collected by a fiber grating demodulator, and the two-dimensional coordinates of the deformed flexible rod are collected by an industrial camera to form a spectrum-coordinate paired data set for training the model; The double-branch neural network is constructed, including a 1D-CNN branch processing a one-dimensional light intensity signal of the spectrum sequence, and a 2D-CNN branch reconstructing the three-channel spectrum data into a two-dimensional image for feature extraction; The design feature fusion module fuses the 1D-CNN branch output and the 2D-CNN branch output in a proportion of 0.3:0.7, and then the fused feature vector is input into a BiLSTM network after being compressed by a full connection layer, a time sequence modeling module is constructed, and a channel attention module and a sequence attention module are integrated to dynamically adjust the attention degree of the network to the spectral channel and the time step. The double-branch neural network model is trained, real-time spectral data is input into the trained neural network model, and two-dimensional coordinates of each monitoring point of the flexible rod are output.

[0006] According to an embodiment of the present application, the flexible rod is made of polyether ether ketone material, and the fiber grating array is fixed in the flexible rod channel by polyimide coating and epoxy AB glue. According to an embodiment of the present application, the spectrum-coordinate pairing data set includes a spectrum vector and a corresponding coordinate label, wherein the spectrum vector is 3 channels x 256 dimensions, and the coordinate label is two-dimensional coordinates of 12 points, a total of 24 dimensions.

[0007] According to an embodiment of the present application, the 1D-CNN branch extracts key time sequence features related to bending amplitude, and the 2D-CNN branch extracts features for inter-channel difference and local area response mode.

[0008] According to an embodiment of the present application, the BiLSTM network is a two-layer stacked structure, and the number of hidden units is 512.

[0009] According to an embodiment of the present application, the channel attention module generates channel weights through global average pooling and a full connection network.

[0010] According to an embodiment of the present application, the sequence attention module generates time step weights through global average pooling and a full connection network.

[0011] According to an embodiment of the present application, the real-time prediction process includes data preprocessing, feature extraction, feature fusion, time sequence modeling, and coordinate prediction. The data preprocessing includes spectral signal denoising and normalization processing. The model training adopts mean square error as a loss function, adopts AdamW optimizer, and adopts Cosine annealing learning rate scheduling strategy.

[0012] The second aspect embodiment of the present application provides a computer readable storage medium having a program stored thereon, and the program is executed by a processor to realize the steps in the method.

[0013] The third aspect of the present application provides an electronic device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps in the method when executing the program.

[0014] Thanks to the above technical solutions, the present application has the following beneficial effects: The present application constructs a double-branch neural network, the 1D-CNN branch effectively extracts the amplitude change characteristics generated by the deformation in the spectral sequence, and the 2D-CNN branch effectively models the response differences between different fiber channels. The two branches work together to realize the joint modeling of the multi-dimensional information of the FBG reflection spectrum, significantly improving the shape reconstruction accuracy. The end-to-end spectrum-to-coordinate mapping method is adopted, which skips the multi-stage modeling process of "demodulation-modeling-inversion" in the traditional method, and directly uses the deep network for joint modeling, which fundamentally avoids the problem of error accumulation in the traditional recursive method. By constructing a time series modeling module, the fused feature vector is reconstructed into a time series and input into the BiLSTM network, which can simultaneously capture the forward and backward dynamic laws of the flexible structure along the fiber layout direction during the deformation process, enhancing the modeling ability of the model to the spatial continuity and structure dependence. By integrating the channel attention module and the sequence attention module, the network's attention to the spectral channels and time steps is dynamically adjusted, effectively highlighting the FBG channels and key wavelength segments that contribute more to deformation perception, suppressing redundant or low-correlation channel features, and significantly reducing the prediction error. The complete FBG reflection spectrum intensity curve is directly used as the input feature without strain conversion or dimensionality reduction preprocessing, preserving the original physical characteristics and nonlinear variation rules in FBG response, providing the model with rich, original, and physically interpretable input information, significantly improving the applicability and robustness of the model in real engineering scenarios. By inputting real-time spectral data into the trained neural network model, the two-dimensional coordinates of each monitoring point of the flexible rod can be output in real time, meeting the demand for high-precision, real-time flexible structure deformation perception in actual engineering applications. BRIEF DESCRIPTION OF DRAWINGS

[0015] The accompanying drawings, which are included to provide a further understanding of the present application, form a part of the present application and illustrate certain illustrative embodiments of the present application and together with the description, serve to explain the present application. In the drawings: Figure 1 A flowchart of a fiber grating flexible rod shape reconstruction method based on a double-branch neural network is provided for the embodiments of the present application. Figure 2 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. Figure 3 A flexible rod and fiber Bragg grating array packaging structure schematic diagram is provided for the embodiments of the present application. Figure 4 A flexible rod sensing plane cross-section structure schematic diagram provided for an embodiment of the present application is shown in the figure; Figure 5 A data acquisition flowchart in a shape reconstruction task provided for an embodiment of the present application is shown in the figure; Figure 6 A deep neural network structure schematic diagram provided for an embodiment of the present application is shown in the figure; Figure 7 A flexible rod shape reconstruction effect comparison diagram of a deep learning method and a traditional single-point recursive method under different bending amplitude conditions provided for an embodiment of the present application is shown in the figure.

[0016] Reference signs: 810, processor; 820, communication interface; 830, memory; 840, communication bus. DETAILED DESCRIPTION

[0017] In order to more clearly illustrate the overall concept of the present application, the following will be described in detail with reference to the accompanying drawings.

[0018] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present application, however, the present application can also be implemented in other ways different from those described herein, therefore, the protection scope of the present application is not limited by the specific embodiments disclosed below. It should be noted that the embodiments of the present application and the features in each embodiment can be combined with each other without conflict.

[0019] In the present application, unless otherwise explicitly specified and limited, the first feature is "on" or "under" the second feature, which can be that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. In the description of the present specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0020] Embodiment 1 As shown in the figure, a fiber grating flexible rod shape reconstruction method based on a double-branch neural network includes: Figure 1 An array of fiber gratings is arranged on the flexible rod, and the array of fiber gratings includes a plurality of FBG nodes, and the node spacing is 20mm.

[0021] ​As described above, a sensing array composed of a plurality of Fiber Bragg Gratings (FBGs) is arranged on the structural body of the flexible rod, each FBG serving as an independent strain sensing unit and being capable of responding to the spectral center wavelength shift caused by local bending or stretching with high sensitivity. The node spacing is 20 mm, meaning that the physical distance between two adjacent FBG sensing points along the axial direction of the flexible rod is 20 mm. This spacing design takes into account both the spatial resolution and the signal decoupling capability: too large a spacing will result in loss of deformation details, and too small a spacing may cause signal crosstalk due to strain coupling. By uniformly arranging the array on the flexible rod, high-density and continuous sampling of the deformation state of the entire rod body can be achieved, providing sufficient spatial information basis for subsequent shape reconstruction.

[0022] In addition, the arrangement method needs to ensure good mechanical coupling between the FBG and the flexible rod substrate, so that when the flexible rod is bent and deformed, the FBG can accurately perceive and transmit the strain, thereby generating a reliable spectral response signal. Usually, adhesion, slot embedding or encapsulation are used to firmly fix the optical fiber on the surface or inside of the flexible rod, avoiding sensing distortion caused by slippage or decoupling.

[0023] For example, in one specific embodiment, a polyether ether ketone (PEEK) flexible rod with a length of 1 meter is used as the structural substrate, and three parallel fine grooves are formed on the outer periphery along the axial direction, one FBG optical fiber is embedded in each groove, and 5 FBG nodes are written on each optical fiber with a strict control of the center spacing between adjacent nodes to be 20 mm, thereby forming 15 equally spaced sensing points on the entire flexible rod. The center wavelengths of these FBGs are distributed in the range of 1535 nm to 1555 nm, and there is sufficient wavelength spacing between them to avoid spectral overlap. When the flexible rod is bent in two dimensions under external load, the FBG nodes at different positions produce different degrees of wavelength shift due to different local curvatures, and these shift information is collected in real time by the fiber grating demodulator to form the input data of the subsequent deep learning model.

[0024] This arrangement scheme not only ensures the spatial sampling density along the length direction of the rod, but also enhances the perception ability of the bending direction through the transverse arrangement of multiple optical fibers, providing the necessary geometric constraints for two-dimensional shape reconstruction.

[0025] It should be noted that in specific implementation scenarios, although 20 mm spacing is used in the preferred embodiment, this value is not absolutely limited. In precision medical catheters or micro robots that require higher spatial resolution, the node spacing can be reduced to 5 mm to 15 mm; and in large-scale structure monitoring (such as bridges, wind blades) that are sensitive to cost or data volume, the spacing can be increased to 25 mm to 50 mm, as long as the deformation information can be effectively captured.

[0026] In a specific implementation scenario, in addition to the above-mentioned scheme, 4, 6 or more optical fibers can be symmetrically arranged on the cross section of the flexible rod to support three-dimensional shape reconstruction. For example, 4 optical fibers are distributed at equal angles around the circumference of a cylindrical flexible rod, each containing multiple FBG nodes, which can realize omnidirectional perception of bending in any direction.

[0027] In a specific implementation scenario, in addition to the above-mentioned scheme, the length (such as 8 mm, 10 mm, 12 mm) of the FBG, the reflection bandwidth, and the center wavelength range (such as 1510-1590 nm) can be optimized according to the performance of the light source, the resolution of the demodulator, and the level of environmental interference, as long as the spectral resolution of each FBG is distinguishable and the response linearity meets the modeling requirements.

[0028] In a specific implementation scenario, in addition to the above-mentioned scheme, in addition to epoxy AB adhesive bonding, heat shrinkable sleeve packaging, laser micro welding, micro mechanical clamping, or integration into a composite laminated structure can also be used to adapt to special working conditions such as high temperature, high humidity, and strong vibration, while ensuring effective transmission of strain.

[0029] In a specific implementation scenario, in addition to the above-mentioned scheme, the flexible rod base is not limited to PEEK material, but can also use flexible or semi-flexible materials such as silicone, polyurethane, nylon, and carbon fiber composite materials that have appropriate elastic modulus and fatigue life.

[0030] The spectrum signal of the fiber grating array is collected by the fiber grating demodulator, and the two-dimensional coordinates of the deformed flexible rod are collected by the industrial camera to form a spectrum-coordinate paired data set for training the model.

[0031] As mentioned above, constructing a high-quality, high-synchronization training data set involves two key sub-processes: one is to use the fiber grating demodulator to obtain the complete spectrum signal reflected by each FBG node on the flexible rod in real time, rather than just extracting the center wavelength or strain value; the other is to use a vision system (such as an industrial camera) to synchronously obtain the real spatial form of the flexible rod under the same deformation state, and extract the two-dimensional coordinates of each monitoring point as the label. The two data streams must be strictly aligned in time to ensure that each set of spectrum signal and corresponding coordinate label reflects the same physical deformation state.

[0032] The collected spectral signals are original light intensity-wavelength curves, which retain the nonlinear characteristics, noise structure, and multi-peak interference in the FBG response, and provide high information density inputs for subsequent deep learning models. The coordinate labels are accurately extracted from the image through image processing techniques such as marker point recognition, camera calibration, and coordinate system conversion, representing the real geometric shape of the flexible rod in space. This "original spectrum-real coordinate" pairing method avoids model errors and information loss caused by intermediate physical quantity conversion (such as wavelength-strain-curvature-coordinate) in traditional methods, laying a data foundation for the training of end-to-end mapping models.

[0033] For example, in one specific embodiment, the experimental system includes a fiber grating demodulator with a model number of GC-97001C-06-04 and a Hikvision industrial camera with a model number of ZX-SF0420C. High-contrast reflective marker points are pre-pasted on the surface of the flexible rod, corresponding to the physical positions of the FBG nodes. During the experiment, different directions and amplitudes of force are applied to the free end of the flexible rod by a mechanical arm, causing it to produce various two-dimensional bending shapes covering 0% to 27% of the tip displacement rate (i.e., the ratio of the maximum displacement of the rod tip to the total rod length). In each stable deformation state, the system synchronously triggers the demodulator and the camera: the demodulator records the complete reflection spectrum of 15 channels of FBG at a sampling rate of 1 kHz (256 wavelength points per channel), and the camera synchronously captures the side image of the flexible rod. Subsequently, through the pre-calibrated camera internal and external parameters, the pixel coordinates of the marker points in the image are converted into two-dimensional coordinates in the world coordinate system, forming the spatial position labels of 12 key points. Finally, a total of 1669 strictly synchronized spectral-coordinate samples are collected, constituting the training, validation, and test datasets.

[0034] This data collection strategy ensures the physical consistency between input features and output labels, and covers a wide range of working conditions from small deformations to large curvature bending, effectively improving the generalization ability of the model.

[0035] It should be noted that in specific implementation scenarios, the fiber grating demodulator is not limited to a specific model, and can use commercial or self-developed devices based on spectrometers, tunable lasers, interferometers, or other wavelength demodulation principles, as long as they can output high-resolution, high-signal-to-noise ratio FBG reflection spectra.

[0036] In specific implementation scenarios, the industrial camera can be replaced by a high-speed camera, a global shutter camera, a multi-view camera array, or even a depth camera (such as a structured light or ToF camera) to obtain more rich spatial information. In the two-dimensional shape reconstruction task, a single-view camera is sufficient; if extended to three-dimensional reconstruction, a stereo or multi-view vision system can be used for stereo matching.

[0037] In specific implementation scenarios, in addition to the visual method based on the marker points, external measurement devices such as a laser tracker, an optical motion capture system (such as Vicon), and a high-precision displacement sensor array can be used to obtain the spatial coordinates of the flexible rod, as long as a high-precision position tag that is time-synchronized with the spectral signal can be provided.

[0038] In specific implementation scenarios, in addition to the visual method based on the marker points, external measurement devices such as a laser tracker, an optical motion capture system (such as Vicon), and a high-precision displacement sensor array can be used to obtain the spatial coordinates of the flexible rod, as long as a high-precision position tag that is time-synchronized with the spectral signal can be provided.

[0039] In specific implementation scenarios, in addition to the visual method based on the marker points, external measurement devices such as a laser tracker, an optical motion capture system (such as Vicon), and a high-precision displacement sensor array can be used to obtain the spatial coordinates of the flexible rod, as long as a high-precision position tag that is time-synchronized with the spectral signal can be provided.

[0040] In specific implementation scenarios, in addition to the visual method based on the marker points, external measurement devices such as a laser tracker, an optical motion capture system (such as Vicon), and a high-precision displacement sensor array can be used to obtain the spatial coordinates of the flexible rod, as long as a high-precision position tag that is time-synchronized with the spectral signal can be provided.

[0041] A double-branch neural network is constructed, including a 1D-CNN branch for processing one-dimensional light intensity signals of the spectral sequence, and a 2D-CNN branch for reconstructing three-channel spectral data into a two-dimensional image for feature extraction.

[0042] As described above, the 1D-CNN branch regards the spectrum of each optical fiber as a one-dimensional sequence signal (i.e., a curve of light intensity changing with wavelength), and focuses on capturing local time sequence features such as amplitude change, peak shift, and waveform distortion caused by bending deformation in the spectrum. This branch processes each channel independently or jointly, and enhances the sensitivity of the model to bending amplitude change.

[0043] The 2D-CNN branch reconstructs multi-channel spectral data (for example, 3 optical fibers x 256 wavelength points) into a single-channel two-dimensional “image”, with the rows corresponding to different optical fiber channels and the columns corresponding to the wavelength dimension. Through two-dimensional convolution operation, this branch can simultaneously perceive spatial response differences across channels (such as strain gradient of different optical fibers under the same bending direction) and joint change patterns in local wavelength regions, thereby enhancing the discrimination ability for bending direction.

[0044] Two branches focus on different structural characteristics of spectral data, avoiding information loss or feature confusion when modeling high-dimensional, nonlinear, multi-channel sensing signals with a single network structure, providing complementary and highly discriminative representations for subsequent feature fusion and shape prediction.

[0045] For example, in a specific embodiment, the input data is the FBG reflection spectrum collected on 3 optical fibers, each spectrum containing 256 continuous wavelength points of light intensity values, forming a 3x256-dimensional original input.

[0046] In the 1D-CNN branch, the 3-channel spectrum is fed into a one-dimensional convolution layer, or concatenated and processed by channel-by-channel convolution. Through multiple layers of convolution and pooling operations, key response features in the wavelength dimension (such as center wavelength shift region, reflection peak width change, etc.) are gradually extracted, and finally a time series feature vector representing the bending amplitude is output.

[0047] In the 2D-CNN branch, the 3x256 data is treated as a two-dimensional image with a height of 3 and a width of 256, and is input into a two-dimensional convolution network composed of multiple (3x3) or (3x7) convolution kernels. This network can identify "which channels have significant changes in which wavelength range", for example, when the flexible rod bends to one side, the outer fiber channel shows stronger reflection intensity changes in a certain wavelength range. This cross-channel spatial pattern is effectively captured by 2D-CNN.

[0048] The feature vectors output by the two branches are then fed into a feature fusion module to provide a multi-dimensional information base for BiLSTM time series modeling. Experiments show that compared with single CNN or LSTM structure, this dual-branch design significantly improves the coordinate prediction accuracy, with an average error reduced from 8.95mm to 1.09mm.

[0049] It should be noted that in specific implementation scenarios, the architecture can be naturally extended to 2 channels (for basic two-dimensional reconstruction), 4 channels, 6 channels or more, to adapt to different layout schemes or three-dimensional shape perception needs, although 3-channel spectra are used in the example. The input image height of the 2D-CNN branch will be adjusted accordingly, and the network structure can be automatically adapted.

[0050] In specific implementation scenarios, one-dimensional convolution variants such as depth separable convolution, dilated convolution, and residual connection can be used to enhance the modeling capability of long-distance wavelength dependence or local details while maintaining computational efficiency based on the above scheme.

[0051] In specific implementation scenarios, on the basis of the above scheme, the convolution kernel size (such as 1x5, 3x5, 5x5), network depth, whether to introduce a hollow convolution or an attention mechanism, etc. can be adjusted. For example, when the number of channels is large, a 1xN horizontal convolution kernel can be used to preferentially extract wavelength direction features, and then an Nxl vertical convolution kernel can be used to model the relationship between channels.

[0052] In specific implementation scenarios, on the basis of the above scheme, in specific scenarios, a third branch (such as a frequency domain branch, modeling after Fourier transform of the spectrum) can be added, or a lightweight double-branch structure sharing the underlying features can be simplified when resources are limited.

[0053] In specific implementation scenarios, on the basis of the above scheme, in addition to the original light intensity curve, the spectrum can also be preprocessed (such as normalization, denoising, difference, logarithmic transformation) before being input into the double-branch network.

[0054] In specific implementation scenarios, on the basis of the above scheme, although a weighted splicing is used in the example, other methods such as addition, multiplication, gated fusion, attention weighted fusion, etc. can also be used for feature integration.

[0055] The feature fusion module is designed to weight splice the 1D-CNN branch output and the 2D-CNN branch output in a ratio of 0.3:0.7, then compress them through a fully connected layer, construct a time series modeling module, reconstruct the fused feature vector into a time series, and input it into a BiLSTM network. The channel attention module and the sequence attention module are integrated to dynamically adjust the attention degree of the network to the spectral channels and time steps.

[0056] As described above, the feature fusion module: fuses the time series features (reflecting the bending amplitude change) extracted by the 1D-CNN branch and the channel spatial features (reflecting the bending direction difference) extracted by the 2D-CNN branch. A weighted splicing method (such as 0.3:0.7) is used, which reflects the prior judgment of the importance of the two types of features - in the application scenario of the present application, the contribution of the spatial response difference between channels to shape reconstruction is slightly greater than the time series change in a single channel. Then, the high-dimensional spliced features are compressed through a fully connected layer to generate a compact and information-rich embedding vector, providing a unified input for subsequent time series modeling.

[0057] The time series modeling module: further reconstructs the compressed feature vector into a pseudo sequence with a time step dimension (for example, divided into 8 time steps), simulating the deformation evolution process of the flexible rod along the axial direction. The pseudo sequence is input into a bidirectional long short-term memory network (BiLSTM), which can simultaneously capture the structure-dependent relationship from front to back and from back to front, enhance the overall understanding of spatial continuity and deformation trend, and effectively alleviate the local prediction jump problem.

[0058] Attention mechanism integration: Two kinds of attention modules are embedded in the dual-branch network respectively. The channel attention module is used to dynamically evaluate the contribution of each FBG channel to the current deformation state, automatically enhance the key channel and suppress the redundant channel. The sequence attention module focuses on the wavelength region or time step in the spectral sequence that is most sensitive to deformation, guiding the model to focus on the key response position such as central wavelength drift. The two work together to make the network have adaptive focusing ability on key information in high-dimensional input, significantly improving the modeling accuracy and robustness.

[0059] For example, in a specific embodiment, the 1D-CNN branch outputs a 512-dimensional time sequence feature vector, and the 2D-CNN branch outputs a 512-dimensional channel space feature vector. The feature fusion module first multiplies the 1D branch feature by a weight of 0.3 and the 2D branch feature by a weight of 0.7, and then concatenates them into a 1024-dimensional vector; then a fully connected layer containing 512 neurons is used for non-linear compression, outputting a 512-dimensional fusion feature.

[0060] The 512-dimensional vector is reshaped into a sequence of 8 time steps and 64 dimensions per step (i.e. 8x64), serving as the input of the BiLSTM. The BiLSTM contains a two-layer stacked structure, with 512 hidden units in each layer, processing the sequence from forward and backward respectively, and finally outputting a time sequence representation that fuses the bidirectional context information. In this process: The channel attention module is located at the end of the 2D-CNN branch, which generates the response intensity score of each channel by doing global average pooling on the spatial dimension of the convolution feature map, and adjusts the channel weight accordingly; The sequence attention module is located at the end of the 1D-CNN branch, which generates the importance weight of each time step by doing global average pooling on the channel dimension of the time sequence feature, highlighting the key wavelength segment.

[0061] Ablation experiments show that removing any attention module will cause the average error to rise (to 1.46mm and 1.25mm respectively), while the complete structure can control the error to 1.09mm, verifying the effectiveness of the design.

[0062] It should be noted that in a specific implementation scenario, in addition to the above scheme, 0.3:0.7 is the fixed ratio preferred by the experiment, but it can also be designed as a learnable parameter (such as dynamically generating weights through a small neural network), or adjusted adaptively according to the input deformation amplitude.

[0063] In a specific implementation scenario, in addition to the above scheme, in addition to weighted concatenation, feature addition, gated fusion (such as using a sigmoid gate signal to control information flow), cross-attention fusion, etc. can also be used.

[0064] In a specific implementation scenario, on the basis of the above scheme, the fused features can be divided into 8 time steps, which is only an example. In practice, the number of FBG nodes, the length of the rod, or the complexity of the task can be adjusted to 4 steps, 12 steps, or 16 steps. The division method can be equal-length division, sliding window overlap division, or non-uniform division based on physical position, as long as it can reflect the spatial evolution relationship of the flexible structure along the axial direction.

[0065] In a specific implementation scenario, on the basis of the above scheme, BiLSTM can be replaced by other time series networks with bidirectional modeling capability, such as bidirectional GRU, Transformer encoder (with position encoding), or time convolution network (TCN).

[0066] In a specific implementation scenario, on the basis of the above scheme, the channel attention module can use classic structures such as SE (Squeeze-and-Excitation), CBAM (Convolutional Block Attention Module), etc. The sequence attention module can introduce a multi-head mechanism or be combined with position encoding. In addition, the position of the attention module can also be adjusted (such as placed after BiLSTM).

[0067] In a specific implementation scenario, on the basis of the above scheme, the attention mechanism can be integrated at the end of the branch, before or after fusion, or inside BiLSTM.

[0068] The double-branch neural network model is trained, and real-time spectral data is input into the trained neural network model to output two-dimensional coordinates of each monitoring point of the flexible rod.

[0069] As described above, in the model training phase, the aforementioned constructed spectral-coordinate paired data set is used to optimize all learnable parameters of the double-branch neural network through supervised learning. The error (such as mean square error) between the predicted coordinates and the true coordinates is used as the optimization objective in the training process, and optimization strategies suitable for deep networks (such as adaptive learning rate, learning rate scheduling, gradient clipping, etc.) are adopted to ensure that the model can fully learn the complex nonlinear mapping relationship between FBG spectrum and flexible rod spatial form. During the training process, the model performance needs to be monitored through the validation set to prevent overfitting, and the model parameters are saved when the performance is best.

[0070] In the real-time inference stage, the FBG spectrum data collected in the actual application scenario (not strain-converted, retaining the original light intensity-wavelength structure) is taken as input and sent to the trained neural network model. The model automatically performs internal processing procedures such as feature extraction, fusion, time series modeling, and attention weighting, and finally directly outputs the two-dimensional spatial coordinates of the preset monitoring points on the flexible rod. This process does not require intermediate physical quantity calculation, realizing end-to-end mapping from the original sensing signal to the spatial coordinates and significantly improving the prediction efficiency and system robustness.

[0071] For example, in a specific embodiment, 1669 groups of spectrum-coordinate samples are used in the training stage, which are divided into training set, validation set and test set according to the ratio of 7:2:1. The AdamW optimizer is adopted, with an initial learning rate of 0.001, and the learning rate is dynamically adjusted with a cosine annealing scheduling strategy; the loss function is mean square error (MSE), which measures the deviation between the 24-dimensional coordinates (12 points x 2 dimensions) predicted by the model and the true coordinates. In the training process, the early stopping mechanism is enabled, and if the validation loss does not decrease for 10 consecutive rounds, the training is terminated, and the model with the best performance on the validation set is saved.

[0072] In the inference stage, the system receives 3-channel x 256-dimensional spectrum data from the fiber grating demodulator in real time, which is input to the optimal model after normalization preprocessing. The model completes all calculations within milliseconds and outputs the (x, y) coordinate values of the 12 monitoring points. These coordinates are sent to the host computer visualization interface, which real-time draws the reconstructed shape curve of the flexible rod and compares it with the historical trajectory or safety threshold for structure health monitoring or flexible robot control. Experiments show that the average error of this method on the test set is only 1.09 mm, which is significantly better than the traditional recursive method (12.3 mm) and existing deep learning methods (8.95 mm).

[0073] It should be noted that in specific implementation scenarios, different loss functions (such as L1 loss, Huber loss, and weighted coordinate loss) can be used to adapt to different error sensitivities based on the above scheme; regularization techniques (such as Dropout, weight decay), data augmentation (such as spectrum noise, coordinate perturbation), or transfer learning strategies can be introduced to improve the model's generalization ability.

[0074] In specific implementation scenarios, the trained model can be deployed on general-purpose computers, embedded devices (such as Jetson series), FPGAs, or specialized AI chips as long as they can support neural network inference operations. In resource-constrained scenarios, pruning, quantization, or knowledge distillation can be performed on the model to generate a lightweight version for edge real-time prediction.

[0075] In a specific implementation scenario, on the basis of the above scheme, although the current output is a two-dimensional coordinate, if the system layout meets the three-dimensional reconstruction condition (such as 4 or more optical fibers are spatially distributed), the model output can be naturally extended to a three-dimensional coordinate (x, y, z), and only the corresponding three-dimensional label needs to be provided in the training stage without changing the overall method logic.

[0076] In a specific implementation scenario, on the basis of the above scheme, the number of output monitoring points is not limited to 12, and can be consistent with the number of FBG nodes (such as 15 points), or more or fewer points can be output through interpolation or subsampling.

[0077] In a specific implementation scenario, on the basis of the above scheme, in a long-term running scenario, an online fine-tuning mechanism can be designed, and new collected labeled or weakly labeled data is used to incrementally update the model to adapt to dynamic factors such as sensor aging, environmental changes or structural damage, and to improve the long-term stability of the system.

[0078] In a specific implementation scenario, on the basis of the above scheme, in addition to the coordinate output, the model can also output auxiliary information such as deformation curvature, strain distribution, and abnormal state flag, forming a multi-task learning framework.

[0079] According to an embodiment of the present application, the flexible rod is made of polyether ether ketone material, and the fiber grating array is fixed in the flexible rod channel by polyimide coating and epoxy AB glue. According to an embodiment of the present application, the spectrum-coordinate paired data set includes a spectrum vector and a corresponding coordinate label, wherein the spectrum vector is 3 channels x 256 dimensions, and the coordinate label is a two-dimensional coordinate of 12 points, a total of 24 dimensions.

[0080] As described above, the spectrum-coordinate paired data set is composed of one-to-one input data and output label. Among them, the spectrum vector as input data, comes from 3 fiber grating arrays arranged on the flexible rod, each fiber provides a reflection spectrum containing 256 continuous wavelength points, so the whole constitutes a spectrum vector of 3 channels x 256 dimensions, used to represent the complete spectrum response characteristics of the flexible rod in a certain deformation state. The coordinate label as the output data corresponds to the actual position of the 12 preset monitoring points on the flexible rod in the two-dimensional space, each monitoring point has a horizontal coordinate and a vertical coordinate, so a total of 24 dimensions, used to indicate the real geometric shape of the flexible rod in this deformation state. In each group of data, the spectrum vector and the coordinate label are strictly synchronized in time, ensuring that they reflect the same physical deformation state, thereby providing accurate mapping relationship for the supervised training of the neural network model.

[0081] According to one embodiment of the present application, the 1D-CNN branch extracts key timing features related to bending amplitude, and the 2D-CNN branch extracts features for inter-channel difference and local area response mode.

[0082] As described above, the 1D-CNN branch regards the spectrum of each optical fiber as a one-dimensional sequence signal, performs convolution operation along the wavelength dimension, and focuses on capturing features such as spectral amplitude change, center wavelength drift, and local waveform distortion caused by bending of the flexible rod, thereby extracting timing features closely related to bending amplitude; the 2D-CNN branch reconstructs multi-channel spectral data into a two-dimensional structure, where the rows correspond to different optical fiber channels and the columns correspond to wavelength points, and simultaneously perceives the response difference of different channels in the same wavelength region and the local change mode of the same channel in adjacent wavelength regions through two-dimensional convolution, thereby extracting inter-channel difference and local area response features reflecting bending direction and spatial strain distribution.

[0083] According to one embodiment of the present application, the BiLSTM network is a two-layer stacked structure with 512 hidden units.

[0084] As described above, the BiLSTM network adopts a two-layer stacked bidirectional long short-term memory structure, each layer containing 512 hidden units, which can model the input timing features from both forward and backward directions at the same time, thereby effectively capturing the spatial continuity and context dependence along the fiber layout direction during deformation of the flexible rod, enhancing the model's ability to perceive and predict the overall shape trend and stability.

[0085] According to one embodiment of the present application, the channel attention module generates channel weights through global average pooling and a fully connected network.

[0086] As described above, the channel attention module first performs global average pooling on the multi-channel feature map output by the 2D-CNN branch in the spatial dimension to obtain global response statistics for each channel; then inputs the statistics into a weight generation structure composed of two fully connected networks, where the first layer is used to reduce dimension to extract the nonlinear dependence between channels, and the second layer is used to restore the original channel dimension; finally, the normalized channel weights are output by the activation function, which are used to weight and adjust each channel of the original feature map, thereby dynamically enhancing the response of deformation-sensitive channels and suppressing the influence of redundant or interfering channels.

[0087] According to one embodiment of the present application, the sequence attention module generates time step weights through global average pooling and a fully connected network.

[0088] As mentioned above, global average pooling: performs a global average pooling operation on the channel dimension of the 1D-CNN branch output's time-series feature map, obtaining an average response vector for the entire time series. This step can capture the importance of each time step in the entire sequence.

[0089] Fully connected network generates weights: the average response vector obtained above is passed through a two-layer fully connected network. The first layer is usually used for dimension reduction and adopts a nonlinear activation function (such as ReLU) to extract the nonlinear relationship between different time steps; the second layer is used to restore the original time step length and uses an activation function such as Sigmoid to output normalized time step weights. This process allows the model to learn which time steps are most important for shape prediction.

[0090] Weighted adjustment: the calculated time step weights are then applied back to the original time-series feature map through a broadcast mechanism, achieving weighted adjustment for each time step. This can emphasize those time points that are crucial for shape reconstruction in the final coordinate prediction, improving the accuracy and robustness of the overall model.

[0091] This mechanism allows the model to automatically focus on and emphasize the most representative positions or time steps in the spectral sequence, enhancing the ability to capture dynamic change patterns, especially when facing complex, non-stable spectral change processes.

[0092] According to one embodiment of the present application, the real-time prediction process includes data preprocessing, feature extraction, feature fusion, time-series modeling, and coordinate prediction; The data preprocessing includes spectral signal denoising and normalization processing; The model training uses mean square error as the loss function, AdamW optimizer, and Cosine annealing learning rate scheduling strategy.

[0093] As mentioned above, the real-time prediction process includes the following steps executed in sequence: first, the collected original spectral signal is preprocessed; then the preprocessed data is input into the trained dual-branch neural network for feature extraction, obtaining time-series features and channel-space features through the 1D-CNN branch and the 2D-CNN branch, respectively; then the two types of features are weighted and fused through the feature fusion module; the fused features are reconstructed into pseudo-time-series sequences and input into the BiLSTM network for time-series modeling to capture the spatial continuity and context dependence of flexible rod deformation; finally, the coordinate prediction is completed through the fully connected output layer, obtaining the two-dimensional coordinates of each monitoring point of the flexible rod.

[0094] The data preprocessing includes denoising the original FBG spectral signal to suppress environmental interference and system noise, and normalizing the signal amplitude range between different channels or different acquisition batches, thereby improving the consistency and stability of the model input.

[0095] During model training, mean squared error is used as the loss function to measure the deviation between the model's predicted coordinates and the true coordinates. The AdamW optimizer is used to update the network parameters. This optimizer introduces a weight decay strategy on the basis of the traditional Adam, which helps to improve the model's generalization ability. At the same time, a Cosine annealing learning rate scheduling strategy is used to dynamically adjust the learning rate during training, so that it decays periodically in the form of a cosine function, in order to promote more stable and efficient convergence of the model.

[0096] A second aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any of the embodiments of the first aspect above.

[0097] Figure 2 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 2 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call logical instructions in the memory 830 to execute the method in any of the embodiments of the first aspect described above, the method including: A fiber grating array is deployed on a flexible pole. The fiber grating array includes multiple FBG nodes with a node spacing of 20 mm. The spectral signal of the fiber grating array is acquired by a fiber grating demodulator, and the two-dimensional coordinates of the flexible rod after deformation are acquired by an industrial camera to form a spectral-coordinate paired dataset for training the model. A dual-branch neural network is constructed, including a 1D-CNN branch that processes the spectral sequence of one-dimensional light intensity signals, and a 2D-CNN branch that reconstructs three-channel spectral data into a two-dimensional image for feature extraction. The feature fusion module is designed to concatenate the outputs of the 1D-CNN branch and the 2D-CNN branch in a weighted ratio of 0.3:0.7 and then compress them through a fully connected layer. The temporal modeling module is constructed to reconstruct the fused feature vectors into a time series input to the BiLSTM network. The channel attention module and the sequence attention module are integrated to dynamically adjust the network’s attention to spectral channels and time steps. The dual-branch neural network model is trained, real-time spectrum data is input into the trained neural network model, and two-dimensional coordinates of each monitoring point of the flexible rod are output.

[0098] In addition, the logic instructions in the memory 830 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk, and various media that can store program codes.

[0099] In another aspect, the present application also provides a computer program product, which includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute the method provided by the above-mentioned methods, and the method includes: The fiber grating array is arranged on the flexible rod, and the fiber grating array includes a plurality of FBG nodes, and the node spacing is 20 mm; The spectrum signal of the fiber grating array is collected by the fiber grating demodulator, and the two-dimensional coordinates of the deformed flexible rod are collected by the industrial camera, so as to form a spectrum-coordinate pairing data set for training the model; A dual-branch neural network is constructed, including a 1D-CNN branch for processing one-dimensional light intensity signals of spectrum serialization, and a 2D-CNN branch for reconstructing three-channel spectrum data into a two-dimensional image for feature extraction; A feature fusion module is designed, the 1D-CNN branch output and the 2D-CNN branch output are spliced by weighting with a ratio of 0.3:0.7, and then compressed through a full connection layer, a time series modeling module is constructed, the fused feature vector is reconstructed into a time series and input into a BiLSTM network, a channel attention module and a sequence attention module are integrated, and the attention degree of the network to the spectrum channel and the time step is dynamically adjusted; The dual-branch neural network model is trained, real-time spectrum data is input into the trained neural network model, and two-dimensional coordinates of each monitoring point of the flexible rod are output.

[0100] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program is executed by a processor to implement the method provided by the above-mentioned methods, and the method includes: An optical fiber grating array is arranged on the flexible rod, and the optical fiber grating array comprises a plurality of FBG nodes, and the node spacing is 20 mm; A spectrum signal of the optical fiber grating array is collected by a fiber grating demodulator, and a two-dimensional coordinate of the flexible rod after deformation is collected by an industrial camera to form a spectrum-coordinate pairing data set for training a model; A double-branch neural network is constructed, including a 1D-CNN branch for processing a one-dimensional light intensity signal of a spectrum sequence, and a 2D-CNN branch for reconstructing three-channel spectrum data into a two-dimensional image for feature extraction; A feature fusion module is designed, the 1D-CNN branch output and the 2D-CNN branch output are spliced by weighting with a proportion of 0.3:0.7, and then compressed through a full connection layer, a time series modeling module is constructed, the fused feature vector is reconstructed into a time series and input into a BiLSTM network, a channel attention module and a sequence attention module are integrated, and the attention degree of the network to the spectrum channel and the time step is dynamically adjusted; The double-branch neural network model is trained, real-time spectrum data is input into the trained neural network model, and a two-dimensional coordinate of each monitoring point of the flexible rod is output.

[0101] Embodiment 2 As shown in Figure 3 , Figure 4 , Figure 5 , Figure 6 and Figure 7 , the present embodiment faces a flexible structure shape reconstruction task, and an intelligent sensing system integrating spectrum acquisition, spatial coordinate calibration, data modeling and prediction output is constructed, and the core structure includes: a flexible rod body, an FBG optical fiber grating array, an optical fiber grating demodulation module, a camera calibration system, a data acquisition and control terminal, and an end-to-end neural network model.

[0102] Flexible structure and sensor structure The present application adopts a polyether ether ketone (PEEK) flexible rod with a length of 1 meter as a structure matrix, and the material has excellent mechanical flexibility and structural stability, and is suitable for deformation sensing requirements in multiple scenes. In order to realize efficient arrangement and strain conduction of the optical fiber grating sensing array, a plurality of equidistant fine groove structures are preset around the flexible rod for embedding the optical fiber sensing unit. As shown in Figure 3 , each optical fiber is arranged along the longitudinal direction of the rod body, and a plurality of FBG nodes are included in the grating string, and the parameter configuration is: the length of each FBG is 10 mm, the node spacing is 20 mm, and the center wavelength range is 1510-1590 nm, so as to realize high-density sampling of the deformation amount of the flexible rod. As shown in Figure 3 , as shown in the cross-sectional structure, all the optical fibers are strictly distributed in the same sensing plane, arranged uniformly, and arranged with high precision, which ensures the consistency and reconfigurability of the spatial strain sampling.

[0103] In the sensor construction process, a polyimide-coated fiber grating array is used as the core sensing medium, which has good high-temperature resistance and mechanical coupling performance. The fiber is firmly pasted in the pre-designed channel by epoxy AB glue, ensuring that the external structure strain can be accurately transmitted to the FBG during the bending and deformation of the flexible rod, and realizing high-fidelity spectrum response acquisition. The structure design takes into account the rationality of layout, sensing sensitivity and processing feasibility, providing a solid foundation for subsequent data acquisition and reconstruction modeling.

[0104] Data acquisition system construction The data acquisition system, as shown in Figure 5 , is composed of three parts: a fiber grating demodulator (model GC-97001C-06-04), a high-precision industrial camera (model ZX-SF0420C, Hikvision) and a computer terminal. The fiber grating demodulator is responsible for reading the grating array reflection spectrum in real time and sending it to the computer through the communication interface; the camera system is responsible for acquiring the two-dimensional pixel coordinates of the surface reflection markers of the flexible rod during deformation, and through camera calibration and multi-frame tracking technology, the spatial form of the flexible rod corresponding to the time is obtained; the upper computer program is used to coordinate the data synchronization of the above-mentioned equipment, control the start and end of data acquisition, and automatically save the spectrum and image data of each acquisition time, realizing synchronous calibration.

[0105] During data acquisition, the flexible rod is subjected to controlled bending through manual or mechanical means, covering a deformation range of 0%–27% (total rod length ratio) of the maximum displacement of the tip. A total of 1669 paired data samples are collected, each containing a spectrum vector (dimension 3x256) and a corresponding coordinate label (two-dimensional coordinate values of 12 points, dimension 24). In the experiment, it is observed that the linear correlation between the center wavelength change of some FBGs and the local deformation variable is only 0.80, indicating that the response of the sensing system has nonlinear characteristics, and traditional linear reconstruction methods cannot accurately restore the structure form, thus highlighting the applicability of the data-driven method of the present application.

[0106] Model structure and training method To effectively model the complex nonlinear mapping relationship between spectrum and shape, a deep neural network is proposed, which integrates a double-branch convolutional network, a double-attention mechanism and a BiLSTM time series modeling module, as shown in Figure 6 , which mainly includes the following components: 1D-CNN channel branch: taking 3-channel spectrum data (256 dimensions per channel) as input, using Depthwise convolution, standard convolution and sequence attention module to extract dynamic evolution features in the wavelength dimension; 2D-CNN sequence branch: 3-channel spectra are reconstructed in image form, and 2D convolution modules with (3x7) and (3x3) input convolution kernels are used, combined with channel attention mechanism to enhance cross-channel feature aggregation; Feature fusion module: the outputs of the two branches are weighted (ratio 0.3:0.7) and spliced, and compressed into a fixed-length feature vector through a fully connected layer; Time series modeling module: the feature vector is reconstructed into 8 time steps and input into a 2-layer bidirectional LSTM to mine the context dependence between time series; Fully connected output layer: all time steps of the LSTM output are spliced into a one-dimensional vector, and the final 24-dimensional coordinate prediction result is output through a fully connected mapping layer.

[0107] The model training uses mean square error (MSE) as the loss function, the optimizer selects AdamW, and the learning rate scheduling uses the CosineAnnealing strategy. The samples in the training data are normalized, and the training, validation, and test sets are divided in the ratio of 7:2:1. During the training process, mixed precision acceleration and early stopping strategies are enabled.

[0108] The places not mentioned in the application can be implemented by using or referring to the existing technology.

[0109] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

[0110] The above only describes the embodiments of the application and does not limit the application. Those skilled in the art can make various modifications and changes to the application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the application shall be included in the scope of the claims of the application.

Claims

1. A method for fiber Bragg grating flexible rod shape reconstruction based on a double-branch neural network, characterized in that, The method comprises the following steps: arranging a fiber grating array on a flexible rod, the fiber grating array comprising a plurality of FBG nodes, the node spacing being 20 mm; collecting the spectrum signal of the fiber grating array by a fiber grating demodulator, and collecting the two-dimensional coordinates of the deformed flexible rod by an industrial camera to form a spectrum-coordinate paired data set for training the model; constructing a double-branch neural network, including a 1D-CNN branch processing the one-dimensional light intensity signal of the spectrum sequence, and a 2D-CNN branch reconstructing the three-channel spectrum data into a two-dimensional image for feature extraction; designing a feature fusion module, weighting and splicing the output of the 1D-CNN branch and the output of the 2D-CNN branch at a ratio of 0.3:0.7, then compressing through a fully connected layer, constructing a time series modeling module, reconstructing the fused feature vector into a time series, inputting into a BiLSTM network, integrating a channel attention module and a sequence attention module, and dynamically adjusting the attention degree of the network to the spectrum channel and the time step; training the double-branch neural network model, inputting real-time spectrum data into the trained neural network model, and outputting the two-dimensional coordinates of each monitoring point of the flexible rod.

2. The method of claim 1, wherein, The flexible rod is made of polyether ether ketone material, and the fiber grating array is fixed in the flexible rod channel by polyimide coating and epoxy AB glue.

3. The method of claim 1, wherein, The spectrum-coordinate paired data set comprises a spectrum vector and a corresponding coordinate label, wherein the spectrum vector is 3 channels x 256 dimensions, and the coordinate label is the two-dimensional coordinates of 12 points, a total of 24 dimensions.

4. The method of claim 1, wherein, The 1D-CNN branch extracts key time sequence features related to bending amplitude, and the 2D-CNN branch extracts features for inter-channel difference and local area response mode.

5. The method of claim 1, wherein, The BiLSTM network has a two-layer stacked structure, and the number of hidden units is 512.

6. The method of claim 1, wherein, The channel attention module generates channel weights through global average pooling and a fully connected network.

7. The method of claim 1, wherein, The sequence attention module generates time step weights through global average pooling and a fully connected network.

8. The method of claim 1, wherein, The real-time prediction process includes data preprocessing, feature extraction, feature fusion, time series modeling, and coordinate prediction. The data preprocessing includes spectrum signal denoising and normalization processing. The model training adopts mean square error as the loss function, AdamW optimizer, and Cosine annealing learning rate scheduling strategy.

9. A computer-readable storage medium having stored thereon a program, characterized in that, The program is executed by the processor to realize the steps in the method of any one of claims 1-8.

10. An electronic device comprising a memory, a processor, and a program stored on the memory and executable on the processor, characterized in that, The processor executes the program to realize the steps in the method of any one of claims 1-8.