A gesture sensor control method and system based on the Internet of Things
The model is built through deep reinforcement learning algorithms, which solves the problem of insufficient performance of IoT attitude sensors in complex environments, achieves more precise and efficient control, is highly adaptable, optimizes sensor performance and reduces the need for manual intervention.
Patent Information
- Application Number
- CN202410669191.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-05-28
AI Technical Summary
Attitude sensors based on the Internet of Things are difficult to give full play to their performance in complex and changeable environments. Traditional control methods rely on predefined rules or algorithms and lack intelligent control, which results in the need for frequent manual intervention and increases the cost and complexity of management and maintenance. .
A deep reinforcement learning algorithm is used to build a model, converting the attitude control problem into a reinforcement learning problem. By learning from the data collected by the sensor, the decision-making can be dynamically adjusted to optimize the performance of the attitude sensor. Specific steps include data preprocessing, quaternion representation, Mahony filter algorithm, construction and training of deep reinforcement learning models, defining state and action spaces and reward functions, and using DQN algorithm and CNN to learn value functions.
It achieves more precise and efficient control of attitude sensors, is highly adaptable, can learn and adjust in a changing environment, cope with complex situations and uncertain factors, optimizes sensor performance, and reduces the need for manual intervention.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of adjustment systems, and in particular to a gesture sensor control method and system based on the Internet of Things. Background Art
[0002] The attitude sensor based on the Internet of Things combines the traditional attitude sensor with the Internet of Things technology. The attitude sensor is connected to the Internet through a wireless network and transmits the collected attitude data to a remote server or other device for processing and analysis. The sensor has the characteristics of remote control, allowing users to monitor and manage the sensor data from any location. The attitude sensor based on the Internet of Things can transmit the attitude data of the aircraft or other equipment to the ground control center in real time, so that the flight and operators can monitor the status of the aircraft or other equipment and make corresponding adjustments;
[0003] The control method of the attitude sensor based on the Internet of Things is a method of processing attitude data based on pre-set rules or algorithms. The traditional fixed control strategy may not be able to fully adapt to complex and changing environments, resulting in the performance of the attitude sensor being limited and difficult to achieve optimal performance. Traditional control methods usually rely on pre-defined rules or algorithms and cannot handle some complex situations or changes. The lack of intelligent control methods may require frequent manual intervention to adjust and optimize the operation of the sensor, increasing the cost and complexity of management and maintenance;
[0004] Therefore, it is urgent to propose a gesture sensor control method based on the Internet of Things. Summary of the invention
[0005] The purpose of the present invention is to address the shortcomings of the prior art and provide a posture sensor control method based on the Internet of Things. The method aims to use a deep reinforcement learning algorithm to build a model, convert the posture control problem into a reinforcement learning problem, and implement control instructions based on the constructed model. The deep reinforcement learning algorithm can learn from the data collected by the sensor and dynamically adjust the decision according to environmental changes to make the sensor control more precise and efficient. The model can learn the best control behavior under different circumstances, thereby optimizing the performance of the posture sensor. The deep reinforcement learning algorithm has strong adaptability, can learn and adjust in a constantly changing environment, and can cope with various complex situations and uncertain factors.
[0006] To this end, the present application provides a gesture sensor control method based on the Internet of Things, comprising the following steps:
[0007] Step S100, collecting posture data in the environment based on the posture sensor in the Internet of Things, and preprocessing the data collected in real time, the preprocessing including calibration and noise reduction;
[0008] Step S200, using quaternions to represent attitude information, and calculating attitude information based on preprocessed data, using Mahony filter as an attitude solution algorithm, converting raw data output by the sensor into attitude information;
[0009] Step S201, calculating the incremental change of the posture based on the sensor data, filtering the posture increment using the Mahony filter algorithm to obtain an estimated value of the posture, and updating the current posture quaternion based on the estimated value of the posture;
[0010] Step S202, set the angular velocity data ω = [p, qr], where p, q, r represent the angular velocity around the X-axis, Y-axis and Z-axis respectively, in radians per second; set the acceleration data a = [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis respectively, in m / s 2 ;
[0011] Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter;
[0012] Step S202.1, calculate the incremental change Δθ of the posture:
[0013] The angular velocity data is used to calculate the incremental change of the attitude. If the time interval is Δt, the incremental change of the attitude is:
[0014] Δθ=ω·Δt
[0015] Step S202.2: The update rule of the Mahony filter is as follows:
[0016]
[0017] Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ;
[0018] Step S300: based on the calculated result, convert the obtained information, build a model using a deep reinforcement learning algorithm, and execute the control instruction based on the built model;
[0019] Step S301, converting the posture control problem into a reinforcement learning problem, defining the spatial state, action space and reward function, taking the posture information and environmental features as the state, the control instructions as the action, and giving rewards or penalties according to the control effect;
[0020] Step S302: Based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for estimating the value function;
[0021] Step S303: Collect training data, and use the DQN algorithm to train the network based on the collected data. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm.
[0022] Step S304: Evaluate and verify the deep reinforcement learning model after training, collect new test data to evaluate the generalization ability and performance of the model, perform quantitative evaluation on the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment;
[0023] Step S400: Based on the verification and evaluation results, the model is tuned and improved. After the verification and evaluation are passed, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjusting and optimizing the model.
[0024] In some specific embodiments, preprocessing and analysis are performed based on the collected data, and the preprocessing includes filtering, calibration and noise reduction, specifically including:
[0025] Step S100.1, static data calibration: when the attitude sensor is installed, static calibration is performed, the output value of the sensor in a static state is recorded as zero bias, and the sensor output is scaled and calibrated to calibrate its scale error;
[0026] Zero bias calibration is as follows:
[0027] Output after offset calibration = original output - static offset value
[0028] The scaling calibration is as follows:
[0029]
[0030] Step S100.2, dynamic data calibration, using the quaternion update method to adjust the calibration parameters of the sensor, initializing the attitude estimation by reading the gyroscope data, setting the initial attitude as the reference coordinate system, updating the current attitude estimation based on the sensor data, and updating the current quaternion state based on the quaternion update formula according to the sensor data and the current attitude estimation;
[0031] The quaternion is updated using the attitude update equation, based on the angular velocity update:
[0032]
[0033] In the formula, represents the rate of change of the quaternion, q is the current attitude quaternion, ω is the angular velocity vector, Represents quaternion multiplication;
[0034] Based on the updated quaternion state, the current attitude information is calculated, and the parameters in the sensor fusion process are calibrated based on the obtained information;
[0035] Step S100.3, data denoising, performing wavelet transform based on the posture data output by the sensor, decomposing the data into sub-bands of different frequencies, suppressing the noise components in the high-frequency sub-bands through threshold processing or soft threshold processing, retaining the effective information in the low-frequency sub-bands, and reconstructing the processed data into the denoised posture data through inverse wavelet transform, specifically:
[0036] x denoised (t)=InverseWavelet(Threshold(Wavelet(x(t)),T))
[0037] Where: x(t) is the original signal, Wavelet(x(t)) means performing wavelet transform on the signal x(t) to decompose it into sub-bands of different frequencies, T is the threshold, InverseWavelet(y) means performing inverse wavelet transform on the signal after threshold processing, and the reconstructed signal is x denoised (t).
[0038] In some specific implementations, the posture control problem is converted into a reinforcement learning problem, the spatial state, action space and reward function are defined, the posture information and environmental features are used as the state, the control instructions are used as the action, and rewards or penalties are given according to the control effect, specifically including:
[0039] Step S301.1, the state space is composed of posture information and environmental features. Assume that the posture information is vector s and the environmental features are vector f, then the state space is:
[0040] S = [s, f]
[0041] Step S301.2: The action space defines all actions that the model can perform. In the posture control problem, the action space is specifically a set of control instructions. Based on the requirements of the problem and the complexity of the scene, the action space can be changed to continuous or discrete;
[0042] Assume that the action space is discrete, and the action set is Action a represents an index i, i.e. a=i;
[0043] Step S301.3, define a reward function, which is used to evaluate the performance of the model after executing an action. In the posture control problem, the reward function needs to take into account the control effect, energy consumption, and task completion as factors. The reward function is defined as the negative value of the difference between the actual posture and the expected posture, as well as an additional reward when the target position is reached;
[0044] Let the target position be goal and the expected posture be q desired , the actual posture is q actual , energy consumption is energy, then the reward function can be expressed as:
[0045] R=-α||q desired -q actual ||-γenergy+bonus
[0046] In the formula, α and γ are parameters that weigh the control effect and energy consumption, and bonus is the additional reward when the target position is reached;
[0047] Substitute the three values into the calculation formula of the reward function for corresponding calculations. For the control effect part, let q desired -q actual =0.1, α=1, then the reward for the control effect is calculated as: -αq desired -q actual =-0.1;
[0048] Energy consumption, assuming that energy consumption is energy = 10, γ = 0.5, then the reward for the energy consumption part is: -γenergy = -5;
[0049] Task completion status: if the target position is reached, the additional reward bonus = 20, otherwise bonus = 0;
[0050] Substituting the above values into the calculation formula of the reward function for corresponding calculation, we get:
[0051] R=-(-0.1)-5+20=15.1
[0052] In the formula, the result reflects the performance of the model after executing the action, which refers to the specific values of the three elements of control effect, energy consumption and task completion.
[0053] In some specific implementations, based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for estimating the value function, specifically including:
[0054] Step S302.1, based on CNN learning state value function, CNN can effectively process image data and extract features for estimating value function;
[0055] Assume that the output of CNN is the action value function Q(S, a; θ), where θ is the parameter of CNN. The input of CNN is state S. After the input state S is convolved, features at different levels are extracted. CNN contains multiple convolutional layers, each of which includes multiple filters, and each filter is responsible for extracting different features.
[0056] After the convolutional layer, a nonlinear activation function is applied to introduce nonlinear properties and enhance the network's expressiveness;
[0057] Pooling operation, after the convolution layer, a pooling operation is performed to reduce the size of the feature map and enhance translation invariance;
[0058] Flattening: After convolution and pooling operations, the feature map is flattened into a vector as the input of the fully connected layer;
[0059] The fully connected layer operation inputs the flattened feature vector into the fully connected layer, which maps the feature vector to the output space of the action-value function. Each output node corresponds to the value function estimate of an action.
[0060] The output layer does not use an activation function, but directly outputs the value function estimate of each action.
[0061] CNN learns the mapping from state S to action value function. During the training process, the network parameter θ is adjusted by the difference with the true action value function. In reinforcement learning, the DQN algorithm is used to optimize the network parameters by minimizing the difference between the predicted value and the actual value. CNN extracts the characteristics of the state through convolution, pooling and fully connected layer operations, and outputs the value function estimate of each action, thereby realizing the learning of the state value function, extracting features through convolution and pooling operations, and finally outputting the value function estimate of each action through the fully connected layer.
[0062] In some specific implementations, training data is collected, and based on the collected data, the DQN algorithm is used to train the network. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm, specifically including:
[0063] Step 303.1: Before training the DQN network, collect training data. In the process of interacting with the environment, the model selects action a according to the current strategy. t , and observe the feedback from the environment to get reward r t and the next state s t+1 , the recorded empirical data is (s t a t , rt ,s t+1 ), and store it in the experience replay buffer;
[0064] Step S303.2, experience replay mechanism, the experience replay mechanism randomly samples a batch of data from the experience buffer for training, assuming the size of the experience buffer is N, then randomly sample a small batch of samples of size B from it for training each time;
[0065] Step S303.3, target network, the parameters of the target network are expressed as θ - , the parameters θ of the main network are continuously updated during the training process. If the update frequency of the target network is low, it can be updated every certain number of training steps. The target Q value is calculated through the target network. Let the target Q value be expressed as Q = (s t+1 , a; θ - );
[0066] Step S303.4: During the training process, a batch of data D is randomly sampled from the experience buffer using the experience playback mechanism, where Calculate the target Q value y for each sample j , used to update network parameters;
[0067] The loss function is used to measure the difference between the predicted Q value and the target Q value, and the network parameters θ are updated by gradient descent:
[0068]
[0069] In the formula, Q(s j , a j ; θ) is the predicted Q value output by the network, y j is the target Q value;
[0070] Step S303.5: Training stop condition. The training process needs to set a stop condition, which is set to the maximum number of training rounds T. max , when the stopping condition is met, the training process ends, and the network parameters obtained by training are used in the subsequent posture control task. Through the above steps, the network is trained based on the collected training data and the DQN algorithm is used to achieve autonomous learning and decision-making of the model in the posture control task.
[0071] In some specific implementations, evaluation and verification are performed based on the deep reinforcement learning model after training, new test data is collected to evaluate the generalization ability and performance of the model, the model is quantitatively evaluated, the average reward and success rate indicators are calculated, and a qualitative evaluation is performed to observe the performance of the model in the actual environment, specifically including:
[0072] Step S304.1, evaluation and verification phase, collect new test data sets, which need to cover a variety of different situations and environments to verify the generalization ability and performance of the model. The test data collection method is similar to the training data. The DQN network interacts with the environment and records the state, action, reward and next state of each time step;
[0073] Step S304.2: Perform a quantitative evaluation on the deep reinforcement learning model after training, including calculating the average reward and success rate indicators;
[0074] Calculate the average reward, assuming the average reward is It is obtained by calculating the average reward of each time step on the test dataset, specifically:
[0075]
[0076] Where T is the total number of time steps in the test dataset, r t is the reward value at each time step;
[0077] Calculate the success rate, set the success rate as SR, and calculate it by the ratio of the number of successful completions of the task to the total number of times:
[0078]
[0079] Step S304.3, qualitative evaluation, observe the performance of the model in the actual environment, through actual observation and analysis. Qualitative evaluation can discover the behavior and performance of the model in specific situations, as well as possible problems and corresponding improvement space.
[0080] The present application further provides a posture sensor control system based on the Internet of Things, comprising:
[0081] The preprocessing module is used to collect the posture data in the environment based on the posture sensor in the Internet of Things, and preprocess the data collected in real time, including calibration and noise reduction;
[0082] The calculation module is used to represent the attitude information using quaternions, calculate the attitude information based on the preprocessed data, and use the Mahony filter as the attitude calculation algorithm to convert the raw data output by the sensor into attitude information;
[0083] Wherein, the solution module includes an update module and a calculation module;
[0084] The update module is used to calculate the incremental change of the attitude based on the sensor data, filter the attitude increment using the Mahony filter algorithm to obtain the estimated value of the attitude, and update the current attitude quaternion based on the estimated value of the attitude;
[0085] The calculation module is used in S202. The angular velocity data ω is set to [p′q′r], where p, q, and r represent the angular velocity around the X-axis, Y-axis, and Z-axis, respectively, in radians per second; the acceleration data a is set to [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis respectively, in m / s 2 ;
[0086] Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter;
[0087] Calculate the incremental change Δθ of the attitude:
[0088] The angular velocity data is used to calculate the incremental change of the attitude. If the time interval is Δt, the incremental change of the attitude is:
[0089] Δθ=ω·Δt
[0090] The update rule of the Mahony filter is as follows:
[0091]
[0092] Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ;
[0093] A deep reinforcement learning module is used to convert the information obtained based on the calculated results, build a model using a deep reinforcement learning algorithm, and execute control instructions based on the built model;
[0094] The deep reinforcement learning module includes a definition module, a construction module, a training module and an evaluation module;
[0095] Definition module, used to convert the posture control problem into a reinforcement learning problem, define the spatial state, action space and reward function, take posture information and environmental features as state, control instructions as actions, and give rewards or penalties based on the control effect;
[0096] A building module is used to learn the value function using CNN based on the DQN algorithm, and extract features through CNN for estimating the value function;
[0097] The training module is used to collect training data. Based on the collected data, the DQN algorithm is used to train the network. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm.
[0098] The evaluation module is used to evaluate and verify the deep reinforcement learning model after training. It collects new test data to evaluate the generalization ability and performance of the model. The model is quantitatively evaluated to calculate the average reward and success rate indicators, and qualitatively evaluated to observe the performance of the model in the actual environment.
[0099] The feedback module is used to tune and improve the model based on the verification and evaluation results. After verification and evaluation, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjustment and optimization of the model.
[0100] The present application provides a posture sensor control method based on the Internet of Things. The posture sensor in the Internet of Things collects posture data in the environment, and pre-processes the data collected in real time. The pre-processing includes calibration and noise reduction. Quaternions are used to represent posture information, and posture information is calculated based on the pre-processed data. Mahony filter is used as a posture solution algorithm to convert the original data output by the sensor into posture information. Based on the calculated result, the obtained information is converted. A deep reinforcement learning algorithm is used to build a model. Control instructions are implemented based on the constructed model. The posture control problem is converted into a reinforcement learning problem. The spatial state, action space and reward function are defined. The posture information and environmental characteristics are used as the state, the control instruction is used as the action, and rewards or penalties are given according to the control effect. Based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for value function estimation. Training data is collected. Based on the collected data, the DQN algorithm is used to train the network. During the training process, the collected data is collected. Use the experience replay mechanism and target network to improve the stability and convergence speed of the algorithm. Evaluate and verify the deep reinforcement learning model after training. Collect new test data to evaluate the generalization ability and performance of the model. Quantitatively evaluate the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment. Based on the verification and evaluation results, tune and improve the model. After verification and evaluation, deploy the trained deep reinforcement learning model to the actual environment. After deployment, continuously monitor the performance and effect of the model, and regularly collect feedback data to adjust and optimize the model. The deep reinforcement learning algorithm can learn from the data collected by the sensor and dynamically adjust the decision according to environmental changes to make the sensor control more precise and efficient. The model can learn the best control behavior in different situations, thereby optimizing the performance of the posture sensor. The deep reinforcement learning algorithm has strong adaptability and can learn and adjust in a constantly changing environment to cope with various complex situations and uncertain factors. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0102] Figure 1 An overall flow chart of a gesture sensor control method based on the Internet of Things provided in an embodiment of the present application;
[0103] Figure 2A specific flow chart of step 300 in a gesture sensor control method based on the Internet of Things provided in an embodiment of the present application. DETAILED DESCRIPTION
[0104] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0105] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0106] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0107] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0108] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0109] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0110] Please refer to Figure 1 and Figure 2 , which shows the process of an embodiment of a gesture sensor control method based on the Internet of Things according to the present disclosure.
[0111] like Figure 1 and Figure 2 As shown, a gesture sensor control method based on the Internet of Things includes the following steps:
[0112] Step S100, collecting posture data in the environment based on the posture sensor in the Internet of Things, and preprocessing the data collected in real time, the preprocessing including calibration and noise reduction;
[0113] Step S200, using quaternions to represent attitude information, and calculating attitude information based on preprocessed data, using Mahony filter as an attitude solution algorithm, converting raw data output by the sensor into attitude information;
[0114] Step S201, calculating the incremental change of the posture based on the sensor data, filtering the posture increment using the Mahony filter algorithm to obtain an estimated value of the posture, and updating the current posture quaternion based on the estimated value of the posture;
[0115] Step S202, set the angular velocity data ω = [p, qr], where p, q, r represent the angular velocity around the X-axis, Y-axis and Z-axis respectively, in radians per second; set the acceleration data a = [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis respectively, in m / s 2 ;
[0116] Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter;
[0117] Step S202.1, calculate the incremental change Δθ of the posture:
[0118] The angular velocity data is used to calculate the incremental change of the attitude. If the time interval is Δt, the incremental change of the attitude is:
[0119] Δθ=ω·Δt
[0120] Step S202.2: The update rule of the Mahony filter is as follows:
[0121]
[0122] Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ;
[0123] Step S300: based on the calculated result, convert the obtained information, build a model using a deep reinforcement learning algorithm, and execute the control instruction based on the built model;
[0124] Step S301, converting the posture control problem into a reinforcement learning problem, defining the spatial state, action space and reward function, taking the posture information and environmental features as the state, the control instructions as the action, and giving rewards or penalties according to the control effect;
[0125] Step S302: Based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for estimating the value function;
[0126] Step S303: Collect training data, and use the DQN algorithm to train the network based on the collected data. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm.
[0127] Step S304: Evaluate and verify the deep reinforcement learning model after training, collect new test data to evaluate the generalization ability and performance of the model, perform quantitative evaluation on the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment;
[0128] Step S400: Based on the verification and evaluation results, the model is tuned and improved. After the verification and evaluation are passed, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjusting and optimizing the model.
[0129] Here, specifically include:
[0130] Step S100.1, static data calibration: when the attitude sensor is installed, static calibration is performed, the output value of the sensor in a static state is recorded as zero bias, and the sensor output is scaled and calibrated to calibrate its scale error;
[0131] Zero bias calibration is as follows:
[0132] Output after offset calibration = original output - static offset value
[0133] The scaling calibration is as follows:
[0134]
[0135] Step S100.2, dynamic data calibration, using the quaternion update method to adjust the calibration parameters of the sensor, initializing the attitude estimation by reading the gyroscope data, setting the initial attitude as the reference coordinate system, updating the current attitude estimation based on the sensor data, and updating the current quaternion state based on the quaternion update formula according to the sensor data and the current attitude estimation;
[0136] The quaternion is updated using the attitude update equation, based on the angular velocity update:
[0137]
[0138] In the formula, represents the rate of change of the quaternion, q is the current attitude quaternion, ω is the angular velocity vector, Represents quaternion multiplication;
[0139] Based on the updated quaternion state, the current attitude information is calculated, and the parameters in the sensor fusion process are calibrated based on the obtained information;
[0140] Step S100.3, data denoising, performing wavelet transform based on the posture data output by the sensor, decomposing the data into sub-bands of different frequencies, suppressing the noise components in the high-frequency sub-bands through threshold processing or soft threshold processing, retaining the effective information in the low-frequency sub-bands, and reconstructing the processed data into the denoised posture data through inverse wavelet transform, specifically:
[0141] x denoised (t)=InverseWavelet(Threshold(Wavelet(x(t)),T))
[0142] Where: x(t) is the original signal, Wavelet(x(t)) means performing wavelet transform on the signal x(t) to decompose it into sub-bands of different frequencies, T is the threshold, InverseWavelet(y) means performing inverse wavelet transform on the signal after threshold processing, and the reconstructed signal is x denoised (t).
[0143] Here, specifically include:
[0144] Step S301.1, the state space is composed of posture information and environmental features. Assume that the posture information is vector s and the environmental features are vector f, then the state space is:
[0145] S = [s, f]
[0146] Step S301.2: The action space defines all actions that the model can perform. In the posture control problem, the action space is specifically a set of control instructions. Based on the requirements of the problem and the complexity of the scene, the action space can be changed to continuous or discrete;
[0147] Assume that the action space is discrete, and the action set is Action a represents an index i, i.e. a=i;
[0148] Step S301.3, define a reward function, which is used to evaluate the performance of the model after executing an action. In the posture control problem, the reward function needs to take into account the control effect, energy consumption, and task completion as factors. The reward function is defined as the negative value of the difference between the actual posture and the expected posture, as well as an additional reward when the target position is reached;
[0149] Let the target position be goal and the expected posture be q desired , the actual posture is q actual , energy consumption is energy, then the reward function can be expressed as:
[0150] R=-α||q desired -q actual ||-γenergy+bonus
[0151] In the formula, α and γ are parameters that weigh the control effect and energy consumption, and bonus is the additional reward when the target position is reached;
[0152] Substitute the three values into the calculation formula of the reward function for corresponding calculations. For the control effect part, let q desired -q actual =0.1, α=1, then the reward for the control effect is calculated as: -αq desired -q actual =-0.1;
[0153] Energy consumption, assuming that energy consumption is energy = 10, γ = 0.5, then the reward for the energy consumption part is: -γenergy = -5;
[0154] Task completion status: if the target position is reached, the additional reward bonus = 20, otherwise bonus = 0;
[0155] Substituting the above values into the calculation formula of the reward function for corresponding calculation, we get:
[0156] R=-(-0.1)-5+20=15.1
[0157] In the formula, the result reflects the performance of the model after executing the action, which refers to the specific values of the three elements of control effect, energy consumption and task completion.
[0158] Here, specifically include:
[0159] Step S302.1, based on CNN learning state value function, CNN can effectively process image data and extract features for estimating value function;
[0160] Assume that the output of CNN is the action value function Q(S, a; θ), where θ is the parameter of CNN. The input of CNN is state S. After the input state S is convolved, features at different levels are extracted. CNN contains multiple convolutional layers, each of which includes multiple filters, and each filter is responsible for extracting different features.
[0161] After the convolutional layer, a nonlinear activation function is applied to introduce nonlinear properties and enhance the network's expressiveness;
[0162] Pooling operation, after the convolution layer, a pooling operation is performed to reduce the size of the feature map and enhance translation invariance;
[0163] Flattening: After convolution and pooling operations, the feature map is flattened into a vector as the input of the fully connected layer;
[0164] The fully connected layer operation inputs the flattened feature vector into the fully connected layer, which maps the feature vector to the output space of the action-value function. Each output node corresponds to the value function estimate of an action.
[0165] The output layer does not use an activation function, but directly outputs the value function estimate of each action.
[0166] CNN learns the mapping from state S to action value function. During the training process, the network parameter θ is adjusted by the difference with the true action value function. In reinforcement learning, the DQN algorithm is used to optimize the network parameters by minimizing the difference between the predicted value and the actual value. CNN extracts the characteristics of the state through convolution, pooling and fully connected layer operations, and outputs the value function estimate of each action, thereby realizing the learning of the state value function, extracting features through convolution and pooling operations, and finally outputting the value function estimate of each action through the fully connected layer.
[0167] Here, specifically include:
[0168] Step 303.1: Before training the DQN network, collect training data. In the process of interacting with the environment, the model selects action a according to the current strategy. t , and observe the feedback from the environment to get reward r t and the next state s t+1, the recorded empirical data is (s t a t , r t ,s t+1 ), and store it in the experience replay buffer;
[0169] Step S303.2, experience replay mechanism, the experience replay mechanism randomly samples a batch of data from the experience buffer for training, assuming the size of the experience buffer is N, then randomly sample a small batch of samples of size B from it for training each time;
[0170] Step S303.3, target network, the parameters of the target network are expressed as θ - , the parameters θ of the main network are continuously updated during the training process. If the update frequency of the target network is low, it can be updated every certain number of training steps. The target Q value is calculated through the target network. Let the target Q value be expressed as Q = (s t+1 , a; θ - );
[0171] Step S303.4: During the training process, a batch of data D is randomly sampled from the experience buffer using the experience playback mechanism, where Calculate the target Q value y for each sample j , used to update network parameters;
[0172] The loss function is used to measure the difference between the predicted Q value and the target Q value, and the network parameters θ are updated by gradient descent:
[0173]
[0174] In the formula, Q(s j , a j ; θ) is the predicted Q value output by the network, y j is the target Q value;
[0175] Step S303.5: Training stop condition. The training process needs to set a stop condition, which is set to the maximum number of training rounds T. max , when the stopping condition is met, the training process ends, and the network parameters obtained by training are used in the subsequent posture control task. Through the above steps, the network is trained based on the collected training data and the DQN algorithm is used to achieve autonomous learning and decision-making of the model in the posture control task.
[0176] Here, specifically include:
[0177] Step S304.1, evaluation and verification phase, collect new test data sets, which need to cover a variety of different situations and environments to verify the generalization ability and performance of the model. The test data collection method is similar to the training data. The DQN network interacts with the environment and records the state, action, reward and next state of each time step;
[0178] Step S304.2: Perform a quantitative evaluation on the deep reinforcement learning model after training, including calculating the average reward and success rate indicators;
[0179] Calculate the average reward, assuming the average reward is It is obtained by calculating the average reward of each time step on the test dataset, specifically:
[0180]
[0181] Where T is the total number of time steps in the test dataset, r t is the reward value at each time step;
[0182] Calculate the success rate, set the success rate as SR, and calculate it by the ratio of the number of successful completions of the task to the total number of times:
[0183]
[0184] Step S304.3, qualitative evaluation, observe the performance of the model in the actual environment, through actual observation and analysis. Qualitative evaluation can discover the behavior and performance of the model in specific situations, as well as possible problems and corresponding improvement space.
[0185] The present application provides a posture sensor control method based on the Internet of Things. The posture sensor in the Internet of Things collects posture data in the environment, and pre-processes the data collected in real time. The pre-processing includes calibration and noise reduction. Quaternions are used to represent posture information, and posture information is calculated based on the pre-processed data. Mahony filter is used as a posture solution algorithm to convert the original data output by the sensor into posture information. Based on the calculated result, the obtained information is converted. A deep reinforcement learning algorithm is used to build a model. Control instructions are implemented based on the constructed model. The posture control problem is converted into a reinforcement learning problem. The spatial state, action space and reward function are defined. The posture information and environmental characteristics are used as the state, the control instruction is used as the action, and rewards or penalties are given according to the control effect. Based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for value function estimation. Training data is collected. Based on the collected data, the DQN algorithm is used to train the network. During the training process, the collected data is collected. Use the experience replay mechanism and target network to improve the stability and convergence speed of the algorithm. Evaluate and verify the deep reinforcement learning model after training. Collect new test data to evaluate the generalization ability and performance of the model. Quantitatively evaluate the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment. Based on the verification and evaluation results, tune and improve the model. After verification and evaluation, deploy the trained deep reinforcement learning model to the actual environment. After deployment, continuously monitor the performance and effect of the model, and regularly collect feedback data to adjust and optimize the model. The deep reinforcement learning algorithm can learn from the data collected by the sensor and dynamically adjust the decision according to environmental changes to make the sensor control more precise and efficient. The model can learn the best control behavior in different situations, thereby optimizing the performance of the posture sensor. The deep reinforcement learning algorithm has strong adaptability and can learn and adjust in a constantly changing environment to cope with various complex situations and uncertain factors.
[0186] The present application further provides a posture sensor control system based on the Internet of Things, comprising:
[0187] The preprocessing module is used to collect the posture data in the environment based on the posture sensor in the Internet of Things, and preprocess the data collected in real time, including calibration and noise reduction;
[0188] The calculation module is used to represent the attitude information using quaternions, calculate the attitude information based on the preprocessed data, and use the Mahony filter as the attitude calculation algorithm to convert the raw data output by the sensor into attitude information;
[0189] Wherein, the solution module includes an update module and a calculation module;
[0190] The update module is used to calculate the incremental change of the attitude based on the sensor data, filter the attitude increment using the Mahony filter algorithm to obtain the estimated value of the attitude, and update the current attitude quaternion based on the estimated value of the attitude;
[0191] The calculation module is used in S202. The angular velocity data ω is set to [p, qr], where p, q, and r represent the angular velocity around the X-axis, Y-axis, and Z-axis, respectively, in radians per second; the acceleration data a is set to [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis respectively, in m / s 2 ;
[0192] Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter;
[0193] Calculate the incremental change Δθ of the attitude:
[0194] The angular velocity data is used to calculate the incremental change of the attitude. If the time interval is Δt, the incremental change of the attitude is:
[0195] Δθ=ω·Δt
[0196] The update rule of the Mahony filter is as follows:
[0197]
[0198] Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ;
[0199] A deep reinforcement learning module is used to convert the information obtained based on the calculated results, build a model using a deep reinforcement learning algorithm, and execute control instructions based on the built model;
[0200] The deep reinforcement learning module includes a definition module, a construction module, a training module and an evaluation module;
[0201] Definition module, used to convert the posture control problem into a reinforcement learning problem, define the spatial state, action space and reward function, take posture information and environmental features as state, control instructions as actions, and give rewards or penalties based on the control effect;
[0202] A building module is used to learn the value function using CNN based on the DQN algorithm, and extract features through CNN for estimating the value function;
[0203] The training module is used to collect training data. Based on the collected data, the DQN algorithm is used to train the network. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm.
[0204] The evaluation module is used to evaluate and verify the deep reinforcement learning model after training. It collects new test data to evaluate the generalization ability and performance of the model. The model is quantitatively evaluated to calculate the average reward and success rate indicators, and qualitatively evaluated to observe the performance of the model in the actual environment.
[0205] The feedback module is used to tune and improve the model based on the verification and evaluation results. After verification and evaluation, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjustment and optimization of the model.
[0206] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0207] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0208] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A gesture sensor control method based on the Internet of Things, characterized in that: The steps include: S100, collecting posture data in the environment based on the posture sensor in the Internet of Things, and preprocessing the real-time collected data, the preprocessing including calibration and noise reduction; S200, using quaternion to represent the posture information, and calculating the posture information based on the preprocessed data, using Mahony filter as the posture solution algorithm, and converting the raw data output by the sensor into posture information; S201, calculating the incremental change of the posture based on the sensor data, filtering the posture increment using the Mahony filter algorithm to obtain an estimated value of the posture, and updating the current posture quaternion based on the estimated value of the posture; S202, assuming that the angular velocity data ω = [p, q, r], where p, q, r represent the angular velocity around the X-axis, Y-axis and Z-axis respectively, in radians per second; assuming that the acceleration data a = [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis, in m / s 2 ; Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter; S202.
1. Calculate the incremental change Δθ of the posture: The angular velocity data is used to calculate the incremental change of the attitude. If the time interval is Δt, the incremental change of the attitude is: Δθ=ω·Δt S202.
2. The update rule of the Mahony filter is as follows: Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ; S300, based on the calculated result, convert the obtained information, build a model using a deep reinforcement learning algorithm, and execute control instructions based on the built model; S301, converting the posture control problem into a reinforcement learning problem, defining the spatial state, action space and reward function, taking the posture information and environmental features as the state, the control instructions as the action, and giving rewards or penalties according to the control effect; S302, based on the DQN algorithm, using CNN to learn the value function, and extracting features through CNN for estimating the value function; S303, collecting training data, and using the DQN algorithm to train the network based on the collected data. During the training process, an experience replay mechanism and a target network are used to improve the stability and convergence speed of the algorithm; S304. Evaluate and verify the deep reinforcement learning model after training, collect new test data to evaluate the generalization ability and performance of the model, perform quantitative evaluation on the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment; S400. Based on the verification and evaluation results, the model is tuned and improved. After verification and evaluation, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjustment and optimization of the model.
2. A gesture sensor control method based on the Internet of Things as claimed in claim 1, characterized in that: Preprocessing and analysis are performed based on the collected data. Preprocessing includes filtering, calibration and noise reduction, specifically including: S100.
1. Static data calibration. When the attitude sensor is installed, static calibration is performed. The output value of the sensor in a static state is recorded as zero bias. The sensor output is scaled and calibrated to calibrate its scale error. Zero bias calibration is as follows: Output after offset calibration = original output - static offset value The scaling calibration is as follows: S100.2, dynamic data calibration, using the quaternion update method to adjust the sensor calibration parameters, by reading the gyroscope data to initialize the attitude estimation, set the initial attitude to the reference coordinate system, based on the sensor data to update the current attitude estimation, according to the sensor data and the current attitude estimation, based on the quaternion update formula to update the current quaternion state; The quaternion is updated using the attitude update equation, based on the angular velocity update: In the formula, represents the rate of change of the quaternion, q is the current attitude quaternion, ω is the angular velocity vector, Represents quaternion multiplication; Based on the updated quaternion state, the current attitude information is calculated, and the parameters in the sensor fusion process are calibrated based on the obtained information; S100.3, data denoising, performing wavelet transform based on the attitude data output by the sensor, decomposing the data into sub-bands of different frequencies, suppressing the noise components in the high-frequency sub-bands through threshold processing or soft threshold processing, retaining the effective information in the low-frequency sub-bands, and reconstructing the processed data into attitude data after denoising through inverse wavelet transform, specifically: x denoised (t)=InverseWavelet(Threshold(Wavelet(x(t)),T)) Where: x(t) is the original signal, Wavelet(x(t)) means performing wavelet transform on the signal x(t) to decompose it into sub-bands of different frequencies, T is the threshold, InverseWavelet(y) means performing inverse wavelet transform on the signal after threshold processing, and the reconstructed signal is x denoised (t).
3. The method for controlling a gesture sensor based on the Internet of Things as claimed in claim 1, characterized in that: The posture control problem is converted into a reinforcement learning problem. The spatial state, action space and reward function are defined. The posture information and environmental features are used as the state, the control instructions are used as the action, and rewards or penalties are given according to the control effect. Specifically, it includes: S301.
1. The state space is composed of posture information and environmental features. Suppose the posture information is vector s and the environmental features are vector f. Then the state space is: S = [s, f] S301.2, the action space defines all the actions that the model can perform. In the posture control problem, the action space is specifically a set of control instructions. Based on the requirements of the problem and the complexity of the scene, the action space can be changed to continuous or discrete; Assume that the action space is discrete, and the action set is Action a represents an index i, i.e. a=i; S301.
3. Define a reward function. The reward function is used to evaluate the performance of the model after executing an action. In the posture control problem, the reward function needs to take into account the control effect, energy consumption, and task completion as three factors. The reward function is defined as the negative value of the difference between the actual posture and the expected posture, as well as the additional reward when the target position is reached; Let the target position be goal and the expected posture be q desired , the actual posture is q actual , energy consumption is energy, then the reward function can be expressed as: R=-α||q desired -q actual ||-γenergy+bonus In the formula, α and γ are parameters that weigh the control effect and energy consumption, and bonus is the additional reward when the target position is reached; Substitute the three values into the calculation formula of the reward function for corresponding calculations. For the control effect part, let q desired -q actual =0.1, α=1, then the reward for the control effect is calculated as: -αq desired -q actual =-0.1; Energy consumption, assuming that energy consumption is energy = 10, γ = 0.5, then the reward for the energy consumption part is: -γenergy = -5; Task completion status: if the target position is reached, the additional reward bonus = 20, otherwise bonus = 0; Substituting the above values into the calculation formula of the reward function for corresponding calculation, we get: R=-(-0.1)-5+20=15.1 In the formula, the result reflects the performance of the model after executing the action, which refers to the specific values of the three elements of control effect, energy consumption and task completion.
4. The method for controlling a gesture sensor based on the Internet of Things according to claim 1, characterized in that: Based on the DQN algorithm, CNN is used to learn the value function, and features are extracted through CNN for value function estimation, including: S302.
1. Based on CNN learning state value function, CNN can effectively process image data and extract features for estimating value function; Assume that the output of CNN is the action value function Q(S, a; θ), where θ is the parameter of CNN. The input of CNN is state S. After the input state S is convolved, features at different levels are extracted. CNN contains multiple convolutional layers, each of which includes multiple filters, and each filter is responsible for extracting different features. After the convolutional layer, a nonlinear activation function is applied to introduce nonlinear properties and enhance the network's expressiveness; Pooling operation, after the convolution layer, a pooling operation is performed to reduce the size of the feature map and enhance translation invariance; Flattening: After convolution and pooling operations, the feature map is flattened into a vector as the input of the fully connected layer; The fully connected layer operation inputs the flattened feature vector into the fully connected layer, which maps the feature vector to the output space of the action-value function. Each output node corresponds to the value function estimate of an action. Output layer: The output layer does not use an activation function and directly outputs the value function estimate of each action. CNN learns the mapping from state S to action value function. During the training process, the network parameter θ is adjusted by the difference with the true action value function. In reinforcement learning, the DQN algorithm is used to optimize the network parameters by minimizing the difference between the predicted value and the actual value. CNN extracts the features of the state through convolution, pooling, and fully connected layer operations, and outputs the value function estimate of each action, thereby realizing the learning of the state value function. Features are extracted through convolution and pooling operations, and finally the value function estimate of each action is output through the fully connected layer.
5. The method for controlling a gesture sensor based on the Internet of Things as claimed in claim 1, characterized in that: Collect training data. Based on the collected data, use the DQN algorithm to train the network. During the training process, use the experience replay mechanism and target network to improve the stability and convergence speed of the algorithm, including: S303.
1. Before training the DQN network, collect training data. In the process of interacting with the environment, the model selects action a according to the current strategy. t , and observe the feedback from the environment to get reward r t and the next state s t+1 , the recorded empirical data is (s t , a t , r t ,s t+1 ), and store it in the experience replay buffer; S303.2, experience replay mechanism, the experience replay mechanism randomly samples a batch of data from the experience buffer for training. Suppose the size of the experience buffer is N, then a small batch of samples of size B is randomly sampled from it for training each time; S303.3, target network, the parameters of the target network are expressed as θ - , the parameters θ of the main network are continuously updated during the training process. If the update frequency of the target network is low, it can be updated every certain number of training steps. The target Q value is calculated through the target network. Let the target Q value be expressed as: Q = (s t+1 , a; θ - ); S303.4, during the training process, a batch of data D is randomly sampled from the experience buffer using the experience replay mechanism, where Calculate the target Q value y for each sample j , used to update network parameters; The loss function is used to measure the difference between the predicted Q value and the target Q value, and the network parameters θ are updated by gradient descent: In the formula, Q(s j , a j ; θ) is the predicted Q value output by the network, y j is the target Q value; S303.5, training stop condition, the training process needs to set the stop condition, set the stop condition to the maximum number of training rounds T max , when the stopping condition is met, the training process ends, and the network parameters obtained by training are used in the subsequent posture control task. Through the above steps, the network is trained based on the collected training data and the DQN algorithm is used to achieve autonomous learning and decision-making of the model in the posture control task.
6. The method for controlling a gesture sensor based on the Internet of Things according to claim 1, characterized in that: Evaluate and verify the deep reinforcement learning model after training, collect new test data to evaluate the generalization ability and performance of the model, perform quantitative evaluation on the model, calculate the average reward and success rate indicators, and perform qualitative evaluation to observe the performance of the model in the actual environment, including: S304.
1. Evaluation and verification phase: collect new test data sets that cover a variety of situations and environments to verify the generalization ability and performance of the model. The test data collection method is similar to the training data. The DQN network interacts with the environment and records the state, action, reward, and next state of each time step. S304.
2. Perform quantitative evaluation on the deep reinforcement learning model after training, including calculation of average reward and success rate indicators; Calculate the average reward, assuming the average reward is It is obtained by calculating the average reward of each time step on the test dataset, specifically: Where T is the total number of time steps in the test dataset, r t is the reward value at each time step; Calculate the success rate, set the success rate as SR, and calculate it by the ratio of the number of successful completions of the task to the total number of times: S304.
3. Qualitative evaluation: observe the performance of the model in the actual environment. Through actual observation and analysis, qualitative evaluation can discover the behavior and performance of the model in specific situations, as well as possible problems and corresponding improvement space.
7. A posture sensor control system based on the Internet of Things, characterized in that: include: The preprocessing module is used to collect the posture data in the environment based on the posture sensor in the Internet of Things, and preprocess the data collected in real time, including calibration and noise reduction; The calculation module is used to represent the attitude information using quaternions, calculate the attitude information based on the preprocessed data, and use the Mahony filter as the attitude calculation algorithm to convert the raw data output by the sensor into attitude information; Wherein, the solution module includes an update module and a calculation module; The update module is used to calculate the incremental change of the attitude based on the sensor data, filter the attitude increment using the Mahony filter algorithm to obtain the estimated value of the attitude, and update the current attitude quaternion based on the estimated value of the attitude; The calculation module is used to set the angular velocity data ω = [p, q, r], where p, q, r represent the angular velocity around the X-axis, Y-axis and Z-axis respectively, in radians per second; set the acceleration data a = [a x , a y , a z ], where a x ,a y ,a z Represents the acceleration of the X-axis, Y-axis, and Z-axis, in m / s 2 ; Calculate the incremental change Δθ of the attitude, and update the current attitude quaternion based on the update rule of the Mahony filter; Calculate the incremental change Δθ of the attitude. The angular velocity data is used to calculate the incremental change of the attitude. Assuming the time interval is Δt, the incremental change of the attitude is specifically: Δθ=ω·Δt The update rule of the Mahony filter is as follows: Where q represents the current attitude quaternion, represents the multiplication of quaternions, β is the gain parameter of the oscillator, Δt is the time interval, and grad is the gradient of the error. First, the update value Δq of the quaternion is calculated based on the incremental change Δθ of the attitude, and then the current attitude quaternion is updated according to the update value to obtain the new attitude quaternion q new ; A deep reinforcement learning module is used to convert the information obtained based on the calculated results, build a model using a deep reinforcement learning algorithm, and execute control instructions based on the built model; The deep reinforcement learning module includes a definition module, a construction module, a training module and an evaluation module; Definition module, used to convert the posture control problem into a reinforcement learning problem, define the spatial state, action space and reward function, take posture information and environmental features as state, control instructions as actions, and give rewards or penalties based on the control effect; A building module is used to learn the value function using CNN based on the DQN algorithm, and extract features through CNN for estimating the value function; The training module is used to collect training data. Based on the collected data, the DQN algorithm is used to train the network. During the training process, the experience replay mechanism and the target network are used to improve the stability and convergence speed of the algorithm. The evaluation module is used to evaluate and verify the deep reinforcement learning model after training. It collects new test data to evaluate the generalization ability and performance of the model. The model is quantitatively evaluated to calculate the average reward and success rate indicators, and qualitatively evaluated to observe the performance of the model in the actual environment. The feedback module is used to tune and improve the model based on the verification and evaluation results. After verification and evaluation, the trained deep reinforcement learning model is deployed to the actual environment. After deployment, the performance and effect of the model are continuously monitored, and feedback data is regularly collected for adjustment and optimization of the model.
