{'fraction_non_alphanumeric': 0.029676657315812788, 'fraction_numerical': 0.012205325065209901, 'mean_word_length': 4.728784888638286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Back propagation neutral network based signal acquisition for Brillouin distributed optical fiber sensors

: This manuscript proposes a method based on back propagation (BP) neural network and the spectral subtraction method to quickly obtain sensing information in Brillouin fiber optics sensors. BP neural network’s characteristics which can realize any complex nonlinear mapping help to determine the frequency shift section(s) information. The training function, transfer function and number of hidden layer nodes of BP neural network are determined with experimental data. The experimental results show that comparing with traditional Lorentz fitting algorithm and edge detection with Sobel operator, the BP neural network is about 1/12 in terms of time complexity with the Lorentz algorithm, about 1/9 with the edge detection based on Sobel operator; while the respective accuracy on determine the frequency shifted section(s) has improved by 79.4% and 27.9%.

However, the above-mentioned methods are the same as the traditional acquisition of Brillouin sensing system distributed sensing information, and it is necessary to calculate the full spectrum to obtain the sensing information. By the Lorentz fitting method (LFM) or other ways, the full spectrum point is fitted and the spectral information is obtained from the central Brillouin frequency shift. Some scholars [16][17][18][19][20] proposed the idea that since the algorithm is sensitive to noise, when the SNR is relatively high, the accuracy of the detection will be greatly affected. To shorten the processing time, Yu et al. proposed a spectral subtraction method to obtain the sensing information of the Brillouin sensing system [21], however, it is difficult to determine the fitting threshold for a noisy spectrum. Therefore, we put forward a BP neural network algorithm to achieve fast extraction of sensing information (i.e. the frequency shifted fiber section(s)) in the subtracted spectrum. We then theoretically analyze how to obtain BFS information using BP neural network, and verify this algorithm with experimental data. The processing time complexity using proposed algorithm is two orders of magnitude smaller that of the LFM (91.9%) with a higher accuracy in determining the shifted section(s) (79.4%).
The main framework of this manuscript is as follow: firstly, as a comparison, the Sobel operator of edge detection is used to locate the frequency shift in the subtracted spectrum. Secondly, the BP neural network is trained to learn the subtracted spectrum, to obtain the characteristics of points which the frequency shift from those don't, and to locate the frequency shifted points. Then the BP neural network's parameter is obtained with experimental data, and the algorithm is used to test new spectra and to locate which segments with frequency shift to reduce the work load done by Lorentz fitting. Thus the BFS can be restored and sensing information can be obtained in a much faster way. Finally, results obtained with the LFM and the edge detection, as well as BP neural network are compared for further discussion.

Spectral subtraction method
As shown in Fig. 1, the spectral subtraction method is subtracting the original (un-shifted) from the measurement Brillouin spectrum to obtain a subtracted spectrum, from which sensing information is retrieved. The advantages over the traditional algorithm are now only the fiber segment containing the sensing information needed to process rather than fitting the entire fiber, which is thus simpler and more efficient.

Edge detection algorithm
Edge detection is an important research area in image processing and computer vision, especially in feature extraction. In this manuscript, edge detection algorithm is used to distinguish between frequency shift information and system noise in Brillouin through edges defined by gray-scale contours. The template-based Sobel operator [22] is used to determine the Brillouin frequency shift information, as the Sobel operator performs better than the derivative operator encountering relatively large system noise.

BP neural network
Artificial Neural Networks (ANNs) are widely accepted in many disciplines for modeling complex real-world problems, enabling massively parallel computations for data processing and knowledge representation [23]. BP neural network, one of the most widely used ANNs models, is a multi-layer forward neural network back propagation algorithm trained by error. It can learn and store a large number of input and output model mappings without previous knowledge on the mapping relationship equation. Taking advantage of this feature, a BP neural network is trained and learned Brillouin spectral information can distinguish the frequency shifted section(s) in a noisy spectrum.
The topology of the BP neural network includes the input layer (i.e.: Brillouin spectrum data in this manuscript), the hidden layer and the output layer (i.e.: the position information of the frequency shifted fiber segment(s)). The topology used in this manuscript is shown in Fig.  2 [24]. x j is the input of the j-th node of the input layer, where j = 1, 2, ···, M. w ij and θ i are the weight and the threshold of the i-th node of the hidden layer to the input layer, respectively, where i = 1, 2, ···, q. φ is the transfer function of the hidden layer. w ki is the weight of the k-th node of the output layer to the i-th node of the hidden layer, where k = 1, 2, ···, L. a k and O k are the threshold and output of the k-th node of the output layer, respectively.  Figure 3 shows the training and testing phases of the BP neural network to obtain the shifted section(s) information of the Brillouin sensor. During the training phase, a large number of tagged frequency shift information (shifted = 1, un-shifted = 0) is used as input for the BP neural network (i.e.: g(z 1 _training), g(z 2 _training), …,g(z n _training)). At the beginning of the training, the thresholds and weights parameters are random initial values. Then the input and output values of each layer, and the error E(q) of the output layer are calculated. If E(q) > = ε (ε is the accuracy of the BP network, the accuracy of the input data and the data set tag information), then the threshold and weight will be modified until E(q) < ε. And the test data (i.e.: g(z 1 _testing), g(z 2 _ testing), …,g(z n _ testing)) is detected using optimized thresholds and weights to obtain the frequency shift section(s).

Experiments
The experimental setup of BOTDA is shown in Fig. 4 [25,26]. In this system, light from a continuous wave laser is split by a 50/50 coupler to generate pump and probe signals in two branches. A radio frequency (RF) signal applied to an Electro-Optic Modulator (EOM 1) in the upper branch is used to generate a double sideband suppressed carrier probe signal with extinction ratio greater than 30 dB. The probe is amplified by Erbium doped fiber amplifier (EDFA 2), then passed through filter 2 and transmitted through an isolator into the fiber. The CW signal at the lower branch is modulated by EOM 2 driven by a pulse generator for generating pump pulses, and a polarization scrambler (PS) is utilized to minimize the polarization dependent fading of the Brillouin gain. Subsequently, it is boosted by EDFA 1. After the unwanted higher frequency sideband is filtered by the filter, the amplified detection signal by the SBS process is detected by a photodetector (PD).
We use a 9.7 km Corning SMF-28e + single-mode fiber with Brillouin center frequency of 10.83 GHz and put about 800 m (8.9~9.7 km) long section at far end in an oven to control temperature, which is set to 30, 40, 50 degrees respectively. The pump pulse width is 10 ns, the probe, which is tuned from 10742 MHz to 10942 MHz, is received by a 250 MHz photodetector and then acquired by a Tektronix real-time oscilloscope. In order to verify the proposed algorithm, the deviation and the time complexity with the traditional LFM, edge detection, and BP neural network are compared. The time consumption for LFM contains the Lorentz fitting time; and the time for the edge detection contains: the time for obtaining the subtracted spectrum, denoise filtering, determining the start and end position of the frequency shift with edge detection, Lorentz fitting of the shifted fiber segment; And the time based on BP neural network includes: detecting frequency shifted positions in the subtracted spectrum based on the determined weight and the threshold, and Lorentz fitting of the shifted fiber segment.
The position deviation of determining the frequency shifted section(s) in this manuscript is defined as follows: where L start and L end respectively represent the start and end position of the frequency shifted fiber section in the subtracted spectrum determined by the algorithm; where L Left and L Right represent the actual start and end position.
The following steps are used to locate the starting position of BFS: 1) Take 500 data points near the Brillouin gain spectrum rising edge with and without frequency shift, respectively, average and take the median of the two mean values; 2) take the 2 to 3 sets of data above the rising edge for a line fitting; 3) The median obtained in step 1 is a straight line above the y-axis, and its intersection with the straight line fitted in step 2 is used as the starting point of the rising edge. Similarly, the end point of the falling edge is obtained, then the frequency shifted segment are determined.

