A temperature measurement method and device based on machine learning and a storage medium
By combining an interferometric fiber optic temperature sensor and a dispersion-compensating fiber with a Transformer neural network, the challenge of balancing high-speed and high-precision demodulation in fiber optic temperature sensors was solved, enabling real-time and accurate temperature monitoring and improving the system's performance in harsh environments.
Patent Information
- Application Number
- CN202511704872.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-11-20
AI Technical Summary
Existing fiber optic temperature sensors struggle to achieve both high speed and high precision demodulation. Traditional spectral reading devices are limited in speed, and time-domain stretching technology lacks sufficient detection accuracy and is susceptible to noise interference, making it difficult to meet the real-time, high-precision temperature monitoring requirements of industrial applications.
An interferometric fiber optic temperature sensor is used to convert temperature changes into wavelength shifts in the interference spectrum. Dispersion-compensating fiber is used for time-domain stretching, and signal preprocessing and Transformer neural network are combined for feature extraction and enhancement. Finally, the predicted temperature value is output through a fully connected layer.
It achieves high-speed real-time temperature monitoring at 50MHz, reduces the demodulation mean square error by three orders of magnitude to 0.000011 °C², and reaches high-precision measurement at the sub-Celsius level, improving the system's stability and robustness in harsh environments.
Smart Images

