Optical fiber event detection method and device, electronic equipment and storage medium
By combining the pre-trained fiber event detection model and attention mechanism, multiple types of features in fiber signals are extracted and processed, and the problem of fiber event recognition is solved, and the accuracy of fiber event recognition is improved. robustness.
Patent Information
- Application Number
- CN202411047472.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-19
AI Technical Summary
Existing fiber event recognition technology is sensitive to noise and interference, which can easily lead to misidentification or misidentification of fiber events.
The pre-trained fiber event detection model is used to detect the signal graph, and combined with the attention mechanism to automatically learn and pay attention to the important features in the signal, multiple types of signal characteristics are extracted for visual processing to improve the accuracy of event recognition.
Effectively reduce the negative impact of noise and interference on fiber event recognition, improve the accuracy and robustness of fiber event recognition, reduce misjudgment and misjudgment, and meet real-time application needs.
Smart Images

Figure CN118980394A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of optical signal detection, and in particular to a method, device, electronic device and storage medium for detecting optical fiber events. Background Art
[0002] Fiber optic event recognition is an important technology used to detect and identify various events occurring in fiber optic sensors, such as temperature changes, strains, vibrations, etc.
[0003] Fiber optic event identification can use traditional signal processing techniques such as filtering, spectrum analysis, and time-frequency analysis to analyze fiber optic signals in the time domain and frequency domain to identify fiber optic events.
[0004] However, this method is sensitive to noise and interference of optical fiber signals and is easily affected by noise and interference, resulting in misidentification or missed identification of optical fiber events. Summary of the invention
[0005] In view of the above, the embodiments of the present application provide a fiber optic event detection method, device, electronic device and computer-readable storage medium, which are conducive to reducing the negative impact of noise and interference on fiber optic event identification and improving the accuracy of fiber optic event identification.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting an optical fiber event, comprising:
[0007] Obtaining an optical fiber signal of the optical fiber to be tested;
[0008] Extracting signal characteristics of the optical fiber signal;
[0009] Performing visualization processing on the signal characteristics to obtain a signal graph of the optical fiber signal;
[0010] Detecting the optical fiber events in the signal graph based on a pre-trained optical fiber event detection model to obtain the optical fiber events occurring in the optical fiber to be tested;
[0011] Wherein, the optical fiber event detection model is trained based on the target detection model.
[0012] The embodiment of the present application visualizes the optical fiber signal of the optical fiber to be tested to obtain a signal graph, which includes more signal details. Then, an optical fiber event detection model is used to detect the optical fiber events in the signal graph. The optical fiber event detection model is trained based on the target detection model. It can take the optical fiber event as the detection target and learn the characteristics of the optical fiber event in the signal graph, which is helpful for dealing with various types of noise and interference, reducing the negative impact of noise and interference on the identification of optical fiber events, and improving the accuracy of optical fiber event identification.
[0013] In some embodiments, an attention mechanism is configured in the optical fiber event detection model, and the optical fiber event detection model based on pre-training detects the optical fiber events in the signal graph to obtain the optical fiber events occurring in the optical fiber to be tested, including:
[0014] Performing image feature extraction on the signal graph based on the optical fiber event detection model to obtain a feature graph;
[0015] Generate query items, key items and value items of the feature graph based on the optical fiber event detection model;
[0016] A fiber event occurring in the optical fiber to be tested is determined based on the attention mechanism, the query item, the key item, and the value item.
[0017] In this technical solution, the optical fiber event detection model introduces an attention mechanism, which can automatically learn and focus on important features in optical fiber signals, better capture key information of events, and improve the accuracy of event recognition.
[0018] In some embodiments, determining the optical fiber event occurring in the optical fiber to be tested based on the attention mechanism, the query item, the key item, and the value item includes:
[0019] Obtaining an attention weight based on the query item and the key item;
[0020] Weighting the value item based on the attention weight to obtain a weighted value item;
[0021] A fiber event occurring in the optical fiber to be tested is obtained based on the weighted value item.
[0022] In some embodiments, the optical fiber signal includes multiple types of signal features, and the visual processing of the signal features to obtain a signal graph of the optical fiber signal includes:
[0023] Performing visualization processing on the plurality of types of signal features respectively to obtain signal graphs of the optical fiber signal;
[0024] The optical fiber event detection model based on the pre-training detects the optical fiber event in the signal graph to obtain the optical fiber event occurring in the optical fiber to be tested, including:
[0025] Inputting each of the signal graphs into the optical fiber event detection model to obtain a target detection result of each of the signal graphs;
[0026] The target detection result of the signal graph includes the probability of each optical fiber event occurring in the optical fiber to be tested detected based on the signal graph;
[0027] The optical fiber event occurring in the optical fiber to be tested is determined based on the target detection results of the signal graphs.
[0028] The embodiments of the present application use multiple types of signal features, which can detect fiber events occurring in the optical fiber to be tested from multiple dimensions, thereby further improving the accuracy of fiber event detection.
[0029] In some embodiments, the step of training the fiber event detection model includes:
[0030] Obtain a signal graph sample corresponding to the optical fiber signal sample;
[0031] Inputting the signal graph sample into the target detection model to obtain the target detection result of the signal graph sample;
[0032] Determining a loss value of the target detection model based on the target detection result;
[0033] The model parameters of the target detection model are updated based on the loss value until the target detection model training is completed to obtain the optical fiber event detection model.
[0034] In some embodiments, obtaining a signal graph sample corresponding to the optical fiber signal sample includes:
[0035] Determining a plurality of signal graph samples based on a plurality of types of signal features in the optical fiber signal sample;
[0036] The step of inputting the signal graph sample into the target detection model to obtain the target detection result of the signal graph sample includes:
[0037] Inputting the plurality of signal graph samples into the target detection model to obtain target detection results of the plurality of signal graph samples;
[0038] The determining the loss value of the target detection model based on the target detection result of the signal graph sample includes:
[0039] Determining loss values corresponding to the plurality of signal graph samples based on target detection results of the plurality of signal graph samples;
[0040] A loss value of the target detection model is determined based on the loss values corresponding to the multiple signal graph samples.
[0041] The embodiments of the present application can ensure the fiber event detection capability of the fiber event detection model for different types of signal graphs.
[0042] In some embodiments, the signal feature includes one or more of spectrum information, envelope information and phase information, and the signal graph includes one or more of a spectrum graph, an envelope graph and a phase waterfall graph.
[0043] In a second aspect, an embodiment of the present application further provides a fiber event detection device, comprising:
[0044] An information acquisition module, used to acquire the optical fiber signal of the optical fiber to be tested;
[0045] A feature extraction module, used to extract the signal features of the optical fiber signal and perform visualization processing on the signal features to obtain a signal graph of the optical fiber signal;
[0046] An event detection module, used to detect the optical fiber events in the signal graph based on a pre-trained optical fiber event detection model, and obtain the optical fiber events occurring in the optical fiber to be tested;
[0047] Wherein, the optical fiber event detection model is trained based on the target detection model.
[0048] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the electronic device executes the optical fiber event detection method as described in the first aspect.
[0049] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the optical fiber event detection method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 The present invention is a flowchart of a method for detecting optical fiber events according to an embodiment of the present application.
[0051] Figure 2 The figure is a schematic diagram of a scenario in which a fiber event detection model is used to detect a fiber event according to an embodiment of the present application.
[0052] Figure 3 The flowchart is a sub-step flowchart of step 104 provided according to an embodiment of the present application.
[0053] Figure 4 Schematic diagram of the network structure of a VGG16 network provided according to an embodiment of the present application.
[0054] Figure 5 The present invention is a flowchart of the steps of a method for training a fiber event detection model according to an embodiment of the present application.
[0055] Figure 6 A schematic diagram of a training scenario for a fiber event detection model provided according to an embodiment of the present application.
[0056] Figure 7The module diagram of the optical fiber event detection device provided according to an embodiment of the present application is shown in FIG.
[0057] Figure 8 The figure is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the implementation methods of the present application and the features in the implementation methods can be combined with each other without conflict.
[0059] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described implementations are only part of the implementations of the present application, rather than all the implementations.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0061] It should be further noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0062] In this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0063] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0064] The embodiments of the present application provide a fiber optic event detection method, device, electronic device and computer-readable storage medium, which are conducive to reducing the negative impact of noise and interference in fiber optic signals on fiber optic event identification and improving the accuracy of fiber optic event identification.
[0065] The optical fiber event detection method of the present application can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to processors, microprogrammed control units (MCU), application specific integrated circuits (ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc. The electronic device can be a portable electronic device (such as a mobile phone, a tablet computer), a personal computer, a server, etc.
[0066] Figure 1 This is a flowchart of the steps of an embodiment of the optical fiber event detection method of the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0067] See also Figure 1 As shown, the optical fiber event detection method may include the following steps.
[0068] Step 101, obtaining the optical fiber signal of the optical fiber to be tested.
[0069] The optical fiber of the optical fiber under test is the optical signal transmitted by the optical fiber under test.
[0070] Step 102: extracting signal characteristics of the optical fiber signal.
[0071] Signal characteristics are signal properties in optical fiber signals that can reflect optical fiber events.
[0072] For example, the signal feature may be one or more of spectrum information, envelope information or phase information of the optical fiber signal, but is not limited thereto.
[0073] Among them, the spectrum information refers to the spectrum of the optical fiber signal; the envelope information refers to the envelope of the optical fiber signal; and the phase information refers to the phase of the optical fiber signal.
[0074] In step 102, the electronic device may extract one or more of spectrum information, envelope information, and phase information of the optical fiber signal.
[0075] Step 103: Visualize the signal characteristics to obtain a signal graph of the optical fiber signal.
[0076] That is, the electronic device can perform graphical processing on the signal characteristics to draw a corresponding signal graph.
[0077] In some embodiments, the signal graph may include one or more of a spectrum graph, an envelope graph, and a phase waterfall graph.
[0078] Specifically, the electronic device can perform visualization processing on the spectrum information of the optical fiber signal, thereby obtaining a spectrum diagram of the optical fiber signal.
[0079] The electronic device can visualize the envelope information of the optical fiber signal to obtain the envelope diagram of the optical fiber signal.
[0080] The electronic device can visualize the phase information of the optical fiber signal to obtain a phase waterfall diagram of the optical fiber signal.
[0081] Step 104 , detecting the optical fiber events in the signal graph based on the pre-trained optical fiber event detection model to obtain the optical fiber events occurring in the optical fiber to be tested.
[0082] The optical fiber event can be, but is not limited to, a temperature change in the optical fiber environment, strain of the optical fiber, vibration of the optical fiber, etc. The optical fiber events that can be detected by the optical fiber event detection model can be configured according to actual application requirements, for example, they can also be configured as trampling events, stretching events, etc.
[0083] The optical fiber event detection model is trained based on the target detection model.
[0084] The fiber event detection model can be configured with an attention mechanism.
[0085] In some embodiments, reference Figure 2 and Figure 3 As shown, Figure 2 A sub-step flow chart of step 104 provided in an embodiment of the present application, Figure 3 A schematic diagram of a scenario in which a fiber event detection model provided in an embodiment of the present application performs fiber event detection.
[0086] Specifically, step 104 may include:
[0087] Step 1041, extracting image features from the signal graph based on the optical fiber event detection model to obtain a feature graph.
[0088] For example, the fiber event detection model is configured with an image feature extraction network, which can extract image features in the signal graph to obtain a feature graph.
[0089] The image feature extraction network may be a deep convolutional neural network, a ResNet network, etc., but is not limited thereto.
[0090] Among them, reference Figure 4 As shown, the deep convolutional neural network can be a VGG16 network, but is not limited thereto. The VGG16 network includes multiple convolutional layers and pooling layers. The VGG16 network is used to extract image features layer by layer to obtain feature maps.
[0091] Furthermore, the optical fiber event detection model may include multiple image feature extraction networks, and the multiple image feature extraction networks respectively extract features from different types of feature maps.
[0092] For example, assuming that the multiple image feature extraction networks are all deep convolutional neural networks, continue to refer to Figure 3 As shown, step 1041 may include: the electronic device inputs the spectrum diagram, envelope diagram and / or phase waterfall diagram into the corresponding deep convolutional neural network, thereby obtaining a first feature diagram corresponding to the spectrum diagram, a second feature diagram corresponding to the envelope diagram, and / or a third feature diagram corresponding to the phase waterfall diagram.
[0093] Step 1042, generating query items, key items and value items of the feature graph based on the optical fiber event detection model.
[0094] In some embodiments, the fiber event detection model may further include several convolutional layers, and the feature graph is input into the several convolutional layers to obtain the query item Q, key item K and value item V of the feature graph.
[0095] The convolution layer may be a 1x1 convolution layer, but is not limited thereto.
[0096] Further, combined with Figure 3 As shown, the electronic device can input the first feature map, the second feature map, and / or the third feature map into the corresponding several convolutional layers, thereby obtaining the query item Q1, key item K1 and value item V1 corresponding to the first feature map, the query item Q2, key item K2 and value item V2 corresponding to the second feature map, and / or the query item Q3, key item K3 and value item V3 corresponding to the third feature map.
[0097] Step 1043, determining the fiber event occurring in the optical fiber to be tested based on the attention mechanism, the query item, the key item, and the value item.
[0098] In some embodiments, step 1043 may include: the electronic device obtains an attention weight based on the query item and the key item, for example, performing a dot product operation on the query item Q and the key item K to obtain the attention weight.
[0099] Then, the electronic device weights the value item based on the attention weight to obtain a weighted value item. For example, the electronic device may normalize the attention weight, multiply the normalized attention weight by the value item V, and obtain a weighted value item.
[0100] After the electronic device obtains the weighted value item, it can obtain the optical fiber event occurring in the optical fiber to be tested based on the weighted value item.
[0101] For example, continue to refer to Figure 3 As shown, the electronic device can input the weighted value item into the prediction layer in the optical fiber event detection model to obtain the target detection result.
[0102] The target detection result is used to describe the probability of each optical fiber event occurring in the optical fiber to be tested based on the signal graph.
[0103] For example, the fiber event detection model can detect fiber event types including: fiber event 1, fiber event 2, and fiber event 3. The target detection result of the signal graph can include the probability of fiber event 1 occurring in the tested optical fiber, the probability of fiber event 2 occurring, and the probability of fiber event 3 occurring.
[0104] In some embodiments, in step 102, if the electronic device extracts a type of signal feature from the optical fiber signal, for example, the signal feature may be spectrum information, envelope information, or phase information, the electronic device may obtain a target detection result based on a feature graph of the signal feature, and then use the optical fiber event with the highest probability in the target detection result as the optical fiber event occurring in the optical fiber to be tested.
[0105] For example, the electronic device inputs the spectrum information corresponding to the spectrum graph into the optical fiber event detection model to obtain the target detection result of the spectrum graph. In the target detection result of the spectrum graph, the probability of occurrence of optical fiber event 1 is 0.7, the probability of occurrence of optical fiber event 2 is 0.2, and the probability of occurrence of optical fiber event 3 is 0.1. Therefore, the electronic device can regard optical fiber event 1 as the optical fiber event occurring in the optical fiber to be tested.
[0106] In other embodiments, in step 102, if the electronic device extracts multiple types of signal features from the optical fiber signal, for example, the multiple types of signal features may be spectrum information, envelope information, and phase information, respectively; the electronic device may respectively visualize the multiple types of signal features to obtain signal graphs of the optical fiber signal, such as a spectrum graph, envelope graph, and phase waterfall graph of the optical fiber signal.
[0107] Next, the electronic device may input each signal graph of the optical fiber signal into the optical fiber event detection model to obtain a target detection result of each signal graph.
[0108] For example, the electronic device can input the spectrum diagram, envelope diagram and phase waterfall diagram of the optical fiber signal into the optical fiber event detection model to obtain the target detection result of the spectrum diagram, the target detection result of the envelope diagram and the target detection result of the phase waterfall diagram. The method for obtaining the target detection result of each signal diagram can refer to the above steps 1041 to 1043, which will not be repeated here.
[0109] Then, the electronic device may determine the optical fiber event occurring in the optical fiber to be tested based on the target detection results of each signal graph.
[0110] In some embodiments, the fiber event detection model is configured with detection result weights corresponding to each signal graph (i.e., detection result weights corresponding to each type of signal feature). The electronic device can perform weighted summation on the probability of each fiber event occurring in the fiber to be tested based on the target detection results of each signal graph and the detection result weights corresponding to each signal graph to obtain a weighted sum probability value of each fiber event; and determine the fiber event occurring in the fiber to be tested based on the weighted sum probability value of each fiber event.
[0111] For example, among the weighted sum probability values of each fiber event, the fiber event corresponding to the weighted sum probability value greater than the preset threshold is taken as the fiber event occurring in the fiber to be tested. The preset threshold can be set according to actual application requirements, and the embodiment of the present application does not limit this.
[0112] For another example, among the weighted sum probability values of the optical fiber events, the optical fiber event corresponding to the maximum weighted sum probability value is taken as the optical fiber event occurring in the optical fiber to be tested.
[0113] For example, the above signal diagrams include a spectrum diagram, an envelope diagram and a phase waterfall diagram. Assume that the detection result weight corresponding to the spectrum diagram is w1, the detection result weight corresponding to the envelope diagram is w2, and the detection result weight corresponding to the phase waterfall diagram is w3.
[0114] The fiber event detection model obtains target detection result 1 based on the spectrum diagram, and target detection result 1 includes the probability P11 that fiber event 1 occurs in the fiber under test and the probability P12 that fiber event 2 occurs; the fiber event detection model obtains target detection result 2 based on the envelope diagram, and target detection result 2 includes the probability P21 that fiber event 1 occurs in the fiber under test and the probability P22 that fiber event 2 occurs; the fiber event detection model obtains target detection result 3 based on the phase waterfall diagram, and target detection result 3 includes the probability P31 that fiber event 3 occurs in the fiber under test and the probability P32 that fiber event 2 occurs.
[0115] The electronic device can obtain the weighted sum probability value of optical fiber event 1 based on the detection result weights corresponding to the spectrogram, envelope diagram, and phase waterfall diagram, as well as the probability of optical fiber event 1 occurring in each target detection result.
[0116] For example, the weighted sum probability value P1 of optical fiber event 1 = P11 * w1 + P21 * w2 + P31 * w3;
[0117] Similarly, the weighted sum probability value P2 of optical fiber event 2 can be obtained.
[0118] Among them, P2 = P12 * w1 + P22 * w2 + P32 * w3.
[0119] If P1 > P2, then optical fiber event 1 is regarded as the optical fiber event occurring in the optical fiber to be measured; if P1 < P2, then optical fiber event 2 is regarded as the optical fiber event occurring in the optical fiber to be measured.
[0120] These detection result weights are configured in the optical fiber event detection model, and the detection result weights can be gradually optimized during the training process of the optical fiber event detection model.
[0121] The embodiment of the present application also provides a training method for an optical fiber event detection model. This training method is used to train the above-mentioned optical fiber event detection model. The execution device of the training method for the optical fiber event detection model and the execution device of the optical fiber event detection method can be the same electronic device or different electronic devices. The embodiment of the present application does not limit this.
[0122] Reference Figure 5 and Figure 6 As shown, the training method for the optical fiber event detection model may include:
[0123] Step 501, obtain a signal diagram sample corresponding to the optical fiber signal sample.
[0124] For example, the optical fiber signal sample can be an optical fiber signal generated by a vibrating optical fiber, that is, an optical fiber vibration signal. The optical fiber signal sample can carry various types of interference and noise, so that the trained target detection model can resist the influence of various types of interference and noise.
[0125] Specifically, the electronic device can obtain the optical fiber signal sample; extract the signal features of the optical fiber signal sample to obtain a signal feature sample; perform visualization processing on the signal features to obtain the signal diagram sample of the optical fiber signal.
[0126] The signal features may include one or more of spectral information, envelope information, and phase information, and the signal diagram sample may include one or more of a spectrogram, an envelope diagram, and a phase waterfall diagram.
[0127] For example, the electronic device may determine a plurality of signal graph samples based on a plurality of types of signal features in the optical fiber signal samples.
[0128] For example, the electronic device can visualize the spectrum information of the optical fiber signal sample to obtain the spectrum diagram sample of the optical fiber signal sample; the electronic device can visualize the envelope information of the optical fiber signal to obtain the envelope diagram sample of the optical fiber signal sample; the electronic device can visualize the phase information of the optical fiber signal sample to obtain the phase waterfall diagram sample of the optical fiber signal sample.
[0129] Step 502: input the signal graph sample into the target detection model to obtain the target detection result of the signal graph sample.
[0130] In some embodiments, reference Figure 6 As shown, an attention mechanism is configured in the target detection model. Step 502 may include:
[0131] A, the electronic device extracts image features from the signal graph sample based on the target detection model to obtain a feature graph sample.
[0132] For example, the target detection model is configured with an image feature extraction network, which can be used to extract image features in signal graph samples to obtain feature graph samples.
[0133] The image feature extraction network may be a deep convolutional neural network or a ResNet network, but is not limited thereto.
[0134] Among them, the deep convolutional neural network can be as follows Figure 4 The VGG16 network shown. The VGG16 network includes multiple convolutional layers and pooling layers. The VGG16 network is used to extract image features layer by layer to obtain feature map samples.
[0135] In some embodiments, the target detection model may include multiple image feature extraction networks, which can respectively perform feature extraction on different types of feature map samples.
[0136] Specifically, continue to refer to Figure 6 As shown, the electronic device can input the spectrum map samples, envelope map samples and / or phase waterfall map samples into the corresponding deep convolutional neural network, thereby obtaining the first feature map samples corresponding to the spectrum map samples, the second feature map samples corresponding to the envelope map samples, and / or the third feature map samples corresponding to the phase waterfall map samples.
[0137] B. The electronic device generates query items, key items, and value items of feature map samples based on the target detection model.
[0138] In some embodiments, the target detection model may further include several convolutional layers, and by inputting the feature map sample into the several convolutional layers, the query item Q, key item K and value item V of the feature map sample may be obtained.
[0139] The convolution layer may be a 1x1 convolution layer.
[0140] Furthermore, the electronic device may input the first feature map sample, the second feature map sample, and / or the third feature map sample into corresponding convolutional layers, thereby obtaining query items Q1, key items K1 and value items V1 corresponding to the first feature map sample, query items Q2, key items K2 and value items V2 corresponding to the second feature map sample, and / or query items Q3, key items K3 and value items V3 corresponding to the third feature map sample.
[0141] C, the electronic device determines the fiber events occurring in the optical fiber under test based on the attention mechanism, the query item, the key item and the value item.
[0142] Specifically, the electronic device may obtain the attention weight based on the query item and the key item, for example, by performing a dot product operation on the query item Q and the key item K to obtain the attention weight.
[0143] Then, the electronic device weights the value item based on the attention weight to obtain a weighted value item. For example, the attention weight is normalized, and then the normalized attention weight is multiplied by the value item V to obtain a weighted value item.
[0144] After the electronic device obtains the weighted value item, it can obtain the fiber event occurring in the optical fiber to be tested based on the weighted value item. For example, the electronic device can input the weighted value item into the corresponding prediction layer in the target detection model to obtain the target detection result.
[0145] The target detection result is used to describe the probability of each type of optical fiber event occurring in the signal graph sample.
[0146] Step 503: determine the loss value of the target detection model based on the target detection result.
[0147] If the electronic device obtains a target detection result corresponding to a signal graph sample in step 502, the electronic device may obtain a loss value of the target detection model based on the target detection result, the optical fiber event label and a preset loss function in step 503.
[0148] The optical fiber event label may include an optical fiber event that occurs when the optical fiber to be tested transmits the optical fiber signal.
[0149] In some embodiments, if the electronic device inputs the multiple signal graph samples into the target detection model in step 502 and obtains the target detection results of the multiple signal graph samples, then in step 503, the electronic device may determine the loss values corresponding to the multiple signal graph samples based on the target detection results of the multiple signal graph samples.
[0150] For example, refer to Figure 6 As shown, it is assumed that in step 503 the electronic device calculates the target detection results of the first feature map sample, the second feature map sample, and the third feature map sample, and the loss function corresponding to the spectrum map is recorded as loss function F1, the loss function corresponding to the envelope map is recorded as loss function F2, and the loss function corresponding to the phase waterfall map is recorded as loss function F3.
[0151] The electronic device can obtain a loss value 1 corresponding to the spectrum diagram based on the loss function F1, the first characteristic diagram sample and the optical fiber event label; obtain a loss value 2 corresponding to the envelope diagram based on the loss function F2, the second characteristic diagram sample and the optical fiber event label; and obtain a loss value 3 corresponding to the phase waterfall diagram based on the loss function F3, the third characteristic diagram sample and the optical fiber event label.
[0152] Then, the loss value 1, loss value 2 and loss value are weightedly summed to obtain the loss value of the target detection model.
[0153] The above loss function F1, loss function F2 and loss function F3 can all adopt the cross entropy loss function.
[0154] The cross entropy loss function F can be shown as follows:
[0155]
[0156] Where n is the number of fiber event categories; p i Whether the optical fiber transmitting the optical fiber signal sample actually has an optical fiber event i, p i The value of can be determined according to the fiber event label. For example, when the fiber event label indicates that the fiber has a fiber event i, p i =1; when the fiber event label indicates that the fiber has not experienced fiber event i, p i =0;q i is the probability of the fiber event i occurring in the fiber predicted by the target detection model, q i The value can be determined based on the target detection result.
[0157] The above loss function is only an example. In actual application, it can be set according to needs, and the embodiments of the present application are not limited to this.
[0158] Step 504: Update the model parameters of the target detection model based on the loss value of the target detection model until the target detection model training is completed to obtain the optical fiber event detection model.
[0159] For example, the electronic device may update the model parameters of the target detection model based on the loss value of the target detection model and the gradient descent method.
[0160] After the target detection model is trained, the target detection model can be used as a fiber event detection model. Then, the user can deploy the fiber event detection model in an electronic device for performing fiber event detection so that the electronic device can perform fiber event detection.
[0161] The embodiment of the present application visualizes the optical fiber signal of the optical fiber to be tested to obtain a signal graph, which includes more signal details. Then, an optical fiber event detection model is used to detect the optical fiber events in the signal graph. The optical fiber event detection model is trained based on the target detection model. It can take the optical fiber event as the detection target and learn the characteristics of the optical fiber event in the signal graph, which is helpful for dealing with various types of noise and interference, reducing the negative impact of noise and interference on the identification of optical fiber events, and improving the accuracy of optical fiber event identification.
[0162] Moreover, in an embodiment of the present application, the fiber optic event detection model can introduce an attention mechanism, which can automatically learn and focus on important features in the fiber optic signal, further reduce the sensitivity of the fiber optic event detection model to noise and interference, better capture the key information of the event, reduce the misjudgment and omission of fiber optic events, and improve the accuracy of event recognition.
[0163] In addition, the embodiments of the present application use multiple types of signal features, which can detect fiber events occurring in the optical fiber to be tested from multiple dimensions, further improving the accuracy of fiber event detection and ensuring the accuracy and robustness of fiber event detection.
[0164] The optical fiber event detection model of the embodiment of the present application has high recognition efficiency, can complete event recognition in a short time, meets the needs of real-time applications, and can realize real-time event recognition under limited computing resources.
[0165] Based on the same idea as the optical fiber detection method in the above embodiment, the present application also provides an optical fiber detection device, which can be used to perform the above optical fiber detection method. For ease of explanation, the structural schematic diagram of the optical fiber device embodiment only shows the parts related to the embodiment of the present application. It can be understood by those skilled in the art that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0166] like Figure 7As shown, the optical fiber event detection device includes an information acquisition module 701, a feature extraction module 702, and an event detection module 703. In some embodiments, the above modules can be programmable software instructions stored in a memory and can be called and executed by a processor. It is understood that in other embodiments, the above modules can also be program instructions or firmware solidified in the processor.
[0167] The information acquisition module 701 is used to acquire the optical fiber signal of the optical fiber to be tested.
[0168] The feature extraction module 702 is used to extract the signal features of the optical fiber signal and perform visualization processing on the signal features to obtain a signal graph of the optical fiber signal.
[0169] The event detection module 703 is used to detect the fiber events in the signal diagram based on a pre-trained fiber event detection model to obtain the fiber events occurring in the fiber to be tested; wherein the fiber event detection model is trained based on a target detection model.
[0170] Figure 8 This is a schematic diagram of an embodiment of an electronic device of the present application.
[0171] The electronic device 100 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. When the processor 30 executes the computer program 40, the steps in the above-mentioned optical fiber event detection method embodiment are implemented, for example Figure 1 Steps 101 to 104 are shown.
[0172] Exemplarily, the computer program 40 can also be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 30. The one or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program 40 in the electronic device 100. For example, it can be divided into Figure 7 The shown acquisition module 701, feature extraction module 702, and event detection module 703.
[0173] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation of the electronic device 100. The electronic device 100 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 100 may also include input and output devices, network access devices, buses, etc.
[0174] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, a single-chip microcomputer, or the processor 30 may also be any conventional processor, etc.
[0175] The memory 20 can be used to store the computer program 40 and / or the module / unit. The processor 30 realizes various functions of the electronic device 100 by running or executing the computer program and / or the module / unit stored in the memory 20 and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0176] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0177] In the several embodiments provided in this application, it should be understood that the disclosed electronic device and method can be implemented in other ways. For example, the electronic device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation.
[0178] In addition, each functional unit in each embodiment of the present application may be integrated into the same processing unit, each unit may exist physically separately, or two or more units may be integrated into the same unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0179] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or electronic devices stated in the electronic device claim can also be implemented by the same unit or electronic device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A method for detecting optical fiber events, characterized in that: include: Obtaining an optical fiber signal of the optical fiber to be tested; Extracting signal characteristics of the optical fiber signal; Performing visualization processing on the signal characteristics to obtain a signal graph of the optical fiber signal; Detecting the optical fiber events in the signal graph based on a pre-trained optical fiber event detection model to obtain the optical fiber events occurring in the optical fiber to be tested; Wherein, the optical fiber event detection model is trained based on the target detection model.
2. The optical fiber event detection method according to claim 1, characterized in that: The optical fiber event detection model is configured with an attention mechanism, and the optical fiber event detection model based on pre-training detects the optical fiber events in the signal graph to obtain the optical fiber events occurring in the optical fiber to be tested, including: Performing image feature extraction on the signal graph based on the optical fiber event detection model to obtain a feature graph; Generate query items, key items and value items of the feature graph based on the optical fiber event detection model; A fiber event occurring in the optical fiber to be tested is determined based on the attention mechanism, the query item, the key item, and the value item.
3. The optical fiber event detection method according to claim 2, characterized in that: The determining of the optical fiber event occurring in the optical fiber to be tested based on the attention mechanism, the query item, the key item and the value item comprises: Obtaining an attention weight based on the query item and the key item; Weighting the value item based on the attention weight to obtain a weighted value item; A fiber event occurring in the optical fiber to be tested is obtained based on the weighted value item.
4. The optical fiber event detection method according to claim 1, characterized in that: The optical fiber signal includes multiple types of signal features, and the signal features are visualized to obtain a signal graph of the optical fiber signal, including: Performing visualization processing on the plurality of types of signal features respectively to obtain signal graphs of the optical fiber signal; The optical fiber event detection model based on the pre-training detects the optical fiber event in the signal graph to obtain the optical fiber event occurring in the optical fiber to be tested, including: Inputting each of the signal graphs into the optical fiber event detection model to obtain a target detection result of each of the signal graphs; The target detection result of the signal graph includes the probability of each optical fiber event occurring in the optical fiber to be tested detected based on the signal graph; The optical fiber event occurring in the optical fiber to be tested is determined based on the target detection results of the signal graphs.
5. The optical fiber event detection method according to claim 1, characterized in that: The training step of the optical fiber event detection model comprises: Obtain a signal graph sample corresponding to the optical fiber signal sample; Inputting the signal graph sample into the target detection model to obtain the target detection result of the signal graph sample; Determining a loss value of the target detection model based on the target detection result of the signal graph sample; The model parameters of the target detection model are updated based on the loss value until the target detection model training is completed to obtain the optical fiber event detection model.
6. The optical fiber event detection method according to claim 5, characterized in that: The obtaining of a signal graph sample corresponding to the optical fiber signal sample comprises: Determining a plurality of signal graph samples based on a plurality of types of signal features in the optical fiber signal sample; The step of inputting the signal graph sample into the target detection model to obtain the target detection result of the signal graph sample includes: Inputting the plurality of signal graph samples into the target detection model to obtain target detection results of the plurality of signal graph samples; The determining the loss value of the target detection model based on the target detection result of the signal graph sample includes: Determining loss values corresponding to the plurality of signal graph samples based on target detection results of the plurality of signal graph samples; A loss value of the target detection model is determined based on the loss values corresponding to the multiple signal graph samples.
7. The optical fiber event detection method according to any one of claims 1 to 6, characterized in that: The signal feature includes one or more of spectrum information, envelope information and phase information, and the signal graph includes one or more of spectrum graph, envelope graph and phase waterfall graph.
8. An optical fiber event detection device, characterized in that: include: An information acquisition module, used to acquire the optical fiber signal of the optical fiber to be tested; A feature extraction module, used to extract the signal features of the optical fiber signal and perform visualization processing on the signal features to obtain a signal graph of the optical fiber signal; An event detection module, used to detect the optical fiber events in the signal graph based on a pre-trained optical fiber event detection model, and obtain the optical fiber events occurring in the optical fiber to be tested; Wherein, the optical fiber event detection model is trained based on the target detection model.
9. An electronic device, comprising a processor and a memory, characterized in that: The memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the optical fiber event detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the optical fiber event detection method according to any one of claims 1 to 7.
Citation Information
Cited By
Wind speed detection method and device, electronic equipment and storage medium
CN121540901A
