A low-computing-power feature extraction and data compression method for acceleration sensor data
Through the sliding window and sparse coding methods, the problem of high computational overhead of acceleration sensor data in IoT devices is solved, low-computing feature extraction and data compression are achieved, and device life and data transmission efficiency are improved.
Patent Information
- Application Number
- CN202211646883.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-12-21
AI Technical Summary
In IoT devices, how to reduce the computational overhead of accelerometer data acquisition on low-power hardware, especially the computational overhead of feature extraction and data compression, especially during data transmission between terminal devices and cloud models.
A sliding window is used to divide the acceleration data, calculate the total acceleration direction and count the frequency, and use the sparse coding method to convert the frequency array into a binary string for data compression. The feature extraction and compression are completed by combining the terminal device and the cloud machine learning model.
Without reducing the classification accuracy, the computing power and power consumption of the feature extraction process are reduced, the battery life of the device is increased, and the data transmission overhead is reduced.
Smart Images

Figure CN115758126B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of Internet of Things data acquisition and communication, and specifically relates to a low-computing-power feature extraction and data compression method for acceleration sensor data. Background Art
[0002] The Internet of Things (IoT) is a system that connects computing devices, terminal devices, and various objects through the internet, allowing them to share information. Leveraging the network's data transmission capabilities, information such as the status of terminals and object identification codes can be easily accessed. This information enables comprehensive data analysis and assessment of object status.
[0003] An accelerometer is a sensor mounted on an object to collect real-time acceleration data. Depending on the dimension of the acceleration being measured, accelerometers are available in single-axis, dual-axis, and tri-axis configurations. Thanks to advances in microelectromechanical (MEMS) technology, accelerometers are shrinking in size, enabling their installation in devices of all sizes.
[0004] Accelerometers are widely used in IoT devices as crucial data acquisition sensors. Examples include automotive airbags and anti-lock braking systems, motion detection in game controllers, drop detection in portable hard drives, and posture detection and motion recognition for both humans and devices. In many scenarios, devices must be able to collect data over extended periods of time. While utilizing low-power hardware, reducing computational overhead in software is also a key challenge.
[0005] The steps of the original extraction and data compression method are as follows:
[0006] Step 1: Data collection: Use the accelerometer in the IoT device to collect the raw data generated by the object's activity.
[0007] Step 2: Signal processing, using a variety of filters such as median filter, low-pass filter and Kalman filter to reduce the noise of the original data.
[0008] Step 3: Feature extraction, extract useful features from the time series through feature extraction methods.
[0009] Step 4: Model Identification: Depending on the task, the data is fed into different models. For example, for classification tasks, a small classification model can be deployed on the device, or the data can be uploaded to the cloud via wireless network and classified using a larger model with better classification performance.
[0010] The data collected by sensors is time series data—a series of data recorded in chronological order. Feature extraction is a crucial step in the entire process chain. Commonly used features are categorized as time domain features and frequency domain features. Time domain features primarily include common statistical values such as mean, variance, and kurtosis. Frequency domain features are eigenvalues extracted by converting raw time domain data to the frequency domain using a fast Fourier transform. Typical frequency domain features include energy, spectral entropy, spectral coefficients, and cepstral coefficients. The higher the dimensionality of the feature space, the more parameters the model requires, and the greater the computational effort.
[0011] Data compression occurs between feature extraction and data transmission. Deploying powerful machine learning models in the cloud can yield better results. Extracted features must be uploaded to the cloud, and the power consumption during this transmission process is positively correlated with the amount of data. This requires appropriate compression of the extracted features to reduce this computational overhead. Summary of the Invention
[0012] To address these issues, this paper discloses a low-computing feature extraction and data compression method for acceleration sensor data. This method uses the frequency of the combined acceleration direction over a certain time period as a feature and designs a corresponding data compression algorithm. This method, combined with terminal device hardware, data processing and filtering algorithms, and cloud-based machine learning models, accomplishes various tasks. Ultimately, this method reduces computational overhead while ensuring task completion.
[0013] The terminal device is a terminal device comprising a three-axis acceleration sensor, a micro control unit, a wireless transmission module and a power supply module.
[0014] The tasks described include anomaly detection, regression prediction, and multi-classification tasks depending on the usage scenario.
[0015] To achieve the above object, the technical solution of the present invention is as follows:
[0016] A low-computing feature extraction and data compression method for accelerometer data consists of the following two parts:
[0017] The first part is to extract features from the filtered sensor data. There are three steps:
[0018] Step 1: Use a sliding window of fixed length to divide the original time series. The sliding window method is a method for re-dividing time series data into several subsequences of the same length. The window length is the length of the target subsequence. By setting the overlap ratio between the previous and next windows, different numbers of subsequences can be generated. The present invention adds a certain overlap ratio between the sliding windows, for example, a 50% overlap ratio, meaning that the second half of the previous window and the first half of the next window cover the same sampling points.
[0019] Step 2: The segmented subsequences contain acceleration signals for the x, y, and z axes. For each sampling point, the combined acceleration direction of the three-axis acceleration signals is calculated. Based on the pre-set base directions, the combined acceleration direction is replaced with the nearest base direction number. The base directions are unit vectors uniformly distributed in three-dimensional space, including the positive and negative directions of the x, y, and z axes.
[0020] Step 3: Count the frequency of each base direction in the subsequence. The resulting array has a subscript range of the base direction number and a value of the frequency of the corresponding base direction.
[0021] Part 2: Data compression of the frequency array. Because the subsequence represents a short period of time, the direction of the resulting acceleration is concentrated in a smaller range within a short period of time. Therefore, the frequency array exhibits a certain degree of sparsity. This invention addresses this sparsity by proposing a data encoding method. The encoding and decoding process of the frequency array is as follows:
[0022] The encoding process is to losslessly compress the original frequency array into a binary string. When the subsequence length is less than 127, it can be converted into an unsigned binary number of 0 to 111 1111, so any frequency value can be represented by 7 bits of binary. If the sequence length is longer, the number of binary bits will be increased accordingly. For the large number of 0 values in the array, using 7 bits of binary will take up a lot of extra space. The present invention encodes the 0 value in the array as a single bit with a value of 0. For non-zero values, 8 bits are used to represent it. The first bit is fixed to 1 as a flag bit, and the last 7 bits are the binary values of the corresponding frequency. The values in the array are encoded in order and spliced into a long binary string to facilitate subsequent data transmission.
[0023] During the decoding process, after the binary string has been verified, it is decoded sequentially, and the decoded values are sequentially placed into an array within the range of the subscript base direction encoding. Each time a bit is read from the binary string, if the value is 0, the position pointed to by the array subscript is assigned the value 0, and the subscript is incremented by 1. If the value is 1, the next 7 bits are read, and the 7-bit binary number is converted into a decimal integer and assigned to the position pointed to by the array subscript, and the subscript is incremented by 1. This process continues until the entire binary string is decoded. The array obtained after decoding is the original frequency array. This verification method verifies that the data maintains its integrity after transmission.
[0024] The beneficial effects of the present invention are:
[0025] (1) The feature extraction method proposed in this invention mainly involves calculating the combined acceleration of the x, y, and z axes. Compared with extracting and calculating the feature values in the time domain and the frequency domain, the combined acceleration consumes less computing power. In subsequent models, using the combined acceleration as a feature can achieve good results in some tasks. Therefore, the method proposed in this invention reduces the computing power consumption caused by the feature extraction process without reducing the subsequent classification accuracy, thereby increasing the overall battery life of the device.
[0026] (2) Feature extraction methods using time domain and frequency domain data require calculations on all data of each subsequence. Due to some overlap between adjacent subsequences, calculations are repeated to a certain extent. The feature extraction method proposed in this invention only requires data from its own sampling points and is not affected by the overlap between subsequences. It also reduces power consumption and increases the battery life of the device.
[0027] (3) The calculated combined acceleration direction is two floating-point values. The present invention replaces these two floating-point values with the nearest base direction number, which is a small integer. This is the first compression of the read data. The frequency of each direction in the subsequence is counted and used as a feature to further reduce the dimensionality of the data, which serves as the second compression. These two methods used by the present invention have a significant compression effect on the data.
[0028] (4) The method designed by the present invention for encoding a subsequence frequency array into a binary character string facilitates data transmission and reduces the overhead during data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a structural schematic diagram of the present invention;
[0030] Figure 2 is the distribution of the base direction in the first quadrant of the rectangular coordinate system;
[0031] Figure 3 Schematic diagram of the process of encoding a frequency histogram into a binary string;
[0032] Figure 4 This is a diagram showing the effect of action recognition using the feature extraction method proposed in this invention. DETAILED DESCRIPTION
[0033] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0034] In this embodiment, the task to be completed is human motion recognition based on wearable devices.
[0035] In this embodiment, the raw sensor data used comes from the UCI human motion recognition dataset. The dataset uses five MTx 3-DOF directional trackers worn on the left and right arms, left and right legs, and torso for data collection. A total of eight volunteers participated in the data collection, and data for 19 activities were recorded at a sampling frequency of 25 Hz. The MTx 3-DOF directional tracker is a wearable device produced by Xsens that includes a three-axis accelerometer. This implementation scheme only classifies seven of the daily activities, namely: sitting still, standing, lying down, climbing stairs, descending stairs, walking, and running. By using at least two wearable devices worn on the arms and legs for data collection, a higher accuracy rate in motion classification can be achieved.
[0036] The base direction in space is calculated as follows: in the spherical coordinate system, let α be the azimuth angle between the projection of the vector in the xOy plane and the positive direction of the x-axis, and let β be the angle between the vector and the positive direction of the z-axis. Set the direction that meets the following conditions as the base direction:
[0037] Condition 1: The direction is the positive or negative direction of the z-axis.
[0038] Condition 2: The α value is 0°, and the β value is an integer multiple of 30°.
[0039] Condition 3: The values of α and β are both integer multiples of 30°.
[0040] There are two directions that satisfy condition 1, five directions that satisfy condition 2, and 55 directions that satisfy condition 3. A total of 62 directions evenly distributed in space are set as base directions. The base direction that is the same as the positive z-axis is numbered 1.
[0041] Among the unnumbered directions, the one with the smallest sum of distances to all numbered directions is set as the next number. The numbers of each direction are shown in Table 1:
[0042] Table 1 Numbers of base directions
[0043]
[0044] Feature extraction of raw data is divided into the following three steps:
[0045] Step 1: Split the original data using a sliding window of length 125, with an overlap rate of 50%. Each window has data of length 125 for each of the three channels x, y, and z.
[0046] Step 2: Calculate the angles α and β based on the x, y, and z acceleration values. Find the base direction closest to the calculated angle in Table 1 and add the corresponding base direction numbers to the array. The three-channel data, each 125 in length, is converted into an array of base direction numbers of the same length.
[0047] Step 3: Count the frequency of each base direction in the base direction number array to obtain a frequency array with a length of 62.
[0048] Data compression is performed on the frequency array. Since the subsequence represents a 5-second period, the direction of the resulting acceleration is concentrated in a relatively small range within a short period of time. Therefore, the frequency array exhibits a certain degree of sparsity. To address this sparsity, a targeted encoding scheme is employed. The encoding and decoding process for the frequency array is as follows:
[0049] The encoding process is to losslessly compress the original frequency array into a binary string. Since the length of the subsequence is 125, the unsigned binary number converted to 0 to 111 1101 can be used to represent any frequency value in a 7-bit binary system. For the large number of 0 values that appear in the array, using 7-bit binary will take up a lot of extra space. The present invention encodes the 0 value in the array as a single bit with a value of 0. For non-zero values, 8 bits are used to represent it. The first bit is fixed to 1 as a flag bit, and the next 7 bits are the binary values of the corresponding frequency. The values in the array are encoded in order and spliced into a long binary string to facilitate subsequent data transmission.
[0050] During the decoding process, after the binary string has been verified, it is decoded sequentially, and the decoded values are placed in arrays with subscripts from 1 to 62. Each time a bit is read from the binary string, if the value is 0, the position pointed to by the array subscript is assigned the value 0, and the subscript is incremented by 1. If the value is 1, the next 7 bits are read, converted into a decimal integer, and assigned to the position pointed to by the array subscript, and the subscript is incremented by 1. This process continues until the entire binary string is decoded. The array obtained after decoding is the original frequency array. This verification method verifies that the data maintains its integrity after transmission.
[0051] To verify the effectiveness of the features, the dataset was split into training and test sets in a 2:1 ratio. A deep learning network was used as the classifier. The classifier was built using the PyTorch framework and consisted of an input layer with 124 neurons, two hidden layers, and an output layer with 7 neurons. Sigmoid was used as the activation function. The neural network was trained using the training set data and then validated on the test set. Figure 2 is the confusion matrix for the recognition of 7 actions.
[0052] Compared with the action classification accuracy of 96.67% obtained by extracting time domain and frequency domain data as feature recognition, the classification accuracy of the feature extraction method of the present invention is 99.5%.
[0053] In summary, the feature extraction method proposed in this paper requires minimal computation and, when combined with a deep neural network, can accurately classify actions. The data compression method proposed in this feature extraction method can also reduce wireless transmission overhead during data transmission, thereby increasing the battery life of wearable devices.
[0054] It should be noted that the above content merely illustrates the technical idea of the present invention and cannot be used to limit the scope of protection of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications all fall within the scope of protection of the claims of the present invention.
Claims
1. A low-computing-power feature extraction and data compression method for acceleration sensor data, characterized by: It is divided into the following two parts: There are three steps to extract features from filtered sensor data: Step 1: Use a fixed-length sliding window to divide the original time series. The sliding window is a method that re-divides time series data into several subsequences of the same length. The window length is the length of the target subsequence. By setting the overlap rate of the front and back windows, different numbers of subsequences can be divided. Step 2: The segmented subsequence contains acceleration signals for the x, y, and z axes. For each sampling point, the resultant acceleration direction of the three-axis acceleration signals is calculated. Based on the pre-set base directions, the resultant acceleration direction is replaced with the nearest base direction number. The base directions are unit vectors in the spherical coordinate system that point from the origin to all directions. These unit vectors are evenly distributed, meaning that the angles between the two most adjacent unit vectors are equal. Step 3: Count the frequency of occurrence of each base direction in the subsequence; get an array whose subscript is the base direction number and whose value is the frequency of occurrence of the corresponding base direction; Data compression for the frequency array: Since the subsequence represents a short time period, the direction of the total acceleration will be concentrated in a smaller range within a short period of time; the frequency array also exhibits a certain sparsity. To address this sparsity, a data encoding method is proposed. The encoding and decoding process of the frequency array is as follows: The encoding process is to losslessly compress the original frequency array into a binary string; for the large number of zero values in the array, in order to save storage overhead, the zero values in the array are encoded as a single bit with a value of 0. For non-zero values, N bits are used to represent them, the first bit is fixed to 1 as a flag bit, and the next N-1 bits are the binary value of the corresponding frequency. When the number of bits used for the value is less than N-1, it is increased to N-1 bits by adding 0 in the front; the values in the array are encoded in order and spliced into a long binary string to facilitate subsequent data transmission; the N-1 is the minimum number of binary bits that can represent all the data values in the array; the N is the number of bits after the flag bit in front of the N-1 bit value; Decoding process,After the binary string is verified, it is decoded in sequence, and the decoded values are placed in the array with the subscript as the base direction number; Each time a bit is read from the binary string, if the value is 0, the position pointed to by the array subscript is assigned to 0 and the array subscript is increased by 1. If the value is 1, then continue to read N-1 bits, convert the N-1 binary number into a decimal integer, and assign it to the position pointed to by the array subscript, and the array subscript is increased by 1; until the entire binary string is decoded; The array obtained after decoding is the frequency array before compression; the verification is a method of verifying whether the data can still maintain integrity after transmission.
2. A low-computing-power feature extraction and data compression method for acceleration sensor data as claimed in claim 1, characterized in that In step 1, a certain overlap ratio is added between the sliding windows. When the overlap ratio is 50%, the second half of the previous window and the first half of the next window cover the same sampling points; this overlapping data will participate in the feature extraction calculation of the two windows.
3. The low-computing-power feature extraction and data compression method for acceleration sensor data according to claim 1, characterized in that: Data collection and processing are performed at the edge; the edge device is a terminal device equipped with a three-axis acceleration sensor, wireless communication capabilities and a certain amount of computing power, or an electronic module with the above functions.
4. The low-computing-power feature extraction and data compression method for acceleration sensor data according to claim 1, characterized in that: The final classification or regression task is performed in the cloud; the cloud device is equipped with network or Bluetooth wireless technology, has strong computing and storage capabilities, and can run electronic devices such as cloud servers and mobile phones stably for a long time.
Citation Information
Patent Citations
Step counting method based on mobile phone three-axis acceleration sensor
CN107462258A
Human body action recognition method based on sensor ECOC technology
CN110084286A