Disclosure of Invention
The object of the invention can be achieved by the following technical measures:
a first aspect of the invention provides a method of batch processing of sensor data, the method comprising:
continuously acquiring sensor data over a first time at a first sampling rate;
performing data compression processing on the obtained current sensor data to obtain corresponding compressed data, generating corresponding bit indication data according to the compression state of the compressed data, and respectively storing the obtained compressed data and the obtained bit indication data into a first memory to form a first data column formed by the compressed data according to the time sequence of reaching an input port and a bit indication column formed by the bit indication data corresponding to the compressed data one by one in the first memory;
and sequentially carrying out data reconstruction on each compressed data of the first data column according to the bit indication column and sequentially transmitting the reconstructed data to the application processor.
Preferably, the method further comprises the steps of:
the analog signals of the sensors are converted to digital signals to form sensor data.
Preferably, the data compression process includes:
performing high-order elimination processing on the sensor data which is less than or equal to a first threshold value to form compressed data; or
The sensor data greater than the first threshold is divided by a first scalar for data reduction to form compressed data.
Preferably, the compression state includes a compressed state corresponding to the data reduction process and an uncompressed state corresponding to the high-order elimination process, and the bit indication data includes first indication data indicating the compressed state and second indication data indicating the uncompressed state.
Preferably, the data reconstruction includes:
when the bit indication data corresponding to the compressed data is first indication data, multiplying the compressed data by a first scalar; and when the bit indication data corresponding to the compressed data is the second indication data, taking the compressed data as reconstruction data.
A second aspect of the present invention provides a batch processing apparatus for sensor data, comprising:
a data comparator for comparing the current sensor data with a first threshold to obtain a first comparison result;
the data compressor is used for performing data compression processing on the current sensor data according to the first comparison result to obtain a first data column formed by compressed data;
the bit indicator is used for generating a bit indication column formed by bit indication data corresponding to the compressed data one by one according to the compression state of each compressed data in the first data column, and the bit indication data is used for indicating the compression state of the compressed data; and
and the data reconstructor is used for sequentially reconstructing the compressed data of the first data column according to the bit indication column to obtain reconstructed data.
Preferably, the apparatus further comprises:
an analog-to-digital converter for converting the analog signal of the sensor to a digital signal to form sensor data.
A third aspect of the present invention is a portable electronic device comprising:
at least one sensor;
a GNSS signal receiver for acquiring a positioning location;
a first memory for caching sensor data;
the application processor is used for processing the sensor data and triggering an application event according to a processing result;
data batching device for batching sensor data for performing the following process:
continuously acquiring sensor data over a first time at a first sampling rate;
performing data compression processing on the obtained current sensor data to obtain corresponding compressed data, generating corresponding bit indication data according to the compression state of the compressed data, and respectively storing the obtained compressed data and the obtained bit indication data into a first memory to form a first data column formed by the compressed data according to the time sequence of reaching an input port and a bit indication column formed by the bit indication data corresponding to the compressed data one by one in the first memory;
and sequentially carrying out data reconstruction on each compressed data of the first data column according to the bit indication column and sequentially transmitting the reconstructed data to the application processor.
Preferably, the portable electronic device further comprises:
a display device for displaying the application event.
A fourth aspect of the present invention provides a storage medium having a program stored therein, the program, when executed, implementing the batch processing method of sensor data described above.
According to the batch processing method of the sensor data, the sensor data column formed by the plurality of data samples is compressed and then cached, the compression state of the data is indicated through the bit indication column, data reconstruction is facilitated, the constraint condition of a memory is relieved on the basis of reducing power consumption, data displacement is not needed, a marking bit is not needed, and the processing speed is accelerated.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In order to make the description of the present disclosure more complete and complete, the following description is given for illustrative purposes with respect to the embodiments and examples of the present invention; it is not intended to be the only form in which the embodiments of the invention may be practiced or utilized. The embodiments are intended to cover the features of the various embodiments as well as the method steps and sequences for constructing and operating the embodiments. However, other embodiments may be utilized to achieve the same or equivalent functions and step sequences.
< method examples >
Fig. 1 illustrates one embodiment of a batch processing method of sensor data of the present invention, including the steps of:
s1, continuously acquiring sensor data at a first sampling rate over a first time;
s2, performing data compression processing on the obtained current sensor data to obtain corresponding compressed data, generating corresponding bit indication data according to the compression state of the compressed data, and respectively storing the obtained compressed data and the obtained bit indication data into a first memory to form a first data column formed by the compressed data according to the time sequence of reaching the input port and a bit indication column formed by the bit indication data corresponding to the compressed data one by one in the first memory;
s3, sequentially reconstructing the compressed data of the first data sequence according to the bit indication sequence and sequentially transmitting the reconstructed data to the application processor.
It should be noted that the sensor includes one or more of an accelerometer, a gyroscope, or a magnetometer.
It should be noted that the sensor data in this embodiment is preferably digital data, that is, the sensor data in this embodiment is raw sensor digital data representing a reading of the sensor.
It should be noted that, in this embodiment, when the sensor data reading is small (does not exceed a set threshold), data compression is not needed, and only the change of the data representation mode may be involved, and the data value is not changed.
It should be noted that, when data acquisition is performed on a sensor, all sensor data in a first time may be collected according to a first sampling rate, each sensor data is acquired, immediately compressed, and bit indication data is generated according to a compression state, the obtained current compressed data and the current bit indication data are stored, as a first time period passes, a first data column and a bit indication column are formed in a first memory, the first data column is formed by sorting compressed data corresponding to the sensor data according to a time sequence of arrival at an input port, the bit indication column is formed by bit indication data corresponding to the compressed data one by one, and an arrangement sequence of the bit indication column is consistent with an arrangement sequence of the first data column. For example, at the frequency of acquiring accelerometer data every 1/10 seconds, all accelerometer data acquired within 5 minutes are sequentially acquired, there are 3000 accelerometer data in total, and the 3000 accelerometer data are sequentially compressed and stored in the time sequence of acquisition.
As a preferred embodiment of this embodiment, in step S2, the data compression process includes:
performing high-order elimination processing on the sensor data which is less than or equal to a first threshold value to form compressed data; or
The sensor data greater than the first threshold is divided by a first scalar for data reduction to form compressed data.
As a preferred embodiment of the present embodiment, in step S2, the compression state includes a compressed state corresponding to the data reduction process and an uncompressed state corresponding to the high-order erasure process, and the bit indication data includes first indication data indicating the compressed state and second indication data indicating the uncompressed state.
As a preferred implementation of this embodiment, in step S3, the data reconstruction includes:
when the bit indication data corresponding to the compressed data is first indication data, multiplying the compressed data by a first scalar; and when the bit indication data corresponding to the compressed data is the second indication data, taking the compressed data as reconstruction data.
Fig. 2 shows an embodiment of the batch processing method of sensor data according to the present invention, and on the basis of the embodiment shown in fig. 1, the present embodiment further includes the following steps before step S1:
s0, converting the analog signal of the sensor into a digital signal to form sensor data.
Specifically, in a preferred embodiment, step S0 may be performed by an analog-to-digital converter in the sensor processor.
The above process will be described in detail below by taking the example that the sensor data is 16-bit digits (i.e., the original data is 16-bit digits), and the compressed data is 8-bit digits.
A given processor of the one or more sensor processors forming part of the sensor chip includes an analog-to-digital (a/D) converter for providing digital data at its output representative of the amplitude values of successive portions of the sensor signal. That is, the digital dataform of the sensor data represents the amplitude values of successive portions of the sensor signal. For example: if a given processor of the one or more sensor processors is configured to acquire sensor data every 1/10 seconds using the accelerometer, the analog-to-digital converter may sample the sensor signal in the analog acceleration signal and generate digital sensor data corresponding to the sensor information. The sensor data is the accelerometer readings and begins to be digitized by an analog-to-digital converter to 16-bit numbers (data type short int, so the integer value of the data ranges between 32,767 and-32,768). For example: if a given processor of the one or more sensor processors is configured to acquire sensor data using the accelerometer for a given time (e.g., 5 minutes) without the application processor transitioning to an active state, a batch of sensor data indicative of a time series of accelerometer readings may be determined. For a three-dimensional accelerometer, the data size of a batch of sensor data is approximately 18K.
Referring to fig. 3, fig. 3 shows a data packet, each of which is buffered in the first memory and indicates an arrangement of compressed data formed by compressing the sensor data. The data packet includes a bit indication column, which is also referred to as a bit field header or a bit sequence, and a first data column, where the bit indication column includes two data types, i.e., one is first indication data and the other is second indication data, e.g., the first indication data is 1, the second indication data is 0, i.e., 1 represents that the compressed data of the corresponding sensor is in a compressed state, and 0 represents that the compressed data of the corresponding sensor is in an uncompressed state. Of course, the first indicating data may be set to 0 and the second indicating data may be set to 1. The first data column is a data field comprising a sequence of bytes with a sensor data sequence value representation.
Depending on the characteristics of the sensor, one or more sensors such as accelerometers, gyroscopes, compasses, and magnetometer sensors may produce sensor signals of varying magnitudes corresponding to human activity. For example: when a person is in motion, such as walking, the accelerometer may determine an acceleration magnitude based on the resultant acceleration signal readings, and typically the output of the acceleration magnitude appears as a sine wave.
When a human being is at rest, the amplitude of the sensor signal may vary over time within a small range, so the magnitude of the sensor data is digitized by an analog-to-digital converter within a small range of values, for example: the x-, y-, and z-axis gyroscope readings (data levels) are 17, 13, and 17, and the x-, y-, and z-axis magnetometer readings (magnitudes) are-98, 120, and 45. In such an example, the magnitude of the sensor data is below a first threshold (e.g. +/-128). Thus, 16 bits are used for raw sensor data, and less bit inference (referring to uncompressed data) can be used by the process of elimination. The process of elimination is of the order that the lower 8 bits of a given integer value comprise sensor data, and the upper 8 bits are ignored. As shown in fig. 2, the first 2 "0" of the bit indication column (bit field header portion) shows that the compression state of the first 2 sensor compressed data of the first data column (data field portion) is uncompressed, which is represented by 8-bit sensor data, not by 16-bit raw sensor data, since the upper 8 bits thereof are eliminated.
The amplitude of the sensor signal may vary over a large range over time when the human being is in motion, so that the magnitude of the sensor data is digitized over a large range of values by the analog-to-digital converter. For example: the x-, y-and z-axis gyroscope sensor readings (orders of magnitude) are 10482, -4077 and-31038, and the magnetic sensor readings (amplitudes) are-163,130 and-171. In this example, the magnitude of the sensor data exceeds a first threshold (e.g., +/-128). Thus, 16 bits for raw sensor data may be compressed by a process of data reduction (referred to as compressed data). The process of data reduction compression is as follows: the order of magnitude of the sensor data divided by a first scalar (e.g., 128, 256), the result after the division, or the quotient of two integers, may be considered the compressed data for the sensor and included in 8 bits. As shown in fig. 2, bits 3 to 6 in the bit field header portion are indicated by "1". This shows that the third, fourth, fifth and sixth bits of data of the data field portion are compressed by the first scalar, and thus may be represented by 8-bit sensor data, rather than by 16-bit raw sensor data.
While the bit indication columns themselves may be compressed, the described data compression scheme may achieve a 1.7-1.9 compression ratio, since the bit indication columns are typically sparse with respect to the sensor data array. For example: this compression may be a simple form of huffman coding. If the compression is still working, the bit indicates that the column should consist primarily of dummy bytes. These dummy bytes may be represented by a single bit.
In step S3, the information in the bit indication column (bit field header) is used to identify the compressed or uncompressed sensor data in the first data column (data field), which can speed up and simplify the reconstruction of the sensor data. For example: as shown in fig. 2, the first two positions in the bit field are indicated by "0". This means that the first two sensor data in the data field are not compressed, and the corresponding compressed data can be directly judged to be the sensor data. As shown in fig. 2, the third, fourth, fifth and sixth data of the data field are compressed, and the compressed data may be reconstructed by multiplying by a first scalar to determine the sensor data.
It should be noted that the first memory for caching the compressed data of the sensor may only store one set of the first data column and the bit indication column, and perform the next round of data acquisition and batch processing after the set of data is transmitted to the application processor. The first memory for buffering the sensor compressed data may also store a plurality of sets of the first data column and the bit indication column at the same time.
< apparatus embodiment >
Accordingly, an embodiment of the present invention further provides a sensor data batch processing apparatus 100, configured to implement the above-mentioned batch processing method for sensor data, please refer to fig. 4, where the apparatus 100 includes: the data compression method comprises a data comparator 10, a data compressor 20, a bit indicator 30 and a data reconstructor 40, wherein the data comparator 10 is used for comparing current sensor data with a first threshold value to obtain a first comparison result; the data compressor 20 is configured to perform data compression processing on the current sensor data according to the first comparison result to obtain a first data column formed by compressed data; the bit indicator 30 is used for generating a bit indication column formed by bit indication data corresponding to the compressed data one by one according to the compression state of each compressed data in the first data column, and the bit indication data is used for indicating the compression state of the compressed data; the data reconstructor 40 is configured to sequentially perform data reconstruction on the compressed data of the first data column according to the bit indication column to obtain reconstructed data.
Further, in a preferred embodiment of the present embodiment, the apparatus 100 further comprises an analog-to-digital converter 50 for converting the analog signal of the sensor into a digital signal to form the sensor data.
The batch processing apparatus 100 for sensor data of the present embodiment may be a software apparatus alone, or may be an apparatus combining software and hardware. The batch processing apparatus 100 for sensor data and the first storage of the present embodiment may be directly applied to a sensor processor, the first storage is used as a memory of the sensor processor, and a software module of the apparatus 100 of the present embodiment is embedded in a processing chip. The data comparator 10, the data compressor 20 and the bit indicator 30 in combination may perform step S2 of the above-described method embodiment; the data reconstructor may perform step S3 of the above-described method embodiment. The analog-to-digital converter 50 may perform step S0 of the above-described method embodiment.
In an embodiment of the apparatus, the compression state includes a compressed state corresponding to the data reduction process and an uncompressed state corresponding to the high-order elimination process, and the bit indication data includes first indication data indicating the compressed state and second indication data indicating the uncompressed state.
Accordingly, as a preferred embodiment, the data compressor 20 further includes a first compression unit and a second compression unit, wherein the first compression unit is configured to perform high bit erasure processing on the sensor data equal to or less than a first threshold value to form compressed data; the second compression unit is used for dividing the sensor data larger than the first threshold value by the first scalar for data reduction to form compressed data. When data reconstruction is performed, the data reconstructor 40 multiplies the compressed data by a first scalar when the bit indicating data corresponding to the compressed data is the first indicating data; and when the bit indication data corresponding to the compressed data is the second indication data, taking the compressed data as reconstruction data.
It should be noted that, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to part of the description of the method embodiment for relevant points, which is not described herein again.
< apparatus embodiment >
An embodiment of the present invention further provides a portable electronic device, as shown in fig. 5, the portable electronic device includes: the system comprises at least one sensor, a GNSS signal receiver, a first memory, an application processor and a data batching device, wherein the GNSS signal receiver is used for acquiring a positioning position of the portable electronic equipment, the first memory is used for caching sensor data, the data batching device is used for batching the sensor data by executing the steps of the method embodiment, and the application processor is used for processing the sensor data and triggering an application event according to the processing result.
Specifically, the data batch processing device is used for executing the following processes:
continuously acquiring sensor data over a first time at a first sampling rate;
performing data compression processing on the obtained current sensor data to obtain corresponding compressed data, generating corresponding bit indication data according to the compression state of the compressed data, and respectively storing the obtained compressed data and the obtained bit indication data into a first memory to form a first data column formed by the compressed data according to the time sequence of reaching an input port and a bit indication column formed by the bit indication data corresponding to the compressed data one by one in the first memory;
and sequentially carrying out data reconstruction on each compressed data of the first data column according to the bit indication column and sequentially transmitting the reconstructed data to the application processor.
It should be noted that the data batch processing apparatus described above may also be implemented in the manner described in the above apparatus embodiment, with the purpose of implementing the steps of the method embodiment.
The raw data acquired by the sensor in a period of time are processed by the data batch processing device and then cached in the first memory, the raw data are transmitted to the application processor for processing after data reconstruction, the application processor can perform behavior identification according to the data of the sensor, and then the positioning position acquired by the GNSS receiver is matched to realize a navigation function and/or other functions.
Further, the portable electronic device of the present embodiment further includes a display device for displaying an application event, and a second memory, the second memory may store a program of a behavior recognition algorithm, a program of a position determination algorithm, and map data, and the program of the recognition algorithm and the program of the position determination algorithm in the second memory, when executed, implement behavior recognition and position determination, wherein the implementation of behavior recognition is based on the sensor data, and the implementation of position determination is based on the positioning position acquired by the GNSS receiver.
Further, the portable electronic device of the present embodiment further includes a sensor processor connected to both the sensor and the fifo queue, and the data batching device is built in the sensor processor. The sensor processors may be arranged in one-to-one correspondence with the sensors, or only one sensor processor may be arranged, for example, one dedicated sensor processor. For example: a given processor of the one or more sensor processors may be a processor that is part of the accelerometer chip. The one or more sensor processors are configured to transition from an inactive or standby state to an active state faster than the application processor, which may cause the sensor processors to consume less average power when the one or more sensors are periodically used to acquire sensor data.
In particular, the at least one sensor in this embodiment may be an accelerometer, a gyroscope, a magnetometer, a barometer or the like. The application processor may be a microprocessor, digital signal processor, multi-core processor, or the like.
The portable electronic device of the present embodiment may be a smart phone, laptop computer, desktop computer, wearable device, or other type of device.
Further, the first memory and the second memory may be any type of memory, such as: volatile memories such as Random Access Memory (RAM), Dynamic Random Access Memory (DRAM), and Static Random Access Memory (SRAM), or non-volatile memories such as Read Only Memory (ROM), flash memory, magnetic or optical disks, or compact disk read only memory (CD-ROM), which temporarily or permanently store data or instructions between devices. For example: one or more sensor processors may be coupled to the first memory. Another example is: the application processor may be coupled to the second memory. In this example, the application processor may store data in the second memory by requesting data from the one or more sensor processors.
As shown in fig. 5, the first memory may include one or more first-in-first-out (FIFO) queues, and may further include one or more position determination algorithms, and a behavior recognition algorithm. Each of the one or more FIFO queues may be implemented as a set of read and write pointers, data storage, and control logic. For example: the data store may be DRAM, SRAM, flip-flop, or any other suitable form of storage, and the control logic may specify how one or more sensor processors (optionally the host application processor) read/write to the data store. The first memory for buffering the sensor compressed data may store only one set of the first data column and the bit indication column in one or more first-in-first-out (FIFO) queues, and perform the next data acquisition and batch processing after the set of data is transferred to the application processor. The first memory for buffering sensor compressed data may also store multiple sets of first data columns and bit indicator columns simultaneously into one or more FIFO queues.
In particular, the one or more sensor processors may acquire data once per second, once per minute, etc. using the one or more sensors. However, one or more sensor processors may be used to acquire data at different intervals. For example: the one or more sensor processors may be configured to acquire sensor data using the accelerometer once every 1/10 seconds and acquire sensor data using the gyroscope once every 1/12 seconds. When sensor data is determined, the one or more sensor processors may also be configured to store the sensor data in a FIFO queue of the first memory.
The first memory may store one or more location determination algorithms to determine the location of the portable electronic device. The GNSS receiver in this embodiment may also have its own processor built therein. For example: the position determination algorithm comprises a position, velocity, time (PVT) processing algorithm stored as software instructions and executed by a processor built into the GNSS receiver. When the GNSS receiver receives signals from one or more satellites, the processor may use PVT processing algorithms to determine the location of the portable electronic device. For example: the pedestrian navigation algorithm is stored as software instructions and executed by a processor in the GNSS receiver. The processor of the GNSS receiver may determine the displacement of the known position using a pedestrian navigation algorithm and using a kalman filter based on the GNSS position results combined with the dead reckoning results. The second memory may store one or more location determination algorithms that the primary application processor may select to execute to determine the location of the portable electronic device.
When the determination is made as being in a mobile state, the first memory may store information for a behavior recognition algorithm to determine human activity (e.g., walking, running, cycling, or other activity). In one embodiment, a time domain feature vector is analyzed using a probabilistic graphical model to determine one or more states associated with human activity. In another embodiment, the feature vectors in the frequency domain are analyzed based on a Fast Fourier Transform (FFT) model and one or more states associated with human activity are determined. Alternatively, when the second memory may store a behavior recognition algorithm, the application processor may execute to determine one or more states associated with human activity.
In the fig. 5 example, the second memory may also store map data for navigation. Based on the location information determined by the PVT processing algorithm or the pedestrian navigation algorithm, the portable electronic device may invoke and/or adjust the location-based application as needed. For example: the application processor is executable to display navigation information in a foreground via the display device based on the location information. For example: the application processor is executable to display map information on a display device based on the location information.
< storage Medium embodiment >
An embodiment of the present invention further provides a storage medium, where a program is stored in the storage medium, and when the program is executed, the program implements the batch processing method for the sensor data according to any one of the above methods.
It should be noted that the storage medium in this embodiment may be a read-only memory, a static storage device capable of storing static information and instructions, a random access memory, or a dynamic storage device capable of storing information and instructions, and may also be an electrically erasable programmable read-only memory, a read-only optical disc, or other optical disc storage, magnetic disc storage medium, or other magnetic storage device.
It should be noted that the programs of the present embodiment may be written in any combination of one or more programming languages, including an object oriented programming language such as JAVA, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.