Figure CN121167679B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of temperature demodulation technology, specifically relating to a temperature measurement method, device, and storage medium based on machine learning. Background Technology
[0002] Fiber optic temperature sensors play a crucial role in precision temperature monitoring in harsh environments, such as industrial settings, due to their inherent advantages such as resistance to electromagnetic interference, small size, and high stability. The Sagnac interferometer, as a core sensing structure, offers the advantage of generating a phase difference through temperature-induced changes in fiber birefringence without requiring complex microfabrication, thereby achieving highly sensitive measurement of localized temperatures.
[0003] To further improve sensitivity, researchers typically employ specialized optical fibers with high birefringence (such as panda fiber or side-hole fiber) to amplify temperature-induced phase differences. While sensitivity is improved, the demodulation rate is severely limited by the speed of traditional spectral reading devices (such as optical spectrum analyzers), usually only a few hertz to several hundred hertz, which cannot meet the demands of high-speed, real-time temperature monitoring in industrial applications.
[0004] To address the speed bottleneck, time-domain stretching technology has been introduced in recent years. This technology utilizes a dispersive medium to map spectral information onto a time-domain waveform, enabling low-speed electronic devices to capture MHz-level optical events, thus achieving high-speed demodulation. However, this high-speed time-domain demodulation method faces the serious challenge of insufficient detection accuracy. Time-domain waveforms are susceptible to noise interference, and traditional simple algorithms such as linear fitting struggle to accurately extract minute temperature information from complex waveform changes, resulting in large measurement errors and limiting its practical application in scenarios requiring high precision.
[0005] Therefore, there is an urgent need in this field for an innovative technical solution that can simultaneously achieve high-speed and high-precision temperature demodulation, in order to overcome the inherent defects of existing technologies that make it difficult to achieve both speed and precision. Summary of the Invention
[0006] To achieve high-speed and high-precision temperature demodulation, in a first aspect, the present invention provides a temperature measurement method based on machine learning, the method comprising:
[0007] Temperature changes are converted into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor.
[0008] The wavelength shift is stretched in the time domain using dispersion-compensating fiber, and the wavelength shift is mapped to a time-series shift of a time-domain waveform.
[0009] The time offset is acquired by a signal acquisition device to obtain time-domain sequence data, and the time-domain sequence data is preprocessed.
[0010] Positional encoding is used to inject temporal information into preprocessed time-domain sequence data to obtain feature sequences containing temporal information.
[0011] The feature sequence is input into a Transformer neural network, and the multi-head self-attention mechanism of the Transformer neural network is used to extract global features;
[0012] The global features are normalized and then processed by the position-aware feedforward network of the Transformer neural network to enhance the features;
[0013] The enhanced features are mapped through the fully connected layer of the Transformer neural network to output a predicted temperature value.
[0014] In one possible implementation, the step of acquiring the time offset through a signal acquisition device to obtain time-domain sequence data, and preprocessing the time-domain sequence data, includes:
[0015] The time offset is converted into an electrical signal using a photodetector, and the electrical signal is captured by a high-speed oscilloscope to obtain time-domain sequence data.
[0016] High-frequency noise in the time-domain sequence data is removed by low-pass filtering;
[0017] For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
[0018] In one possible implementation, the step of injecting temporal information into the preprocessed time-domain sequence data using positional encoding to obtain a feature sequence containing temporal information includes:
[0019] The preprocessed time-domain sequence data is mapped into high-dimensional feature vectors through a linear embedding layer;
[0020] Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
[0021] In one possible implementation, the step of inputting the feature sequence into a Transformer neural network and extracting global features using the multi-head self-attention mechanism of the Transformer neural network includes:
[0022] The feature sequence containing temporal information is split into multiple attention heads;
[0023] The attention weights corresponding to the value vectors in each attention head are calculated using query vectors and key vectors to capture global dependencies within the sequence;
[0024] The global features are obtained by concatenating the outputs of all attention heads and performing a linear transformation.
[0025] In one possible implementation, the step of normalizing the global features and then processing them through the position-aware feedforward network of the Transformer neural network to enhance the features includes:
[0026] The normalized global features are then subjected to dimensionality reduction to obtain compressed global features.
[0027] The compressed global features are processed by a nonlinear activation function to obtain enhanced features, including amplitude abrupt change rate, slope change of continuous sampling points, and steepness of pulse rise and fall edges;
[0028] The compressed global feature, which has undergone nonlinear activation, is subjected to dimensionality upscaling to obtain a first feature, the dimension of which is the same as that of the global feature.
[0029] The first feature is normalized, and the process is returned to execute: global features are extracted using the multi-head self-attention mechanism of the Transformer neural network; the global features are normalized and then processed by the position-aware feedforward network of the Transformer neural network to enhance the features; wherein, the input of each loop is the feature after the second normalization in the previous loop, and after a preset number of loops, the encoded features are obtained.
[0030] In one possible implementation, mapping the enhanced features through the fully connected layer of the Transformer neural network to output a predicted temperature value includes:
[0031] The encoded features are subjected to global average pooling to obtain the pooled feature vector;
[0032] The pooled feature vector is input into the fully connected layer, and the final continuous temperature prediction value is output through linear weighting and bias adjustment.
[0033] Secondly, embodiments of this application provide a temperature measurement device based on machine learning, the device comprising:
[0034] The conversion module is used to convert temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor.
[0035] The mapping module is used to stretch the wavelength shift in the time domain using dispersion compensation fiber, and map the wavelength shift into a time-series shift of a time-domain waveform.
[0036] The acquisition module is used to acquire the time offset through a signal acquisition device to obtain time-domain sequence data, and to preprocess the time-domain sequence data;
[0037] The position encoding module is used to inject temporal information into the preprocessed time-domain sequence data using position encoding, thereby obtaining a feature sequence containing temporal information.
[0038] The self-attention processing module is used to input the feature sequence into the Transformer neural network and extract global features using the multi-head self-attention mechanism of the Transformer neural network.
[0039] The position-aware feedforward network processing module is used to normalize the global features and then process them through the position-aware feedforward network of the Transformer neural network to enhance the features;
[0040] The output module is used to map the enhanced features through the fully connected layer of the Transformer neural network and output the predicted temperature value.
[0041] In one possible implementation, the acquisition module is specifically used for:
[0042] The time offset is converted into an electrical signal using a photodetector, and the electrical signal is captured by a high-speed oscilloscope to obtain time-domain sequence data.
[0043] High-frequency noise in the time-domain sequence data is removed by low-pass filtering;
[0044] For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
[0045] In one possible implementation, the location encoding module is specifically used for:
[0046] The preprocessed time-domain sequence data is mapped into high-dimensional feature vectors through a linear embedding layer;
[0047] Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
[0048] Thirdly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the above-mentioned temperature measurement methods based on machine learning.
[0049] This application provides a machine learning-based temperature measurement method. It converts temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor. The wavelength shift is then stretched in the time domain using dispersion-compensating fiber, mapping it to a time-series waveform shift. This time-series shift is acquired using a signal acquisition device to obtain time-domain sequence data, which is then preprocessed. Position encoding is used to inject time-series information into the preprocessed time-domain sequence data, resulting in a feature sequence containing time-series information. This feature sequence is input into a Transformer neural network, where a multi-head self-attention mechanism is used to extract global features. The global features are then normalized and processed through the position-aware feedforward network of the Transformer neural network to enhance them. Finally, the enhanced features are mapped through a fully connected layer of the Transformer neural network to output a predicted temperature value. This method achieves high-speed, high-precision temperature prediction. Attached Figure Description
[0050] Figure 1 A schematic diagram of the first process of a temperature measurement method based on machine learning provided in an embodiment of the present invention;
[0051] Figure 2 This is a schematic diagram of a first structure of a temperature measurement system based on machine learning provided in an embodiment of the present invention;
[0052] Figure 3 This is a schematic diagram of a second structure of a temperature measurement system based on machine learning provided in an embodiment of the present invention;
[0053] Figure 4 This is a schematic diagram of a second process for a temperature measurement method based on machine learning provided in an embodiment of the present invention. Detailed Implementation
[0054] The present invention will be described in detail below through embodiments.
[0055] Fiber optic temperature sensors play a crucial role in precision temperature monitoring in harsh environments, such as industrial settings, due to their inherent advantages such as resistance to electromagnetic interference, small size, and high stability. The Sagnac interferometer, as a core sensing structure, offers the advantage of generating a phase difference through temperature-induced changes in fiber birefringence without requiring complex microfabrication, thereby achieving highly sensitive measurement of localized temperatures.
[0056] To further improve sensitivity, researchers typically employ specialized optical fibers with high birefringence (such as panda fiber or side-hole fiber) to amplify temperature-induced phase differences. While sensitivity is improved, the demodulation rate is severely limited by the speed of traditional spectral reading devices (such as optical spectrum analyzers), usually only a few hertz to several hundred hertz, which cannot meet the demands of high-speed, real-time temperature monitoring in industrial applications.
[0057] To address the speed bottleneck, time-domain stretching technology has been introduced in recent years. This technology utilizes a dispersive medium to map spectral information onto a time-domain waveform, enabling low-speed electronic devices to capture MHz-level optical events, thus achieving high-speed demodulation. However, this high-speed time-domain demodulation method faces the serious challenge of insufficient detection accuracy. Time-domain waveforms are susceptible to noise interference, and traditional simple algorithms such as linear fitting struggle to accurately extract minute temperature information from complex waveform changes, resulting in large measurement errors and limiting its practical application in scenarios requiring high precision.
[0058] Therefore, there is an urgent need in this field for an innovative technical solution that can simultaneously achieve high-speed and high-precision temperature demodulation, in order to overcome the inherent defects of existing technologies that make it difficult to achieve both speed and precision.
[0059] Firstly, see [the following] Figure 1 This application provides a temperature measurement method based on machine learning, the method comprising:
[0060] S101 converts temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor.
[0061] The interferometric fiber optic temperature sensor uses a Sagnac interferometer based on side-hole fiber or panda fiber as its core temperature-sensitive element. The Sagnac interferometer converts changes in external temperature into shifts in the transmitted light spectrum. When the temperature changes by ΔT, it causes a change in birefringence ΔB in the side-hole fiber, which in turn leads to a wavelength shift Δλ in the interference spectrum. Its temperature sensitivity is Δλ / ΔT = -0.626 nm / °C.
[0062] S102, the wavelength shift is stretched in the time domain using dispersion compensation fiber, and the wavelength shift is mapped to the time-series shift of the time-domain waveform.
[0063] By utilizing the dispersion effect of dispersion-compensating fiber (dispersion coefficient D = -100 ps / nm), the spectral pulse from the temperature sensor is broadened in time, and the wavelength shift Δλ is linearly converted into the time-domain waveform time shift Δt, with the conversion relationship being Δλ = Δt / D. This enables high-speed real-time signal acquisition at 50 MHz, with a time-domain sensitivity of Δt / ΔT = 0.28 ns / °C.
[0064] S103, the timing offset is acquired by a signal acquisition device to obtain time-domain sequence data, and the time-domain sequence data is preprocessed.
[0065] Specifically, it may include: converting the time offset into an electrical signal using a photodetector, capturing the electrical signal using a high-speed oscilloscope, and obtaining time-domain sequence data; wherein the high-speed oscilloscope captures the data at a repetition frequency of 50MHz;
[0066] High-frequency noise in the time-domain sequence data is removed by low-pass filtering; wherein, the low-pass filtering is a Butterworth low-pass filter with a cutoff frequency of 5MHz, which is designed to remove high-frequency noise introduced by the photodetector.
[0067] For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
[0068] S104. Positional encoding is used to inject temporal information into the preprocessed time-domain sequence data to obtain a feature sequence containing temporal information.
[0069] Specifically, this can include mapping preprocessed time-domain sequence data into high-dimensional feature vectors through a linear embedding layer;
[0070] Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
[0071] By introducing positional encoding, the Transformer neural network is able to utilize the sequential information of the waveform along the time axis.
[0072] S105, the feature sequence is input into the Transformer neural network, and the global features are extracted using the multi-head self-attention mechanism of the Transformer neural network.
[0073] Self-attention mechanisms can globally capture long-range, temperature-related key feature dependencies in waveform sequences, overcoming the gradient vanishing problem in traditional recurrent neural networks when processing long sequences.
[0074] Specifically, this may include splitting the feature sequence containing temporal information into multiple attention heads;
[0075] The attention weights corresponding to the value vectors in each attention head are calculated using query vectors and key vectors to capture global dependencies within the sequence;
[0076] The global features are obtained by concatenating the outputs of all attention heads and performing a linear transformation.
[0077] Each attention point focuses on a problem, such as the movement of a wave crest or the overall tilt of a waveform. Through this parallel processing, neural networks can capture multiple different types and scales of dependencies from the same signal, thereby pinpointing the features most relevant to temperature changes with unparalleled precision.
[0078] If the feature sequence includes 200 sampling points, for each sampling point, its initial vector is linearly transformed into three new vectors—a query vector Q, a key vector K, and a value vector V—using three different weight matrices. With 200 sampling points, there are 200 Qs, 200 Ks, and 200 Vs. For each sampling point, its query vector is multiplied by the 200 key vectors to obtain 200 attention scores for each value vector, representing the level of attention that should be given to the 1st, 2nd, ... 200th points when understanding the current sampling point. These 200 attention scores are normalized using a softmax function, resulting in a set of weights that sum to 1. This set of weights is then used to perform a weighted summation of the 200 value vectors. This process is executed in parallel for each sampling point in the sequence, ultimately resulting in a completely new sequence of 200 points, each containing global contextual information.
[0079] S106, after normalizing the global features, the features are processed through the position-aware feedforward network of the Transformer neural network to enhance the features.
[0080] The normalized global features are then subjected to dimensionality reduction to obtain compressed global features.
[0081] The compressed global features are processed by a nonlinear activation function to obtain enhanced features, including amplitude abrupt change rate, slope change of continuous sampling points, and steepness of pulse rise and fall edges;
[0082] The compressed global feature, which has undergone nonlinear activation, is subjected to dimensionality upscaling to obtain a first feature, the dimension of which is the same as that of the global feature.
[0083] The first feature is normalized, and the process is returned to execute: global features are extracted using the multi-head self-attention mechanism of the Transformer neural network; the global features are normalized and then processed by the position-aware feedforward network of the Transformer neural network to enhance the features; wherein, the input of each loop is the feature after the second normalization in the previous loop, and after a preset number of loops, the encoded features are obtained.
[0084] The input (feature sequence containing temporal information) and output (global features) of the Transformer neural network are residually concatenated, and the result of the residual concatenation is normalized to obtain the input of the position-aware feedforward network. The position-aware feedforward network is used to perform nonlinear transformations and feature enhancement on the output of the self-attention layer, including two linear transformations and one nonlinear activation. Then, the input and output of the position-aware feedforward network are residually concatenated again, and the result of the residual concatenation is normalized. This encoder layer is repeatedly stacked four times, and the feature extraction capability is enhanced through multi-layer iteration, finally outputting the encoded features.
[0085] S107, the enhanced features are mapped through the fully connected layer of the Transformer neural network to output the predicted temperature value.
[0086] The encoded features are subjected to global average pooling to obtain the pooled feature vector;
[0087] The pooled feature vector is input into the fully connected layer, and the final continuous temperature prediction value is output through linear weighting and bias adjustment.
[0088] This application provides a machine learning-based temperature measurement method. It converts temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor. The wavelength shift is then stretched in the time domain using dispersion-compensating fiber, mapping it to a time-series waveform shift. This time-series shift is acquired using a signal acquisition device to obtain time-domain sequence data, which is then preprocessed. Position encoding is used to inject time-series information into the preprocessed time-domain sequence data, resulting in a feature sequence containing time-series information. This feature sequence is input into a Transformer neural network, where a multi-head self-attention mechanism is used to extract global features. The global features are then normalized and processed through the position-aware feedforward network of the Transformer neural network to enhance them. Finally, the enhanced features are mapped through a fully connected layer of the Transformer neural network to output a predicted temperature value. This method achieves high-speed, high-precision temperature prediction.
[0089] See Figure 2This is a schematic diagram of a machine learning-based temperature measurement system provided in an embodiment of this application, including a mode-locked laser 101, a Sagnac interferometer 102, a dispersion-compensating fiber 103, a photodetector 104, a high-speed oscilloscope 105, and a computing unit 106. The mode-locked laser generates ultrashort optical pulses, and the Sagnac interferometer modulates the ultrashort optical pulses generated by the mode-locked laser, encoding the interference spectrum information onto the pulses. Subsequently, this spectrally modulated pulse is time-stretched through the dispersion-compensating fiber, thereby converting the wavelength shift into a detectable time-domain waveform. These time-domain waveforms are captured by the photodetector, recorded by the high-speed oscilloscope, and finally demodulated by the computing unit.
[0090] See Figure 3 This is another schematic diagram of a machine learning-based temperature measurement system provided in this application embodiment, including a mode-locked laser 101, an isolator 201, a polarization controller 202, a 50:50 coupler 203, a Sagnac interferometer 102, a dispersion-compensating fiber 103, a 90:10 optical coupler 204, a spectrum analyzer 205, a photodetector 104, a high-speed oscilloscope 105, and a computing unit 106. The mode-locked laser model can be ROI, EFLA-B-1560-50, with a center wavelength of 1560 nm and a pulse width of 100 fs. The light pulse emitted by the mode-locked laser passes sequentially through the isolator and the polarization controller, modulating the polarization state of the light pulse before entering the Sagnac interferometer (based on a 30 cm side-hole fiber), which serves as the core sensing unit, through the 50:50 coupler. Subsequently, the interference-modulated light is guided into the dispersion-compensating fiber for time stretching. Subsequently, a 90:10 optical coupler splits the signal into two paths: one path is guided to a spectrometer (model: YOKOGAWA AQ6370D, resolution 0.02 nm) for spectral characterization and calibration; the other path is used for photoelectric conversion by a high-speed photodetector (model: HLT Optical, bandwidth 10 GHz) and recorded by a high-speed oscilloscope (model: Waverunner 8404M, bandwidth 4 GHz, sampling rate 40 GS / s) for time-domain signal acquisition. The acquired time-domain waveform is finally transmitted to the computing unit to run the Transformer neural network algorithm for computation and demodulation.
[0091] See Figure 4 This is a schematic diagram of the processing flow of the Transformer neural network provided in the embodiments of this application.
[0092] S201, Obtain training sample pairs.
[0093] The system receives the acquired time-domain sequence data, with a sequence length of 200 sampling points and an input dimension of 200×1 (sequence length × time-domain amplitude feature dimension). First, a Butterworth low-pass filter with a cutoff frequency of 5MHz is used to remove high-frequency noise introduced by the photodetector. Then, Z-score normalization is applied to map the signal amplitude to the [-1,1] interval. Finally, the preprocessed time-domain sequence data is bound to the corresponding real temperature labels to form training sample pairs.
[0094] S202, position encoding is performed on the preprocessed time-domain sequence data.
[0095] Next, positional encoding is performed on the sequence. First, it is mapped to a 64-dimensional feature vector through a linear embedding layer (weight matrix 1×64). Then, sine-cosine positional encoding is used to inject temporal information, and a 200×64-dimensional feature sequence containing temporal information is output.
[0096] S203 performs multi-head self-attention processing.
[0097] The aforementioned feature sequences are input into stacked Transformer encoder layers for processing. First, a multi-head self-attention mechanism is used to split the 64-dimensional features into 8 heads, generating Q, K, and V matrices (200×8 dimensions). Attention weights are calculated using Attention(Q,K,V)=softmax(dkQKT)V (dk=8). After concatenating the outputs of the 8 heads, a linear transformation (64×64 weight matrix) is performed to obtain the result. Global temporal dependencies are extracted, such as the temporal correlation between peaks and valleys at different sampling points and the trend of amplitude changes across locations.
[0098] S204, Residual Connection and Normalization.
[0099] The 200×64-dimensional temporal feature sequence output from step S202 is joined with the multi-head self-attention processing result output from step S203 using a residual connection. The residual connection result is then normalized, and layer normalization is used to stabilize the feature distribution.
[0100] S205 is processed through a position-aware feedforward network.
[0101] The position-aware feedforward network processes features point by point through a two-layer linear transformation from 64-dimensional to 25-dimensional (ReLU activation) to 64-dimensional, extracting local salient features (such as amplitude abrupt change rate, slope change of continuous sampling points, steepness of pulse rise and fall edges, and other waveform morphology features directly related to temperature).
[0102] 1. First linear transformation
[0103] The 64-dimensional vector at each location is mapped to a new dimension (25-dimensional) through a fully connected layer (linear layer). By changing the dimension (dimensionality reduction), the network is forced to learn a more efficient information representation.
[0104] 2. Introducing nonlinearity (core step)
[0105] The 25-dimensional vector obtained in the previous step is then processed using a non-linear activation function, ReLU, which sets all negative values to zero, retaining only positive values. This introduces non-linear transformation capabilities into the model, enabling it to learn and simulate more complex feature patterns. Without this step, the entire feedforward network would simply be a superposition of two linear transformations, significantly reducing its expressive power. It allows the network to capture complex features such as amplitude abrupt change rates and the steepness of pulse rise and fall edges.
[0106] 3. Second linear transformation (recovering dimensions)
[0107] The 25-dimensional vector activated by ReLU is mapped back to its original 64 dimensions through another fully connected layer. The processed features are then projected back into a space with the same dimensions as the input, so that they can be added to the residual connections and fed into the next Transformer layer.
[0108] The output of this step is a feature sequence with the same dimensions [200, 64]. However, the 64-dimensional vector at each position is no longer simple global correlation information, but rather a feature that has undergone deep nonlinear processing, resulting in higher quality and stronger expressive power.
[0109] S206, Residual Connection and Normalization.
[0110] The input (i.e., the first residual concatenation and normalization result of the output of step S204 above) and the output (i.e., the output of step S205 above) of the position-aware feedforward network are concatenated and normalized.
[0111] To enhance feature extraction capabilities, the encoder layers are stacked four times, meaning that steps S203 to S206 are executed four times in a loop to finally obtain the encoded features.
[0112] S207, the temperature value of the regression output.
[0113] First, global average pooling is performed on the encoded feature. The mean value of the feature values of 200 sampling points is calculated for each of the 64 feature dimensions, and then compressed into a 64-dimensional single vector to aggregate the global features. Then, this 64-dimensional vector is input into a fully connected layer and matrix multiplied with a learnable 64×1 weight matrix (the mean value of each dimension is multiplied and accumulated with the corresponding weight). Then, a single-value bias term is added for adjustment. Since temperature prediction is a continuous value regression task, this fully connected layer does not introduce a non-linear activation function and directly outputs the single-value result, that is, the final continuous temperature prediction value, thus completing the mapping from abstract deep features to the specific temperature numerical space.
[0114] The Transformer neural network training aims to minimize the mean square error between the predicted and actual temperatures. The Adam optimizer is used for gradient backpropagation to update parameters. The training process lasts for 600 rounds, with validation every 10 rounds. The training stops early when the validation set loss does not decrease for 20 consecutive rounds. Ultimately, this method achieves high-precision temperature prediction from time-domain waveforms.
[0115] The machine learning-based temperature measurement method provided in this application achieves a balance between speed and accuracy, specifically in the following aspects:
[0116] Ultra-high speed: By using time-domain stretching technology, the demodulation rate is increased from the Hz level of traditional spectrometers to 50MHz, realizing true real-time, high-speed temperature monitoring and capturing transient temperature changes.
[0117] Ultra-high precision: By introducing a Transformer neural network for intelligent computation, the demodulation mean square error is reduced from 0.017614 °C² in traditional linear fitting to 0.000011 °C², a reduction of three orders of magnitude. The corresponding root mean square error reaches 0.0033 °C, achieving sub-degree Celsius level high-precision measurement. This level of accuracy is difficult to achieve by simply optimizing hardware or traditional algorithms.
[0118] The machine learning-based temperature measurement method provided in this application improves the robustness and practicality of the system, specifically in the following aspects:
[0119] Strong anti-interference capability: The Transformer model excels at extracting effective features from complex signals containing noise. Its global perception capability makes it insensitive to random fluctuations and noise in time-domain waveforms, thereby significantly improving the stability and reliability of the system in harsh industrial environments.
[0120] This invention addresses the pain point of insufficient accuracy in traditional time-domain demodulation: It directly targets the biggest technical obstacle in high-speed time-domain demodulation technology - poor accuracy, and provides an effective solution, enabling the technology to move from "usable" to "easy to use", greatly expanding its application scenarios.
[0121] The temperature measurement method based on machine learning provided in this application offers an innovative technological fusion paradigm. This invention is not a simple aggregation of hardware, optics, and algorithms, but rather a deep integration of high-sensitivity Sagnac sensing, high-speed time-domain stretching physical transformation, and cutting-edge Transformer intelligent algorithms, forming a complete and high-performance sensing system solution. This interdisciplinary technological fusion provides new ideas and methodologies for solving the high-speed, high-precision measurement of other physical quantities.
[0122] Secondly, embodiments of this application provide a temperature measurement device based on machine learning, the device comprising:
[0123] The conversion module is used to convert temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor.
[0124] The mapping module is used to stretch the wavelength shift in the time domain using dispersion compensation fiber, and map the wavelength shift into a time-series shift of a time-domain waveform.
[0125] The acquisition module is used to acquire the time offset through a signal acquisition device to obtain time-domain sequence data, and to preprocess the time-domain sequence data;
[0126] The position encoding module is used to inject temporal information into the preprocessed time-domain sequence data using position encoding, thereby obtaining a feature sequence containing temporal information.
[0127] The self-attention processing module is used to input the feature sequence into the Transformer neural network and extract global features using the multi-head self-attention mechanism of the Transformer neural network.
[0128] The position-aware feedforward network processing module is used to normalize the global features and then process them through the position-aware feedforward network of the Transformer neural network to enhance the features;
[0129] The output module is used to map the enhanced features through the fully connected layer of the Transformer neural network and output the predicted temperature value.
[0130] In one possible implementation, the acquisition module is specifically used for:
[0131] The time offset is converted into an electrical signal using a photodetector, and the electrical signal is captured by a high-speed oscilloscope to obtain time-domain sequence data.
[0132] High-frequency noise in the time-domain sequence data is removed by low-pass filtering;
[0133] For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
[0134] In one possible implementation, the location encoding module is specifically used for:
[0135] The preprocessed time-domain sequence data is mapped into high-dimensional feature vectors through a linear embedding layer;
[0136] Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
[0137] Thirdly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-mentioned COSEM object data acquisition methods based on the DLMS protocol.
[0138] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0139] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0140] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0141] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes to the above embodiments within the scope of the present invention without departing from the principles and spirit of the present invention.
Claims
1. A temperature measurement method based on machine learning, characterized in that, The method includes: Temperature changes are converted into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor. The wavelength shift is stretched in the time domain using dispersion-compensating fiber, and the wavelength shift is mapped to a time-series shift of a time-domain waveform. The time offset is acquired by a signal acquisition device to obtain time-domain sequence data, and the time-domain sequence data is preprocessed. Positional encoding is used to inject temporal information into preprocessed time-domain sequence data to obtain feature sequences containing temporal information. The feature sequence is input into a Transformer neural network, and the multi-head self-attention mechanism of the Transformer neural network is used to extract global features; The global features are normalized and then processed by the position-aware feedforward network of the Transformer neural network to enhance the features; The enhanced features are mapped through the fully connected layer of the Transformer neural network to output the predicted temperature value; The step of normalizing the global features and then processing them through the position-aware feedforward network of the Transformer neural network to enhance the features includes: The normalized global features are then subjected to dimensionality reduction to obtain compressed global features. The compressed global features are processed by a nonlinear activation function to obtain enhanced features, including amplitude abrupt change rate, slope change of continuous sampling points, and steepness of pulse rise and fall edges; The compressed global feature, which has undergone nonlinear activation, is subjected to dimensionality upscaling to obtain a first feature, the dimension of which is the same as that of the global feature. The first feature is normalized, and the process is returned to execute: global features are extracted using the multi-head self-attention mechanism of the Transformer neural network; the global features are normalized and then processed by the position-aware feedforward network of the Transformer neural network to enhance the features; wherein, the input of each loop is the feature after the second normalization in the previous loop, and after a preset number of loops, the encoded features are obtained. The process of mapping the enhanced features through the fully connected layer of the Transformer neural network to output a predicted temperature value includes: The encoded features are subjected to global average pooling to obtain the pooled feature vector; The pooled feature vector is input into the fully connected layer, and the final continuous temperature prediction value is output through linear weighting and bias adjustment.
2. The method according to claim 1, characterized in that, The step of acquiring the time offset through a signal acquisition device to obtain time-domain sequence data, and preprocessing the time-domain sequence data, includes: The time offset is converted into an electrical signal using a photodetector, and the electrical signal is captured by a high-speed oscilloscope to obtain time-domain sequence data. High-frequency noise in the time-domain sequence data is removed by low-pass filtering; For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
3. The method according to claim 1, characterized in that, The step of injecting temporal information into the preprocessed time-domain sequence data using positional encoding to obtain a feature sequence containing temporal information includes: The preprocessed time-domain sequence data is mapped into high-dimensional feature vectors through a linear embedding layer; Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
4. The method according to claim 1, characterized in that, The step of inputting the feature sequence into a Transformer neural network and extracting global features using the multi-head self-attention mechanism of the Transformer neural network includes: The feature sequence containing temporal information is split into multiple attention heads; The attention weights corresponding to the value vectors in each attention head are calculated using query vectors and key vectors to capture global dependencies within the sequence; The global features are obtained by concatenating the outputs of all attention heads and performing a linear transformation.
5. A temperature measurement device based on machine learning, characterized in that, The device includes: The conversion module is used to convert temperature changes into wavelength shifts in the interference spectrum using an interferometric fiber optic temperature sensor. The mapping module is used to stretch the wavelength shift in the time domain using dispersion compensation fiber, and map the wavelength shift into a time-series shift of a time-domain waveform. The acquisition module is used to acquire the time offset through a signal acquisition device to obtain time-domain sequence data, and to preprocess the time-domain sequence data; The position encoding module is used to inject temporal information into the preprocessed time-domain sequence data using position encoding, thereby obtaining a feature sequence containing temporal information. The self-attention processing module is used to input the feature sequence into the Transformer neural network and extract global features using the multi-head self-attention mechanism of the Transformer neural network. The position-aware feedforward network processing module is used to normalize the global features and then process them through the position-aware feedforward network of the Transformer neural network to enhance the features; The output module is used to map the enhanced features through the fully connected layer of the Transformer neural network and output the predicted temperature value. The position-aware feedforward network processing module is specifically used to: reduce the dimensionality of the normalized global features to obtain compressed global features; process the compressed global features using a nonlinear activation function to obtain enhanced features, including amplitude mutation rate, slope change of continuous sampling points, and steepness of pulse rise and fall edges; increase the dimensionality of the compressed global features after nonlinear activation to obtain a first feature, the first feature having the same dimension as the global features; normalize the first feature and return to execute: extract global features using the multi-head self-attention mechanism of the Transformer neural network; normalize the global features and process them through the position-aware feedforward network of the Transformer neural network to enhance the features; wherein, the input of each loop is the feature after the second normalization in the previous loop, and after a preset number of loops, the encoded features are obtained; The output module is specifically used to perform global average pooling on the encoded features to obtain a pooled feature vector; input the pooled feature vector into the fully connected layer, and output the final continuous temperature prediction value through linear weighting and bias adjustment.
6. The apparatus according to claim 5, characterized in that, The acquisition module is specifically used for: The time offset is converted into an electrical signal using a photodetector, and the electrical signal is captured by a high-speed oscilloscope to obtain time-domain sequence data. High-frequency noise in the time-domain sequence data is removed by low-pass filtering; For the denoised time-domain sequence data, the signal amplitude is mapped to the [-1,1] interval through normalization processing.
7. The apparatus according to claim 5, characterized in that, The location encoding module is specifically used for: The preprocessed time-domain sequence data is mapped into high-dimensional feature vectors through a linear embedding layer; Sine-cosine position coding is used to inject temporal information into the high-dimensional feature vector to obtain a feature sequence containing temporal information.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements any of the machine learning-based temperature measurement methods described in claims 1-4.
Citation Information
Patent Citations
Temperature optimized measurement method on basis of analysis on interference spectrum of core-dislocated fibers in BP neural network
CN105092084A
Multi-channel photon sampling analog-to-digital conversion system and method based on neural network
CN119483599A