A method and system for controlling a home security robot dog based on MoT and a transformer
By combining MoT and Transformer, accurate communication assessment and intelligent safety decision-making are achieved in the complex electromagnetic interference environment of the home, solving the problem of insufficient safety and intelligence in robot dog control and ensuring the safety and accuracy of the robotic arm's response.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING ZHONGKE JIANYOU TECHNOLOGY CO LTD
- Filing Date
- 2026-06-04
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies, when used in complex electromagnetic interference scenarios in home environments, fail to provide adequate safety and intelligence for robot dog control. They also suffer from limited communication quality assessment dimensions, insufficient extraction of damaged command features, and a lack of intelligence in safety action decision-making, leading to dangerous erroneous actions or slow responses from the robotic arm.
By synchronously acquiring the original instruction sequence, the arrival time sequence of the communication link, and the instruction feedback sequence, the bit error rate and information entropy are calculated, a confidence table is generated, and the target vector is extracted using the MoT and Transformer encoder. Combined with the alternative expert network, intelligent safety decisions are made, and the optimal control instruction is adaptively matched.
It enables accurate communication assessment and intelligent safety decision-making in strong interference scenarios, avoids malfunctions of the robotic arm, and improves home security.
Smart Images

Figure CN122323219A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of robot control technology, and in particular relates to a control method and system for a home security robot dog based on MoT and Transformer. Background Technology
[0002] With the rapid development of artificial intelligence technology, control methods based on MoT and Transformer architectures have shown broad application prospects in the field of robotics. Home security robot dogs, as emerging intelligent security devices, play an increasingly important role in home security by performing complex tasks such as patrolling and retrieving objects using robotic arms. Transformer encoders, with their powerful global context feature extraction capabilities, can handle complex timing control commands, while the MoT architecture, through the collaborative work of multiple expert networks, can achieve intelligent decision-making and control in different task scenarios.
[0003] In existing technologies, some robot control methods have begun to apply deep learning models to address communication interference issues. For example, frequency-hopping communication techniques and bit error detection algorithms are used to identify compromised commands, or traditional signal processing methods are employed to assess communication link quality. Some studies have proposed neural network-based interference signal identification techniques, classifying interference types by extracting time-frequency features. Other solutions utilize pre-defined safety control strategies to trigger fixed protective actions when communication anomalies are detected.
[0004] However, existing technologies generally suffer from problems such as inaccurate communication quality assessment, insufficient extraction of damaged command features, and a lack of intelligence in safety action decisions when facing strong electromagnetic interference from complex electronic devices in the home environment. In particular, when control commands are lost or malfunctioning, traditional methods struggle to comprehensively assess dynamic confidence levels by integrating interference features across both time and frequency dimensions. They also fail to intelligently match optimal safety control strategies based on the deep semantic features of damaged commands, easily leading to dangerous malfunctions or slow responses from the robotic arm, thus affecting home security. Therefore, existing technologies suffer from insufficient safety and intelligence in robotic dog control under strong interference scenarios. Summary of the Invention
[0005] The purpose of this application is to provide a home security robot dog control method and system based on MoT and Transformer, so as to solve the problems of insufficient safety and intelligence in the control of robot dogs in the prior art.
[0006] To address the aforementioned technical problems, in a first aspect, this application provides a method for controlling a home security robot dog based on MoT and Transformer, comprising: The system simultaneously acquires the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frames extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator. By comparing the instruction feedback sequence with the original instruction sequence bit by bit, the instruction segments that do not match are extracted to form the damaged instruction sequence, and the bit error rate under different control frequency bands is calculated to obtain the bit error sequence. The information entropy of the arrival time series within a preset time window is calculated to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, the confidence level corresponding to each control frequency band is calculated to obtain the confidence level table. Using the confidence level in the confidence table as the prior label, the prior label is aligned and concatenated with the action words in the damaged instruction sequence to obtain the fusion tensor. The fusion tensor is then input into the Transformer encoder to calculate the attention weight between the confidence level and the action words, thus obtaining the target vector. Calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control command corresponding to the damaged command sequence in the preset security control library based on the target vector.
[0007] Optionally, the method further includes: Obtain historical confidence records within the historical control period; Calculate the historical mean and historical variance of the confidence level for each control frequency band in the historical confidence level records; The fluctuation coefficient for each control frequency band is obtained by using the ratio of historical variance to historical mean. The information entropy of the arrival time series within a preset time window is calculated to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band, including: The information entropy of the arrival time series within a preset time window is calculated to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, the confidence level corresponding to each control frequency band is calculated by using the fluctuation coefficient to obtain the confidence level table.
[0008] Optionally, the information entropy of the arrival time series within a preset time window is calculated to obtain an entropy sequence. Based on the entropy sequence and the bit error sequence, the confidence level corresponding to each control frequency band is calculated using the fluctuation coefficient to obtain a confidence table, including: The arrival time series is grouped according to the control frequency band, and the time difference between two adjacent arrival time values in the arrival time series corresponding to each control frequency band is calculated to obtain the time interval series corresponding to each control frequency band. Based on each time interval sequence, the time difference is slid sequentially according to a preset time window length. The proportion of each time difference within each sliding window is obtained by calculating the ratio of the number of times each time difference occurs within the sliding window length to the total number of all time differences within the sliding window length. After calculating the product of the occurrence percentage of each time difference and the logarithm of the occurrence percentage, the products corresponding to each time difference are accumulated and the negative value is taken to obtain the information entropy of each sliding window. The average value of all information entropies in the time interval sequence is calculated to obtain the information entropy of each control frequency band. An entropy sequence is constructed based on all information entropies. Calculate the product of the fluctuation coefficient of each control frequency band with the preset time entropy weight and the preset bit error rate weight to obtain the first weight and the second weight of each control frequency band; The first weighted value is obtained by multiplying the information entropy of each control frequency band in the entropy sequence with the corresponding first weight, and the second weighted value is obtained by multiplying the bit error rate of each control frequency band in the bit error sequence with the corresponding second weight. The confidence level of each control frequency band is obtained by summing the first weighted value and the second weighted value, and a confidence table is obtained based on all the confidence levels.
[0009] Optionally, by comparing the instruction feedback sequence bit-by-bit with the original instruction sequence, extracting the instruction segments that do not match to form the damaged instruction sequence, and statistically analyzing the bit error rate under different control frequency bands to obtain the bit error sequence, including: By comparing the bits at the same position in the instruction feedback sequence aligned according to the timestamp with the original instruction sequence bit by bit, the position of the bit that does not match is determined as the target position, and the target position sequence is obtained. Extract instruction fragments, including each target position in the target position sequence, from the original instruction sequence. Arrange all instruction fragments in chronological order to obtain the damaged instruction sequence. Map each target position in the target position sequence to the corresponding control frequency band in the original instruction sequence, and count the number of target positions in each control frequency band to obtain the number of error bits in each control frequency band; The bit error rate (BER) of each control band is obtained by calculating the ratio of the number of erroneous bits in each control band to the total number of bits in the corresponding control band. The BER sequence is then obtained based on all the BER rates.
[0010] Optionally, using the confidence level in the confidence table as a priori identifier, the priori identifier is aligned and concatenated with the action words in the damaged instruction sequence to obtain a fusion tensor. The fusion tensor is then input into the Transformer encoder to calculate the attention weights between the confidence level and the action words, resulting in a target vector, including: The damaged instruction sequence is divided into multiple action words according to the preset word segmentation rules. The control frequency band corresponding to each action word is extracted from the damaged instruction sequence. The corresponding confidence level is found in the confidence table based on the control frequency band as the prior identifier of each action word. Based on each action word, according to the preset mapping relationship between action words and word codes, the word vector corresponding to each action word is obtained. By copying and expanding the prior identifier of each action word, a prior vector with the same length as the word vector is obtained. A fusion vector is constructed based on word vectors and prior vectors. All fusion vectors are arranged in chronological order to obtain a fusion tensor. The fusion tensor is input into the trained Transformer encoder. The multi-head attention computation unit in the Transformer encoder is used to calculate the dot product between any two fusion vectors in the fusion tensor. All dot products are normalized row-wise to obtain the attention weight matrix. The attention weight matrix is used to perform a weighted summation of all fusion vectors in the fusion tensor to obtain the target vector.
[0011] Optionally, the matching degree between the target vector and each candidate expert network within the MoT architecture is calculated, and the candidate expert network with the highest matching degree is determined as the target expert network, including: Calculate the dot product between the target vector and the routing weight vector corresponding to each candidate expert network in the MoT architecture to obtain the routing score for each candidate expert network, and construct a routing score sequence based on all routing scores; By normalizing all route scores in the route score sequence, the matching degree corresponding to each candidate expert network is obtained, and the candidate expert network with the highest matching degree is determined as the target expert network.
[0012] Optionally, using a target expert network, the target control commands corresponding to the damaged command sequence are determined from a pre-defined security control library based on the target vector, including: By utilizing multiple fully connected layers within the target expert network, a layer-by-layer linear transformation and nonlinear activation calculation are performed on the target vector to obtain the classification vector; Extract the standard vector corresponding to each security control instruction from the preset security control library, and calculate the cosine similarity between the classification vector and the standard vector corresponding to each security control instruction. The security control instruction corresponding to the largest cosine similarity is identified as the target control instruction corresponding to the damaged instruction sequence.
[0013] Secondly, this application provides a home security robot dog control system based on MoT and Transformer, including: The acquisition module is used to synchronously acquire the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frame extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator. The comparison module is used to compare the instruction feedback sequence with the original instruction sequence bit by bit, extract the instruction segments that do not match the comparison to form the damaged instruction sequence, and calculate the bit error rate under different control frequency bands to obtain the bit error sequence. The calculation module is used to calculate the information entropy of the arrival time series within a preset time window to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, the confidence level is calculated for each control frequency band to obtain the confidence level table. The generation module is used to align and concatenate the prior labels with the action words in the damaged instruction sequence using the confidence in the confidence table as the prior label, to obtain the fusion tensor. The fusion tensor is then input into the Transformer encoder to calculate the attention weight between the confidence and the action words, and to obtain the target vector. The generation module is also used to calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control instruction corresponding to the damaged instruction sequence in the preset security control library based on the target vector.
[0014] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the home security robot dog control method based on MoT and Transformer as described in the first aspect above.
[0015] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the home security robot dog control method based on MoT and Transformer as described in the first aspect above.
[0016] The home security robot dog control method based on MoT and Transformer provided in this application firstly acquires the original command sequence, arrival time sequence and command feedback sequence synchronously, and then performs bit-by-bit comparison between the feedback sequence and the original sequence to extract the damaged command fragments. At the same time, it calculates the bit error rate of different control frequency bands, which can accurately locate the damaged command location and frequency band distribution characteristics.
[0017] Subsequently, by calculating the information entropy of the arrival time series within a preset time window, the regularity of communication is quantified from the time dimension. Combined with the bit error sequence, the interference intensity is quantified from the spatial frequency band dimension. The confidence levels of each control frequency band are then comprehensively calculated, achieving a dynamic and accurate assessment of communication quality and overcoming the limitation of existing technologies with only one assessment dimension. Next, the confidence level is used as a priori identifier and concatenated with the action lexical units of the damaged instruction to form a fusion tensor. The target vector is extracted by calculating global contextual attention weights through a Transformer encoder, which fully integrates communication state information and instruction semantic features, solving the problem of insufficient feature extraction of damaged instructions.
[0018] Finally, the matching degree between the target vector and each candidate expert network is calculated using the MoT architecture. The optimal expert network is then activated to intelligently retrieve target control commands from the safety control library. Compared to a fixed safety policy triggering mechanism, this achieves adaptive safety decision-making based on damage characteristics, significantly improving the intelligence and accuracy of safety action matching. Therefore, this application can effectively ensure the safety and intelligence of robot dog control in complex electromagnetic interference environments at home, preventing the robotic arm from performing dangerous erroneous actions and improving home safety protection.
[0019] Furthermore, this application obtains historical confidence records within historical control cycles, calculates the historical confidence mean and historical variance for each control frequency band, and uses the ratio of historical variance to historical mean to obtain the fluctuation coefficient. This incorporates the historical communication state variation patterns into the confidence calculation process for the current cycle. When electromagnetic interference in the home environment exhibits time-varying characteristics, the confidence levels of each frequency band across different control cycles fluctuate with the intensity of the interference. The fluctuation coefficient can quantitatively characterize this time-varying pattern and reflect the instability of the current frequency band communication state.
[0020] By using the fluctuation coefficient as a dynamic adjustment factor applied to both the time entropy weight and the bit error rate weight, the weights are tilted towards the bit error rate during the burst phase of interference and tend to be more balanced during the stable phase of interference. This achieves a dynamic and adaptive assessment of the reliability of each control frequency band, overcoming the limitation that fixed weights cannot reflect the time-varying characteristics of interference, and enabling the confidence table to more accurately reflect the actual communication quality of the current control cycle. Therefore, this application can further improve the accuracy and adaptability of communication confidence assessment in strong interference scenarios. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A flowchart illustrating a home security robot dog control method based on MoT and Transformer provided for embodiments of this application; Figure 2 A flowchart illustrating a method for generating a damaged instruction sequence and a bit error sequence, provided in an embodiment of this application; Figure 3 A flowchart illustrating a method for generating target vectors provided in an embodiment of this application; Figure 4 A schematic diagram of a home security robot dog control system based on MoT and Transformer is provided for an embodiment of this application; Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0023] Existing technologies have three core shortcomings when dealing with strong electromagnetic interference in home environments: First, the communication quality assessment dimension is too narrow. Existing methods either rely solely on bit error detection to assess frequency band reliability or solely on time-frequency characteristics to identify interference types. They fail to integrate the regularity of command arrival in the time dimension with the degree of bit damage in the spatial frequency band dimension, making it difficult for the confidence assessment results to accurately reflect the actual communication status.
[0024] Secondly, the feature extraction of damaged commands is insufficient. Existing methods only detect anomalies at the signal level and fail to integrate communication quality status with command semantic features for modeling. They are unable to extract deep features that take into account both communication background and action intent. Thirdly, safety action decision-making lacks intelligence. Existing methods generally use fixed rules to trigger protective actions and cannot adaptively match the optimal safety strategy according to the specific characteristics of the damaged command. In complex and ever-changing interference scenarios, this can easily cause the robotic arm to malfunction or respond slowly, affecting the effectiveness of home security protection.
[0025] To address the aforementioned issues, this application proposes a home security robot dog control method based on MoT and Transformer. Its core lies in synchronously acquiring the original instruction sequence, communication link arrival time sequence, and instruction feedback sequence, and comprehensively calculating the damaged instructions, error sequences, and information entropy sequences obtained by bit-by-bit comparison. This method quantifies communication reliability from both time and frequency band dimensions and generates a confidence table, thus solving the problem of a single evaluation dimension.
[0026] Building upon this foundation, confidence levels are used as prior identifiers and concatenated with action lexes of damaged commands to construct a fusion tensor. This tensor is then input into a Transformer encoder to extract a target vector that integrates communication state and command semantics, overcoming the shortcomings of insufficient feature extraction in existing technologies. Finally, the matching degree between the target vector and each candidate expert network is calculated using a MoT architecture. The optimal expert network is then activated to adaptively retrieve target control commands from the safety control library, achieving intelligent safety decision-making driven by damaged features. This effectively ensures the safety and intelligence of home security robot dogs under strong interference scenarios.
[0027] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] To address the problems of the prior art, this application provides a method, apparatus, device, computer storage medium, and computer program product for controlling a home security robot dog based on MoT and Transformer. The method for controlling a home security robot dog based on MoT and Transformer provided in this application will be described below.
[0029] Figure 1 This illustration shows a flowchart of a home security robot dog control method based on MoT and Transformer according to an embodiment of this application. Figure 1 As shown, the method includes: S101. Synchronously acquire the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frame extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator.
[0030] The original instruction sequence refers to the ordered set of all control instructions issued by the master control terminal to the home security robot dog in chronological order. It can include action types such as adjusting the joint angle of the robotic arm, switching the direction of travel, and triggering the defensive posture. Each instruction is encoded and transmitted in the form of binary data frames.
[0031] Arrival time series refers to the set of timestamp records of each control protocol frame actually arriving at the receiving end, extracted from the underlying layer of the robot dog's communication link. It reflects the time distribution pattern of control commands during the communication transmission process and is obtained through the hardware layer counter of the communication link or the frame reception record of the protocol stack.
[0032] A command feedback sequence refers to an ordered set formed by the robotic arm actuator sending back the actual received command content to the master control unit after receiving and responding to control commands. It may include damaged command fragments that differ from the original command sequence in content or order and is used for comparison and verification with the original command sequence.
[0033] Specifically, when the home security robot dog performs patrol or retrieval tasks, the main control unit continuously sends control commands to the robot dog, while simultaneously activating three parallel data acquisition channels to collect the original command sequence, arrival time sequence, and command feedback sequence, respectively. First, when issuing each control command, the main control unit writes the binary data frame of that command into the original command sequence in chronological order. ,in This represents the total number of instruction frames issued within the current control cycle. Each element represents a control instruction frame encoded in binary, for example... It can provide motion commands to control the retraction of the robotic arm. It can be used to give commands to keep the robot dog on standby.
[0034] At the same time, the underlying layer of the communication link records the arrival time of each successfully received control protocol frame and arranges them in the order of arrival to form an arrival time sequence. ,in Indicates the first The time when the frame of the Frame Control Protocol arrives at the receiving end and After receiving a control command, the robotic arm actuator transmits the actual received command content back in the order of receipt, forming a command feedback sequence. ,in The first one actually received by the actuator The content of the instruction and .
[0035] S102. By comparing the instruction feedback sequence with the original instruction sequence bit by bit, the instruction segments that do not match are extracted to form the damaged instruction sequence, and the bit error rate under different control frequency bands is calculated to obtain the bit error sequence.
[0036] Optionally, step S102, which involves comparing the instruction feedback sequence with the original instruction sequence bit by bit, extracting the instruction segments that do not match to form the damaged instruction sequence, and calculating the bit error rate under different control frequency bands to obtain the bit error sequence, may specifically include: Figure 2 A flowchart illustrating a method for generating a corrupted instruction sequence and an error sequence according to an embodiment of this application is shown. Figure 2 As shown, the method includes: S1021. By comparing the bits at the same position in the instruction feedback sequence aligned according to the timestamp with the bits in the original instruction sequence bit by bit, the position of the bit that does not match is determined as the target position, and the target position sequence is obtained.
[0037] The target location refers to the position where the bit values of the same location are inconsistent when comparing the bit-by-bit sequence of the instruction feedback sequence and the original instruction sequence. It can be represented by coordinates using both frame number and intra-frame offset. The target location sequence is an ordered set of all target locations within the current control cycle, arranged in the order of detection, and reflects the distribution of damage to the communication link at the bit level.
[0038] Specifically, firstly, the instruction feedback sequence With the original instruction sequence Align by timestamp to ensure that the first two timestamps are aligned. element and They correspond to the same control command in terms of time. Then, for each pair of aligned commands... and Compare bit by bit at the bit level. For each bit, if... and If the bit values at a given position are different, then the position identifier of that bit is recorded as a target position.
[0039] For example, let The binary content is , The binary content is After comparing the two digit by digit, it was found that the 4th digit was... =1, 0 and the 6th bit =0, If the values are inconsistent (e.g., 3rd and 4th positions of frame number 1 and 3rd and 6th positions of frame number 3), then record them as the two target locations respectively. Finally, iterate through all the locations. After comparing the instructions, all detected target locations are arranged in the order of detection to obtain the target location sequence. ,in The total number of target locations detected within the current control cycle, each Indicates the first Location identifier of each target location and .
[0040] S1022. Extract instruction fragments from the original instruction sequence, including each target position in the target position sequence, and arrange all instruction fragments in chronological order to obtain the damaged instruction sequence.
[0041] A damaged instruction sequence refers to an ordered set of all instruction fragments, including at least one target location, extracted from the original instruction sequence and arranged in chronological order, including instruction frames whose content has been bit-flipped due to electromagnetic interference during communication transmission.
[0042] Specifically, first traverse Each target location in ,according to The frame numbers recorded in the original instruction sequence The complete instruction frame containing the target location is located and extracted. Then, all extracted instruction frames are processed according to their position in the original instruction sequence. Arrange the data in chronological order, remove duplicate frames extracted from the same frame, and obtain the damaged instruction sequence. ,in The total number of extracted damaged instruction frames and each Indicates the first The complete binary content of the damaged instruction frame and .
[0043] S1023. Map each target position in the target position sequence to the corresponding control frequency band in the original instruction sequence, and count the number of target positions in each control frequency band to obtain the number of error bits in each control frequency band.
[0044] Control frequency bands refer to the different carrier frequency ranges used for transmitting control commands in the robot dog's communication link. Different control frequency bands carry different types of control commands, and the degree of electromagnetic interference to each control frequency band may vary. The number of error bits refers to the total number of target positions belonging to that frequency band in the target position sequence, and reflects the total number of bit flips caused by interference in that frequency band during the current control cycle.
[0045] Specifically, firstly, based on each target location The frame number recorded in the data, combined with the preset mapping relationship between each frame and the control frequency band in the communication protocol, will... Mapped to its corresponding control frequency band. Assume the communication link is divided into [number] bands. One control frequency band, denoted as Next, for each control frequency band... Statistical target location sequence The number of target locations belonging to this frequency band is used to determine the number of error bits in that frequency band. ,in .
[0046] S1024. Calculate the ratio of the number of erroneous bits in each control band to the total number of bits in the corresponding control band to obtain the bit error rate of each control band, and obtain the bit error sequence based on all bit error rates.
[0047] Bit error rate (BER) is the ratio of the number of erroneous bits in a given control frequency band to the total number of bits transmitted in that band. It ranges from 0 to 1, with a higher value indicating more severe interference in that band. A bit error rate sequence is an ordered set of BER values for all control frequency bands within the current control cycle, arranged sequentially by frequency band.
[0048] Specifically, firstly by analyzing the original instruction sequence China belongs to Sum the bit lengths of all instruction frames to obtain the control frequency band. Total number of bits transmitted in the current control cycle Next, the bit error rate for each control band is calculated. Finally, the bit error rates of all control frequency bands are arranged in frequency band order to obtain the bit error sequence. .
[0049] This embodiment accurately locates the bit flip positions within each control frequency band, extracts damaged command frames, and quantizes the bit error rate of each frequency band. It achieves precise tracking of interference-damaged locations and frequency band-level quantization at the bit level, effectively improving the recognition accuracy of damaged commands in strong interference scenarios.
[0050] S103. Calculate the information entropy of the arrival time series within a preset time window to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, calculate the confidence level corresponding to each control frequency band to obtain the confidence level table.
[0051] Optionally, the method further includes: Obtain historical confidence records within the historical control period.
[0052] Historical confidence records refer to the collection of confidence tables generated in multiple historical control periods prior to the current control period, including the confidence values for each control frequency band in each historical period, and are used to analyze the temporal variation patterns of communication quality in each control frequency band.
[0053] Specifically, firstly, a preset number of confidence tables for historical control cycles are read from the data storage unit. Then, the confidence values corresponding to each control frequency band in each historical control cycle are extracted by grouping them according to the control frequency band, thus obtaining historical confidence records. ,in Indicates control frequency band The confidence level numerical sequence within the historical control period and .
[0054] Calculate the historical mean and historical variance of the confidence level for each control frequency band in the historical confidence level record.
[0055] The historical mean refers to the arithmetic mean of all confidence scores for a given control frequency band over a historical control period, reflecting the historical baseline level of communication quality for that band. Historical variance refers to the dispersion of all confidence scores for a given control frequency band relative to the historical mean over a historical control period, reflecting the degree of fluctuation in confidence levels for that band.
[0056] Specifically, firstly for each control frequency band Corresponding historical confidence value sequence Calculate the arithmetic mean to obtain the historical average for this frequency band. Next, calculate. Each confidence level value and its historical mean The historical variance of this frequency band is obtained by averaging the sum of squared differences. Finally, iterate through all of them. Each control frequency band completes the calculation, resulting in a set of historical averages. With historical variance set .
[0057] The fluctuation coefficient for each control frequency band is obtained by using the ratio of historical variance to historical mean.
[0058] The fluctuation coefficient is the ratio of the historical variance to the historical mean of a certain control frequency band. It is used to quantify the relative fluctuation intensity of the confidence level of the frequency band within a historical period. The larger the value, the more obvious the time-varying characteristics of the communication quality of the frequency band.
[0059] Specifically, first calculate each control frequency band historical variance Compared with historical average The ratio of these values yields the fluctuation coefficient for that frequency band. Next, the fluctuation coefficients of all control frequency bands are arranged in frequency band order to obtain the fluctuation coefficient set. .
[0060] Step S103 calculates the information entropy of the arrival time series within a preset time window to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band, including: S1031. Calculate the information entropy of the arrival time series within a preset time window to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, calculate the confidence level corresponding to each control frequency band by using the fluctuation coefficient to obtain the confidence level table.
[0061] Specifically, first, the arrival time series is calculated. The information entropy within a preset time window yields an entropy sequence. ,in Indicates control frequency band The corresponding information entropy value. Then, the fluctuation coefficient is used. Multiply by the preset initial time entropy weight and the preset initial bit error rate weight respectively to obtain the control frequency band. The corresponding dynamic time entropy weight and dynamic bit error rate weight.
[0062] Finally, the dynamic time entropy weight and entropy sequence are combined. Information entropy of the corresponding frequency band Multiplying them yields the first weighted value, which is then combined with the dynamic bit error rate weight and the bit error sequence. Bit error rate of the corresponding frequency band Multiplying the two values yields the second weighted value; summing the two weighted values gives the control frequency band. The confidence levels are calculated, and the confidence levels of all control frequency bands are summarized to obtain a confidence table. ,in Indicates control frequency band The confidence level value for the current control cycle.
[0063] This embodiment tilts the weights towards the bit error rate during the burst phase of interference and makes the weight distribution more balanced during the stable phase of interference. It achieves dynamic adaptive evaluation of communication quality and effectively improves the accuracy of confidence calculation and time-varying response capability in strong interference scenarios.
[0064] Optionally, step S1031, which calculates the information entropy of the arrival time series within a preset time window to obtain an entropy sequence, and then calculates the confidence level corresponding to each control frequency band based on the entropy sequence and the bit error sequence, to obtain a confidence table, may specifically include: The arrival time series are grouped according to the control frequency band, and the time difference between two adjacent arrival time values in the arrival time series corresponding to each control frequency band is calculated to obtain the time interval series corresponding to each control frequency band.
[0065] A time interval sequence is an ordered set of time differences obtained by successively subtracting two adjacent arrival time values in the arrival time sequence corresponding to a certain control frequency band. It reflects the interval distribution pattern of control protocol frames between consecutive arrival times in the control frequency band and is used to measure the time uniformity of instruction transmission in the band.
[0066] Specifically, firstly, based on the preset mapping relationship between each control protocol frame and the control frequency band in the communication protocol, the arrival time sequence is... Group by control frequency band and extract those belonging to the control frequency band. The arrival times of all frames are used to obtain the control frequency band. The corresponding arrival time subsequence. Then, the difference between any two adjacent arrival times in this subsequence is taken to obtain the control frequency band. Corresponding time interval sequence ,in To control the frequency band The total number of adjacent frame pairs within the frame. Indicates the first frequency band within that frequency band The time difference of arrival of adjacent frames and .
[0067] Based on each time interval sequence, the time difference is slid sequentially according to a preset time window length. The proportion of each time difference within each sliding window is obtained by calculating the ratio of the number of times each time difference occurs within the sliding window length to the total number of all time differences within the sliding window length.
[0068] The occurrence percentage refers to the ratio of the number of times a certain time difference value appears within a certain sliding window to the total number of all time differences within that window. The value ranges from 0 to 1 and reflects the relative frequency distribution of that time difference within the current sliding window. The preset time window length is shown in Table 1 below. Table 1: Preset Time Window Length Comparison Table
[0069] As shown in Table 1, the preset time window length configurations for each control frequency band are given. The preset time window length for different control frequency bands is set according to the differences in transmission rate and interference sensitivity of that frequency band. The larger the time window length, the wider the range of capturing time distribution patterns; the smaller the time window length, the more sensitive the response to local abrupt changes.
[0070] Specifically, firstly, based on the preset time window length corresponding to each control frequency band in Table 1... For control frequency band time interval sequence By window length Perform a positional sliding motion. At each sliding position... Extract from the location, starting from the first position. Starting from each time difference, continuously The time differences constitute the observation set of the current sliding window.
[0071] Next, count the frequency of each different time difference value in the observation set, and divide the frequency of each time difference value by 1 / 2. This yields the percentage of occurrences of the time difference within the current sliding window. Finally, the time interval sequence is iterated through. It calculates the percentage of each time difference within each possible sliding window based on all possible sliding positions.
[0072] After calculating the product of the occurrence percentage of each time difference and the logarithm of the occurrence percentage, the products corresponding to each time difference are accumulated and the negative value is taken to obtain the information entropy of each sliding window. The average value of all information entropies in the time interval sequence is calculated to obtain the information entropy of each control frequency band. An entropy sequence is constructed based on all information entropies.
[0073] The information entropy of each sliding window refers to the information entropy value calculated based on the proportion of all time difference values within a certain sliding window. It reflects the degree of uncertainty of the frame arrival time interval within that sliding window, and the higher the value, the more dispersed the distribution of frame arrival time intervals and the weaker the communication regularity within that time period. The information entropy of each control frequency band refers to the arithmetic mean of the position information entropy corresponding to all sliding positions within a certain control frequency band, and reflects the comprehensive level of communication time regularity of that frequency band throughout the entire observation period.
[0074] Specifically, firstly, assume that at a certain sliding position, the observation set contains [a certain number of occurrences]. Different time differences, the first The proportion of occurrence of this time difference is The formula for calculating the information entropy corresponding to the sliding position is: ,in For the first The percentage of occurrence of each time difference. For each sliding position. The information entropy of the observation set at that location is calculated using the formula above. .
[0075] Subsequently, the control frequency band was... time interval sequence The information entropy of this frequency band is obtained by taking the arithmetic mean of the information entropy corresponding to all sliding positions within the band. ,in To control the frequency band The preset time window length, This represents the total number of possible sliding positions within the time interval sequence. Finally, iterate through all positions. The above calculations are performed for each control frequency band. The frequency band information entropy of each frequency band is arranged in order of frequency band to obtain the entropy sequence. .
[0076] The first weight and the second weight of each control frequency band are obtained by multiplying the fluctuation coefficient of each band with the preset time entropy weight and the preset bit error rate weight.
[0077] The first weight refers to the control frequency band. Fluctuation coefficient The dynamic weight value, obtained by multiplying the preset time entropy weight corresponding to the frequency band, is used to adjust the frequency band information entropy in the confidence calculation in a way that matches the intensity of historical fluctuations. The second weight refers to the control frequency band. Fluctuation coefficient The dynamic weight value, obtained by multiplying the preset bit error rate weight corresponding to this frequency band, is used to apply corresponding dynamic adjustments to the bit error rate. The preset time entropy weights are shown in Table 2 below: Table 2: Preset Time Entropy Weight Reference Table
[0078] As shown in Table 2, Table 2 provides the preset time entropy weight configuration for each control frequency band. The preset time entropy weight reflects the basic contribution ratio of the time regularity characteristics of each control frequency band to the confidence calculation under the condition of no historical fluctuation correction, and is preset according to the differences in transmission characteristics of each frequency band.
[0079] The preset bit error rate weights are shown in Table 3 below: Table 3: Preset Bit Error Rate Weighting Table
[0080] As shown in Table 3, Table 3 gives the preset bit error rate weight configuration for each control frequency band. The preset bit error rate weight reflects the basic contribution ratio of the bit error rate of each control frequency band to the confidence calculation under the condition of no historical fluctuation correction, and together with the preset time entropy weight, it constitutes the initial weight configuration for confidence calculation.
[0081] Specifically, first, find the control frequency band according to Table 2. Corresponding preset time entropy weight Set of volatility coefficients The corresponding volatility coefficient and Multiply to obtain the control frequency band. First weight .
[0082] Next, find the control frequency band according to Table 3. Corresponding preset bit error rate weight ,Will and Multiply to obtain the control frequency band. Second weight Finally, iterate through all of them. A control frequency band is used to obtain the first weight set. With the second weight set .
[0083] The first weighted value is obtained by multiplying the information entropy of each control frequency band in the entropy sequence with the corresponding first weight, and the second weighted value is obtained by multiplying the bit error rate of each control frequency band in the bit error sequence with the corresponding second weight.
[0084] The first weighting value refers to the control frequency band. Frequency band information entropy With the corresponding first weight The multiplied value reflects the contribution of the time-dimension communication regularity, after fluctuation correction, to the confidence level. The second weighting value refers to the control frequency band. Bit error rate With the corresponding second weight The multiplication result reflects the contribution of the spatial frequency band interference intensity, after fluctuation correction, to the confidence level.
[0085] Specifically, first from the entropy sequence Extract the control frequency band from Corresponding information entropy , with the first weight Multiply to obtain the control frequency band. First weighted value Next, from the error sequence... Extract the control frequency band from Corresponding bit error rate , with the second weight Multiply to obtain the control frequency band. Second weighting Finally, iterate through all of them. A set of control frequency bands is used to obtain the first weighted value set. With the second weighted set .
[0086] The confidence level of each control frequency band is obtained by summing the first weighted value and the second weighted value, and a confidence table is obtained based on all the confidence levels.
[0087] Specifically, firstly, control the frequency band First weighted value With the second weighted value The summation yields the comprehensive interference penalty index. Subsequently, a negative exponential mapping function is used to calculate the confidence level for this frequency band. Then iterate through all of them. The negative exponential mapping calculation is performed for each control frequency band. The confidence levels of all control frequency bands are then arranged in frequency band order to obtain a confidence table. ,in Indicates control frequency band At the confidence level of the current control cycle and .
[0088] This embodiment enables dynamic and accurate evaluation of communication quality in each control frequency band, effectively improving the accuracy of confidence calculation and time-varying response capability under strong interference scenarios.
[0089] S104. Using the confidence level in the confidence level table as the prior label, align and concatenate the prior label with the action words in the damaged instruction sequence to obtain the fusion tensor. Input the fusion tensor into the Transformer encoder to calculate the attention weight between the confidence level and the action words to obtain the target vector.
[0090] Optionally, step S104, using the confidence level in the confidence table as a priori identifier, aligns and concatenates the priori identifier with the action words in the damaged instruction sequence to obtain a fusion tensor. The process of inputting the fusion tensor into the Transformer encoder to calculate the attention weights between the confidence level and the action words to obtain the target vector can specifically include: Figure 3 A flowchart illustrating a method for generating target vectors according to an embodiment of this application is shown. Figure 3 As shown, the method includes: S1041. The damaged instruction sequence is divided into multiple action words according to the preset word segmentation rules. The control frequency band corresponding to each action word is extracted from the damaged instruction sequence. The corresponding confidence level is found in the confidence table according to the control frequency band as the prior identifier of each action word.
[0091] Action words refer to the smallest semantically independent instruction unit obtained by segmenting the damaged instruction sequence according to preset word segmentation rules, and include encoded segments of basic action types such as robotic arm extension, rotation angle, and gripping force. Prior identifiers refer to the confidence value of the control frequency band corresponding to each action word, reflecting the reliability level of the communication environment in which the action word is located during transmission and used to annotate communication quality background information for the action word. The preset word segmentation rules are shown in Table 4 below: Table 4: Preset Word Segmentation Rules Comparison Table
[0092] As shown in Table 4, the preset word segmentation rule configuration is given. This rule defines the segmentation boundary identifiers of different instruction types at the binary level. By identifying specific start and end flags, the continuous binary instruction stream is segmented into semantically independent action words. The flag patterns corresponding to different action types are different to ensure the accuracy of segmentation.
[0093] Specifically, this application adopts a segmentation strategy that combines sliding window-based fuzzy regular expression matching with Hamming code verification. First, based on the preset word segmentation rules defined in Table 4, the damaged instruction sequence is segmented... A sliding window with a length equal to the standard flag bit length is used to perform frame-by-frame continuous scanning, and the Hamming distance between the extracted binary segment within the sliding window and the standard start or end flag bit is calculated.
[0094] When the Hamming distance is less than or equal to a preset fault tolerance threshold (e.g., 2 bits) and the segment can pass the error correction check of the local Hamming code at the lower layer of the communication link, a valid boundary flag is identified. Based on this fuzzy-identified flag boundary, each damaged instruction frame... The system is elastically segmented into multiple action words. Then, the action words obtained from all damaged command frames are aggregated and arranged chronologically to obtain an action word sequence. ,in The total number of action verbs obtained from the segmentation. Indicates the first The binary content of each action word and .
[0095] Then, based on each action morpheme Extract the control band identifier corresponding to the term from the frame attribution relationship in the original instruction sequence. Then, extract the identifier from the confidence table. The confidence level corresponding to the control frequency band is searched, and this confidence level is used as an action word. Prior identifiers Finally, iterate through all of them. Each action lexical completes the extraction of prior identifiers, resulting in a prior identifier sequence. .
[0096] S1042. Based on each action word, according to the preset mapping relationship between action words and word codes, obtain the word vector corresponding to each action word. By copying and expanding the prior identifier of each action word, obtain a prior vector with the same length as the word vector.
[0097] A lexical vector is a fixed-length numerical vector representation of an action lexical word, converted through a predefined encoding mapping table, and used for numerical computation and feature extraction in a neural network. A prior vector is a vector formed by copying and expanding the prior identifier value corresponding to the action lexical word into a vector of the same length as the lexical vector. The predefined mapping relationship between action lexical words and lexical encodings is shown in Table 5 below: Table 5: Mapping Relationship between Action Lexical Elements and Lexical Encoding
[0098] As shown in Table 5, Table 5 gives the preset mapping relationship between action words and word codes. This mapping table maps the binary content of word codes of different action types to a predefined fixed-length numerical vector. The numerical values of each dimension of the mapping vector are obtained by the position encoding and numerical normalization of the binary content of word codes, ensuring that word codes of the same action type are mapped to similar vector space positions.
[0099] Specifically, firstly, based on the action word motif For each action type, refer to Table 5 to find the corresponding lexical encoding vector dimension. Because the binary length of the lexical units differs between different action types (e.g., 16 bits for extension / retraction of a robotic arm and 24 bits for posture adjustment), we first need to analyze the action lexical units. The binary content is padded with trailing zeros to align to the preset maximum instruction length specification, such as uniformly padding to 24 bits. Then, the aligned binary sequence is converted into the corresponding decimal scalar value.
[0100] Next, construct the pre-defined feature mapping matrix. The decimal numerical scalar is subjected to high-dimensional linear projection through matrix multiplication, and then superimposed with temporal positional encoding based on sine and cosine functions to preserve the temporal features of action lexical units. The calculation formula is as follows: This tightly maps the binary content of the action lexical unit to... dimensional word vector ,in The first word vector represents the first word vector. dimensional value and .
[0101] Subsequently, this application addresses the action word element. Corresponding prior identifiers Introducing a learnable prior scaling matrix Through matrix multiplication operations By smoothly and evenly projecting the one-dimensional confidence scalar onto a feature space of the same dimension as the word vector, we obtain... dimensional prior vector Finally, iterate through all of them. Each action word is used to obtain a word vector set. With the prior vector set .
[0102] S1043. Construct a fusion vector based on word vectors and prior vectors, and arrange all fusion vectors in chronological order to obtain the fusion tensor.
[0103] A fusion vector is a vector obtained by concatenating the lexical vector corresponding to a specific action lexical with the prior vector along the feature dimension. It includes both action semantic information and communication quality background information and is used as input to the Transformer encoder for feature extraction. A fusion tensor is a two-dimensional tensor formed by arranging the fusion vectors corresponding to all action lexicals in chronological order. Its first dimension is the time-series index of the action lexical, and its second dimension is the feature dimension of the fusion vector.
[0104] Specifically, firstly, for each action morpheme... corresponding dimensional word vector and dimensional prior vector The feature dimensions are concatenated and fused to obtain a length of [length missing]. fusion vector Then all of them The fusion vectors corresponding to each action word are arranged according to the order in which the action words are sent in the time series, and the dimension is [dimension number missing]. Fusion tensor , where the matrix's first Action is an action word. corresponding fusion vector .
[0105] S1044. Input the fusion tensor into the trained Transformer encoder, use the multi-head attention computation unit in the Transformer encoder to calculate the dot product between any two fusion vectors in the fusion tensor, and normalize all dot products by row to obtain the attention weight matrix. Use the attention weight matrix to perform a weighted summation of all fusion vectors in the fusion tensor to obtain the target vector.
[0106] The attention weight matrix is a weight matrix obtained by calculating the dot product between each fusion vector in the fusion tensor and normalizing it in the multi-head attention computation unit of the Transformer encoder. It reflects the association strength between action words at different time positions and is used to perform weighted aggregation of fusion vectors. The target vector is a fixed-length vector obtained by weighting and summing all fusion vectors in the fusion tensor according to the attention weight matrix, and it integrates the semantic information and communication quality background information of all action words.
[0107] The structure of a trained Transformer encoder includes a multi-head attention computation unit, a feedforward neural network layer, and a layer normalization unit. The multi-head attention computation unit includes... The multi-head attention network consists of several parallel attention heads, each independently calculating the attention weights and extracting features from the input sequence. The outputs of each attention head are then concatenated and linearly transformed to obtain the multi-head attention output. The feedforward neural network layer comprises two fully connected layers: the first layer maps the input to a higher-dimensional space and applies non-linear activation, while the second layer maps the high-dimensional features back to the original dimension. Layer normalization units normalize the output of each layer to stabilize the training process.
[0108] As another implementation of this application, before inputting the fused tensor into the trained Transformer encoder, the method further includes a process of training the Transformer encoder: obtaining a training sample set, which includes multiple training samples, each of which includes a sequence of damaged instructions collected under a simulated electromagnetic interference scenario, the corresponding confidence table, and the constructed fused tensor. Human experts assess the hazard level under the simulated scenario and label each fused tensor with a One-Hot code representing the category of the real safety control instruction.
[0109] The fused tensor from each training sample is input into a pre-defined Transformer encoder. After processing by a multi-head attention unit and a feedforward neural network layer, a predicted target vector is obtained. Based on this predicted target vector, a Softmax classification layer is used to calculate the predicted probability distribution for each safety control instruction category. The cross-entropy loss function value of the Transformer encoder is then calculated based on the distribution of the actual safety control instruction category labels and the predicted probability distribution for each category. ,in The total number of categories in the classification system. The actual label value of the category. This represents the predicted probability for the corresponding category.
[0110] When the cross-entropy loss function fails to converge and the number of iterations is less than the preset maximum number of iterations (e.g., 500), the Adam optimizer is used, with the initial learning rate set to... Batch size is Combined with the backpropagation algorithm, the weight parameter matrices in each computational layer of the Transformer encoder are dynamically adjusted. When the value of the decision loss function no longer shows a decreasing trend for 10 consecutive cycles on an independent validation set, the model is considered to have reached convergence and the parameter iteration ends, outputting the trained Transformer encoder.
[0111] Specifically, firstly, the fusion tensor The input is fed into the trained Transformer encoder, and the fusion tensor is processed in the multi-head attention computation unit. Each row of fusion vector With all other fused vectors Calculate the dot product to obtain the fusion vector. and Attention scores between ,in Represents the fusion vector The dimensional value and .
[0112] Next, the fusion vector Attention score compared to all fused vectors The attention weights are then normalized and calculated using the softmax function. ,in Represents the fusion vector For the fusion vector The attention weights are calculated by iterating through all fused vectors. After completing the above calculations, the attention weight matrix is obtained:
[0113] Then, the attention weight matrix was used. For fusion tensor Perform a weighted summation for each fusion vector. Calculate its weighted output ,in For fusion vector The output vector after attention weighting. Finally, the fully weighted output vector. Perform global average pooling and calculate its arithmetic mean to obtain the dimension. Target vector .
[0114] This embodiment achieves deep fusion of communication status information and instruction semantic features, and fully extracts the global semantics and local communication quality background of damaged instructions.
[0115] S105. Calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control instruction corresponding to the damaged instruction sequence in the preset security control library based on the target vector.
[0116] Optionally, the process of calculating the matching degree between the target vector and each candidate expert network within the MoT architecture in step S105, and determining the candidate expert network with the highest matching degree as the target expert network, may specifically include: S1051. Calculate the dot product between the target vector and the routing weight vector corresponding to each candidate expert network in the MoT architecture to obtain the routing score corresponding to each candidate expert network, and construct a routing score sequence based on all routing scores.
[0117] The routing weight vector refers to the pre-trained weight vector corresponding to each candidate expert network within the MoT architecture. It is used to measure the degree of feature matching between the input vector and the candidate expert network, and its dimension is the same as that of the target vector.
[0118] The routing score is a scalar value obtained by performing a dot product operation between the target vector and the routing weight vector corresponding to a candidate expert network. It reflects the degree of correlation between the target vector and the features of that candidate expert network, and the larger the value, the better the match between the two features. The routing score sequence is an ordered set consisting of the routing scores corresponding to all candidate expert networks within the current control period, arranged in the order of the candidate expert network numbers.
[0119] The trained MoT architecture consists of a gated routing layer and multiple candidate expert networks. The gated routing layer is responsible for calculating the matching degree between the input target vector and each candidate expert network and activating the optimal expert network. It also includes routing weight vectors corresponding to each candidate expert network. Each candidate expert network consists of multiple fully connected layers, and the weight parameters of each candidate expert network are independent of each other. They perform specialized feature extraction and classification for different types of interference scenarios and security control tasks.
[0120] As another implementation of this application, before calculating the dot product of the target vector and the routing weight vector corresponding to each candidate expert network in the MoT architecture, the method also includes a process of training the MoT architecture: obtaining a training sample set, which includes target vectors generated under different types of electromagnetic interference such as pulse interference and continuous wave interference scenarios, as well as manually labeled real safety control instruction category labels.
[0121] The target vector from each training sample is input into a predefined MoT architecture. The gated routing layer calculates the routing score, and the softmax function non-linearly transforms it into a state where... to The matching degree of the candidate expert network within the interval is used to activate the candidate expert network with the highest matching degree to perform feature classification mining on the target vector, and obtain the predicted probability distribution of each category.
[0122] The loss function value of the MOT architecture is calculated using a joint loss function with a load balancing penalty term. ,in The first term is the standard classification cross-entropy loss, and the second term is an information entropy penalty term based on the matching distribution, used to prevent model collapse and balance the uneven training load among each expert network. This is a positive penalty coefficient. For the first The matching probability of each expert network is obtained through normalization. Before the training iteration of the MoT architecture starts, the Xavier normal distribution algorithm is used to pre-assign stateful values to the routing weight matrix in the gated routing layer and the initial weight parameters of the multi-layer fully connected layers in each candidate expert network.
[0123] During model training, the AdamW optimizer is used with the weight decay coefficient preset to 0. When the loss function value fails to reach the target convergence threshold and the number of training iterations is less than the preset maximum termination period, the backpropagation algorithm is periodically used to calculate the gradient based on the joint loss function, dynamically adjusting the weight parameters of the gated routing layer and the fully connected layers in each candidate expert network, until the overall action classification accuracy of the model on the external validation set reaches the preset value. By converging the threshold and completing the training process, a mature MoT architecture is obtained.
[0124] Specifically, firstly, all [resources] are extracted from the trained MOT architecture. The routing weight vector corresponding to each candidate expert network ,in Indicates the first Each candidate expert network corresponds to a routing weight vector, and its dimension is the same as the target vector. The same means all are , .
[0125] Next, calculate the target vector. With each route weight vector The dot product of the first and second halves yields the first... Routing scores for each candidate expert network ,in Represents the target vector The Dimensional value, Represents the route weight vector The The routing scores of all candidate expert networks are then arranged in numerical order to form a routing score sequence. .
[0126] S1052. By normalizing all routing scores in the routing score sequence, the matching degree corresponding to each candidate expert network is obtained, and the candidate expert network with the largest matching degree is determined as the target expert network.
[0127] Matching degree refers to the probability value obtained after normalizing the routing scores of each candidate expert network in the routing score sequence. The value ranges from 0 to 1, and the sum of the matching degrees of all candidate expert networks is 1. The target expert network is the candidate expert network with the highest matching degree value, used for specific feature classification and security control instruction retrieval of the target vector.
[0128] Specifically, firstly, the routing score sequence All route scores in the dataset are normalized using the softmax function to obtain the matching degree for each candidate expert network. ,in Indicates the first The matching degree of each alternative expert network and Next, all matching scores are arranged according to the candidate expert network number to obtain the matching score sequence. Finally, the matching degree sequence The candidate expert network corresponding to the highest matching degree in the median value is determined as the target expert network. .
[0129] Optionally, step S105, which uses a target expert network to determine the target control command corresponding to the damaged command sequence in a preset security control library based on the target vector, may specifically include: S1053. The target vector is obtained by performing layer-by-layer linear transformation and nonlinear activation calculation on the target vector using multiple fully connected layers in the target expert network.
[0130] A classification vector is a fixed-length feature vector output after the target vector is processed layer by layer by multiple fully connected layers in the target expert network. It reflects the category features of the security control intent corresponding to the damaged instruction sequence in the interference scenario and is used to retrieve the most matching target control instruction in the security control library.
[0131] Specifically, firstly, the target vector carrying comprehensive characteristics... Input to the target expert network with the highest matching degree In the first fully connected layer, the mapping weight matrix inherent in this internal network layer is utilized. and its configuration bias terms for vector Apply a matrix linear transformation operation, followed by the introduction of a modified linear unit. As a nonlinear activation function, redundant negative values are truncated, thereby transforming the target vector from its basic form. Effectively cross and map 1-dimensional space to a dimension of 1 Within the high-dimensional nonlinear intermediate feature analytic space.
[0132] Next, the calculation output of the first layer is serialized and input into each subsequent deep fully connected layer in the target expert network. In each information feedforward processing layer, nonlinear activation calculations similar to matrix multiplication and ReLU function are strictly reused. In this way, the discriminative features that are highly correlated with the deep security control category are extracted layer by layer.
[0133] Finally, through the fully connected layer at the final output of the target expert network, the internal latent feature dimensions are reduced and converged to a fixed dimension in the preset standard classification feature space using the attribution feature projection matrix. Within, the classification vector is obtained. ,in The first class vector represents the classification vector. dimensional analytical numerical and .
[0134] S1054. Extract the standard vector corresponding to each security control instruction from the preset security control library, and calculate the cosine similarity between the classification vector and the standard vector corresponding to each security control instruction.
[0135] A standard vector is a predefined fixed-length feature vector corresponding to each security control instruction in a pre-defined security control library. It has the same dimension as the classification vector and is used to calculate similarity with the classification vector to retrieve the best-matching security control instruction. The pre-defined security control library is shown in Table 6 below: Table 6: Preset Security Control Library Comparison Table
[0136] As shown in Table 6, Table 6 provides the preset security control library configuration. The security control library predefines various safety actions that home security robot dogs can execute when subjected to strong interference, as well as their corresponding standard vectors. The standard vectors of each security control instruction are obtained by clustering the feature vectors of corresponding actions in a large number of normal scenarios and taking the average value, which is used as the matching benchmark for classification vectors during retrieval.
[0137] Specifically, firstly, the standard vectors corresponding to all security control commands are extracted from the preset security control library shown in Table 6, denoted as... ,in The total number of security control commands in the security control library. Indicates the first The standard vector corresponding to each safety control instruction has a dimension of 1. and Next, the classification vector is calculated. With each standard vector Cosine similarity between ,in The dot product of two vectors. and These are the magnitudes of the two vectors, respectively.
[0138] S1055. The security control instruction corresponding to the cosine similarity with the largest value is determined as the target control instruction corresponding to the damaged instruction sequence.
[0139] The target control command refers to the safety control command with the highest cosine similarity to the classification vector in the preset safety control library. It reflects the most appropriate safety avoidance action to be performed in the current damaged command sequence under strong interference scenario and will be sent to the robot dog's robotic arm actuator for actual control.
[0140] Specifically, firstly, the cosine similarity set... Compare all the values in the dataset and find the cosine similarity score with the highest value. Next, according to Table 6, The corresponding safety control command is determined to be the target control command. Ultimately, the target control command will be executed. The robotic arm actuator, which is sent to the home security robot dog, drives the robot dog to perform the retraction action of the robotic arm, and completes the safe avoidance response to damaged commands in the case of strong interference.
[0141] This embodiment realizes adaptive expert routing and intelligent retrieval of security control commands based on the characteristics of damaged commands, effectively replacing the traditional fixed rule triggering mode, and ensuring the safety and intelligence of home security robot dogs in strong interference scenarios.
[0142] Figure 4 A schematic diagram illustrating a specific implementation of a home security robot dog control system based on MoT and Transformer, provided in this application, is shown below. Figure 4 The system may include: The acquisition module 410 is used to synchronously acquire the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frame extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator. The comparison module 420 is used to perform bit-by-bit comparison between the instruction feedback sequence and the original instruction sequence, extract the instruction segments that do not match the comparison to form a damaged instruction sequence, and calculate the bit error rate under different control frequency bands to obtain the bit error sequence. The calculation module 430 is used to calculate the information entropy of the arrival time series within a preset time window to obtain the entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band. The generation module 440 is used to align and concatenate the prior label with the action word in the damaged instruction sequence using the confidence in the confidence table as the prior label to obtain a fusion tensor. The fusion tensor is then input into the Transformer encoder to calculate the attention weight between the confidence and the action word to obtain the target vector. The generation module 440 is also used to calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control instruction corresponding to the damaged instruction sequence in the preset security control library based on the target vector.
[0143] The home security robot dog control system based on MoT and Transformer in this application is used to implement the aforementioned home security robot dog control method based on MoT and Transformer. Therefore, the specific implementation of the home security robot dog control system based on MoT and Transformer can be found in the embodiment section of the home security robot dog control method based on MoT and Transformer mentioned above. The specific implementation can be referred to the description of the corresponding embodiments, which will not be repeated here.
[0144] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application is shown.
[0145] The electronic device may include a processor 510 and a memory 520 storing computer program instructions.
[0146] Specifically, the processor 510 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0147] Memory 520 may include mass storage for data or instructions. For example, and not limitingly, memory 520 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 520 may include removable or non-removable (or fixed) media. Where appropriate, memory 520 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 520 is non-volatile solid-state memory.
[0148] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of this disclosure.
[0149] The processor 510 reads and executes computer program instructions stored in the memory 520 to implement any of the home security robot dog control methods based on MoT and Transformer in the above embodiments.
[0150] In one example, the electronic device may also include a communication interface 530 and a bus 540. Wherein, such as Figure 5 As shown, the processor 510, memory 520, and communication interface 530 are connected through bus 540 and complete communication with each other.
[0151] The communication interface 530 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0152] Bus 540 includes hardware, software, or both, that couples components of an online data traffic metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 540 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0153] The electronic device can execute the home security robot dog control method based on MoT and Transformer in the embodiments of this application, thereby realizing the home security robot dog control method based on MoT and Transformer described in conjunction with the accompanying drawings.
[0154] Furthermore, in conjunction with the home security robot dog control method based on MoT and Transformer in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the home security robot dog control methods based on MoT and Transformer in the above embodiments.
[0155] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0156] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0157] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0158] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0159] The foregoing has provided a detailed description of a home security robot dog control method and system based on MoT and Transformer provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A control method for a home security robot dog based on MoT and Transformer, characterized in that, include: The system simultaneously acquires the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frames extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator. By comparing the instruction feedback sequence with the original instruction sequence bit by bit, the instruction segments that do not match are extracted to form the damaged instruction sequence, and the bit error rate under different control frequency bands is calculated to obtain the bit error sequence. The information entropy of the arrival time series within a preset time window is calculated to obtain an entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band. Using the confidence level in the confidence level table as a priori identifier, the priori identifier is aligned and concatenated with the action words in the damaged instruction sequence to obtain a fusion tensor. The fusion tensor is then input into the Transformer encoder to calculate the attention weights between the confidence level and the action words to obtain the target vector. Calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control instruction corresponding to the damaged instruction sequence in a preset security control library based on the target vector.
2. The method according to claim 1, characterized in that, The method further includes: Obtain historical confidence records within the historical control period; Calculate the historical mean and historical variance of the confidence level for each control frequency band in the historical confidence level record; The fluctuation coefficient of each control frequency band is obtained based on the ratio of the historical variance to the historical mean. The process involves calculating the information entropy of the arrival time series within a preset time window to obtain an entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band, including: The information entropy of the arrival time series within a preset time window is calculated to obtain an entropy sequence. Based on the entropy sequence and the bit error sequence, the confidence level corresponding to each control frequency band is calculated using the fluctuation coefficient to obtain a confidence table.
3. The method according to claim 2, characterized in that, The process involves calculating the information entropy of the arrival time series within a preset time window to obtain an entropy sequence. Based on the entropy sequence and the bit error sequence, a confidence table is obtained by calculating the confidence level corresponding to each control frequency band using the fluctuation coefficient. This table includes: The arrival time series is grouped according to the control frequency band, and the time difference between two adjacent arrival time values in the arrival time series corresponding to each control frequency band is calculated to obtain the time interval series corresponding to each control frequency band. Based on each time interval sequence, the time is slid sequentially according to a preset time window length. The proportion of each time difference within each sliding window is obtained by calculating the ratio of the number of times each time difference occurs within the sliding window length to the total number of all time differences within the sliding window length. After calculating the product of the occurrence percentage and the logarithm of the occurrence percentage for each time difference, the products corresponding to each time difference are accumulated and the negative value is taken to obtain the information entropy of each sliding window. The average value of all the information entropies in the time interval sequence is calculated to obtain the information entropy of each control frequency band. An entropy sequence is constructed based on all the information entropies. Calculate the product of the fluctuation coefficient of each control frequency band with the preset time entropy weight and the preset bit error rate weight to obtain the first weight and the second weight of each control frequency band; A first weighted value is obtained by multiplying the information entropy of each control frequency band in the entropy sequence with the corresponding first weight, and a second weighted value is obtained by multiplying the bit error rate of each control frequency band in the bit error sequence with the corresponding second weight. The confidence level of each control frequency band is obtained by summing the first weighted value and the second weighted value, and a confidence table is obtained based on all the confidence levels.
4. The method according to claim 1, characterized in that, The step of comparing the instruction feedback sequence with the original instruction sequence bit by bit, extracting instruction segments that do not match to form a damaged instruction sequence, and calculating the bit error rate under different control frequency bands to obtain the bit error sequence includes: By comparing the bits at the same position in the instruction feedback sequence aligned according to the timestamp with the original instruction sequence bit by bit, the position of the bit that does not match is determined as the target position, and the target position sequence is obtained. Extract instruction fragments, including each target position in the target position sequence, from the original instruction sequence, and arrange all the instruction fragments in chronological order to obtain the damaged instruction sequence; Map each target position in the target position sequence to the corresponding control frequency band in the original instruction sequence, and count the number of target positions in each control frequency band to obtain the number of error bits in each control frequency band; The bit error rate of each control band is obtained by calculating the ratio of the number of erroneous bits in each control band to the total number of bits in the corresponding control band, and the bit error sequence is obtained based on all the bit error rates.
5. The method according to claim 1, characterized in that, The process involves using the confidence level in the confidence table as a priori identifier, aligning and concatenating the priori identifier with action words in the damaged instruction sequence to obtain a fusion tensor. This fusion tensor is then input into a Transformer encoder to calculate the attention weights between the confidence level and the action words, resulting in a target vector, including: The damaged instruction sequence is segmented into multiple action words according to a preset word segmentation rule. The control frequency band corresponding to each action word is extracted from the damaged instruction sequence. The corresponding confidence level is found in the confidence table based on the control frequency band as the prior identifier of each action word. Based on each action word, according to the preset mapping relationship between action words and word codes, the word vector corresponding to each action word is obtained. By copying and expanding the prior identifier of each action word, a prior vector with the same length as the word vector is obtained. A fusion vector is constructed based on the word vector and the prior vector. All the fusion vectors are arranged in chronological order to obtain the fusion tensor. The fusion tensor is input into the trained Transformer encoder. The multi-head attention computation unit in the Transformer encoder is used to calculate the dot product between any two fusion vectors in the fusion tensor. All the dot products are normalized row by row to obtain the attention weight matrix. The attention weight matrix is used to perform a weighted summation of all fusion vectors in the fusion tensor to obtain the target vector.
6. The method according to claim 1, characterized in that, The step of calculating the matching degree between the target vector and each candidate expert network within the MoT architecture, and determining the candidate expert network with the highest matching degree as the target expert network, includes: Calculate the dot product between the target vector and the routing weight vector corresponding to each candidate expert network in the MoT architecture to obtain the routing score corresponding to each candidate expert network, and construct a routing score sequence based on all the routing scores; By normalizing all the routing scores in the routing score sequence, the matching degree corresponding to each candidate expert network is obtained, and the candidate expert network with the largest matching degree is determined as the target expert network.
7. The method according to claim 1, characterized in that, The step of using the target expert network to determine the target control command corresponding to the damaged command sequence in a preset security control library based on the target vector includes: The target vector is obtained by performing layer-by-layer linear transformation and nonlinear activation calculation on the target vector using multiple fully connected layers in the target expert network; Extract the standard vector corresponding to each security control instruction from the preset security control library, and calculate the cosine similarity between the classification vector and the standard vector corresponding to each security control instruction. The security control instruction corresponding to the cosine similarity with the largest value is determined as the target control instruction corresponding to the damaged instruction sequence.
8. A home security robot dog control system based on MoT and Transformer, characterized in that, include: The acquisition module is used to synchronously acquire the original instruction sequence issued by the home security robot dog, the arrival time sequence of the control protocol frame extracted from the robot dog's communication link, and the instruction feedback sequence transmitted back by the robotic arm actuator. The comparison module is used to perform bit-by-bit comparison between the instruction feedback sequence and the original instruction sequence, extract the instruction segments that do not match to form a damaged instruction sequence, and calculate the bit error rate under different control frequency bands to obtain the bit error sequence. The calculation module is used to calculate the information entropy of the arrival time series within a preset time window to obtain an entropy sequence, and based on the entropy sequence and the bit error sequence, to obtain a confidence table by calculating the confidence level corresponding to each control frequency band. The generation module is used to align and concatenate the prior identifier with the action words in the damaged instruction sequence using the confidence level in the confidence level table as the prior identifier, to obtain a fusion tensor, and input the fusion tensor into the Transformer encoder to calculate the attention weight between the confidence level and the action words to obtain the target vector. The generation module is also used to calculate the matching degree between the target vector and each candidate expert network in the MoT architecture, determine the candidate expert network with the highest matching degree as the target expert network, and use the target expert network to determine the target control instruction corresponding to the damaged instruction sequence in a preset security control library based on the target vector.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the home security robot dog control method based on MoT and Transformer as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the implementation of the home security robot dog control method based on MoT and Transformer as described in any one of claims 1 to 7.