Temperature measurement method and device based on machine learning and storage medium
By combining an interferometric fiber optic temperature sensor with a Transformer neural network, high-speed and high-precision temperature monitoring of the fiber optic temperature sensor is achieved, solving the problems of insufficient demodulation rate and accuracy in traditional methods and improving the practicality and stability of the system.
Patent Information
- Application Number
- CN202511704872.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2045-11-20
AI Technical Summary
Existing fiber optic temperature sensors suffer from limited demodulation rates and insufficient accuracy in industrial applications, making it impossible to simultaneously achieve high-speed and high-precision temperature monitoring.
An interferometric fiber optic temperature sensor is used to convert temperature changes into wavelength shifts in the interferometric spectrum. Dispersion-compensating fiber is used for time-domain stretching, and a Transformer neural network is used for signal processing, including a multi-head self-attention mechanism and a position-aware feedforward network, to extract global features and output predicted temperature values.
It achieves high-speed real-time temperature monitoring at 50MHz and high-precision measurement at the sub-Celsius level, significantly improving the system's robustness and anti-interference ability, and solving the problem of the difficulty in achieving both speed and accuracy in traditional methods.
Smart Images

Figure CN121167679A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of temperature demodulation, and particularly relates to a temperature measurement method and device based on machine learning and a storage medium. BACKGROUND
[0002] Optical fiber temperature sensors play a key role in precise temperature monitoring in harsh environments (such as industrial scenes) due to their inherent advantages such as electromagnetic interference resistance, small size, and good stability. As a core sensing structure, the Sagnac interferometer has the advantage of being able to produce a phase difference through the change of fiber birefringence caused by temperature without complex microprocessing, thereby achieving high-sensitivity measurement of local temperature.
[0003] In order to further improve the sensitivity, researchers usually introduce special optical fibers (such as panda fibers and side-hole fibers) with high birefringence coefficients to amplify the phase difference caused by temperature. Although the sensitivity is improved, the demodulation rate is severely limited by the speed of traditional spectral reading devices (such as optical spectrum analyzers), which is usually only a few hertz to a few hundred hertz, and cannot meet the demand for high-speed and real-time temperature monitoring in industrial applications.
[0004] In order to solve the speed bottleneck, time-domain stretching technology has been introduced in recent years. This technology uses dispersive media to map spectral information into time-domain waveforms, so that MHz-level optical events can be captured by low-speed electronic devices, thereby achieving high-speed demodulation. However, this high-speed time-domain demodulation method faces the serious challenge of insufficient detection accuracy. Time-domain waveforms are easily disturbed by noise, and traditional simple algorithms such as linear fitting are difficult to accurately extract small temperature information from complex waveform changes, resulting in large measurement errors and limiting its practical application in high-precision scenarios.
[0005] Therefore, there is an urgent need in the art for an innovative technical solution that can simultaneously achieve high-speed and high-precision temperature demodulation to overcome the inherent defects of existing technologies in balancing speed and accuracy. SUMMARY
[0006] In order to achieve high-speed and high-precision demodulation of temperature, in a first aspect, the application provides a temperature measurement method based on machine learning, which comprises: converting temperature changes into wavelength shifts of interference spectra by an interference optical fiber temperature sensor; mapping the wavelength shift into a time sequence shift of a time-domain waveform by using a dispersion-compensated optical fiber to stretch the wavelength shift in time domain; acquiring the time sequence shift by a signal acquisition device to obtain time-domain sequence data, and preprocessing the time-domain sequence data; injecting time sequence information into the preprocessed time-domain sequence data by using position encoding to obtain a feature sequence containing time sequence information; inputting the feature sequence into a Transformer neural network, and extracting global features by using a multi-head self-attention mechanism of the Transformer neural network; processing the global features by a position-aware feedforward network of the Transformer neural network after normalization, and enhancing the features; mapping the enhanced features by a fully connected layer of the Transformer neural network, and outputting a predicted temperature value.
[0007] In a possible implementation, the time sequence offset is collected by the signal collection device to obtain time domain sequence data, and the time domain sequence data is preprocessed, including: The time sequence offset is converted into an electrical signal by 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 interval [-1, 1] by normalization processing.
[0008] In a possible implementation, the time sequence information is injected into the preprocessed time domain sequence data by using position encoding to obtain a feature sequence containing time sequence information, including: The preprocessed time domain sequence data is mapped into a high-dimensional feature vector by a linear embedding layer; The time sequence information is injected into the high-dimensional feature vector by using sine-cosine position encoding to obtain the feature sequence containing the time sequence information.
[0009] In a possible implementation, the feature sequence is input into a Transformer neural network, and global features are extracted by using a multi-head self-attention mechanism of the Transformer neural network, including: The feature sequence containing the time sequence information is split into multiple attention heads; The attention weight corresponding to the value vector in each attention head is calculated by using a query vector and a key vector to capture the global dependency relationship within the sequence; The outputs of all the attention heads are spliced and linearly transformed to obtain the global features.
[0010] In a possible implementation, the global features are normalized and processed by a position-aware feedforward network of the Transformer neural network to enhance the features, including: The normalized global features are processed by dimension reduction to obtain compressed global features; The compressed global feature is processed by a nonlinear activation function to obtain an enhanced feature, including a rate of amplitude mutation, a change in a slope of continuous sampling points, and a steepness of pulse rising and falling edges. The compressed global feature subjected to nonlinear activation is processed to obtain a first feature, and a dimension of the first feature is the same as a dimension of the global feature. The first feature is normalized, and the following is performed: global features are extracted by using a multi-head self-attention mechanism of the Transformer neural network; and the global features are processed by a position-aware feedforward network of the Transformer neural network after being normalized, to enhance the features; wherein an input of each round of circulation is the features after being normalized for the second time in the previous round, and after circulation for a preset number of rounds, an encoded feature is obtained.
[0011] In a possible implementation, the enhanced feature is mapped by using a fully connected layer of the Transformer neural network to output a predicted temperature value, including: The encoded feature is globally averaged pooled to obtain a pooled feature vector. The pooled feature vector is input into the fully connected layer, and a final continuous temperature prediction value is output by linear weighting and bias adjustment.
[0012] In a second aspect, an embodiment of the present application provides a temperature measuring device based on machine learning, including: A conversion module is configured to convert temperature changes into wavelength shifts of an interference spectrum by using an interferometric fiber optic temperature sensor. A mapping module is configured to map the wavelength shifts into time sequence shifts of a time-domain waveform by using a dispersion-compensated optical fiber to stretch the wavelength shifts in the time domain. A collection module is configured to collect the time sequence shifts by using a signal collection device to obtain time-domain sequence data, and to pre-process the time-domain sequence data. A position encoding module is configured to inject time sequence information into the pre-processed time-domain sequence data by using position encoding to obtain a feature sequence containing the time sequence information. A self-attention processing module is configured to input the feature sequence into a Transformer neural network to extract global features by using a multi-head self-attention mechanism of the Transformer neural network. A position-aware feedforward network processing module is configured to process the global features by using a position-aware feedforward network of the Transformer neural network after normalizing the global features, to enhance the features. An output module is configured to map the enhanced features through a full connection layer of the Transformer neural network, and output a predicted temperature value.
[0013] In a possible implementation, the collection module is specifically configured to: convert the time sequence offset into an electrical signal through a photoelectric detector, capture the electrical signal through a high-speed oscilloscope, and obtain time domain sequence data; remove high-frequency noise in the time domain sequence data through low-pass filtering; for the denoised time domain sequence data, map the signal amplitude to the interval [-1, 1] through normalization processing.
[0014] In a possible implementation, the position encoding module is specifically configured to: map the preprocessed time domain sequence data into a high-dimensional feature vector through a linear embedding layer; inject time sequence information into the high-dimensional feature vector through a sine-cosine position encoding, and obtain a feature sequence containing time sequence information.
[0015] In a third aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement any of the above machine learning-based temperature measurement methods.
[0016] The machine learning-based temperature measurement method provided by the embodiments of the present application converts temperature changes into wavelength shifts of interference spectra through an interference optical fiber temperature sensor; a dispersion compensation optical fiber is used to stretch the time domain of the wavelength shift, and map the wavelength shift into a time sequence offset of a time domain waveform; the time sequence offset is collected through a signal collection device to obtain time domain sequence data, and the time domain sequence data is preprocessed; time sequence information is injected into the preprocessed time domain sequence data through position encoding to obtain a feature sequence containing time sequence information; the feature sequence is input into a Transformer neural network, and global features are extracted through a multi-head self-attention mechanism of the Transformer neural network; the global features are normalized and then processed through a position-aware feedforward network of the Transformer neural network to enhance the features; the enhanced features are mapped through a full connection layer of the Transformer neural network, and a predicted temperature value is output. High-speed and high-precision temperature prediction is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 The first flowchart of the machine learning-based temperature measurement method provided by the embodiments of the present application; Figure 2A first structural schematic diagram of a temperature measurement system based on machine learning provided by an embodiment of the present application is shown in FIG. 1. Figure 3 A second structural schematic diagram of a temperature measurement system based on machine learning provided by an embodiment of the present application is shown in FIG. 2. Figure 4 A second flowchart of a temperature measurement method based on machine learning provided by an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION
[0018] The present application will be described in detail below through embodiments.
[0019] Optical fiber temperature sensors play a key role in precise temperature monitoring in harsh environments (such as industrial scenarios) due to their inherent advantages such as electromagnetic interference resistance, small size, and good stability. As a core sensing structure, the Sagnac interferometer has the advantage of being able to produce a phase difference through the change in fiber birefringence caused by temperature without complex microprocessing, thereby achieving high-sensitivity measurement of local temperature.
[0020] In order to further improve the sensitivity, researchers usually use special optical fibers with high birefringence coefficients (such as panda fibers and side-hole fibers) to amplify the phase difference caused by temperature. Although the sensitivity is improved, the demodulation rate is severely limited by the speed of traditional spectral reading devices (such as optical spectrum analyzers), which is usually only a few hertz to a few hundred hertz, and cannot meet the demand for high-speed and real-time temperature monitoring in industrial applications.
[0021] In order to solve the speed bottleneck, time-domain stretching technology has been introduced in recent years. This technology uses dispersive media to map spectral information into time-domain waveforms, so that MHz-level optical events can be captured by low-speed electronic devices, thereby achieving high-speed demodulation. However, this high-speed time-domain demodulation method faces the serious challenge of insufficient detection accuracy. Time-domain waveforms are easily disturbed by noise, and traditional simple algorithms such as linear fitting are difficult to accurately extract small temperature information from complex waveform changes, resulting in large measurement errors and limiting its practical application in high-precision scenarios.
[0022] Therefore, there is an urgent need in the art for an innovative technical solution that can simultaneously achieve high-speed and high-precision temperature demodulation to overcome the inherent defects of existing technologies in balancing speed and accuracy.
[0023] In a first aspect, referring to Figure 1 A temperature measurement method based on machine learning provided by an embodiment of the present application, the method comprises: S101, converting temperature changes into wavelength shifts of interference spectra by an interference optical fiber temperature sensor.
[0024] The interference type optical fiber temperature sensor is a Sagnac interferometer based on a side hole fiber or a panda fiber. The core temperature sensitive element is the Sagnac interferometer, which converts the external temperature change into the movement of the transmission light spectrum. When the temperature changes by ΔT, the birefringence of the side hole fiber changes by ΔB, which in turn causes the wavelength shift of the interference spectrum to be Δλ, and the temperature sensitivity is Δλ / ΔT=-0.626nm / °C.
[0025] S102, using a dispersion compensation fiber to time domain stretch the wavelength shift, and mapping the wavelength shift into a time sequence shift of the time domain waveform.
[0026] Using the dispersion effect (dispersion coefficient D=-100ps / nm) of the dispersion compensation fiber, the spectrum pulse from the temperature sensor is widened in time, and the wavelength shift Δλ is linearly converted into the time sequence shift Δt of the time domain waveform, and the conversion relationship is Δλ=Δt / D, thereby realizing high-speed real-time signal acquisition of 50MHz, and the time domain sensitivity is Δt / ΔT=0.28ns / °C.
[0027] S103, acquiring the time sequence shift through a signal acquisition device to obtain time domain sequence data, and preprocessing the time domain sequence data.
[0028] Specifically, it can include: converting the time sequence shift into an electrical signal through a photoelectric detector, and capturing the electrical signal through a high-speed oscilloscope to obtain time domain sequence data; wherein the high-speed oscilloscope captures at a repetition frequency of 50MHz; 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 filtering with a cutoff frequency of 5MHz, which aims to remove high frequency noise introduced by the photoelectric detector; For the denoised time domain sequence data, the signal amplitude is mapped to the interval [-1, 1] through normalization processing.
[0029] S104, injecting time sequence information into the preprocessed time domain sequence data using position encoding to obtain a feature sequence containing time sequence information.
[0030] Specifically, it can include: mapping the preprocessed time domain sequence data to a high-dimensional feature vector through a linear embedding layer; injecting time sequence information into the high-dimensional feature vector using sine-cosine position encoding to obtain a feature sequence containing time sequence information.
[0031] By introducing position encoding, it is ensured that the Transformer neural network can utilize the sequential information of the waveform on the time axis.
[0032] S105, input the feature sequence into a Transformer neural network, and extract global features by using a multi-head self-attention mechanism of the Transformer neural network.
[0033] The self-attention mechanism can globally capture long-distance temperature-dependent key feature dependencies in the waveform sequence, and overcome the gradient disappearance problem of the traditional recurrent neural network when processing long sequences.
[0034] Specifically, the feature sequence containing time sequence information can be split into multiple attention heads; The attention weight corresponding to the value vector in each attention head is calculated by using the query vector and the key vector, so as to capture the global dependency within the sequence; The outputs of all attention heads are spliced and linearly transformed to obtain the global features.
[0035] One attention head focuses on one problem, which can be the movement of the wave crest, the overall tilt of the waveform, etc. Through this parallel processing, the neural network can capture multiple different types and scales of dependencies from the same signal, thereby accurately locking the most relevant features to temperature changes.
[0036] If the feature sequence includes 200 sampling points, for each sampling point, the initial vector is linearly transformed into three new vectors, i.e., a query vector Q, a key vector K, and a value vector V, by using three different weight matrices. There are 200 Qs, 200 Ks, and 200 Vs for 200 sampling points. For each sampling point, the query vector is dot multiplied by 200 key vectors to obtain 200 value vectors each corresponding to an attention score, which indicates how much attention should be paid to the 1st point, the 2nd point, …, and the 200th point when understanding the current sampling point. The 200 attention scores are normalized by a softmax function to obtain a set of weights with a sum of 1, and the 200 value vectors are weighted and summed by using the set of weights. The above process is performed in parallel for each sampling point in the sequence, and finally, a new sequence of 200 points is obtained, each point containing global context information.
[0037] S106, after normalizing the global features, the global features are processed by a position-aware feedforward network of the Transformer neural network to enhance the features.
[0038] The global features after normalization are processed by dimension reduction to obtain compressed global features. The compressed global features are processed by a nonlinear activation function to obtain enhanced features, including amplitude mutation rate, continuous sampling point slope change, and pulse rising and falling edge steepness. The compressed global feature subjected to nonlinear activation is dimensionally upgraded to obtain a first feature, which has the same dimension as the global feature; The first feature is normalized, and the following is performed: global features are extracted using the multi-head self-attention mechanism of the Transformer neural network; the global features are processed by the position-aware feedforward network of the Transformer neural network after being normalized, so as to enhance the features; wherein the input of each round of circulation is the feature after the second normalization in the last round, and after circulation for a preset number of rounds, an encoded feature is obtained.
[0039] The input (a feature sequence containing time sequence information) and the output (a global feature) of the Transformer neural network are connected in residual connection, and then the result of the residual connection is normalized to obtain the input of the position-aware feedforward network. The position-aware feedforward network is used for nonlinear transformation and feature enhancement of the output of the self-attention layer, including two linear transformations and one nonlinear activation, and then the input and the output of the position-aware feedforward network are connected in residual connection again, and the result of the residual connection is normalized. The above encoder layer is repeatedly stacked for 4 layers, the feature extraction capability is strengthened through multi-layer iteration, and finally the encoded feature is output.
[0040] In S107, the enhanced feature is mapped through the fully connected layer of the Transformer neural network, and a predicted temperature value is output.
[0041] The encoded feature is globally averaged and pooled to obtain a pooled feature vector; The pooled feature vector is input into the fully connected layer, and a final continuous temperature prediction value is output through linear weighting and bias adjustment.
[0042] The temperature measurement method based on machine learning provided by the embodiment of the application converts temperature changes into wavelength shifts of interference spectrum through an interference optical fiber temperature sensor; a dispersion compensation optical fiber is used to stretch the time domain of the wavelength shift, so as to map the wavelength shift into a time sequence shift of the time domain waveform; the time sequence shift is collected by a signal collection device, time domain sequence data is obtained, and the time domain sequence data is preprocessed; position coding is used to inject time sequence information into the preprocessed time domain sequence data, so as to obtain a feature sequence containing time sequence information; the feature sequence is input into a Transformer neural network, and a multi-head self-attention mechanism of the Transformer neural network is used to extract global features; after the global features are normalized, the global features are processed by a position perception feedforward network of the Transformer neural network, so as to enhance the features; the enhanced features are mapped by a full connection layer of the Transformer neural network, and a predicted temperature value is output. High-speed and high-precision temperature prediction is realized.
[0043] Referring to Figure 2 A structural schematic diagram of the temperature measurement system based on machine learning provided by the embodiment of the application includes a mode-locked laser 101, a Sagnac interferometer 102, a dispersion compensation optical fiber 103, a photoelectric detector 104, a high-speed oscilloscope 105 and a computing unit 106. The mode-locked laser is used to generate ultrashort optical pulses, and the Sagnac interferometer is used to modulate the spectrum of the ultrashort optical pulses generated by the mode-locked laser, so as to encode the interference spectrum information on the pulses. Subsequently, the pulses after the spectrum modulation pass through the dispersion compensation optical fiber to stretch the time domain, so as to convert the wavelength shift into a detectable time domain waveform. The time domain waveform is captured by the photoelectric detector, recorded by the high-speed oscilloscope, and finally demodulated by the computing unit.
[0044] Referring to Figure 3Another structural schematic diagram of the temperature measurement system based on machine learning provided by the embodiment of the present application includes a mode-locked laser 101, an isolator 201, a polarization controller 202, a 50:50 coupler 203, a Sagnac interferometer 102, a dispersion compensation 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 model of the mode-locked laser can be ROI, EFLA-B-1560-50, the center wavelength is 1560 nm, and the pulse width is 100 fs. The light pulses emitted by the mode-locked laser pass through the isolator and the polarization controller in turn, and the polarization state of the light pulses is modulated and then enters the Sagnac interferometer (based on a 30 cm side-hole optical fiber) as the core sensing unit through the 50:50 coupler. Subsequently, the interference-modulated light is introduced into the dispersion compensation fiber for time stretching. Thereafter, a 90:10 optical coupler divides the signal into two paths: one path is guided to the spectrum analyzer (model: YOKOGAWA AQ6370D, resolution 0.02 nm) for spectral characterization and calibration; the other path is photoelectrically converted by the high-speed photodetector (model: HLT Optical, bandwidth 10 GHz) and recorded by the 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 calculation and demodulation.
[0045] Referring to Figure 4 The processing flow schematic diagram of the Transformer neural network provided by the embodiment of the present application is shown in FIG. 4.
[0046] S201, a training sample pair is obtained.
[0047] The acquired time-domain sequence data is received, the sequence length is set to 200 sampling points, and the input dimension is 200x1 (sequence length x time-domain amplitude feature dimension). First, the Butterworth low-pass filter with a cutoff frequency of 5 MHz is used to remove the high-frequency noise introduced by the photodetector, and then the Z-score normalization is used to map the signal amplitude to the [-1, 1] interval. Subsequently, the preprocessed time-domain sequence data and the corresponding true temperature label are bound to form a training sample pair.
[0048] S202, position encoding is performed on the preprocessed time-domain sequence data.
[0049] Then, position encoding is performed on the sequence. First, it is mapped to a 64-dimensional feature vector through a linear embedding layer (weight matrix 1x64), and then the sine-cosine position encoding is used to inject the time sequence information, outputting a 200x64-dimensional feature sequence containing the time sequence.
[0050] S203, multi-head self-attention processing is performed.
[0051] The above feature sequence is input into a stacked Transformer encoder layer for processing. First, the 64-dimensional features are split into 8 heads by the multi-head self-attention mechanism, Q, K, and V matrices (dimension 200x8) are generated, and attention weights are calculated by Attention(Q, K, V)=softmax(dkQKT)V (dk=8), after splicing the 8-head output, a linear transformation (64x64 weight matrix) is performed to obtain the result, and global time dependency is extracted, such as the time sequence correlation of different sampling point peak and valley values, and the trend of cross-position amplitude change.
[0052] S204, residual connection and normalization.
[0053] The 200x64-dimensional time-dependent feature sequence output by the above S202 step is connected in residual with the multi-head self-attention processing result output by the above S203 step, and the residual connection result is normalized, and layer normalization is used to stabilize the feature distribution.
[0054] S205, processed by position-aware feedforward network.
[0055] The position-aware feedforward network processes the features by two layers of linear transformation 64-dimensional→25-dimensional (ReLU activation)→64-dimensional, extracting local significant features such as amplitude mutation rate, continuous sampling point slope change, and pulse rising and falling edge steepness, which are directly related to temperature.
[0056] 1. First linear transformation The 64-dimensional vector at each position is mapped to a new dimension (25-dimensional) through a fully connected layer (linear layer). By changing the dimension (here it is reduced), the network is forced to learn a more effective information representation.
[0057] 2. Introduce nonlinearity (core step) The 25-dimensional vector obtained in the last step is passed through a nonlinear activation function ReLU, which sets all negative values to zero and only keeps positive values. This introduces a nonlinear transformation capability to the model, allowing it to learn and model more complex feature patterns. Without this step, the entire feedforward network is just a stack of two linear transformations, and its expression ability will be greatly reduced. It enables the network to capture complex features such as amplitude mutation rate and pulse rising and falling edge steepness.
[0058] 3. Second linear transformation (restore dimension) The 25-dimensional vector activated by ReLU is mapped back to the original 64 dimensions through another fully connected layer. The processed features are projected back to a space with the same dimension as the input to be added to the residual connection and input to the next Transformer layer.
[0059] The output of this step is a feature sequence with the same dimension of [200, 64]. However, the 64-dimensional vector at each position is no longer simply global correlation information, but a higher-quality and more expressive feature after deep nonlinear processing.
[0060] S206, residual connection and normalization.
[0061] The input of the position-aware feedforward network (i.e., the first residual connection and normalization result output by step S204 above) and the output (i.e., the output of step S205 above) are connected and normalized.
[0062] To enhance feature extraction capability, the above encoder layer is repeated and stacked four times, i.e., the steps including S203 to S206 are executed four times, and finally the encoded features are obtained.
[0063] S207, regression output temperature value.
[0064] First, perform global average pooling on the encoded features, calculate the mean of the feature values of the 200 sampling points for each of the 64 feature dimensions, and compress it into a 64-dimensional vector to aggregate global features; then input the 64-dimensional vector into a fully connected layer, perform matrix multiplication with a learnable 64x1 weight matrix (multiply and accumulate the mean of each dimension with the corresponding weight), and add a single-value bias term for adjustment. Since temperature prediction is a continuous value regression task, this fully connected layer does not introduce a nonlinear activation function, and directly outputs a single-value result, which is the final continuous temperature prediction value, completing the mapping from abstract deep features to specific temperature value space.
[0065] The Transformer neural network is trained to minimize the mean square error between the predicted temperature and the true temperature, using the Adam optimizer for gradient backpropagation to update the parameters. A total of 600 rounds of training are performed, with verification every 10 rounds. If the validation set loss does not decrease for 20 consecutive rounds, the training is stopped early. Finally, high-precision temperature prediction from time-domain waveforms is achieved.
[0066] The machine learning-based temperature measurement method provided in the present application achieves a balance between speed and accuracy, which is manifested in the following aspects: Ultra-high speed: Through time-domain stretching technology, the demodulation rate is improved from the Hz level of traditional spectrum analyzers to 50MHz, realizing real-time and high-speed temperature monitoring in a true sense, and being able to capture transient temperature changes.
[0067] Ultra-high precision: By introducing the Transformer neural network for intelligent calculation, the demodulation mean square error is reduced from the traditional linear fitting of 0.017614 °C² to 0.000011 °C², the error is reduced by three orders of magnitude, and the root mean square error reaches 0.0033 °C, realizing the high-precision measurement of sub-degree level. This is the precision level that pure hardware or traditional algorithm is difficult to achieve.
[0068] The machine learning-based temperature measurement method provided in the application improves the robustness and practicality of the system, which is specifically manifested in the following aspects: Strong anti-interference capability: The Transformer model is good at extracting effective features from complex signals containing noise, and its global perception capability makes it insensitive to random fluctuations and noise in the time domain waveform, thereby significantly improving the stability and reliability of the system in harsh industrial environments.
[0069] Solves the pain point of insufficient precision of traditional time domain demodulation: The present application provides an effective solution to the biggest technical obstacle in high-speed time domain demodulation technology-precision difference, making the technology from "available" to "useful", greatly expanding its application scenarios.
[0070] The machine learning-based temperature measurement method provided in the application provides an innovative technology integration paradigm, and the present application is not a simple superposition of hardware, optical and algorithmic technologies, but a deep integration of high-sensitivity Sagnac sensor, high-speed time domain stretching physical conversion and advanced Transformer intelligent algorithm, forming a complete and superior sensing system solution. This cross-disciplinary technology integration provides a new approach and methodology for solving high-speed and high-precision measurement of other physical quantities.
[0071] In a second aspect, the embodiments of the present application provide a machine learning-based temperature measurement device, which comprises: A conversion module for converting temperature changes into wavelength shifts of interference spectra by an interferometric fiber temperature sensor; A mapping module for mapping the wavelength shift into a time sequence shift of a time domain waveform by time domain stretching of the wavelength shift using a dispersion compensation fiber; An acquisition module for acquiring the time sequence shift by a signal acquisition device to obtain time domain sequence data, and pre-processing the time domain sequence data; A position encoding module for injecting time sequence information into the pre-processed time domain sequence data to obtain a feature sequence containing time sequence information; The self-attention processing module is configured to input the feature sequence into a Transformer neural network, and extract global features by using a multi-head self-attention mechanism of the Transformer neural network. The position-aware feedforward network processing module is configured to normalize the global features and process the normalized global features by a position-aware feedforward network of the Transformer neural network, and enhance the features. The output module is configured to map the enhanced features by a fully connected layer of the Transformer neural network, and output a predicted temperature value.
[0072] In a possible implementation, the acquisition module is specifically configured to: convert the time sequence offset into an electrical signal by using a photoelectric detector, capture the electrical signal by using a high-speed oscilloscope, and obtain time-domain sequence data; remove high-frequency noise in the time-domain sequence data by using low-pass filtering; for the denoised time-domain sequence data, map the signal amplitude to the interval [-1, 1] by using normalization processing.
[0073] In a possible implementation, the position encoding module is specifically configured to: map the preprocessed time-domain sequence data into a high-dimensional feature vector by using a linear embedding layer; inject time sequence information into the high-dimensional feature vector by using sine-cosine position encoding, and obtain a feature sequence containing time sequence information.
[0074] In a third aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement any of the above-mentioned COSEM object data acquisition methods based on the DLMS protocol.
[0075] In the embodiments described above, all or some of the steps can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, all or some of the steps can be implemented in the form of one or more computer programs or program elements. The computer programs reside (at least temporarily) in a memory of a computer during execution. The memory can be a RAM memory, a flash memory, a ROM memory, an EPROM memory, or any other suitable device. The memory can exist within a computer as a stand-alone device, or it can be provided in association with a computer as a system memory, or it can be provided in association with one or more computer processors as a processor memory. The computer programs can be written in any suitable programming language, or languages, and can be compiled or interpreted. The computer programs can be distributed over network coupled computer systems so that the computer programs are stored and executed in a distributed fashion. The computer programs can also be embodied in the form of computer readable data, which can be stored in a computer readable storage medium. The storage medium can be magnetic (e.g., a floppy disk or a hard drive), optical (e.g., a compact disc or a DVD), magneto-optical (e.g., a floptical disk), semiconductor (e.g., a solid state hard drive like a SSD), or any other suitable device. The computer readable storage medium can be a computer readable storage device or a computer readable storage medium that is integrated in a computer or a computer processor.
[0076] It should be noted that, in the present document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. In other words, it is contemplated that the process, method, article, or apparatus that comprises one or more first elements can include one or more second elements, and that the process, method, article, or apparatus that comprises one or more first elements can include one or more second elements, and that the process, method, article, or apparatus that comprises one or more first elements can include one or more second elements, without necessarily including the first elements, unless the context clearly indicates otherwise.
[0077] The various embodiments described in the specification can be implemented in related fashion, and the same or similar parts among the various embodiments can be mutually referred to. Each embodiment focuses on the difference from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0078] Although the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are exemplary and are not to be construed as limiting the present application, and that modifications can be made by those skilled in the art without departing from the spirit and scope of the present application.
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 a predicted temperature value.
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. The method according to claim 1, characterized in that, 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.
6. The method according to claim 5, characterized in that, 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.
7. 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.
8. The apparatus according to claim 7, 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.
9. The apparatus according to claim 7, 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.
10. 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-6.
Citation Information
Patent Citations
Temperature optimized measurement method on basis of analysis on interference spectrum of core-dislocated fibers in BP neural network
CN105092084A
Lithium battery module temperature field reconstruction method based on deep operator learning
CN117195713A
Multi-channel photon sampling analog-to-digital conversion system and method based on neural network
CN119483599A
Intelligent temperature adjusting method and system for injection molding mold
CN119871831A
High-precision prediction method for shelf-life of aquatic products under variable temperature environment
US20250225296A1
Cited By
Distributed optical fiber temperature measurement positioning calibration method and system based on Raman effect
CN121540166A