Sobel operator edge detection algorithm based on spectral subtraction method
The edge detection algorithm based on Sobel operator is divided into three parts: 1) Determine sequence of processing, scheme 1, filter the original and the measurement spectrum first then subtract them; or scheme 2, subtract the original and the measurement spectrum and then filter the subtracted, 2) Determine the filtering parameter, as shown in The filtering process in this manuscript refers to the 1D/2D median filtering processing, the filtering parameters ranges from 0 to 80 with the step size is 5; the parameter of the opening circles is 1 to 15 and the step size is 1) As shown in Figs. 6(a) and 6(b), it is experimentally obtained that the distortion of the 2D median filter on the original and the measurement spectrum is the lowest; as shown in Fig.  6(c), the deviation of the subtracted spectrum obtained by using scheme 1(filter then subtract) is significantly lower. The influence of the 2D median filtering on the subtracted spectrum is best; As shown in Fig. 6(d), the best opening circles parameter in the edge detection is 6 with lowest deviation.
With large noises, the accuracy of the edge detection based on edge detection will be greatly affected. Therefore, BP neural network algorithm is used to determine the frequency shift information, as it's less sensitive.

BP neural network algorithm based on spectral subtraction method
The algorithm based on BP neural network is divided into three parts, 1) Parameter determination: determine BP neural network parameters; 2) Network training: Input a large amount of BOTDA spectral information to train BP neural network; 3) Test: Use the trained BP neural network to test data and obtain the sensing information.

