Transfer learning method applied to distributed optical fiber sensing
By adopting the Prompt-tunning method in distributed fiber sensing technology, the input Prompt is optimized to freeze the source domain model parameters and only train Prompt, the problems of large training data demand, huge models, catastrophic forgetting and long training time in the existing technology are solved, and the transfer learning effect with high accuracy and low storage cost is achieved.
Patent Information
- Application Number
- CN202411931606.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-22
AI Technical Summary
The existing distributed fiber sensing technology has shortcomings in training data requirements, large models, catastrophic forgetting and long training time, making it difficult to effectively identify target domain data.
The Prompt-tunning method is adopted to guide the model to generate the desired output by optimizing the input-added Prompt, and the transfer learning method for distributed fiber sensing is used to freeze the source domain model parameters, and only the added Prompt is trained to achieve the identification and classification of target domain samples.
It effectively improves the adaptability of the model to the target tasks, improves the accuracy of prediction, significantly reduces storage costs, and maintains good cross-domain universality.
Smart Images

Figure CN119862912A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of transfer learning and distributed optical fiber sensing, and more specifically, to a transfer learning method applied to distributed optical fiber sensing. Background Art
[0002] Since the 1980s, the development of new sensors and new sensing technologies has become a hot topic of research at home and abroad. Distributed fiber acoustic sensing (DAS) technology uses optical fiber as a signal transmission medium and sensing unit to detect the changes in parameters such as intensity, phase and polarization state of optical signals in optical fibers under the action of external fields, thereby realizing continuous distributed measurement of external parameters along the optical fiber. Compared with traditional semiconductor sensors, electrochemical sensors, micro-electromechanical system sensors, etc., DAS has many unique advantages. Distributed optical fiber sensors are insulated, resistant to electromagnetic interference, low in loss, and corrosion-resistant. Compared with point or discrete optical fiber sensors, DAS does not require complex installation or special packaging, is easy to lay, and can even use existing communication optical fibers. It can also simultaneously obtain time and space continuous distribution information along the optical fiber path, overcoming the defect that point sensors (such as fiber grating sensors) are difficult to conduct all-round continuous monitoring of the measured field. Therefore, DAS technology has been widely used in many fields such as electricity, energy, communications, transportation, and security.
[0003] On the other hand, DAS detects events based on changes in optical scattering intensity or phase along the fiber path, but cannot directly provide accurate information on the nature or quantity of events, resulting in a high false alarm rate. For example, vibration, impact, environmental noise, etc. may cause similar signal changes, making it difficult to directly identify the source of the event through simple analysis. Machine learning learns the characteristics of different event signals, but it has high requirements for the amount of training data and hardware conditions, so transfer learning is needed to solve this problem.
[0004] Several transfer learning methods applied to distributed optical fiber sensing are also disclosed in the existing technology. Shi Yi et al. of Shantou University (Document 1: A method for classifying optical fiber warning system events based on transfer learning, CN 113408346A) use a model trained on the ImageNet dataset, and then fine-tune and freeze the model, which can reduce the training time and complete the event classification task based on a small data sample and a portable computer. However, the fine-tuned or frozen model will have catastrophic forgetting and can only classify the data in the target domain, but not the source domain data. Shen Yongxu et al. of Qilu University of Technology (Shandong Academy of Sciences) (Document 2: A method for identifying perimeter security intrusion signals based on distributed optical fiber sensing in migration scenarios, CN118781723A) use a linear probe method that adds a new fully connected layer to the original network structure. However, the learning ability of the linear classifier is limited and may not be able to handle complex task requirements. In addition, the model required to be saved is huge and may be difficult to deploy. Summary of the invention
[0005] In order to overcome the shortcomings of the existing technology and solve the problems of the existing DAS in terms of required training data, large models, catastrophic forgetting and long training time, the present invention provides a transfer learning method applied to distributed optical fiber sensing DAS, which adopts a prompt-tunning method to more effectively guide the model to generate the desired output by optimizing the prompt added to the input; so as to solve the problems existing in the prior art and at least provide a beneficial choice or create conditions.
[0006] The solution of the present invention to solve its technical problem is:
[0007] A transfer learning method applied to distributed optical fiber sensing comprises the following steps:
[0008] Step 1: Data preparation: The phase signals in different scenarios are collected through the distributed optical fiber sensing DAS system as source domain and target domain samples;
[0009] Step 2: Data preprocessing: preprocess the collected signal samples, including noise reduction, and then process the one-dimensional signal into a two-dimensional space-time sample;
[0010] Step 3: Source domain model training: The Vision Transformer (ViT) network is used as a DAS signal feature extractor, and the spatiotemporal sample data in the source domain scene is used to train it to obtain the model weight parameters;
[0011] Step 4: Add prompts to the source domain model: Add prompts to the input of the model trained in the source domain;
[0012] Step 5: Prompt-tunning: Use the trained weight parameters in the target domain scenario, freeze all model parameters, and only train the added prompts to complete the sample recognition and classification of the target domain scenario.
[0013] Step 6, Test: Combine the source domain trained model and the trained Prompt into a new model and test it on unlabeled data.
[0014] Further, in step 1, signal acquisition includes acquiring signals in a laboratory scenario and an actual application scenario, respectively. The samples in the laboratory scenario are source domain samples, and the samples in the actual application scenario are target domain samples, as shown in the following formula, where X and Y are samples in the laboratory scenario and the actual application scenario, respectively. is the sample of the nth channel at the mth moment,
[0015]
[0016] Furthermore, in step 2, the denoising is to use wavelet threshold denoising on the collected signal as follows:
[0017]
[0018] X', Y' are the samples after denoising. The one-dimensional time signals of multiple channels are processed into two-dimensional space-time samples as follows. Each row of X', Y' is the sample of the same channel, and each column is the sample of the same time.
[0019]
[0020] Furthermore, in step 3, the ViT network is used as the DAS signal feature extractor. ViT consists of an embedding layer (Embed), a transformer encoding layer (Transformer Encoder) and a multi-layer perceptron (MLP). Embed divides the input image sample into patches (Patches) according to a given size, and then maps each patch to a one-dimensional vector through linear mapping. Transformer Encoder consists of several transformer encoding blocks (EncoderBlock), each Encoder Block consists of layer normalization (Layer Normalization), multi-head self-attention mechanism (Multi-Head Attention) and random inactivation (Dropout) and MLP. Transformer Encoder can capture long-distance dependencies in the input sequence, extract image features and learn rich representation vectors. MLP consists of two fully connected layers and a GELU activation function, and is the final layer structure used for classification. ViT first embeds the kth input image sample through Embed. Divide into a blocks, and then add position code x i , the position code x i And the a samples E output by the linear projection layer i The network model is trained using sufficient sample data from the source domain and the trained model parameters are saved.
[0021]
[0022] Furthermore, in step 4, a prompt is added to the input of the model trained in the source domain as follows:
[0023]
[0024] Where P i-1The Prompt is added before the input of the i-th layer of Transformer Encoder. After adding Prompt to each layer of Transformer Encoder, Prompt will generate corresponding output. Prompt has been added to each layer of Transformer Encoder, and the output dimension of the model will be accumulated from the bottom layer to the deep layer of Transformer Encoder. Therefore, in order to keep the input dimension of each layer of Transformer Encoder unchanged, the corresponding output after each layer of Prompt is input into Transformer Encoder is removed.
[0025] In step 5, prompt-tuning is used to train the model input by adding prompts in the target domain, load the model parameters trained in the source domain, add prompts to a small amount of data in the target domain, freeze all parameters of the trained model, and only train the added prompts. The loss function is calculated as follows:
[0026]
[0027] Among them, N is the total number of samples, M is the total number of categories, y is the probability that the data sample belongs to category c, and p is the predicted probability. Use the back-propagation gradient descent algorithm to optimize the Prompt parameter, save the trained Prompt, combine the trained model of the source domain with the trained Prompt into a new model, input the data samples in the test set into the new model, obtain the classification results and evaluate the model recognition ability. If the effect is good, save the deep convolutional neural network. If the effect is not good, continue to optimize the Prompt parameter until the set number of training rounds is reached.
[0028] The beneficial effects of the present invention are mainly manifested in: first, prompt tuning can effectively improve the adaptability of the model to the target task and improve the accuracy of prediction; second, there is no need to save the entire model parameters, only the trained Prompt parameters are saved, which significantly reduces the storage cost; finally, since the source domain model is not modified, it can still maintain good cross-domain versatility, ensuring its effectiveness in multi-domain applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of the process of the present invention;
[0030] Figure 2 These are two experimental scene diagrams for carpet and floor;
[0031] Figure 3 This is the schematic diagram of the distributed optical fiber sensing system;
[0032] Figure 4 This is the ViT network structure diagram;
[0033] Figure 5 Added Prompt schematic for ViT;
[0034] Figure 6 To remove the output schematic of Prompt;
[0035] Figure 7 The effect of different numbers of prompts on the accuracy when the target domain has different data volumes;
[0036] Figure 8 The impact of the amount of training set data for the target domain of Fine-tuning and Prompt-tunning on the verification accuracy;
[0037] Fig. 9 Confusion matrix comparison of the classification results of the target domain for the Fine-tuning and Prompt-tuning models;
[0038] Fig.10 Comparison of confusion matrices of classification results in the source domain for the Fine-tuning and Prompt-tunning models. DETAILED DESCRIPTION
[0039] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0040] Reference Figures 1 to 10 Taking distributed fiber optic sensing gait recognition as an example, a transfer learning method applied to distributed fiber optic sensing is described. This example is based on the collected gait signal samples of three experimenters wearing different shoes in different scenes, and the different gait samples are classified through the transfer learning model. The transfer learning method applied to distributed fiber optic sensing includes the following steps:
[0041] Step 1: Gait data collection;
[0042] The phase vibration signals in different scenarios are collected by a distributed optical fiber sensing system based on phase-sensitive optical time domain reflectometry (Φ-OTDR). Figure 2, the distributed fiber optic sensing system includes: ultra-narrow linewidth laser, acousto-optic modulator, erbium-doped fiber amplifier, circulator, balanced photodetector, optical coupler, photodetector, sensing fiber, high-speed data acquisition card and other devices integrated in the distributed fiber optic sensing demodulation instrument. The detection distance of the instrument used in the experiment is 5km, including 960 points, the spatial resolution is 5m, the gauge length is 5m, the signal sampling rate is 20kS / s, the communication interface is 1000M Ethernet, the sensing fiber is G652.D single-mode fiber, and the output interface is FC or APC. The device is connected to a 4km long G652.D single-mode fiber. The device first generates continuous light from an ultra-narrow linewidth laser, which is divided into two paths through a coupler. One path enters the modulator and is modulated into pulse light under the control of the modulation signal, and is amplified by the erbium-doped fiber amplifier and enters the sensing fiber through the circulator. In the sensing fiber, the backscattered signals are generated when the pulse light propagates. These signals are guided by the circulator to the balanced photodetector, interfere with the local optical signal, and obtain the phase information of the scattered light. After passing through the photodetector and the digital-to-analog conversion chip, the FPGA realizes phase demodulation, fading suppression and other signal processing, and finally obtains the vibration information of different positions of the optical fiber. The demodulated vibration signal is transmitted to the industrial computer or server via Gigabit Ethernet to realize the back-end processing such as signal feature analysis and event discrimination of the vibration data.
[0043] Build as Figure 3 The experimental scenario of the distributed optical fiber sensing data acquisition system shown in the figure, on the back of the 0.8m*2m carpet, the optical fiber is laid in an "S" shape along the short side of the carpet, with a spacing of 5cm between the optical fibers. The optical fiber is also laid in the same way on the back of the floor above the 3cm high ridge, and the area of the floor where the optical fiber is laid is 1m*2m. 35m of optical fiber (7 channels) is laid on the back of the carpet, and 40m of optical fiber (8 channels) is laid on the back of the floor. One end of the optical fiber is connected to the distributed optical fiber sensing system, and 175m (including 35 points) of optical fiber is retained at the beginning of the carpet and the floor, and tens of meters of optical fiber is retained at the end of the carpet and the floor.
[0044] After starting the device and setting the parameters, at points 36 to 42 (seven points) and 36 to 43 (eight points) where the carpet is located, three experimenters walked on the carpet wearing sneakers and slippers respectively to collect data. Experimenter I is 178cm tall and weighs 75Kg, and wears size 42 shoes. Experimenter II is 175cm tall and weighs 80Kg, and wears size 41 shoes. Experimenter III is 170cm tall and weighs 60Kg, and wears size 40 shoes. A total of 6 types of data samples were collected, and the collection time was 2 hours. The collected data is used as the source domain laboratory scene sample data. At points 36 to 42 where the floor is located, three experimenters walked on the floor wearing sneakers and slippers respectively to collect data. The collection time was 1 hour, and the collected data set is used as the target domain actual application scene sample data. As shown in the following formula:
[0045]
[0046] Where X and Y are samples of the source domain laboratory scenario and the target domain actual application scenario, respectively. is the sample of the 7th channel of the source domain laboratory scene at the last moment, This is the sample of the 8th channel at the last moment in the actual application scenario of the target domain. The pressure of walking on a carpet will directly act on the sensing fiber, and the signal is strong, but long-term trampling may cause the fiber to break. On the other hand, the pressure of walking on the floor will indirectly act on the sensing fiber through the floor, which can protect the fiber from any damage, but the signal is twice as weak as walking on a carpet, and the recognition difficulty is correspondingly increased.
[0047] Step 2: Data preprocessing;
[0048] The collected signal is preprocessed, including wavelet decomposition and noise reduction, and then the one-dimensional signal is processed into a two-dimensional space-time diagram; at the optical fiber point 36 to 43 where the event occurs, the row index of the space-time two-dimensional signal matrix is corresponding, the data signal is extracted, and the signal is de-noised using wavelet decomposition as follows:
[0049]
[0050] Where x(t) is the original signal, ψ jk (t) is the wavelet basis function, a is the scale factor, j is the discrete coefficient of the scale factor, k is the translation factor, and b is the discrete parameter of the position. The wavelet basis function used is db4 wavelet. Wavelet decomposition performs multi-scale analysis on the signal through different scales a and positions k. Through repeated wavelet decomposition, the signal f(t) is decomposed into low-frequency approximate components and high-frequency detail components. After the wavelet decomposition is completed, the soft threshold is applied as follows:
[0051]
[0052] The coefficients less than the threshold are set to 0, the coefficients greater than the threshold are reduced, and the coefficients processed by the threshold are retained and then the inverse wavelet transform is performed to reconstruct the signal. The denoised sample signals are X', Y'. The one-dimensional time signals of multiple channels after denoising are processed into a two-dimensional space-time graph through the contourf function in Python. It is set to 5s as a sample image, where the row is time and the column is the channel, as shown in the following formula. Each row of X', Y' is the sample of each channel, that is, the first row is the sample of the first channel, and each column is the sample of each time, that is, the first column is the sample of each channel at the first moment.
[0053]
[0054] Step 3: Source domain model training;
[0055] The ViT network is used as a DAS signal feature extractor, such as Figure 4 As shown in the figure, ViT consists of Embed, TransformerEncoder and MLP. Embed divides the input image samples into patches (Patches) of a given size, and then maps each patch to a one-dimensional vector through linear mapping. Transformer Encoder consists of 12 Encoder Blocks, each of which consists of Layer Normalization, Multi-Head Attention and Dropout as well as MLP. Transformer Encoder can capture long-distance dependencies in the input sequence, extract image features and learn rich representation vectors. MLP consists of two fully connected layers and GELU activation function for classification.
[0056] The 224*224*3 two-dimensional spatiotemporal signal sample is passed into the network, and the input image is divided into 16x16 patches through a convolution with a convolution kernel size of 16x16, a step size of 16, and a convolution kernel number of 768. After the division, (224 / 16) 2 =196 Patches, and then each patch is mapped to a one-dimensional vector through linear mapping. The data dimension of each patch is [16,16,3]. A vector of length 768 is obtained through mapping. 196 Patches of the same size are mapped to a matrix of dimension [196,768]. Before entering the Transformer Encoder, please note that you need to concatenate a classification embedding vector (class token) specifically for classification. The dimension of this vector is [1,768] and the position encoding (Position Embedding) is added. After concatenation, the dimension of the input to the Transformer Encoder is [197,768]. This input is first normalized by the layer of the transformer encoder block to output a normalized tag sequence. The normalized tag sequence enters the multi-head self-attention layer as input. In the multi-head self-attention layer, it is firstly through matrix multiplication and projection matrix W Q , W K , W V Get the query vector Q, key vector K and value vector V:
[0057]
[0058] Where W Q , W K , W Vis the weight matrix obtained through training. The obtained query vector Q, key vector K and value vector V are divided into h heads respectively, and the head q i , k i 、v i is a subset of the original sequence. The attention score is calculated for each head i, using the dot product attention mechanism:
[0059]
[0060] in is the scaling factor, d k is the dimension of the query vector Q and key vector K in each head, and the Softmax function converts the attention score into a weight. The attention output of each head is concatenated to obtain the final output of multi-head self-attention:
[0061] MultiHead(Q,K,V)=Concat(Attention(q 1 , k 1 , v 1 ), ... Attention(q n , k n , v n )) The concatenated output is passed through another trained weight matrix W o Perform a linear transformation and then perform a residual connection with the input sequence:
[0062] OutPut=LN(MultiHead(Q, K, V))·W O +X;
[0063] Among them, LN is the layer normalization operation. After the output of the multi-head self-attention layer is input into the normalization layer, it enters the MLP, which enlarges and then reduces its input dimension to the dimension size of the originally input tag sequence. After the output, it is residually connected with the input sequence, and the output transformer code enters the next Encoder Block. After L Encoder Blocks, the final transformer code is obtained. Then, it passes through MLP to get the final output. In general, for ViT with 12 layers, the input image is divided into 196 fixed-size blocks, and then each block is embedded into a 768-dimensional latent space through a linear projection layer, as follows:
[0064]
[0065] Among them I j For each image block, Embed is a linear projection layer. is the d-dimensional embedding of the image block. Then a classification head is concatenated to the d-dimensional embedding and position encoding is added, and then it passes through a 12-layer deformer encoder, and finally the classification head outputs the classification result, as follows:
[0066]
[0067] where x i is the added classification head, E i is the image patch embedding, L i It is the Encoder Block of the i-th layer.
[0068] Set the network learning rate lr (learning rate) to 0.005, batch size (batchsize) to 16, weight decay (weight-decay) to 0.00005, momentum (momentum) to 0.9, learning rate decay factor (learning rate decay factor, lrf) to 0.01, train for 200 rounds, use stochastic gradient descent (SGD) optimizer, and use the cosine annealing learning rate scheduling method as follows:
[0069]
[0070] Where x is the current iteration number, epochs is the number of training rounds, and the cosine annealing learning rate scheduler will gradually reduce the learning rate during the training process, which helps the model converge better. In the early stage of training, the learning rate is large, which helps the model learn the characteristics of the data faster; in the later stage of training, the learning rate gradually decreases, allowing the model to adjust the parameters more finely. The loss function is the cross entropy loss function as follows:
[0071]
[0072] Among them, 300 is the total number of samples, 6 is the total number of categories, y is the probability that the data sample belongs to category c, and p is the predicted probability. The data of three experimenters walking on the carpet in slippers and sneakers is used as the source domain data. In order to speed up convergence, the model trained on the ImageNet1K dataset is used to fine-tune in the source domain. The trained model parameters are recorded as Pretrained-Model. The network is trained with 6,000 image samples from the source domain until the network model is saturated and the best network model parameters are saved.
[0073] Step 4: Add prompt to the model input trained in the source domain;
[0074] First, load the model parameters Pretrained-Model trained in the source domain and add Prompt to the input of Encoder Block as follows Figure 5 As shown, three Prompt vectors with dimensions of [1,768] are added as follows:
[0075]
[0076] Among them, P0, P1, and P2 are the prompts added before the input of each layer of the Encoder Block. The prompts are initialized with a normal distribution with a mean of 0 and a standard deviation of 0.02. These prompts are trainable parameters and are input into the network after initialization. Since the prompts are added before the input of each layer of the Encoder Block, the prompts will generate corresponding outputs, and the prompts have been added to each layer of the Transformer Encoder. The output dimension of the model will be accumulated from the bottom layer of the Transformer Encoder to the deep layer. Therefore, in order to keep the input dimension of each layer of the Transformer Encoder unchanged, the corresponding output after each layer of the prompt is input into the Transformer Encoder is removed. As shown below Figure 6 As shown in the figure, the original input dimension of EncoderBlock is [197,768]. After adding three prompts, the input of each layer becomes [200,768]. The three prompts added in the first Encoder Block will produce three corresponding outputs, which are also used as the input of the second Encoder Block. However, three prompts have been added in the second Encoder Block, so the input dimension of the second Encoder Block is [203,768]. Similarly, the three added prompts will generate three corresponding outputs in the next Encoder Block every time they pass through an Encoder Block. In order to maintain the consistent dimension of each layer of Encoder Block as [200,768], it is necessary to delete the output generated by each layer of Encoder Block due to the addition of prompts.
[0077] Step 5: Prompt-tunning model transfer learning;
[0078] In the target domain scenario, load the Pretrained-Model trained in the source domain, classify and identify a small amount of data of three experimenters in the target domain wearing slippers and sneakers, freeze all parameters of the Pretrained-Model, only train the added Prompt, set lr to 0.01, lrf to 0.005, batchsize to 16, weight-decay to 0.00005, momentum to 0.9, train for 200 rounds, calculate the cross entropy loss function, use the SGD back-propagation gradient descent algorithm to optimize the Prompt parameters, save the trained Prompt, combine the source domain trained model and the trained Prompt into a new model, input the data samples in the test set into the new model, obtain the classification results and evaluate the recognition ability of the ViT model, if the effect is good, save the deep convolutional neural network, if the effect is not good, continue to optimize the Prompt parameters until the set total number of training rounds is reached.
[0079] Figure 7(a), (b), (c), and (d) are the effects of adding different numbers of prompts on the accuracy when the training data volume is 120, 240, 360, and 480, respectively. The solid line is the accuracy of Prompt-tunning when the number of prompts is different, and the dotted line is the accuracy of Fine-tuning with the corresponding training data volume. The parameter settings of Fine-tuning are lr=0.0001, lrf=0.005, batchsize=16, weight-decay=0.00005, momentum=0.9, and 200 rounds of training are performed. The cross entropy loss function is calculated, and the SGD back-propagation gradient descent algorithm is used to optimize the parameters. As can be seen from the figure, when the amount of training data is small, 120, Prompt-tunning has an accuracy of 74.58% when adding 3 prompts, while Fine-tunning has an accuracy of only 39.16%. At this time, Prompt-tunning has a significant improvement of 35.42% compared to Fine-tunning; with the increase of training data, the overall gap between Prompt-tunning and Fine-tunning gradually decreases. When the amount of training data is 240, Fine-tunning has the largest improvement of 42.92% compared to Prompt-tunning. The overall effect of Prompt-tunning When the amount of training data is 360, Prompt-tuning is not as good as Fine-tuning when the number of prompts is 1, 3, and 5. If the number of prompts is increased, Prompt-tuning will surpass Fine-tuning, which is about 8% higher than Fine-tuning. When the amount of training data increases to 480, the accuracy of Prompt-tunning with 10 prompts is as high as 97.91%, while the accuracy of Fine-tuning is 90.28%, and the gap between Prompt-tunning and Fine-tunning is the smallest. In addition, this method can significantly reduce the storage cost. Given a ViT-Base with 86 million parameters (327MB), 10 prompt vectors will generate an additional 92160 parameters (0.351MB), which only accounts for 1.073% of all ViT-Base parameters.
[0080] Figure 8This is a comparison of the accuracy of Prompt-tunning and Fine-tunning when the amount of training data is large. At this time, the number of prompts added to Prompt-tunning is 10. From the figure, we can see that with the increase of the amount of training data, the gap between Prompt-tunning and Fine-tunning gradually decreases. When the amount of data is 240, the maximum gap is 40.83%, and when the amount of data is 480, the minimum gap is 7.63%.
[0081] Fig. 9 (a) and Fig. 9 (b) The confusion matrices of the test set for Fine-tunning and Prompt-tunning when the number of target domain training sets is 60 images per category, totaling 480 image samples. I, II, III, IV, V, and VI in the figure are the data of experimenter I, experimenter II, and experimenter III wearing slippers and sneakers, respectively. The number of test sets is 300 images per category, totaling 1500 images. The overall accuracy of Fine-tuning is 90.28%, and it is difficult to distinguish the data of experimenter III wearing slippers and sneakers. The overall accuracy of Prompt-tunning is 96.56%, which can well distinguish the data of experimenter III wearing slippers and sneakers.
[0082] Step 6: Test the model after Fine-tuning and Prompt-tunning in the source domain, such as Fig.10 As shown in (a) and (b), the model after Fine-tuning has only 31.16% recognition accuracy for the source domain. However, since Prompt-tunning freezes the entire model parameters trained in the source domain, it can still recognize the source domain data well with an accuracy of 99.46%.
[0083] The above is a detailed introduction to the transfer learning method for distributed optical fiber sensing described in the present invention. The above example description is only used to help understand the method and its core idea of the present invention rather than to limit it. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principle of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A transfer learning method applied to distributed optical fiber sensing, characterized in that: The method comprises the following steps: Step 1: Data preparation: The phase signals in different scenarios are collected through the distributed optical fiber sensing DAS system as source domain and target domain samples; Step 2: Data preprocessing: preprocess the collected signal samples, including noise reduction, and then process the one-dimensional signal into a two-dimensional space-time sample; Step 3: Source domain model training: The visual deformer ViT network is used as a DAS signal feature extractor, and the spatiotemporal sample data in the source domain scene is used to train it to obtain the model weight parameters; Step 4: Add prompts to the source domain model: Add prompts to the input of the model trained in the source domain; Step 5: Prompt-based model transfer learning: Use the trained weight parameters in the target domain scenario, freeze all model parameters, and only train the added prompt to complete sample recognition and classification of the target domain scenario; Step 6, Test: Combine the source domain trained model and the trained Prompt into a new model and test it on unlabeled data.
2. A transfer learning method for distributed optical fiber sensing according to claim 1, characterized in that: In step 1, signal acquisition includes acquiring signals in a laboratory scenario and an actual application scenario, respectively. The samples in the laboratory scenario are source domain samples, and the samples in the actual application scenario are target domain samples, as shown in the following formula, where X and Y are samples in the laboratory scenario and the actual application scenario, respectively. is the sample of the nth channel at the mth moment, 3. A transfer learning method for distributed optical fiber sensing as claimed in claim 1 or 2, characterized in that: In step 2, the denoising is to use wavelet threshold denoising to the collected signal as follows: X', Y' are the samples after denoising. The one-dimensional time signals of multiple channels are processed into two-dimensional space-time samples as follows. Each row of X', Y' is the sample of the same channel, and each column is the sample of the same time.
4. A transfer learning method applied to distributed optical fiber sensing as claimed in claim 1 or 2, characterized in that: In the step 3, a ViT network is used as a DAS signal feature extractor, wherein ViT is composed of an embedding layer, a transformer encoding layer, and a multi-layer perceptron MLP; Embed divides the input image sample into Patches according to a given size, and then maps each Patch to a one-dimensional vector through a linear mapping; Transformer Encoder consists of several transformer encoder blocks. Each Encoder Block consists of layer normalization, multi-head self-attention mechanism, random dropout and MLP. Transformer Encoder can capture long-distance dependencies in the input sequence, extract image features and learn rich representation vectors. MLP consists of two fully connected layers and GELU activation function, which is the final layer structure used for classification. ViT first embeds the kth input image sample Divide into a blocks, and then add position code x i , the position code x i And the a samples E output by the linear projection layer i The result y is finally output by the classification head, as shown in the following formula. The network model is trained with sufficient sample data in the source domain and the trained model parameters are saved.
5. A transfer learning method applied to distributed optical fiber sensing as claimed in claim 1 or 2, characterized in that: In step 4, a prompt is added to the input of the model trained in the source domain as follows: Where P i-1 The Prompt is added before the input of the i-th layer of Transformer Encoder. After adding Prompt to each layer of Transformer Encoder, Prompt will generate corresponding output. Prompt has been added to each layer of Transformer Encoder, and the output dimension of the model will be accumulated from the bottom layer to the deep layer of Transformer Encoder. Therefore, in order to keep the input dimension of each layer of Transformer Encoder unchanged, the corresponding output after each layer of Prompt is input into Transformer Encoder is removed.
6. A transfer learning method applied to distributed optical fiber sensing as claimed in claim 1 or 2, characterized in that: In step 5, Prompt-tunning is performed based on prompt-based model transfer learning. Prompt is added to the model input in the target domain for training. The model parameters trained in the source domain are loaded. Prompt is added to a small amount of data in the target domain. All parameters of the trained model are frozen. Only the added Prompt is trained. The loss function is calculated as follows: Among them, N is the total number of samples, M is the total number of categories, y is the probability that the data sample belongs to category c, p is the predicted probability, and the Prompt parameter is optimized using the back-propagation gradient descent algorithm. The trained Prompt is saved, and the trained model of the source domain and the trained Prompt are combined into a new model. The data samples in the test set are input into the new model to obtain the classification results and evaluate the model recognition ability. If the effect is good, the deep convolutional neural network is saved. If the effect is not good, the Prompt parameter is continuously optimized until the set number of training rounds is reached.