BP network parameter determination
The BP neural network contains four parameters, i.e.: the number of layers, the training function, and transfer function between hidden layer and output layer of the network, and the number of hidden layer nodes. The initial weights and thresholds of the BP neural network are randomly generated, the initial values of each training and the performances are different, thus the control variable method is employed to determine the relevant parameters; and in the same hardware environment, the BP neural network runs 50 times and records relevant data. Since the selection of the number of hidden layer nodes has a great influence on the network performance, the number of hidden layer nodes is preliminary determined. Then the training function, the transfer function will be determined. Finally, with the above results and the number of hidden layer nodes will be eventually determined.
i) Determine the number of layers of the BP neural network. In [28] proves the universal approximation theorem in the field of neural networks. For the sake of simplicity and practicality, in this manuscript, a three-layer BP neural network with a single hidden layer is chosen.
ii) Preliminary determine the number of hidden layer nodes. In [29] shows that there is always an optimal number of hidden nodes for any network. There are three major methods of finding the number of hidden layer nodes, i.e.: trial and error method, Kolmogorov theorem method [30] and empirical formula method [24]. In order to achieve better detection, the empirical formula method is employed and the formula is: where L is the number of hidden layer nodes; m is the number of input nodes; t is the number of output nodes; a is a constant, a ∈ [1,10]. In this manuscript, the number of input layer nodes (the number of frequencies scanned) is 100, and the number of nodes in the output layer is 1, i.e., whether frequency shift occurs or not. According to the Eq. (2), the number of nodes L in the hidden layer ranges from 11 to 20 with a step size of 1. As shown on the Fig. 7(a), when the number of hidden layer node is selected to be 18, its mean and variance are the lowest; Fig. 7(b) shows the comparison of the five training functions, which suggested to use the traingdx function with the lowest variance. Therefore, the traingdx function is used as the training function with the hidden layer node number as 18 in this manuscript.
iv) Determine the transfer function of the BP neural network. The nodes in the hidden layer use a sigmoid-type transfer function, and the nodes in the output layer use a linear transfer function. And the output of the entire network can take any value. The sigmoid-type transfer functions include tansig and logsig; linear transfer functions include purelin, poslin, satlin and satlins. Figure 8 shows the deviation of different combination of functions for the hidden and output layer. Deviation corresponding to the satlin is higher regardless of whether the hidden layer uses the logsig or the tansig function. The logsig function for the hidden layer and the purelin function for the output layer are to obtain the lowest deviation in this manuscript.v) Based on the experiment results above, a BP neural network is set up to determine the number of the hidden layer nodes. The corresponding deviation of hidden layer nodes is obtained and shown in Fig. 9.   As shown in Fig. 10, the mean value is the lowest when the hidden layer node is 14; while the variance is the lowest for the hidden layer with 19 nodes. In this manuscript, the number of hidden layer node is set to 19, to obtain the lowest variance of the hidden layer for the network.

Network training
The data used in BP neural network training in this manuscript is based on the BOTDA experimental setup described in Fig. 4, the fiber segment at the far end is heated to 1) 30, 2) 40, and 3) 50 degrees respectively, and the data is averaged 100 times, 1000 times, and 4000 times for each temperature. In this manuscript, two sets of experiments with an average of 100 times and 1000 times using the BOTDA as training data; the third set of experiments with 4000 averages using the BOTDA and another set of data from a BOTDR system are used as test data.

Test results
In this manuscript, the test data can be divided into two groups according to the experimental device, that is, measured with the BOTDA or with the BOTDR systems. The LFM, edge detection algorithm and BP neural network are used to determine and compare BFS.
Test 1: The data of experiment 1 is used as the original spectrum (30 C), and the data of experiment 3 is used as the measurement spectrum (50 C); Test 2: The data of experiment 2 is used as the original spectrum (40 C), and the data of experiment 3 is used as the measurement spectrum; Test 3: The data of experiment 1 is used as the original spectrum, and the data of experiment 2 is used as the measurement spectrum; Test 4: The BOTDR experimental data, Brillouin spectrum of the fiber (5.1km length) under room temperature as original spectrum, while then about 1000 m optical fibers at the far end are heated up 30 degrees as the measurement spectrum. The difference between the BFS (obtained with the LFM, edge detection and BP neural network) and the starting position of BFS is clearly shown in Fig. 11, the number at start position determined by the LFM is too large, and the number at end position is too small; and the number at start position determined by the edge detection algorithm is relatively accurate, while the number at end is small; for the BP neural network the number at start is almost accurate and the end reaches the end of FUT. Similarly, the four sets of test results are given in Table 1 demonstrating the BFS position difference between the three algorithms and the starting position of BFS.   It can be seen from Table 2 that in terms of time complexity of obtaining the fiber sensing information in the subtracted spectrum, O(log 2 N ) < O(N) < O(r 1 N 2 /r 2 ), that is, the time complexity of the LFM is the highest, and BP neural network is the lowest. It takes a long time because the entire fiber is required to be fitted for the LFM. In terms of detection accuracy, the edge detection algorithm is susceptible to noise, and the detection effect will be affected when the SNR is large. BP neural network, with a strong generalization ability, can effectively reduce the detection time, and algorithm sensitivity to noise, and eventually it has a higher accuracy; The algorithm has a stronger applicability, according to the deviation obtained by Test 4 in Table 2, although it used BOTDA data for training, it is applied well on the BOTDR data. In some applications, such as the high-speed acquisition and the sweep-free BOTDA, a large sweep interval is utilized. The LFM will bring a large error with less fitting points, while BP neural network can still perform better. As shown in Fig. 12, the deviation of 20 MHz sweep interval of BP network is about the same as that of the LFM at 15 MHz sweep interval. Therefore, with BP neural network the Brillouin sensors can use larger sweep intervals to reduce data acquisition time and still gets higher accuracy than using traditional LFM.

Conclusion
An algorithm based on BP neural network to determine the frequency shifted section(s) and calculate BFS of optical fiber is proposed. Based on the nonlinear mapping ability of BP neural network, it could learn a large amount of spectrum information, and obtains the mapping relationship between input (multidimensional feature) and output (corresponding frequency shifted segment(s) information) after determining the neural network parameters, and it could then help to obtain the BFS. In this manuscript, the BP neural network algorithm is compared with the edge detection method, as well as the LFM, which is most commonly used. The experimental results show that the BP neural network algorithm is superior to other algorithms in terms of time complexity and accuracy.
Even though the training set used by BP neural network is unfiltered and processed, its accuracy is better than the edge detection (with denoising) and the LFM, because BP is less susceptible to noise. The experimental results from BOTDA and BOTDR systems show that the proposed algorithm is effective for determining BFS with a higher accuracy, shorter processing time, and it hopefully can reduce the resources required for actual calculation, as it is less sensitive to noise, stronger in generation ability and fits only the frequency shifted segment(s). Finally, with BP neural network the Brillouin sensors can use larger sweep intervals to reduce data acquisition time and still gets higher accuracy in determine frequency shifted section(s) than using the traditional LFM. Therefore, the proposed algorithm can be an excellent alternative method to process and quickly obtain the Brillouin sensing information, especially when a large frequency scanning step is employed.