WO2023198150A1 - Data compression method for electroencephalogram data, chip, device, and storage medium - Google Patents

Data compression method for electroencephalogram data, chip, device, and storage medium Download PDF

Info

Publication number
WO2023198150A1
WO2023198150A1 PCT/CN2023/088072 CN2023088072W WO2023198150A1 WO 2023198150 A1 WO2023198150 A1 WO 2023198150A1 CN 2023088072 W CN2023088072 W CN 2023088072W WO 2023198150 A1 WO2023198150 A1 WO 2023198150A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
eeg
range
eeg data
Prior art date
Application number
PCT/CN2023/088072
Other languages
French (fr)
Chinese (zh)
Inventor
盛廷义
王斌
Original Assignee
杭州脑芯科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州脑芯科技有限公司 filed Critical 杭州脑芯科技有限公司
Publication of WO2023198150A1 publication Critical patent/WO2023198150A1/en

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction

Definitions

  • the present application relates to a data compression method, chip, equipment and storage medium for EEG data, and belongs to the field of computer technology.
  • Brain-computer interface equipment is an important bridge for information transmission between the brain and computers.
  • the function of the brain-computer interface device is to convert the collected EEG data into operating signals that can be recognized by the computer, so as to control the computer through the EEG data.
  • brain-computer interface devices usually need to collect EEG data for a long time before they can conduct a complete analysis of the EEG signal. This will generate a large amount of EEG data, which leads to the problem of BCI. The problem is the large amount of data stored on the device.
  • This application provides data compression methods, chips, equipment and storage media for EEG data, which can solve the problem that due to the slow change of EEG data, brain-computer interface devices usually need to collect EEG data for a long time, which will generate a large amount of data. EEG data, which leads to the problem of large amounts of data stored in computers.
  • This application provides the following technical solutions:
  • a data compression method for EEG data includes: acquiring target EEG data; determining a target data range to which the target EEG data belongs from each data range; and the data range is It is obtained by dividing the maximum data range of the EEG data; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the mth data range is greater than the data compression rate corresponding to the nth data range, and the data compression rate corresponding to the nth data range is The EEG data in the m data range is smaller than the EEG data in the nth data range, and m and n are positive integers; the target EEG data is compressed using the target data compression rate. , obtain compressed EEG data to store the compressed EEG data.
  • the target data range to which the target EEG data belongs from each data range it further includes: dividing the maximum data range according to a preset dividing method to obtain at least two data ranges;
  • the EEG data in the k-th data range is greater than the EEG data in the h-th data range.
  • the width corresponding to the k-th data range is greater than or equal to the width of the h-th data range.
  • the k and the h is a positive integer.
  • compressing the target EEG data using the target data compression rate to obtain compressed EEG data includes: shifting the target EEG data according to the target compression rate. Operation, the shifted EEG data is obtained; the sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data; the target initial value is determined according to the The target data range is determined.
  • performing a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data includes: determining the movement of the shift operation according to the target compression rate. number of digits; shift the target EEG data to the right by the number of shifting digits to obtain the shifted EEG data.
  • the target EEG data is expressed in p-ary system, and the p is an integer greater than 1; and determining the number of shifting bits of the shift operation according to the target compression rate includes: using the p is the inverse of the logarithm of the data compression rate, which is determined as the number of moving bits.
  • the method before compressing the target EEG data using the target data compression rate, the method further includes: Determine the target initial value corresponding to the target data range.
  • determining the target initial value corresponding to the target data range includes: determining from each of the data ranges a reference data range in which the EEG data is smaller than the EEG data in the target data range; according to the target The data compression rate, the width of each reference data range and the corresponding data compression rate determine the target initial value corresponding to the target data range.
  • determining the target initial value corresponding to the target data range according to the target data compression rate, the width of each reference data range and the corresponding data compression rate includes: converting each reference data range into The sum of the products of the width of the range and the corresponding data compression rate is determined as the first target value; the product of the sum of the widths of each reference data range and the target data compression rate is determined as the second target value; The difference between the first target value and the second target value is determined as the target initial value.
  • a second aspect provides a chip for executing the data compression method for EEG data provided in the first aspect.
  • an electronic device in a third aspect, includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to realize the EEG data provided by the first aspect. Compression method.
  • a computer-readable storage medium is provided.
  • a program is stored in the storage medium.
  • the program is executed by a processor, the program is used to implement the data compression method for EEG data provided in the first aspect.
  • the beneficial effects of this application at least include: obtaining target EEG data; determining the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data; determining the target data The target data compression rate corresponding to the range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is smaller than the EEG data in the n-th data range.
  • Data, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain the compressed EEG data to store the compressed EEG data; it can solve the problem of brain-computer problems due to slow changes in EEG data.
  • Interface devices usually need to collect EEG data for a long time, which will generate a large amount of EEG data, resulting in the problem of a large amount of data stored in the brain-computer interface device; because the target EEG data is first compressed, and then By storing the EEG data, the size of the stored EEG data can be reduced, thereby reducing the amount of data stored by the brain-computer interface device and saving storage space.
  • the data range to which the EEG data belongs corresponds to a greater data compression rate, and the greater the data compression, the higher the accuracy of the compressed data, so the low-level data is in a state of no compression or low compression rate. , which can effectively ensure the accuracy of low-order data.
  • the larger the EEG data the wider the width of the data range to which the EEG data belongs, and because the larger the EEG data is, the smaller the data compression rate corresponding to the data range to which the EEG data belongs, so in each data range, The larger the width of the data range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
  • the process of compressing the target EEG data is achieved by shifting and adding the target data
  • the compression of the target EEG data can be achieved by using adders and shifters.
  • the hardware requirements are low and it is conducive to data processing. Application of compression algorithms.
  • the compressed EEG data can make full use of storage space, so storage space can be further saved.
  • EEG data since the compression of EEG data can make full use of the limited storage space to store EEG data, it increases the duration of EEG data that can be stored and can meet the data duration requirements of different EEG data analysis and processing algorithms. , providing more flexible algorithm choices for the analysis and processing of EEG data.
  • Figure 1 is a schematic diagram of a data compression system for EEG data provided by an embodiment of the present application
  • Figure 2 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application
  • Figure 3 is a schematic diagram of the correspondence between target EEG data and compressed EEG data provided by an embodiment of the present application
  • Figure 4 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application.
  • Figure 5 is a block diagram of a data compression device for EEG data provided by an embodiment of the present application.
  • Figure 6 is a block diagram of an electronic device provided by an embodiment of the present application.
  • EEG data Data that reflects the electrical activity in brain nerve cells on the surface of the cerebral cortex and/or scalp. EEG data has the characteristics of slow changes and low signal amplitude.
  • Data compression refers to a technical method that reduces the amount of data to reduce storage space and improve its transmission, storage and processing efficiency without losing useful information.
  • Data compression ratio refers to the ratio of the size of data after compression to the size before compression.
  • Bit (binary digit, bit): The smallest unit that represents information, which is the information contained in one bit of a binary number.
  • Figure 1 is a data compression system for EEG data provided by an embodiment of the present application.
  • the system at least includes: a data acquisition device 110, a data compression device 120 and a storage device 130.
  • the data acquisition device 110 is used to acquire EEG signals reflecting brain activity from the scalp or inside the brain.
  • the data collection device may be a non-invasive device, such as an EEG cap, or an invasive device, such as an implantable medical device. This embodiment does not limit the type of data collection device.
  • the data acquisition device 110 also has an analog-to-digital conversion (ADC) function, which is used to convert the collected EEG signals (analog signals) into EEG data (digital signals) that can be recognized by electronic devices. Signal).
  • ADC analog-to-digital conversion
  • the EEG data may be a binary number, or it may also be a decimal number. This embodiment does not limit the expression form of the EEG data.
  • the maximum number of data bits of the EEG data generated by the data acquisition device 110 is fixed.
  • the maximum number of data bits of the EEG data generated by the data acquisition device 110 may be 10 bits, or may be 12 bits. This embodiment does not limit the maximum number of data bits of the EEG data generated by the data acquisition device 110 .
  • the maximum data range of the EEG data is determined based on the maximum number of data bits of the EEG data.
  • the EEG data is expressed in binary.
  • the maximum data range of the EEG data is 0 to 1024, or when the maximum number of data bits of the EEG data is 12 bits.
  • the maximum data range of the EEG data is 0 to 4096. This embodiment does not limit the maximum number of digits of the EEG data.
  • the data compression device 120 is connected by communication with the data acquisition device 110, and is used to compress the EEG data generated by the data acquisition device.
  • the data compression device 120 is a brain-computer interface chip, or may be located outside the brain-computer interface device. Among other electronic devices with computing functions, this embodiment does not limit the type of data compression device 120 .
  • the data compression device 120 is used to obtain the target EEG data; determine the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data; Determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is smaller than that in the n-th data range.
  • EEG data, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain compressed EEG data to store the compressed EEG data.
  • the storage device 130 may be a memory inside a chip that can store data, or it may be an external memory outside the chip.
  • the memory inside the chip that can store data may be a static random access memory (Static Random-Access Memory, SRAM), flash memory (Flash EEPROM, FLASH), etc. This embodiment does not limit the type of storage device 130.
  • the storage device 130 is communicatively connected with the data compression device 120 through the storage control device 140; the storage control device 140 is used to control the storage device 130 to store the compressed EEG data.
  • the storage control device 140 is used to splice one or more compressed EEG data into data blocks of a preset size, so as to store the data in one data block into the storage device 130 at a time.
  • the storage control device 140 is also used to control the order in which the storage device 130 stores the compressed EEG data.
  • the storage control device 140 is a First Input First Output (FIFO) memory.
  • FIFO First Input First Output
  • two or more devices among the data collection device 110, the data compression device 120, the storage device 130 and the storage control device 140 can be implemented as the same device, or they can all be implemented as one device. Implemented as different devices, this embodiment does not limit the implementation of the data collection device 110, the data compression device 120, the storage device 130 and the storage control device 140.
  • the data compression system for EEG data adopted in this embodiment obtains the target EEG data; determines the target data range to which the target EEG data belongs from each data range; the data range is the maximum data range of the EEG data. Obtained by dividing; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is less than the EEG data in n data ranges, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain compressed EEG data to store the compressed EEG data; it can solve the problem due to EEG data changes slowly, and brain-computer interface devices usually need to collect EEG data for a long time, which will generate a large amount of EEG data, which leads to the problem of a large amount of data stored in the BCI device; due to the first The target EEG data is compressed and then stored, so the size of the target E
  • FIG. 2 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application.
  • This application takes the application of this method to the data compression device 120 in the EEG data data compression system shown in FIG. 1 as an example. , this method includes at least the following steps:
  • Step 201 Obtain target EEG data.
  • the target EEG data is collected by the data acquisition equipment.
  • obtaining the target EEG data includes: obtaining the target EEG data based on the communication connection with the data collection device.
  • Step 202 Determine the target data range to which the target EEG data belongs from each data range.
  • the data range is obtained by dividing the maximum data range of the EEG data.
  • the maximum data range of the EEG data is stored in the data compression device in advance.
  • the following steps are also included: Divide the maximum data range according to the preset division method to obtain at least two data ranges.
  • the k-th data range and h-th data range in each data range if the EEG data in the k-th data range is greater than the EEG data in the h-th data range, the k-th data range The corresponding width is greater than or equal to the width of the h-th data range, and k and h are positive integers. That is, the greater the EEG data in the data range, the greater the width of the data range. In order to realize that the larger the EEG data, the wider the width of the data range to which the EEG data belongs.
  • the EEG data in the k-th data range is greater than the EEG data in the h-th data range, which means: the minimum value of the EEG data in the k-th data range is greater than the EEG data in the h-th EEG data range.
  • the maximum value of the EEG data is greater than the EEG data in the h-th EEG data range.
  • the width of the data range refers to the number of EEG data types included in the data range.
  • the kth data range is 64 ⁇ 127, and the hth data range is 0 ⁇ 63. Then the minimum value of the EEG data in the kth data range is 64, and the maximum value of the EEG data in the hth data range is is 63.
  • the k-th data range is 128-511, and the h-th data range is 64-127, then the width of the k-th data range is 384, and the width of the h-th data range is 64.
  • the preset division method is stored in the data compression device in advance, and different maximum data ranges correspond to different preset division methods.
  • the maximum data range is 0 ⁇ 1023, and the preset division method is to divide the maximum data range into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the maximum data range is 0 ⁇ 1023.
  • the preset division method is to divide the maximum data range into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the target EEG data is 67 , then the target data range is 64 ⁇ 127.
  • Step 203 Determine the target data compression rate corresponding to the target data range.
  • the brain in the m-th data range if the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, then the brain in the m-th data range
  • the electrical data is smaller than the EEG data in the nth data range, and m and n are positive integers. That is, the smaller the EEG data in the data range, the greater the data compression rate corresponding to the data range. In order to realize that the smaller the EEG data is, the greater the data compression rate corresponding to the data range to which the EEG data belongs.
  • the EEG data in the m-th data range is smaller than the EEG data in the n-th data range, which means: the maximum value of the EEG data in the m-th data range is less than the EEG data in the n-th EEG data range. Minimum value of EEG data.
  • the data compression rate refers to the ratio of the size after data compression to the size before compression. That is, the greater the data compression rate, the higher the accuracy of the compressed data. The lower the data compression rate, the better the data compression effect.
  • the smaller the EEG data the greater the data compression rate corresponding to the data range to which the EEG data belongs, and the greater the data compression, the higher the accuracy of the compressed data, so in the compressed EEG data , the smaller the EEG data, the higher the accuracy of the data, which can ensure the accuracy of low-order EEG data, that is, smaller EEG data.
  • the larger the EEG data the smaller the data compression rate corresponding to the data range to which the EEG data belongs, and the larger the EEG data, the wider the width of the data range to which the EEG data belongs, so in each data range, the data The larger the width of the range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
  • the data compression rates corresponding to each data range are stored in the data compression device in advance, and the data compression rates corresponding to different data ranges are different.
  • the maximum data range is 0 ⁇ 1023.
  • the preset division method is to divide the maximum data range into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the data range 0 ⁇ 63 corresponds to The data compression rate of one eighth.
  • the maximum data range is 0 ⁇ 1023.
  • the maximum data range is divided into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the data compression rate corresponding to the data range 0 ⁇ 63 is 1.
  • the data compression rate corresponding to the data range 64-127 is one-half
  • the data compression rate corresponding to the data range 128-511 is one-fourth
  • the data compression rate corresponding to the data range 512-1023 is one-eighth.
  • the target data range is 64 to 127, and the target data compression rate is one-half.
  • Step 104 Compress the target EEG data using the target data compression rate to obtain compressed EEG data, so as to store the compressed EEG data.
  • using the target data compression rate to compress the target EEG data to obtain the compressed EEG data includes: performing a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data; The sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data.
  • the target initial value is determined based on the target data EEG data.
  • the shift operation refers to: shifting the entire data to the left or right by the corresponding number of bits to obtain new data; when shifting to the right, the low bits are shifted out (discarded), and the high bits are filled with zeros; when shifting to the left, the high bits are shifted out ( Discard), and the low-order vacancies are filled with zeros.
  • f is the compressed EEG data
  • g is the shifted EEG data
  • s is the target initial value corresponding to the target data range.
  • perform a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data including: determining the number of shifting bits for the shift operation according to the target compression rate; shifting the target EEG data to the right. number of digits to obtain the shifted EEG data.
  • the target data is expressed in binary, the target EEG data is 1110, and the number of shifting bits is 2, then the shifted EEG data is 11.
  • the target EEG data is expressed in p-base, and p is an integer greater than 1; determine the number of shifting bits in the shift operation based on the target compression rate, including: taking p as the base of the opposite of the logarithm of the data compression rate Determine the number of moving digits.
  • the target EEG data is expressed in binary; at this time, the number of shifting digits of the shift operation is determined according to the target compression rate, including: compressing the data with base 2 The inverse of the logarithm of the rate is determined as the number of moving bits.
  • p indicates that the target EEG data is in p base; b is the target compression rate; c is the number of moving bits.
  • the target EEG data is expressed in binary.
  • p is 2
  • the target compression rate is one quarter, then the number of moving bits is That is 2.
  • the method before compressing the target EEG data using the target data compression rate, the method further includes: determining a target initial value corresponding to the target data range.
  • determining the target initial value corresponding to the target data range includes at least the following two situations:
  • the initial value corresponding to the data range is a preset value, which is pre-stored in the electronic device.
  • determining the target initial value corresponding to the target data range includes: obtaining the corresponding target data range pre-stored in the data compression device. target initial value.
  • the target initial value is calculated by the data compression device based on the target data range.
  • determining the target initial value corresponding to the target data range includes: determining from each data range that the EEG data is smaller than the target data range.
  • the reference data range of the EEG data in the surrounding area according to the target data compression rate, the width of each reference data range and the corresponding data compression rate, determine the target initial value corresponding to the target data range.
  • determining the target initial value corresponding to the target data range includes: comparing the width of each reference data range with the corresponding data compression rate. The sum of the products is determined as the first target value; the product of the sum of the widths of each reference data range and the target data compression rate is determined as the second target value; the difference between the first target value and the second target value is determined as the target initial value .
  • the target initial value is 0.
  • q is the reference data range
  • e i is the width of the i-th reference range, 1 ⁇ i ⁇ n
  • t i is the data compression rate corresponding to the i-th reference range, 1 ⁇ i ⁇ n
  • n is the reference range number
  • t 0 is the target data compression rate.
  • the maximum data range is 0 ⁇ 1023.
  • the maximum data range is divided into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the data range 0 ⁇ 63 corresponds to a data compression rate of 1.
  • the data compression rate corresponding to the range 64-127 is one-half
  • the data compression rate corresponding to the data range 128-511 is one-fourth
  • the data compression rate corresponding to the data range 512-1023 is one-eighth
  • the target data range is 512 ⁇ 1023
  • the reference data range is 0 ⁇ 63, 64 ⁇ 127 and 128 ⁇ 511. It can be obtained that the target initial value is That is 128.
  • the initial value corresponding to the data range pre-stored in the acquisition can also be calculated based on the data range.
  • the initial value is calculated in the same way as in the second case above based on the target data.
  • the method for calculating the target initial value in the range is the same. For the specific calculation process, refer to the second case, which will not be described again in this embodiment.
  • the preset division method is to divide the maximum data range into four data ranges: 0 ⁇ 63, 64 ⁇ 127, 128 ⁇ 511 and 512 ⁇ 1023.
  • the data compression rate corresponding to the data range 0 ⁇ 63 is 1, and the data range 64 ⁇
  • the data compression rate corresponding to 127 is one-half
  • the data compression rate corresponding to the data range 128-511 is one-quarter
  • the data compression rate corresponding to the data range 512-1023 is one-eighth.
  • the width of the data range 0 ⁇ 63 is 64
  • the width of the data range 64 ⁇ 127 is 64
  • the width of the data range 128 ⁇ 511 is 384
  • the width of the data range 512 ⁇ 1023 is 512
  • the compression ratio corresponding to the data range can be calculated.
  • the compressed width of the data range 0 to 63 is 64
  • the compressed width of the data range 64 to 127 is 32
  • the compressed width of the data range 128 to 511 is 96
  • the data range 512 ⁇ 1023The compressed width is 64.
  • the data compression rate when the data compression rate is 1, the number of shifting bits is 0, so there is no need to perform a shifting operation on the EEG data in the data range 0 to 63 during the data compression process; similarly, it can be seen that the data compression rate
  • the data compression rate When the data compression rate is one-half, the number of shifting bits is 1 bit, so during the data compression process, the EEG data in the data range of 64 to 127 needs to be shifted right by 1 bit; when the data compression rate is one-quarter, the number of shifting bits is 2 bits, so in the process of data compression, the EEG data in the data range 128 ⁇ 511 needs to be shifted to the right by 2 bits; when the data compression rate is one-eighth, the number of shifted bits is 3 bits, so in the process of data compression It is necessary to shift the EEG data in the data range 512 to 1023 to the right by 3 bits.
  • the data range 0 to 63 Since the EEG data in the data range 0 to 63 is smaller than the EEG data in other data ranges, the data range There is no reference data range from 0 to 63, that is, the initial value corresponding to the data range 0 to 63 is 0; similarly, the initial value corresponding to the data range 64 to 127 is 32; the initial value corresponding to the data range 128 to 511 is 64; data The initial value corresponding to the range 512 ⁇ 1023 is 128.
  • the abscissa is the target EEG data
  • the ordinate is the compressed EEG data.
  • the corresponding relationship between the target EEG data and the compressed EEG data is as follows:
  • X is the target EEG data
  • Y is the target EEG data
  • the EEG data range 0 to 63 before compression corresponds to the EEG data range 0 to 63 after compression
  • the EEG data range 64 to 127 before compression corresponds to the EEG data range 64 to 95 after compression.
  • the range of EEG data before compression 128 ⁇ 511 corresponds to the range of EEG data after compression 96 ⁇ 191
  • the range of EEG data before compression 512 ⁇ 1023 corresponds to the range of EEG data after compression 192 ⁇ 255. It can be seen from this that compression The maximum data range of the subsequent EEG data is 0 ⁇ 255.
  • the maximum data range of the compressed EEG data is 0 to 255, and there is no overlapping data range, so the compressed EEG data can be stored using 8-bit storage space, and the compressed EEG data is 8 bits.
  • the data compression algorithm provided by this application can be used to compress 10-bit EEG data into 8-bit, which can save the storage space of the storage device.
  • one memory address can only store three 10-bit data, which will result in a waste of two data bits, while one register address can store four 8-bit data without causing any loss of data bits.
  • the waste can improve the utilization of storage addresses, so the storage space of the storage device can be further saved.
  • the duration of an EEG data is 30s
  • one storage address when directly storing the EEG data, one storage address can store 3 EEG data, so one storage segment can store the EEG data for 90s; while in When storing compressed EEG data, since one storage address can store 4 pieces of EEG data, the duration of EEG data that can be stored in one storage segment is 120 seconds. Therefore, although the 10-bit EEG data is compressed into 8 bits, the compression only reduces the size of the EEG data by 20%, but it increases the storage space utilization by 33%, so storage space can be further saved.
  • EEG data due to the increased duration of EEG data that the storage device can store, it can meet the data duration requirements of different EEG data analysis and processing algorithms, providing a more flexible algorithm choice for the analysis and processing of EEG data.
  • this embodiment only introduces the complete EEG data compression process once.
  • one EEG data can be compressed multiple times according to actual needs, that is, the compressed EEG data can be re-formatted.
  • the compressed EEG data is determined to be the target EEG data to be compressed again. This embodiment does not limit the number of compression times of the EEG data.
  • the number of compressions is three times, and the target EEG data is 20 bits.
  • the compression process is: first, use the compression algorithm provided by this application to compress the 20-bit target EEG data into 18 bits to obtain the first compressed EEG data; then, determine the first compressed EEG data as the target EEG data. Data, again using the compression algorithm provided by this application, will be 18bit
  • the target EEG data is compressed to 16 bits to obtain the second compressed EEG data; finally, the second compressed EEG data is determined as the target EEG data, and the compression algorithm provided by this application is used again to convert the 16-bit target EEG data into 16 bits.
  • the EEG data is compressed to 14 bits, the third compressed EEG data is obtained, and the third compressed EEG data is stored.
  • the data compression method for EEG data obtains the target EEG data; determines the target data range to which the target EEG data belongs from each data range; the data range is the maximum range of the EEG data. Obtained by dividing the data range; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range Less than the EEG data in the nth data range, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain the compressed EEG data to store the compressed EEG data; you can Solve the problem that due to the slow change of EEG data, the brain-computer interface device usually collects the EEG data for a long time, which will generate a large amount of EEG data, resulting in a large amount of data stored in the BCI device; due to The target EEG data is compressed first and then the EEG data.
  • the data range to which the EEG data belongs corresponds to a greater data compression rate, and the greater the data compression, the higher the accuracy of the compressed data, so the low-level data is in a state of high compression rate or even no compression. status, which can effectively ensure the accuracy of low-order data.
  • the larger the EEG data the wider the width of the data range to which the EEG data belongs, and because the larger the EEG data is, the smaller the data compression rate corresponding to the data range to which the EEG data belongs, so in each data range, The larger the width of the data range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
  • the process of compressing the target EEG data is achieved by shifting and adding the target data
  • the compression of the target EEG data can be achieved by using adders and shifters.
  • the hardware requirements are low and it is conducive to data processing. Application of compression algorithms.
  • the compressed EEG data can make full use of storage space, so storage space can be further saved.
  • EEG data since the compression of EEG data can make full use of the limited storage space to store EEG data, it increases the duration of EEG data that can be stored and can meet the data duration requirements of different EEG data analysis and processing algorithms. , providing more flexible algorithm choices for the analysis and processing of EEG data.
  • FIG 4 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application.
  • This application takes the application of this method to the data compression device 120 in the EEG data data compression system shown in Figure 1 as an example.
  • the method at least includes the following steps:
  • Step 401 Obtain target EEG data.
  • Step 402 Divide the maximum data range according to a preset dividing method to obtain at least two data ranges.
  • Step 403 Determine the target data range to which the target EEG data belongs from each data range, and execute steps 404 and 406.
  • Step 404 Determine the number of bits to shift the target EEG data according to the target compression rate.
  • Step 405 Shift the target EEG data to the right by the number of shifting digits to obtain the shifted EEG data, and execute step 407.
  • Step 406 Determine the target initial value corresponding to the target data range, and execute step 407.
  • Step 407 Determine the sum of the shifted EEG data and the target initial value corresponding to the target data range as the compressed EEG data to store the compressed EEG data.
  • step 404 may be executed before step 406, or may be executed after step 406, or may be executed simultaneously with step 406. This embodiment does not limit the execution order of step 404 and step 406.
  • FIG 5 is a block diagram of a data compression device for EEG data provided by an embodiment of the present application.
  • This application uses the data compression device 120 in the data compression system for EEG data shown in Figure 1 as an example to illustrate the device.
  • the device at least includes the following modules: a data acquisition module 510, a first determination module 520, The second determination module 530 and the data compression module 540.
  • Data acquisition module 510 used to acquire target EEG data
  • the first determination module 520 is used to determine the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data;
  • the second determination module 530 is used to determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range.
  • the data is less than the EEG data in the nth data range, m and n are positive integers;
  • the data compression module 540 is used to compress the target EEG data using a target data compression rate to obtain compressed EEG data, and to store the compressed EEG data.
  • the data compression device for EEG data provided in the above embodiment performs data compression of EEG data
  • the division of the above functional modules is only used as an example. In practical applications, the above mentioned functions can be used as needed. Function allocation is completed by different functional modules, that is, the internal structure of the data compression device for EEG data is divided into different functional modules to complete all or part of the functions described above.
  • the data compression device for EEG data and the data compression method for EEG data provided in the above embodiments belong to the same concept. The specific implementation process can be found in the method embodiments and will not be described again here.
  • FIG 6 is a block diagram of an electronic device provided by an embodiment of the present application.
  • This application takes the electronic device applied to the data compression device 120 in the data compression system for EEG data shown in Figure 1 as an example.
  • the electronic device at least includes a processor 601 and a memory 602.
  • the processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc.
  • the processor 601 can adopt at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), and PLA (Programmable Logic Array, programmable logic array).
  • the processor 601 may also include a main processor and a co-processor.
  • the main processor is a processor used to process data in the wake-up state, also called CPU (Central Processing Unit, central processing unit); the co-processor is A low-power processor used to process data in standby mode.
  • the processor 601 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is responsible for rendering and drawing the content that needs to be displayed on the display screen.
  • the processor 601 may also include an AI (Artificial Intelligence, artificial intelligence) processor, which is used to process computing operations related to machine learning.
  • AI Artificial Intelligence, artificial intelligence
  • Memory 602 may include one or more computer readable and writable storage media, which may be non-volatile. Memory 602 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-volatile computer readable and writable storage medium in the memory 602 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 601 to implement the method embodiments provided in this application. Data compression method for EEG data.
  • the electronic device optionally further includes: a peripheral device interface and at least one peripheral device.
  • the processor 601, the memory 602 and the peripheral device interface may be connected through a bus or a signal line.
  • Each peripheral device can be connected to the peripheral device interface through a bus, a signal line or a circuit board.
  • peripheral devices include but are not limited to: radio frequency circuits, touch display screens, audio circuits, power supplies, etc.
  • the electronic device may also include fewer or more components, which is not limited in this embodiment.
  • this application also provides a chip, which may at least include a processor and an internal memory, and optionally include an ADC.
  • the processor can obtain program instructions through the internal memory and be used to run the program instructions to perform the data compression method for EEG data as in the foregoing method embodiment.
  • the processor may be a hardware circuit with information processing capabilities, or a software instruction, or a combination of hardware and software. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor.
  • the chip can complete the sending or receiving of data, instructions or information.
  • the processor can use the data, instructions or other information received by the interface to process it, or it can also send the processing completion information through the interface.
  • this application also provides a computer-readable storage medium in which a program is stored, and the program is loaded and executed by the processor to implement the data compression method for EEG data in the above method embodiment.
  • this application also provides a computer product.
  • the computer product includes a computer-readable storage medium.
  • a program is stored in the computer-readable storage medium. The program is loaded and executed by a processor to implement the EEG data of the above method embodiments. data compression method.

Abstract

The present application relates to the technical field of computers, and relates to a data compression method for electroencephalogram data, a chip, a device, and a storage medium. The method comprises: obtaining target electroencephalogram data (201); determining, from data ranges, a target data range to which the target electroencephalogram data belongs (202), the data ranges being obtained by dividing a maximum data range of electroencephalogram data; determining a target data compression rate corresponding to the target data range (203); and using the target data compression rate to compress the target electroencephalogram data to obtain compressed electroencephalogram data, so as to store the compressed electroencephalogram data (204). The problem that the amount of data stored in a brain-computer interface device is large due to the fact that electroencephalogram data changes slowly and the brain-computer interface device generally needs to collect the electroencephalogram data for a long time can be solved; since the target electroencephalogram data is first compressed and then the electroencephalogram data is stored, the size of the stored electroencephalogram data can be reduced, thereby reducing the amount of data stored in the brain-computer interface device and saving the storage space.

Description

脑电数据的数据压缩方法、芯片、设备及存储介质Data compression methods, chips, equipment and storage media for EEG data
相关申请的交叉引用Cross-references to related applications
本申请要求于2022年04月13日申请的,申请号为202210383249.X,名称为“脑电数据的数据压缩方法、芯片、设备及存储介质”的中国专利申请的优先权。This application claims priority to the Chinese patent application filed on April 13, 2022, with the application number 202210383249.X and titled "Data compression method, chip, equipment and storage medium for EEG data".
技术领域Technical field
本申请涉及一种脑电数据的数据压缩方法、芯片、设备及存储介质,属于计算机技术领域。The present application relates to a data compression method, chip, equipment and storage medium for EEG data, and belongs to the field of computer technology.
背景技术Background technique
脑机接口设备是脑和计算机进行信息传递的重要桥梁。脑机接口设备的作用是把采集到的脑电数据转换成可以被计算机识别的操作信号,以实现通过脑电数据控制计算机。Brain-computer interface equipment is an important bridge for information transmission between the brain and computers. The function of the brain-computer interface device is to convert the collected EEG data into operating signals that can be recognized by the computer, so as to control the computer through the EEG data.
传统的脑机接口设备在对脑电数据进行处理的过程中,通过将采集到的脑电数据直接进行存储,并对存储的脑电数据进行分析和转换,以生成可以被计算机识别的操作信号。In the process of processing EEG data, traditional brain-computer interface devices directly store the collected EEG data and analyze and convert the stored EEG data to generate operating signals that can be recognized by computers. .
然而,由于脑电数据变化缓慢,脑机接口设备通常要对脑电数据进行长时间的采集,才能对脑电信号进行完整的分析,这就会产生大量的脑电数据,从而导致脑机接口设备存储的数据量较大的问题。However, due to the slow change of EEG data, brain-computer interface devices usually need to collect EEG data for a long time before they can conduct a complete analysis of the EEG signal. This will generate a large amount of EEG data, which leads to the problem of BCI. The problem is the large amount of data stored on the device.
发明内容Contents of the invention
本申请提供了脑电数据的数据压缩方法、芯片、设备及存储介质,可以解决由于脑电数据变化缓慢,脑机接口装置通常要对脑电数据进行长时间的采集,这就会产生大量的脑电数据,从而导致计算机存储的数据量较大的问题。本申请提供如下技术方案:This application provides data compression methods, chips, equipment and storage media for EEG data, which can solve the problem that due to the slow change of EEG data, brain-computer interface devices usually need to collect EEG data for a long time, which will generate a large amount of data. EEG data, which leads to the problem of large amounts of data stored in computers. This application provides the following technical solutions:
第一方面,提供一种脑电数据的数据压缩方法,所述方法包括:获取目标脑电数据;从各个数据范围中确定所述目标脑电数据所属的目标数据范围;所述数据范围是对脑电数据的最大数据范围进行划分得到的;确定所述目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,所述第m个数据范围中的脑电数据小于所述第n个数据范围中的脑电数据,所述m和所述n为正整数;使用所述目标数据压缩率对所述目标脑电数据进行压缩,得到压缩后的脑电数据,以存储所述压缩后的脑电数据。In a first aspect, a data compression method for EEG data is provided. The method includes: acquiring target EEG data; determining a target data range to which the target EEG data belongs from each data range; and the data range is It is obtained by dividing the maximum data range of the EEG data; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the mth data range is greater than the data compression rate corresponding to the nth data range, and the data compression rate corresponding to the nth data range is The EEG data in the m data range is smaller than the EEG data in the nth data range, and m and n are positive integers; the target EEG data is compressed using the target data compression rate. , obtain compressed EEG data to store the compressed EEG data.
可选地,所述从各个数据范围中确定所述目标脑电数据所属的目标数据范围之前,还包括:根据预设划分方式对所述最大数据范围进行划分,得到至少两个数据范围;第k个数据范围中的脑电数据大于第h个数据范围中的脑电数据,所述第k个数据范围对应的宽度大于或等于所述第h个数据范围的宽度,所述k和所述h为正整数。Optionally, before determining the target data range to which the target EEG data belongs from each data range, it further includes: dividing the maximum data range according to a preset dividing method to obtain at least two data ranges; The EEG data in the k-th data range is greater than the EEG data in the h-th data range. The width corresponding to the k-th data range is greater than or equal to the width of the h-th data range. The k and the h is a positive integer.
可选地,所述使用所述目标数据压缩率对所述目标脑电数据进行压缩,得到压缩后的脑电数据,包括:根据所述目标压缩率对所述对目标脑电数据进行移位操作,得到移位后的脑电数据;将所述移位后的脑电数据与所述目标数据范围对应的目标初始值之和确定为压缩后的脑电数据;所述目标初始值根据所述目标数据范围确定。Optionally, compressing the target EEG data using the target data compression rate to obtain compressed EEG data includes: shifting the target EEG data according to the target compression rate. Operation, the shifted EEG data is obtained; the sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data; the target initial value is determined according to the The target data range is determined.
可选地,所述根据所述目标压缩率对所述对目标脑电数据进行移位操作,得到移位后的脑电数据,包括:根据所述目标压缩率确定所述移位操作的移动位数;将所述目标脑电数据右移所述移动位数,得到移位后的脑电数据。Optionally, performing a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data includes: determining the movement of the shift operation according to the target compression rate. number of digits; shift the target EEG data to the right by the number of shifting digits to obtain the shifted EEG data.
可选地,所述目标脑电数据用p进制表示,所述p为大于1的整数;所述根据所述目标压缩率确定所述移位操作的移动位数,包括:将以所述p为底所述数据压缩率的对数的相反数确定为所述移动位数。Optionally, the target EEG data is expressed in p-ary system, and the p is an integer greater than 1; and determining the number of shifting bits of the shift operation according to the target compression rate includes: using the p is the inverse of the logarithm of the data compression rate, which is determined as the number of moving bits.
可选地,所述使用所述目标数据压缩率对所述目标脑电数据进行压缩之前,还包括: 确定所述目标数据范围对应的目标初始值。Optionally, before compressing the target EEG data using the target data compression rate, the method further includes: Determine the target initial value corresponding to the target data range.
可选地,所述确定所述目标数据范围对应的目标初始值,包括:从各个所述数据范围中确定脑电数据小于所述目标数据范围中脑电数据的参考数据范围;根据所述目标数据压缩率,及各个所述参考数据范围的宽度和对应的数据压缩率,确定所述目标数据范围对应的目标初始值。Optionally, determining the target initial value corresponding to the target data range includes: determining from each of the data ranges a reference data range in which the EEG data is smaller than the EEG data in the target data range; according to the target The data compression rate, the width of each reference data range and the corresponding data compression rate determine the target initial value corresponding to the target data range.
可选地,所述根据所述目标数据压缩率,及各个所述参考数据范围的宽度和对应的数据压缩率,确定所述目标数据范围对应的目标初始值,包括:将各个所述参考数据范围的宽度与对应的数据压缩率的乘积之和确定为第一目标值;将各个所述参考数据范围的宽度之和与所述目标数据压缩率的乘积确定为第二目标值;将所述第一目标值与所述第二目标值之差确定为所述目标初始值。Optionally, determining the target initial value corresponding to the target data range according to the target data compression rate, the width of each reference data range and the corresponding data compression rate includes: converting each reference data range into The sum of the products of the width of the range and the corresponding data compression rate is determined as the first target value; the product of the sum of the widths of each reference data range and the target data compression rate is determined as the second target value; The difference between the first target value and the second target value is determined as the target initial value.
第二方面,提供一种芯片,所述芯片用于执行以实现第一方面提供的脑电数据的数据压缩方法。A second aspect provides a chip for executing the data compression method for EEG data provided in the first aspect.
第三方面,提供一种电子设备,所述设备包括处理器和存储器;所述存储器中存储有程序,所述程序由所述处理器加载并执行以实现第一方面提供的脑电数据的数据压缩方法。In a third aspect, an electronic device is provided. The device includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to realize the EEG data provided by the first aspect. Compression method.
第四方面,提供一种计算机可读存储介质,所述存储介质中存储有程序,所述程序被处理器执行时用于实现第一方面提供的脑电数据的数据压缩方法。In a fourth aspect, a computer-readable storage medium is provided. A program is stored in the storage medium. When the program is executed by a processor, the program is used to implement the data compression method for EEG data provided in the first aspect.
本申请的有益效果至少包括:通过获取目标脑电数据;从各个数据范围中确定目标脑电数据所属的目标数据范围;数据范围是对脑电数据的最大数据范围进行划分得到的;确定目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数;使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据;可以解决由于脑电数据变化缓慢,脑机接口装置通常要对脑电数据进行长时间的采集,这就会产生大量的脑电数据,从而导致脑机接口设备存储的数据量较大的问题;由于先对目标脑电数据进行压缩,再对脑电数据进行存储,所以可以减小存储的脑电数据的大小,从而减少脑机接口设备存储的数据量,节约存储空间。The beneficial effects of this application at least include: obtaining target EEG data; determining the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data; determining the target data The target data compression rate corresponding to the range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is smaller than the EEG data in the n-th data range. Data, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain the compressed EEG data to store the compressed EEG data; it can solve the problem of brain-computer problems due to slow changes in EEG data. Interface devices usually need to collect EEG data for a long time, which will generate a large amount of EEG data, resulting in the problem of a large amount of data stored in the brain-computer interface device; because the target EEG data is first compressed, and then By storing the EEG data, the size of the stored EEG data can be reduced, thereby reducing the amount of data stored by the brain-computer interface device and saving storage space.
同时,由于脑电数据越小,脑电数据所属的数据范围对应数据压缩率越大,而数据压缩越大,压缩后的数据的精度越高,所以低阶数据处于无压缩或低压缩率状态,可以有效保证低阶数据的精度。At the same time, because the smaller the EEG data is, the data range to which the EEG data belongs corresponds to a greater data compression rate, and the greater the data compression, the higher the accuracy of the compressed data, so the low-level data is in a state of no compression or low compression rate. , which can effectively ensure the accuracy of low-order data.
另外,由于脑电数据越大,脑电数据所属的数据范围的宽度越大,且由于脑电数据越大,脑电数据所属的数据范围对应数据压缩率越小,所以在各个数据范围中,数据范围的宽度越大,数据范围对应的数据压缩率越小,可以提高数据压缩效果。In addition, because the larger the EEG data, the wider the width of the data range to which the EEG data belongs, and because the larger the EEG data is, the smaller the data compression rate corresponding to the data range to which the EEG data belongs, so in each data range, The larger the width of the data range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
另外,由于对目标脑电数据进行压缩的过程是通过对目标数据进行移位和加法实现的,使用加法器和移位器即可实现对目标脑电数据的压缩,硬件要求低,有利于数据压缩算法的应用。In addition, since the process of compressing the target EEG data is achieved by shifting and adding the target data, the compression of the target EEG data can be achieved by using adders and shifters. The hardware requirements are low and it is conducive to data processing. Application of compression algorithms.
另外,可以通过设置合适的压缩算法使得压缩后脑电数据能充分利用存储空间,所以可以进一步节约存储空间。In addition, by setting an appropriate compression algorithm, the compressed EEG data can make full use of storage space, so storage space can be further saved.
另外,由于对脑电数据进行压缩可以使得能够充分利用有限的存储空间存储脑电数据,增加了所能存储的脑电数据的时长,能满足不同脑电数据分析和处理算法对数据时长的要求,为脑电数据的分析和处理提供了更加灵活的算法选择。In addition, since the compression of EEG data can make full use of the limited storage space to store EEG data, it increases the duration of EEG data that can be stored and can meet the data duration requirements of different EEG data analysis and processing algorithms. , providing more flexible algorithm choices for the analysis and processing of EEG data.
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,并可依照说明书的内容予以实施,以下以本申请的较佳实施例并配合附图详细说明如后。The above description is only an overview of the technical solutions of the present application. In order to have a clearer understanding of the technical means of the present application and implement them according to the contents of the specification, the preferred embodiments of the present application are described in detail below with reference to the accompanying drawings.
附图说明Description of the drawings
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见,下面描述中的附图是 本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly explain the specific embodiments of the present invention or the technical solutions in the prior art, the drawings that need to be used in the description of the specific embodiments or the prior art will be briefly introduced below. It is obvious that the drawings in the following description yes For some embodiments of the present invention, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.
图1是本申请一个实施例提供的脑电数据的数据压缩系统的示意图;Figure 1 is a schematic diagram of a data compression system for EEG data provided by an embodiment of the present application;
图2是本申请一个实施例提供的脑电数据的数据压缩方法的流程图;Figure 2 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application;
图3是本申请一个实施例提供的目标脑电数据与压缩后的脑电数据的对应关系的示意图;Figure 3 is a schematic diagram of the correspondence between target EEG data and compressed EEG data provided by an embodiment of the present application;
图4本申请一个实施例提供的脑电数据的数据压缩方法的流程图;Figure 4 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application;
图5本申请一个实施例提供的脑电数据的数据压缩装置的框图;Figure 5 is a block diagram of a data compression device for EEG data provided by an embodiment of the present application;
图6本申请一个实施例提供的电子设备的框图。Figure 6 is a block diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。下文中将参考附图并结合实施例来详细说明本申请。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The technical solution of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, as long as there is no conflict, the embodiments and features in the embodiments of this application can be combined with each other.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
首先,对本申请实施例涉及的若干名词进行介绍。First, some terms involved in the embodiments of this application are introduced.
脑电数据:能反映大脑皮层和\或头皮表面上大脑神经细胞中的电活动的数据。脑电数据具有变化缓慢、信号幅度低的特点。EEG data: Data that reflects the electrical activity in brain nerve cells on the surface of the cerebral cortex and/or scalp. EEG data has the characteristics of slow changes and low signal amplitude.
数据压缩:是指在不丢失有用信息的前提下,缩减数据量以减少存储空间,提高其传输、存储和处理效率的一种技术方法。Data compression: refers to a technical method that reduces the amount of data to reduce storage space and improve its transmission, storage and processing efficiency without losing useful information.
数据压缩率:是指数据压缩后的大小与压缩前的大小的比值。Data compression ratio: refers to the ratio of the size of data after compression to the size before compression.
比特(binary digit,bit):表示信息的最小单位,是二进制数的一位包含的信息。Bit (binary digit, bit): The smallest unit that represents information, which is the information contained in one bit of a binary number.
图1是本申请一个实施例提供的脑电数据的数据压缩系统,该系统至少包括:数据采集设备110,数据压缩设备120和存储设备130。Figure 1 is a data compression system for EEG data provided by an embodiment of the present application. The system at least includes: a data acquisition device 110, a data compression device 120 and a storage device 130.
数据采集设备110用于从头皮或者大脑内部获取反映大脑活动的脑电信号。The data acquisition device 110 is used to acquire EEG signals reflecting brain activity from the scalp or inside the brain.
可选地,数据采集设备可以是为非侵入式设备,比如:脑电帽,或者也可以为侵入式设备,比如:植入式医疗器械,本实施例不对数据采集设备的类型作限定。Optionally, the data collection device may be a non-invasive device, such as an EEG cap, or an invasive device, such as an implantable medical device. This embodiment does not limit the type of data collection device.
本实施例中,数据采集设备110还具有模数转换(analogue-to-digitalconversion,ADC)功能,用于将采集的脑电信号(模拟信号)转换为可以被电子设备识别的脑电数据(数字信号)。In this embodiment, the data acquisition device 110 also has an analog-to-digital conversion (ADC) function, which is used to convert the collected EEG signals (analog signals) into EEG data (digital signals) that can be recognized by electronic devices. Signal).
可选地,脑电数据可以是二进制数,或者,也可以是十进制数,本实施例不对脑电数据的表现形式作限定。Optionally, the EEG data may be a binary number, or it may also be a decimal number. This embodiment does not limit the expression form of the EEG data.
可选地,数据采集设备110产生的脑电数据的最大数据位数是固定的。数据采集设备110产生的脑电数据的最大数据位数可以是10位,或者也可以为12位,本实施例不对数据采集设备110产生的脑电数据的最大数据位数作限定。Optionally, the maximum number of data bits of the EEG data generated by the data acquisition device 110 is fixed. The maximum number of data bits of the EEG data generated by the data acquisition device 110 may be 10 bits, or may be 12 bits. This embodiment does not limit the maximum number of data bits of the EEG data generated by the data acquisition device 110 .
可选地,脑电数据的最大数据范围根据脑电数据的最大数据位数确定。具体地,脑电数据用二进制表示,在脑电数据的最大数据位数为10位时,脑电数据的最大数据范围为0~1024,或者,在脑电数据的最大数据位数为12位时,脑电数据的最大数据范围为0~4096,本实施例不对脑电数据的最大位数作限定。Optionally, the maximum data range of the EEG data is determined based on the maximum number of data bits of the EEG data. Specifically, the EEG data is expressed in binary. When the maximum number of data bits of the EEG data is 10 bits, the maximum data range of the EEG data is 0 to 1024, or when the maximum number of data bits of the EEG data is 12 bits. When , the maximum data range of the EEG data is 0 to 4096. This embodiment does not limit the maximum number of digits of the EEG data.
数据压缩设备120与数据采集设备110之间通信连接,用于对数据采集设备产生的脑电数据进行压缩。The data compression device 120 is connected by communication with the data acquisition device 110, and is used to compress the EEG data generated by the data acquisition device.
可选地,数据压缩设备120为脑机接口芯片,或者,也可以位于脑机接口设备以外的 其他具有计算功能的电子设备中,本实施例不对数据压缩设备120的类型作限定。Optionally, the data compression device 120 is a brain-computer interface chip, or may be located outside the brain-computer interface device. Among other electronic devices with computing functions, this embodiment does not limit the type of data compression device 120 .
本实施例中,数据压缩设备120用于通过获取目标脑电数据;从各个数据范围中确定目标脑电数据所属的目标数据范围;数据范围是对脑电数据的最大数据范围进行划分得到的;确定目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数;使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据。In this embodiment, the data compression device 120 is used to obtain the target EEG data; determine the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data; Determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is smaller than that in the n-th data range. EEG data, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain compressed EEG data to store the compressed EEG data.
存储设备130与数据压缩设备120之间通信连接,用于对压缩后的脑电数据进行存储。There is a communication connection between the storage device 130 and the data compression device 120 for storing compressed EEG data.
可选地,存储设备130可以为可存储数据的芯片内部的存储器,或者也可以是芯片外部的外部存储器,可存储数据的芯片内部的存储器可以为静态随机存取存储器(Static Random-Access Memory,SRAM),闪存(Flash EEPROM,FLASH)等,本实施例不对存储设备130的类型作限定。Optionally, the storage device 130 may be a memory inside a chip that can store data, or it may be an external memory outside the chip. The memory inside the chip that can store data may be a static random access memory (Static Random-Access Memory, SRAM), flash memory (Flash EEPROM, FLASH), etc. This embodiment does not limit the type of storage device 130.
可选地,存储设备130通过存储控制设备140与数据压缩设备120通信连接;存储控制设备140用于控制存储设备130存储压缩后的脑电数据。Optionally, the storage device 130 is communicatively connected with the data compression device 120 through the storage control device 140; the storage control device 140 is used to control the storage device 130 to store the compressed EEG data.
可选地,存储控制设备140用于将一个或多个压缩后的脑电数据拼接成预设大小的数据块,以将一个数据块数据块中的数据一次存储至存储设备130中。Optionally, the storage control device 140 is used to splice one or more compressed EEG data into data blocks of a preset size, so as to store the data in one data block into the storage device 130 at a time.
可选地,存储控制设备140还用于控制存储设备130存储压缩后的脑电数据的顺序。Optionally, the storage control device 140 is also used to control the order in which the storage device 130 stores the compressed EEG data.
在一个示例中,存储控制设备140为先进先出(First Input First Output,FIFO)存储器。In one example, the storage control device 140 is a First Input First Output (FIFO) memory.
需要补充说明的是,本实施例中的数据采集设备110,数据压缩设备120,存储设备130和存储控制设备140中的两个或两个以上设备可以实现为同一个设备,或者,也可以均实现为不同设备,本实施例不对数据采集设备110,数据压缩设备120,存储设备130和存储控制设备140的实现方式作限定。It should be supplemented that in this embodiment, two or more devices among the data collection device 110, the data compression device 120, the storage device 130 and the storage control device 140 can be implemented as the same device, or they can all be implemented as one device. Implemented as different devices, this embodiment does not limit the implementation of the data collection device 110, the data compression device 120, the storage device 130 and the storage control device 140.
综上,本实施例通过的脑电数据的数据压缩系统,通过获取目标脑电数据;从各个数据范围中确定目标脑电数据所属的目标数据范围;数据范围是对脑电数据的最大数据范围进行划分得到的;确定目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数;使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据;可以解决由于脑电数据变化缓慢,脑机接口装置通常要对脑电数据进行长时间的采集,这就会产生大量的脑电数据,从而导致脑机接口设备存储的数据量较大的问题;由于先对目标脑电数据进行压缩,再对脑电数据进行存储,所以可以减小存储的脑电数据的大小,从而减少脑机接口设备存储的数据量,节约存储空间。In summary, the data compression system for EEG data adopted in this embodiment obtains the target EEG data; determines the target data range to which the target EEG data belongs from each data range; the data range is the maximum data range of the EEG data. Obtained by dividing; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range is less than the EEG data in n data ranges, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain compressed EEG data to store the compressed EEG data; it can solve the problem due to EEG data changes slowly, and brain-computer interface devices usually need to collect EEG data for a long time, which will generate a large amount of EEG data, which leads to the problem of a large amount of data stored in the BCI device; due to the first The target EEG data is compressed and then stored, so the size of the stored EEG data can be reduced, thereby reducing the amount of data stored by the brain-computer interface device and saving storage space.
图2是本申请一个实施例提供的脑电数据的数据压缩方法的流程图,本申请以该方法应用于图1所示的脑电数据的数据压缩系统中的数据压缩设备120为例进行说明,该方法至少包括以下几个步骤:FIG. 2 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application. This application takes the application of this method to the data compression device 120 in the EEG data data compression system shown in FIG. 1 as an example. , this method includes at least the following steps:
步骤201,获取目标脑电数据。Step 201: Obtain target EEG data.
其中,目标脑电数据由数据采集设备采集。Among them, the target EEG data is collected by the data acquisition equipment.
可选地,获取目标脑电数据,包括:基于与数据采集设备之间的通信连接获取目标脑电数据。Optionally, obtaining the target EEG data includes: obtaining the target EEG data based on the communication connection with the data collection device.
步骤202,从各个数据范围中确定目标脑电数据所属的目标数据范围。Step 202: Determine the target data range to which the target EEG data belongs from each data range.
其中,数据范围是对脑电数据的最大数据范围进行划分得到的。脑电数据的最大数据范围预先存储在数据压缩设备中。Among them, the data range is obtained by dividing the maximum data range of the EEG data. The maximum data range of the EEG data is stored in the data compression device in advance.
可选地,从各个数据范围中确定目标脑电数据所属的目标数据范围之前,还包括:根 据预设划分方式对最大数据范围进行划分,得到至少两个数据范围。Optionally, before determining the target data range to which the target EEG data belongs from each data range, the following steps are also included: Divide the maximum data range according to the preset division method to obtain at least two data ranges.
可选地,对于各个数据范围中的第k个数据范围和第h个数据范围,如果第k个数据范围中的脑电数据大于第h个数据范围中的脑电数据,第k个数据范围对应的宽度大于或等于第h个数据范围的宽度,k和h为正整数。即,数据范围中的脑电数据越大,数据范围的宽度越大。以实现脑电数据越大,脑电数据所属的数据范围的宽度越大。Optionally, for the k-th data range and h-th data range in each data range, if the EEG data in the k-th data range is greater than the EEG data in the h-th data range, the k-th data range The corresponding width is greater than or equal to the width of the h-th data range, and k and h are positive integers. That is, the greater the EEG data in the data range, the greater the width of the data range. In order to realize that the larger the EEG data, the wider the width of the data range to which the EEG data belongs.
其中,第k个数据范围中的脑电数据大于第h个数据范围中的脑电数据,是指:第k个数据范围中的脑电数据的最小值大于第h个脑电数据范围中的脑电数据的最大值。Among them, the EEG data in the k-th data range is greater than the EEG data in the h-th data range, which means: the minimum value of the EEG data in the k-th data range is greater than the EEG data in the h-th EEG data range. The maximum value of the EEG data.
数据范围的宽度是指:数据范围内包括的脑电数据类型的数量。The width of the data range refers to the number of EEG data types included in the data range.
比如,第k个数据范围为64~127,第h个数据范围为0~63,则第k个数据范围中脑电数据的最小值为64,第h个数据范围中脑电数据的最大值为63。For example, the kth data range is 64~127, and the hth data range is 0~63. Then the minimum value of the EEG data in the kth data range is 64, and the maximum value of the EEG data in the hth data range is is 63.
又比如,第k个数据范围为128~511,第h个数据范围为64~127,则第k个数据范围的宽度为384,第h个数据范围的宽度为64。For another example, the k-th data range is 128-511, and the h-th data range is 64-127, then the width of the k-th data range is 384, and the width of the h-th data range is 64.
本实施例中,预设划分方式预先存储在数据压缩设备中,不同最大数据范围对应的预设划分方式不同。In this embodiment, the preset division method is stored in the data compression device in advance, and different maximum data ranges correspond to different preset division methods.
比如,最大数据范围为0~1023,预设划分方式为将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围。For example, the maximum data range is 0~1023, and the preset division method is to divide the maximum data range into four data ranges: 0~63, 64~127, 128~511 and 512~1023.
在实际实现时,可以根据实际需要可以为同一最大数据范围设置不同的预设划分方式,本实施例不对最大数据范围的划分方式作限定。In actual implementation, different preset division methods can be set for the same maximum data range according to actual needs. This embodiment does not limit the division method of the maximum data range.
在一个示例中,最大数据范围为0~1023,预设划分方式为将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围,目标脑电数据为67,则目标数据范围为64~127。In one example, the maximum data range is 0~1023. The preset division method is to divide the maximum data range into four data ranges: 0~63, 64~127, 128~511 and 512~1023. The target EEG data is 67 , then the target data range is 64~127.
步骤203,确定目标数据范围对应的目标数据压缩率。Step 203: Determine the target data compression rate corresponding to the target data range.
对于各个数据范围中的第m个数据范围和第n个数据范围,如果第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,则第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数。即,数据范围中的脑电数据越小,数据范围对应的数据压缩率越大。以实现脑电数据越小,脑电数据所属的数据范围对应的数据压缩率越大。For the m-th data range and n-th data range in each data range, if the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, then the brain in the m-th data range The electrical data is smaller than the EEG data in the nth data range, and m and n are positive integers. That is, the smaller the EEG data in the data range, the greater the data compression rate corresponding to the data range. In order to realize that the smaller the EEG data is, the greater the data compression rate corresponding to the data range to which the EEG data belongs.
其中,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,是指:第m个数据范围中的脑电数据的最大值小于第n个脑电数据范围中的脑电数据的最小值。Among them, the EEG data in the m-th data range is smaller than the EEG data in the n-th data range, which means: the maximum value of the EEG data in the m-th data range is less than the EEG data in the n-th EEG data range. Minimum value of EEG data.
数据压缩率是指:数据压缩后的大小与压缩前的大小的比值,即数据压缩率越大,压缩后的数据的精度越高,数据压缩率越低,数据压缩效果越好。The data compression rate refers to the ratio of the size after data compression to the size before compression. That is, the greater the data compression rate, the higher the accuracy of the compressed data. The lower the data compression rate, the better the data compression effect.
本实施例中,由于脑电数据越小,脑电数据所属的数据范围对应数据压缩率越大,而数据压缩越大,压缩后的数据的精度越高,所以在压缩后的脑电数据中,脑电数据越小,数据的精度越高,可以保证低阶脑电数据,即较小的脑电数据的精度。In this embodiment, because the smaller the EEG data, the greater the data compression rate corresponding to the data range to which the EEG data belongs, and the greater the data compression, the higher the accuracy of the compressed data, so in the compressed EEG data , the smaller the EEG data, the higher the accuracy of the data, which can ensure the accuracy of low-order EEG data, that is, smaller EEG data.
另外,由于脑电数据越大,脑电数据所属的数据范围对应数据压缩率越小,而脑电数据越大,脑电数据所属的数据范围的宽度越大,所以在各个数据范围中,数据范围的宽度越大,数据范围对应的数据压缩率越小,可以提高数据压缩效果。In addition, because the larger the EEG data, the smaller the data compression rate corresponding to the data range to which the EEG data belongs, and the larger the EEG data, the wider the width of the data range to which the EEG data belongs, so in each data range, the data The larger the width of the range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
在本实施例中,各个数据范围对应的数据压缩率预先存储在数据压缩设备中,不同数据范围对应的数据压缩率不同。In this embodiment, the data compression rates corresponding to each data range are stored in the data compression device in advance, and the data compression rates corresponding to different data ranges are different.
在一个示例中,最大数据范围为0~1023,预设划分方式为将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围,数据范围0~63对应的数据压缩率为1,数据范围64~127对应的数据压缩率为二分之一,数据范围128~511对应的数据压缩率为四分之一,数据范围512~1023对应的数据压缩率为八分之一。In an example, the maximum data range is 0~1023. The preset division method is to divide the maximum data range into four data ranges: 0~63, 64~127, 128~511 and 512~1023. The data range 0~63 corresponds to The data compression rate of one eighth.
在实际实现时,可以根据实际需要可以为同一数据范围设置不同的数据压缩率,本实施例不对各个数据范围对应的数据压缩率作限定。 In actual implementation, different data compression rates can be set for the same data range according to actual needs. This embodiment does not limit the data compression rate corresponding to each data range.
在一个示例中,最大数据范围为0~1023,将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围,数据范围0~63对应的数据压缩率为1,数据范围64~127对应的数据压缩率为二分之一,数据范围128~511对应的数据压缩率为四分之一,数据范围512~1023对应的数据压缩率为八分之一,目标数据范围为64~127,则目标数据压缩率为二分之一。In an example, the maximum data range is 0~1023. The maximum data range is divided into four data ranges: 0~63, 64~127, 128~511 and 512~1023. The data compression rate corresponding to the data range 0~63 is 1. The data compression rate corresponding to the data range 64-127 is one-half, the data compression rate corresponding to the data range 128-511 is one-fourth, and the data compression rate corresponding to the data range 512-1023 is one-eighth. The target data range is 64 to 127, and the target data compression rate is one-half.
步骤104,使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据。Step 104: Compress the target EEG data using the target data compression rate to obtain compressed EEG data, so as to store the compressed EEG data.
可选地,使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,包括:根据目标压缩率对目标脑电数据进行移位操作,得到移位后的脑电数据;将移位后的脑电数据与目标数据范围对应的目标初始值之和确定为压缩后的脑电数据。Optionally, using the target data compression rate to compress the target EEG data to obtain the compressed EEG data includes: performing a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data; The sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data.
其中,目标初始值根据目标数据脑电数据确定。Among them, the target initial value is determined based on the target data EEG data.
其中,移位操作是指:把数据整体左移或右移对应位数,得到新的数据;向右移位时低位移出(舍弃),高位的空位补零;向左移位时高位移出(舍弃),低位的空位补零。Among them, the shift operation refers to: shifting the entire data to the left or right by the corresponding number of bits to obtain new data; when shifting to the right, the low bits are shifted out (discarded), and the high bits are filled with zeros; when shifting to the left, the high bits are shifted out ( Discard), and the low-order vacancies are filled with zeros.
可选地,将移位后的脑电数据与目标数据范围对应的目标初始值之和确定为压缩后的脑电数据,通过下式表示:
f=g+s
Optionally, the sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data, expressed by the following formula:
f=g+s
其中,f为压缩后的脑电数据;g为移位后的脑电数据;s为目标数据范围对应的目标初始值。Among them, f is the compressed EEG data; g is the shifted EEG data; s is the target initial value corresponding to the target data range.
可选地,根据目标压缩率对目标脑电数据进行移位操作,得到移位后的脑电数据,包括:根据目标压缩率确定移位操作的移动位数;将目标脑电数据右移移动位数,得到移位后的脑电数据。Optionally, perform a shift operation on the target EEG data according to the target compression rate to obtain the shifted EEG data, including: determining the number of shifting bits for the shift operation according to the target compression rate; shifting the target EEG data to the right. number of digits to obtain the shifted EEG data.
在一个示例中,目标数据用二进制表示,目标脑电数据为1110,移动位数为2,则移位后的脑电数据为11。In one example, the target data is expressed in binary, the target EEG data is 1110, and the number of shifting bits is 2, then the shifted EEG data is 11.
可选地,目标脑电数据用p进制表示,p为大于1的整数;根据目标压缩率确定移位操作的移动位数,包括:将以p为底数据压缩率的对数的相反数确定为移动位数。Optionally, the target EEG data is expressed in p-base, and p is an integer greater than 1; determine the number of shifting bits in the shift operation based on the target compression rate, including: taking p as the base of the opposite of the logarithm of the data compression rate Determine the number of moving digits.
在实际实现时,为了便于对目标数据进行移位操作,目标脑电数据用2进制表示;此时,根据目标压缩率确定移位操作的移动位数,包括:将以2为底数据压缩率的对数的相反数确定为移动位数。In actual implementation, in order to facilitate the shift operation of the target data, the target EEG data is expressed in binary; at this time, the number of shifting digits of the shift operation is determined according to the target compression rate, including: compressing the data with base 2 The inverse of the logarithm of the rate is determined as the number of moving bits.
可选地,将以p为底数据压缩率的对数的相反数确定为移动位数,通过下式表示:
c=-logpb
Optionally, the inverse of the logarithm of the data compression rate with base p is determined as the number of moving bits, expressed by the following formula:
c=-log p b
其中,p表示目标脑电数据为p进制;b为目标压缩率;c为移动位数。Among them, p indicates that the target EEG data is in p base; b is the target compression rate; c is the number of moving bits.
在一个示例中,目标脑电数据用二进制表示,此时p为2,目标压缩率为四分之一,则移动位数为即2。In an example, the target EEG data is expressed in binary. At this time, p is 2, and the target compression rate is one quarter, then the number of moving bits is That is 2.
可选地,使用目标数据压缩率对目标脑电数据进行压缩之前,还包括:确定目标数据范围对应的目标初始值。Optionally, before compressing the target EEG data using the target data compression rate, the method further includes: determining a target initial value corresponding to the target data range.
本实施例中,确定目标数据范围对应的目标初始值,至少包括以下两种情况:In this embodiment, determining the target initial value corresponding to the target data range includes at least the following two situations:
第一种情况,数据范围对应的初始值为预设定值,预先存储在电子设中,此时确定目标数据范围对应的目标初始值,包括:获取数据压缩设备中预先存储的目标数据范围对应的目标初始值。In the first case, the initial value corresponding to the data range is a preset value, which is pre-stored in the electronic device. At this time, determining the target initial value corresponding to the target data range includes: obtaining the corresponding target data range pre-stored in the data compression device. target initial value.
第二种情况,目标初始值为数据压缩设备根据目标数据范围计算得到,此时,确定目标数据范围对应的目标初始值,包括:从各个数据范围中确定脑电数据小于目标数据范 围中脑电数据的参考数据范围;根据目标数据压缩率,及各个参考数据范围的宽度和对应的数据压缩率,确定目标数据范围对应的目标初始值。In the second case, the target initial value is calculated by the data compression device based on the target data range. At this time, determining the target initial value corresponding to the target data range includes: determining from each data range that the EEG data is smaller than the target data range. The reference data range of the EEG data in the surrounding area; according to the target data compression rate, the width of each reference data range and the corresponding data compression rate, determine the target initial value corresponding to the target data range.
可选地,根据目标数据压缩率,及各个参考数据范围的宽度和对应的数据压缩率,确定目标数据范围对应的目标初始值,包括:将各个参考数据范围的宽度与对应的数据压缩率的乘积之和确定为第一目标值;将各个参考数据范围的宽度之和与目标数据压缩率的乘积确定为第二目标值;将第一目标值与第二目标值之差确定为目标初始值。Optionally, based on the target data compression rate, the width of each reference data range and the corresponding data compression rate, determining the target initial value corresponding to the target data range includes: comparing the width of each reference data range with the corresponding data compression rate. The sum of the products is determined as the first target value; the product of the sum of the widths of each reference data range and the target data compression rate is determined as the second target value; the difference between the first target value and the second target value is determined as the target initial value .
可选地,在参考数据范围的个数为0的情况下,目标初始值为0。Optionally, when the number of reference data ranges is 0, the target initial value is 0.
在参考数据范围不为0的情况下,根据目标数据压缩率,及各个参考数据范围的宽度和对应的数据压缩率,确定目标数据范围对应的目标初始值,通过下式表示:
q=e1t1+...+entn-(e1+...+en)t0
When the reference data range is not 0, the target initial value corresponding to the target data range is determined based on the target data compression rate, the width of each reference data range and the corresponding data compression rate, which is expressed by the following formula:
q=e 1 t 1 +...+e n t n -(e 1 +...+e n )t 0
其中,q为参考数据范围;ei为第i个参考范围的宽度,1≤i≤n;ti为第i个参考范围对应的数据压缩率,1≤i≤n;n为参考范围的个数;t0为目标数据压缩率。Among them, q is the reference data range; e i is the width of the i-th reference range, 1≤i≤n; t i is the data compression rate corresponding to the i-th reference range, 1≤i≤n; n is the reference range number; t 0 is the target data compression rate.
比如,最大数据范围为0~1023,将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围,数据范围0~63对应的数据压缩率为1,数据范围64~127对应的数据压缩率为二分之一,数据范围128~511对应的数据压缩率为四分之一,数据范围512~1023对应的数据压缩率为八分之一,目标数据范围为512~1023,则参考数据范围为0~63、64~127和128~511,可以得到,目标初始值为即128。For example, the maximum data range is 0~1023. The maximum data range is divided into four data ranges: 0~63, 64~127, 128~511 and 512~1023. The data range 0~63 corresponds to a data compression rate of 1. The data compression rate corresponding to the range 64-127 is one-half, the data compression rate corresponding to the data range 128-511 is one-fourth, the data compression rate corresponding to the data range 512-1023 is one-eighth, the target data range is 512~1023, then the reference data range is 0~63, 64~127 and 128~511. It can be obtained that the target initial value is That is 128.
需要补充说明的是,在上述第一种情况中,获取中预先存储的数据范围对应的初始值也可以是根据数据范围计算得到的,初始值的计算方式与上述第二种情况中根据目标数据范围计算目标初始值的方式相同,具体计算过程参考第二种情况,本实施例对此不再赘述。It should be added that in the first case above, the initial value corresponding to the data range pre-stored in the acquisition can also be calculated based on the data range. The initial value is calculated in the same way as in the second case above based on the target data. The method for calculating the target initial value in the range is the same. For the specific calculation process, refer to the second case, which will not be described again in this embodiment.
为了更好的说明本申请提供的脑电数据的数据压缩方法,以下给出一个实例进行说明。In order to better illustrate the data compression method of EEG data provided by this application, an example is given below for illustration.
设脑电数据为10bit数据,即脑电数据的最大数据位数为10位,则脑电数据的最大数据范围为0~1023。预设的划分方式为将最大数据范围划分为0~63、64~127、128~511和512~1023四个数据范围,将数据范围0~63对应的数据压缩率为1,数据范围64~127对应的数据压缩率为二分之一,数据范围128~511对应的数据压缩率为四分之一,数据范围512~1023对应的数据压缩率为八分之一。Assume that the EEG data is 10-bit data, that is, the maximum number of data digits of the EEG data is 10 bits, and the maximum data range of the EEG data is 0 to 1023. The preset division method is to divide the maximum data range into four data ranges: 0~63, 64~127, 128~511 and 512~1023. The data compression rate corresponding to the data range 0~63 is 1, and the data range 64~ The data compression rate corresponding to 127 is one-half, the data compression rate corresponding to the data range 128-511 is one-quarter, and the data compression rate corresponding to the data range 512-1023 is one-eighth.
由上可知,数据范围0~63的宽度为64,数据范围64~127的宽度为64,数据范围128~511的宽度为384,数据范围512~1023的宽度为512,根据数据范围的宽度和数据范围对应的压缩率,可以计算得到,数据范围0~63压缩后的宽度为64,数据范围64~127压缩后的宽度为32,数据范围128~511压缩后的宽度为96,数据范围512~1023压缩后的宽度为64。It can be seen from the above that the width of the data range 0~63 is 64, the width of the data range 64~127 is 64, the width of the data range 128~511 is 384, the width of the data range 512~1023 is 512, according to the width of the data range and The compression ratio corresponding to the data range can be calculated. The compressed width of the data range 0 to 63 is 64, the compressed width of the data range 64 to 127 is 32, the compressed width of the data range 128 to 511 is 96, and the data range 512 ~1023The compressed width is 64.
根据上述方法可以计算得到数据压缩率为1时移动位数为0,所以在数据压缩的过程中不需要对数据范围0~63内的脑电数据进行移位操作;同理可知,数据压缩率为二分之一时移动位数为1位,所以在数据压缩的过程中需要将数据范围64~127内的脑电数据右移1位;数据压缩率为四分之一时移动位数为2位,所以在数据压缩的过程中需要将数据范围128~511内的脑电数据右移2位;数据压缩率为八分之一时移动位数为3位,所以在数据压缩的过程中需要将数据范围512~1023内的脑电数据右移3位。According to the above method, it can be calculated that when the data compression rate is 1, the number of shifting bits is 0, so there is no need to perform a shifting operation on the EEG data in the data range 0 to 63 during the data compression process; similarly, it can be seen that the data compression rate When the data compression rate is one-half, the number of shifting bits is 1 bit, so during the data compression process, the EEG data in the data range of 64 to 127 needs to be shifted right by 1 bit; when the data compression rate is one-quarter, the number of shifting bits is 2 bits, so in the process of data compression, the EEG data in the data range 128 ~ 511 needs to be shifted to the right by 2 bits; when the data compression rate is one-eighth, the number of shifted bits is 3 bits, so in the process of data compression It is necessary to shift the EEG data in the data range 512 to 1023 to the right by 3 bits.
由于数据范围0~63中的脑电数据小于其他数据范围中的脑电数据,所以数据范围 0~63不存在参考数据范围,即数据范围0~63对应的初始值为0;同理可知,数据范围64~127对应的初始值为32;数据范围128~511对应的初始值64;数据范围512~1023对应的初始值为128。Since the EEG data in the data range 0 to 63 is smaller than the EEG data in other data ranges, the data range There is no reference data range from 0 to 63, that is, the initial value corresponding to the data range 0 to 63 is 0; similarly, the initial value corresponding to the data range 64 to 127 is 32; the initial value corresponding to the data range 128 to 511 is 64; data The initial value corresponding to the range 512~1023 is 128.
参考图3,横坐标为目标脑电数据,纵坐标为压缩后的脑电数据,目标脑电数据与压缩后的脑电数据的对应关系如下:Referring to Figure 3, the abscissa is the target EEG data, and the ordinate is the compressed EEG data. The corresponding relationship between the target EEG data and the compressed EEG data is as follows:
在目标脑电数据小于64的情况下,Y=X;When the target EEG data is less than 64, Y=X;
在目标脑电数据大于或等于64,且小于128的情况下: When the target EEG data is greater than or equal to 64 and less than 128:
在目标脑电数据大于或等于128,且小于512的情况下: When the target EEG data is greater than or equal to 128 and less than 512:
在目标脑电数据大于或等于512的情况下: When the target EEG data is greater than or equal to 512:
其中,X为目标脑电数据;Y为目标脑电数据。Among them, X is the target EEG data; Y is the target EEG data.
根据以上对应关系可以得到,压缩前的脑电数据范围0~63对应压缩后的脑电数据范围0~63;压缩前的脑电数据范围64~127对应压缩后的脑电数据范围64~95;压缩前的脑电数据范围128~511对应压缩后的脑电数据范围96~191;压缩前的脑电数据范围512~1023对应压缩后的脑电数据范围192~255,由此可知,压缩后的脑电数据的最大数据范围为0~255。According to the above correspondence, it can be obtained that the EEG data range 0 to 63 before compression corresponds to the EEG data range 0 to 63 after compression; the EEG data range 64 to 127 before compression corresponds to the EEG data range 64 to 95 after compression. ; The range of EEG data before compression 128~511 corresponds to the range of EEG data after compression 96~191; the range of EEG data before compression 512~1023 corresponds to the range of EEG data after compression 192~255. It can be seen from this that compression The maximum data range of the subsequent EEG data is 0~255.
上述实例中,压缩后的脑电数据的最大数据范围0~255,且不存在重合的数据范围,所以用8位存储空间即可存储压缩后的脑电数据,压缩后的脑电数据为8bit,所以用本申请提供的数据压缩算法可以实现将10bit的脑电数据压缩为8bit,可以节约存储设备的存储空间。In the above example, the maximum data range of the compressed EEG data is 0 to 255, and there is no overlapping data range, so the compressed EEG data can be stored using 8-bit storage space, and the compressed EEG data is 8 bits. , so the data compression algorithm provided by this application can be used to compress 10-bit EEG data into 8-bit, which can save the storage space of the storage device.
另外,对于32位的存储设备来说,一个存储器地址只能存储3个10bit的数据,这会导致浪费两个数据位,而一个寄存地址可以存储4个8bit的数据,不会造成数据数据位的浪费,可以提高对存储地址的利用率,所以可以进一步节约存储设备的存储空间。In addition, for a 32-bit storage device, one memory address can only store three 10-bit data, which will result in a waste of two data bits, while one register address can store four 8-bit data without causing any loss of data bits. The waste can improve the utilization of storage addresses, so the storage space of the storage device can be further saved.
比如,设一个脑电数据的时长为30s,在直接对脑电数据进行存储时,一个存储地址可以存储的3个脑电数据,所以一个存储段可以存储脑电数据的时长为90s;而在对压缩后的脑电数据进行存储时,由于一个存储地址可以存储4个脑电数据,所以一个存储段可以存储的脑电数据的时长为120s。所以虽然将10bit的脑电数据压缩为8bit,仅压缩将脑电数据的大小压缩了20%,但是却将存储空间的利用率提高了33%,所以可以进一步节约存储空间。For example, assuming the duration of an EEG data is 30s, when directly storing the EEG data, one storage address can store 3 EEG data, so one storage segment can store the EEG data for 90s; while in When storing compressed EEG data, since one storage address can store 4 pieces of EEG data, the duration of EEG data that can be stored in one storage segment is 120 seconds. Therefore, although the 10-bit EEG data is compressed into 8 bits, the compression only reduces the size of the EEG data by 20%, but it increases the storage space utilization by 33%, so storage space can be further saved.
另外,由于增加了存储设备所能存储的脑电数据的时长,能满足不同脑电数据分析和处理算法对数据时长的要求,为脑电数据的分析和处理提供了更加灵活的算法选择。In addition, due to the increased duration of EEG data that the storage device can store, it can meet the data duration requirements of different EEG data analysis and processing algorithms, providing a more flexible algorithm choice for the analysis and processing of EEG data.
需要补充说明的是,本实施例仅一次完整的脑电数据压缩的过程进行介绍,在实际实现时,可以根据实际需要,对一个脑电数据进行多次压缩,即将压缩后的脑电数据重新确定为目标脑电数据以对压缩后的脑电数据再次进行压缩,本实施例不对脑电数据的压缩次数作限定。It should be supplemented that this embodiment only introduces the complete EEG data compression process once. In actual implementation, one EEG data can be compressed multiple times according to actual needs, that is, the compressed EEG data can be re-formatted. The compressed EEG data is determined to be the target EEG data to be compressed again. This embodiment does not limit the number of compression times of the EEG data.
比如:压缩次数为三次,目标脑电数据为20bit。压缩过程为:首先,使用本申请提供的压缩算法将20bit的目标脑电数据压缩为18bit,得到第一压缩后的脑电数据;然后,将第一压缩后的脑电数据确定为目标脑电数据,再次使用本申请提供的压缩算法,将18bit 的目标脑电数据压缩为16bit,得到第二压缩后的脑电数据;最后,将第二压缩后的脑电数据确定为目标脑电数据,再次使用本申请提供的压缩算法,将16bit的目标脑电数据压缩为14bit,得到第三压缩后的脑电数据,并对第三压缩后的脑电数据进行存储。For example: the number of compressions is three times, and the target EEG data is 20 bits. The compression process is: first, use the compression algorithm provided by this application to compress the 20-bit target EEG data into 18 bits to obtain the first compressed EEG data; then, determine the first compressed EEG data as the target EEG data. Data, again using the compression algorithm provided by this application, will be 18bit The target EEG data is compressed to 16 bits to obtain the second compressed EEG data; finally, the second compressed EEG data is determined as the target EEG data, and the compression algorithm provided by this application is used again to convert the 16-bit target EEG data into 16 bits. The EEG data is compressed to 14 bits, the third compressed EEG data is obtained, and the third compressed EEG data is stored.
综上所述,本实施例提供的脑电数据的数据压缩方法,通过获取目标脑电数据;从各个数据范围中确定目标脑电数据所属的目标数据范围;数据范围是对脑电数据的最大数据范围进行划分得到的;确定目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数;使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据;可以解决由于脑电数据变化缓慢,脑机接口装置通常要对脑电数据进行长时间的采集,这就会产生大量的脑电数据,从而导致脑机接口设备存储的数据量较大的问题;由于先对目标脑电数据进行压缩,再对脑电数据进行存储,所以可以减小存储的脑电数据的大小,从而减少脑机接口设备存储的数据量,节约存储空间。In summary, the data compression method for EEG data provided in this embodiment obtains the target EEG data; determines the target data range to which the target EEG data belongs from each data range; the data range is the maximum range of the EEG data. Obtained by dividing the data range; determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range, and the EEG data in the m-th data range Less than the EEG data in the nth data range, m and n are positive integers; use the target data compression rate to compress the target EEG data to obtain the compressed EEG data to store the compressed EEG data; you can Solve the problem that due to the slow change of EEG data, the brain-computer interface device usually collects the EEG data for a long time, which will generate a large amount of EEG data, resulting in a large amount of data stored in the BCI device; due to The target EEG data is compressed first and then the EEG data is stored, so the size of the stored EEG data can be reduced, thereby reducing the amount of data stored by the brain-computer interface device and saving storage space.
同时,由于脑电数据越小,脑电数据所属的数据范围对应数据压缩率越大,而数据压缩越大,压缩后的数据的精度越高,所以低阶数据处于高压缩率甚至无压缩的状态,可以有效保证低阶数据的精度。At the same time, because the smaller the EEG data is, the data range to which the EEG data belongs corresponds to a greater data compression rate, and the greater the data compression, the higher the accuracy of the compressed data, so the low-level data is in a state of high compression rate or even no compression. status, which can effectively ensure the accuracy of low-order data.
另外,由于脑电数据越大,脑电数据所属的数据范围的宽度越大,且由于脑电数据越大,脑电数据所属的数据范围对应数据压缩率越小,所以在各个数据范围中,数据范围的宽度越大,数据范围对应的数据压缩率越小,可以提高数据压缩效果。In addition, because the larger the EEG data, the wider the width of the data range to which the EEG data belongs, and because the larger the EEG data is, the smaller the data compression rate corresponding to the data range to which the EEG data belongs, so in each data range, The larger the width of the data range, the smaller the data compression rate corresponding to the data range, which can improve the data compression effect.
另外,由于对目标脑电数据进行压缩的过程是通过对目标数据进行移位和加法实现的,使用加法器和移位器即可实现对目标脑电数据的压缩,硬件要求低,有利于数据压缩算法的应用。In addition, since the process of compressing the target EEG data is achieved by shifting and adding the target data, the compression of the target EEG data can be achieved by using adders and shifters. The hardware requirements are low and it is conducive to data processing. Application of compression algorithms.
另外,可以通过设置合适的压缩算法使得压缩后脑电数据能充分利用存储空间,所以可以进一步节约存储空间。In addition, by setting an appropriate compression algorithm, the compressed EEG data can make full use of storage space, so storage space can be further saved.
另外,由于对脑电数据进行压缩可以使得能够充分利用有限的存储空间存储脑电数据,增加了所能存储的脑电数据的时长,能满足不同脑电数据分析和处理算法对数据时长的要求,为脑电数据的分析和处理提供了更加灵活的算法选择。In addition, since the compression of EEG data can make full use of the limited storage space to store EEG data, it increases the duration of EEG data that can be stored and can meet the data duration requirements of different EEG data analysis and processing algorithms. , providing more flexible algorithm choices for the analysis and processing of EEG data.
下面对本申请提供的脑电数据的数据压缩方法进行详细介绍。The data compression method for EEG data provided by this application is introduced in detail below.
图4是本申请一个实施例提供的脑电数据的数据压缩方法的流程图。本申请以该方法应用于图1所示的脑电数据的数据压缩系统中的数据压缩设备120为例进行说明,该方法至少包括以下几个步骤:Figure 4 is a flow chart of a data compression method for EEG data provided by an embodiment of the present application. This application takes the application of this method to the data compression device 120 in the EEG data data compression system shown in Figure 1 as an example. The method at least includes the following steps:
步骤401,获取目标脑电数据。Step 401: Obtain target EEG data.
步骤402,根据预设划分方式对最大数据范围进行划分,得到至少两个数据范围。Step 402: Divide the maximum data range according to a preset dividing method to obtain at least two data ranges.
步骤403,从各个数据范围中确定目标脑电数据所属的目标数据范围,执行步骤404和步骤406。Step 403: Determine the target data range to which the target EEG data belongs from each data range, and execute steps 404 and 406.
步骤404,根据目标压缩率确定对目标脑电数据进行移位操作的移动位数。Step 404: Determine the number of bits to shift the target EEG data according to the target compression rate.
步骤405,将目标脑电数据右移移动位数,得到移位后的脑电数据,执行步骤407。Step 405: Shift the target EEG data to the right by the number of shifting digits to obtain the shifted EEG data, and execute step 407.
步骤406,确定目标数据范围对应的目标初始值,执行步骤407。Step 406: Determine the target initial value corresponding to the target data range, and execute step 407.
步骤407,将移位后的脑电数据与目标数据范围对应的目标初始值之和确定为压缩后的脑电数据,以存储压缩后的脑电数据。Step 407: Determine the sum of the shifted EEG data and the target initial value corresponding to the target data range as the compressed EEG data to store the compressed EEG data.
可选地,步骤404可以在步骤406之前执行,或者也可以在步骤406之后执行或者可以与步骤406同时执行,本实施例不对步骤404和步骤406的执行顺序作限定。Optionally, step 404 may be executed before step 406, or may be executed after step 406, or may be executed simultaneously with step 406. This embodiment does not limit the execution order of step 404 and step 406.
本实施例的相关描述参考上述实施例,本实施例在此不再赘述。The relevant description of this embodiment refers to the above-mentioned embodiment, and this embodiment will not be described again here.
本实施例中,由于对目标脑电数据进行压缩的过程是通过对目标数据进行移位和加 法实现的,使用加法器和移位器即可实现对目标脑电数据的压缩,硬件要求低,有利于数据压缩算法的应用。In this embodiment, since the process of compressing the target EEG data is by shifting and adding the target data, It can be realized by using adder and shifter to compress the target EEG data. The hardware requirements are low and it is conducive to the application of data compression algorithm.
图5是本申请一个实施例提供的脑电数据的数据压缩装置的框图。本申请以该装置应用于图1所示的脑电数据的数据压缩系统中的数据压缩设备120为例进行说明,该装置至少包括以下几个模块:数据获取模块510、第一确定模块520、第二确定模块530和数据压缩模块540。Figure 5 is a block diagram of a data compression device for EEG data provided by an embodiment of the present application. This application uses the data compression device 120 in the data compression system for EEG data shown in Figure 1 as an example to illustrate the device. The device at least includes the following modules: a data acquisition module 510, a first determination module 520, The second determination module 530 and the data compression module 540.
数据获取模块510,用于获取目标脑电数据;Data acquisition module 510, used to acquire target EEG data;
第一确定模块520,用于从各个数据范围中确定目标脑电数据所属的目标数据范围;数据范围是对脑电数据的最大数据范围进行划分得到的;The first determination module 520 is used to determine the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data;
第二确定模块530,用于确定目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,第m个数据范围中的脑电数据小于第n个数据范围中的脑电数据,m和n为正整数;The second determination module 530 is used to determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the m-th data range is greater than the data compression rate corresponding to the n-th data range. The data is less than the EEG data in the nth data range, m and n are positive integers;
数据压缩模块540,用于使用目标数据压缩率对目标脑电数据进行压缩,得到压缩后的脑电数据,以存储压缩后的脑电数据。The data compression module 540 is used to compress the target EEG data using a target data compression rate to obtain compressed EEG data, and to store the compressed EEG data.
相关细节参考上述方法和系统实施例。Relevant details refer to the above method and system embodiments.
需要说明的是:上述实施例中提供的脑电数据的数据压缩装置在进行脑电数据的数据压缩时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将脑电数据的数据压缩装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的脑电数据的数据压缩装置与脑电数据的数据压缩方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the data compression device for EEG data provided in the above embodiment performs data compression of EEG data, the division of the above functional modules is only used as an example. In practical applications, the above mentioned functions can be used as needed. Function allocation is completed by different functional modules, that is, the internal structure of the data compression device for EEG data is divided into different functional modules to complete all or part of the functions described above. In addition, the data compression device for EEG data and the data compression method for EEG data provided in the above embodiments belong to the same concept. The specific implementation process can be found in the method embodiments and will not be described again here.
图6是本申请一个实施例提供的电子设备的框图。本申请以该电子设备应用于图1所示的脑电数据的数据压缩系统中的数据压缩设备120为例进行说明,该电子设备至少包括处理器601和存储器602。Figure 6 is a block diagram of an electronic device provided by an embodiment of the present application. This application takes the electronic device applied to the data compression device 120 in the data compression system for EEG data shown in Figure 1 as an example. The electronic device at least includes a processor 601 and a memory 602.
处理器601可以包括一个或多个处理核心,比如:4核心处理器、8核心处理器等。处理器601可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器601也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器601可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器601还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 601 can adopt at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), and PLA (Programmable Logic Array, programmable logic array). accomplish. The processor 601 may also include a main processor and a co-processor. The main processor is a processor used to process data in the wake-up state, also called CPU (Central Processing Unit, central processing unit); the co-processor is A low-power processor used to process data in standby mode. In some embodiments, the processor 601 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is responsible for rendering and drawing the content that needs to be displayed on the display screen. In some embodiments, the processor 601 may also include an AI (Artificial Intelligence, artificial intelligence) processor, which is used to process computing operations related to machine learning.
存储器602可以包括一个或多个计算机可读写存储介质,该计算机可读写存储介质可以是非易失性的。存储器602还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器602中的非易失性的计算机可读写存储介质用于存储至少一个指令,该至少一个指令用于被处理器601所执行以实现本申请中方法实施例提供的脑电数据的数据压缩方法。Memory 602 may include one or more computer readable and writable storage media, which may be non-volatile. Memory 602 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-volatile computer readable and writable storage medium in the memory 602 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 601 to implement the method embodiments provided in this application. Data compression method for EEG data.
在一些实施例中,电子设备还可选包括有:外围设备接口和至少一个外围设备。处理器601、存储器602和外围设备接口之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口相连。示意性地,外围设备包括但不限于:射频电路、触摸显示屏、音频电路、和电源等。 In some embodiments, the electronic device optionally further includes: a peripheral device interface and at least one peripheral device. The processor 601, the memory 602 and the peripheral device interface may be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface through a bus, a signal line or a circuit board. Illustratively, peripheral devices include but are not limited to: radio frequency circuits, touch display screens, audio circuits, power supplies, etc.
当然,电子设备还可以包括更少或更多的组件,本实施例对此不作限定。Of course, the electronic device may also include fewer or more components, which is not limited in this embodiment.
可选地,本申请还提供有一种芯片,该芯片至少可包括处理器和内部存储器,可选包括ADC。该处理器可通过内部存储器获取程序指令,并用于运行该程序指令,以执行如前述方法实施例的脑电数据的数据压缩方法。Optionally, this application also provides a chip, which may at least include a processor and an internal memory, and optionally include an ADC. The processor can obtain program instructions through the internal memory and be used to run the program instructions to perform the data compression method for EEG data as in the foregoing method embodiment.
其中,处理器可以是具有信息处理能力的硬件电路、或者软件指令,或者硬件和软件的结合。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。该芯片可以完成数据、指令或者信息的发送或者接收,处理器可以利用接口接收的数据、指令或者其它信息,进行处理,也可以将处理完成信息通过接口发送出去。The processor may be a hardware circuit with information processing capabilities, or a software instruction, or a combination of hardware and software. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor. The chip can complete the sending or receiving of data, instructions or information. The processor can use the data, instructions or other information received by the interface to process it, or it can also send the processing completion information through the interface.
可选地,本申请还提供有一种计算机可读存储介质,计算机可读存储介质中存储有程序,程序由处理器加载并执行以实现上述方法实施例的脑电数据的数据压缩方法。Optionally, this application also provides a computer-readable storage medium in which a program is stored, and the program is loaded and executed by the processor to implement the data compression method for EEG data in the above method embodiment.
可选地,本申请还提供有一种计算机产品,该计算机产品包括计算机可读存储介质,计算机可读存储介质中存储有程序,程序由处理器加载并执行以实现上述方法实施例的脑电数据的数据压缩方法。Optionally, this application also provides a computer product. The computer product includes a computer-readable storage medium. A program is stored in the computer-readable storage medium. The program is loaded and executed by a processor to implement the EEG data of the above method embodiments. data compression method.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. It is considered to be within the scope of this manual.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。 The above embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all fall within the protection scope of the present application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims (11)

  1. 一种脑电数据的数据压缩方法,其特征在于,所述方法包括:A data compression method for EEG data, characterized in that the method includes:
    获取目标脑电数据;Obtain target EEG data;
    从各个数据范围中确定所述目标脑电数据所属的目标数据范围;所述数据范围是对脑电数据的最大数据范围进行划分得到的;Determine the target data range to which the target EEG data belongs from each data range; the data range is obtained by dividing the maximum data range of the EEG data;
    确定所述目标数据范围对应的目标数据压缩率;第m个数据范围对应的数据压缩率大于第n个数据范围对应的数据压缩率,所述第m个数据范围中的脑电数据小于所述第n个数据范围中的脑电数据,所述m和所述n为正整数;Determine the target data compression rate corresponding to the target data range; the data compression rate corresponding to the mth data range is greater than the data compression rate corresponding to the nth data range, and the EEG data in the mth data range is less than the EEG data in the nth data range, the m and n are positive integers;
    使用所述目标数据压缩率对所述目标脑电数据进行压缩,得到压缩后的脑电数据,以存储所述压缩后的脑电数据。The target EEG data is compressed using the target data compression rate to obtain compressed EEG data, and the compressed EEG data is stored.
  2. 根据权利要求1所述的方法,其特征在于,所述从各个数据范围中确定所述目标脑电数据所属的目标数据范围之前,还包括:The method according to claim 1, characterized in that before determining the target data range to which the target EEG data belongs from each data range, it further includes:
    根据预设划分方式对所述最大数据范围进行划分,得到至少两个数据范围;第k个数据范围中的脑电数据大于第h个数据范围中的脑电数据,所述第k个数据范围对应的宽度大于或等于所述第h个数据范围的宽度,所述k和所述h为正整数。Divide the maximum data range according to the preset division method to obtain at least two data ranges; the EEG data in the kth data range is greater than the EEG data in the hth data range, and the kth data range The corresponding width is greater than or equal to the width of the h-th data range, and k and h are positive integers.
  3. 根据权利要求1所述的方法,其特征在于,所述使用所述目标数据压缩率对所述目标脑电数据进行压缩,得到压缩后的脑电数据,包括:The method according to claim 1, characterized in that said using the target data compression rate to compress the target EEG data to obtain compressed EEG data includes:
    根据所述目标压缩率对所述对目标脑电数据进行移位操作,得到移位后的脑电数据;Perform a shifting operation on the target EEG data according to the target compression rate to obtain shifted EEG data;
    将所述移位后的脑电数据与所述目标数据范围对应的目标初始值之和确定为压缩后的脑电数据;所述目标初始值根据所述目标数据范围确定。The sum of the shifted EEG data and the target initial value corresponding to the target data range is determined as the compressed EEG data; the target initial value is determined based on the target data range.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述目标压缩率对所述对目标脑电数据进行移位操作,得到移位后的脑电数据,包括:The method according to claim 3, characterized in that, performing a shifting operation on the target EEG data according to the target compression rate to obtain the shifted EEG data includes:
    根据所述目标压缩率确定所述移位操作的移动位数;Determine the number of shifting bits of the shift operation according to the target compression ratio;
    将所述目标脑电数据右移所述移动位数,得到移位后的脑电数据。Shift the target EEG data to the right by the moving number to obtain shifted EEG data.
  5. 根据权利要求4所述的方法,其特征在于,所述目标脑电数据用p进制表示,所述p为大于1的整数;The method according to claim 4, characterized in that the target EEG data is expressed in p-ary system, and the p is an integer greater than 1;
    所述根据所述目标压缩率确定所述移位操作的移动位数,包括:Determining the number of shifting bits of the shift operation according to the target compression rate includes:
    将以所述p为底所述数据压缩率的对数的相反数确定为所述移动位数。The number of moving bits is determined as the inverse of the logarithm of the data compression rate with p as the base.
  6. 根据权利要求1所述的方法,其特征在于,所述使用所述目标数据压缩率对所述目标脑电数据进行压缩之前,还包括:The method according to claim 1, characterized in that before using the target data compression rate to compress the target EEG data, it further includes:
    确定所述目标数据范围对应的目标初始值。Determine the target initial value corresponding to the target data range.
  7. 根据权利要求6所述的方法,其特征在于,所述确定所述目标数据范围对应的目标初始值,包括:The method of claim 6, wherein determining the target initial value corresponding to the target data range includes:
    从各个所述数据范围中确定脑电数据小于所述目标数据范围中脑电数据的参考数据范 围;Determine from each of the data ranges a reference data range in which the EEG data is smaller than the EEG data in the target data range. circumference;
    根据所述目标数据压缩率,及各个所述参考数据范围的宽度和对应的数据压缩率,确定所述目标数据范围对应的目标初始值。According to the target data compression rate, the width of each reference data range and the corresponding data compression rate, the target initial value corresponding to the target data range is determined.
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述目标数据压缩率,及各个所述参考数据范围的宽度和对应的数据压缩率,确定所述目标数据范围对应的目标初始值,包括:The method of claim 7, wherein the target initial value corresponding to the target data range is determined based on the target data compression rate, the width of each reference data range and the corresponding data compression rate. ,include:
    将各个所述参考数据范围的宽度与对应的数据压缩率的乘积之和确定为第一目标值;Determine the sum of the products of the width of each reference data range and the corresponding data compression rate as the first target value;
    将各个所述参考数据范围的宽度之和与所述目标数据压缩率的乘积确定为第二目标值;Determine the product of the sum of the widths of each of the reference data ranges and the target data compression rate as the second target value;
    将所述第一目标值与所述第二目标值之差确定为所述目标初始值。The difference between the first target value and the second target value is determined as the target initial value.
  9. 一种芯片,其特征在于,所述芯片用于执行如权利要求1至8中任意一项所述的方法。A chip, characterized in that the chip is used to perform the method according to any one of claims 1 to 8.
  10. 一种电子设备,其特征在于,所述设备包括处理器和存储器;所述存储器中存储有程序,所述程序由所述处理器加载并执行以实现如权利要求1至8任一项所述的脑电数据的数据压缩方法。An electronic device, characterized in that the device includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to implement any one of claims 1 to 8 Data compression method for EEG data.
  11. 一种计算机可读存储介质,其特征在于,所述存储介质中存储有程序,所述程序被处理器执行时用于实现如权利要求1至8任一项所述的脑电数据的数据压缩方法。 A computer-readable storage medium, characterized in that a program is stored in the storage medium, and when executed by a processor, the program is used to implement the data compression of EEG data according to any one of claims 1 to 8. method.
PCT/CN2023/088072 2022-04-13 2023-04-13 Data compression method for electroencephalogram data, chip, device, and storage medium WO2023198150A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210383249.XA CN114665886A (en) 2022-04-13 2022-04-13 Data compression method, chip, equipment and storage medium for electroencephalogram data
CN202210383249.X 2022-04-13

Publications (1)

Publication Number Publication Date
WO2023198150A1 true WO2023198150A1 (en) 2023-10-19

Family

ID=82034462

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/088072 WO2023198150A1 (en) 2022-04-13 2023-04-13 Data compression method for electroencephalogram data, chip, device, and storage medium

Country Status (2)

Country Link
CN (1) CN114665886A (en)
WO (1) WO2023198150A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114665886A (en) * 2022-04-13 2022-06-24 杭州脑芯科技有限公司 Data compression method, chip, equipment and storage medium for electroencephalogram data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237301A (en) * 2008-02-22 2008-08-06 深圳市深信服电子科技有限公司 Dynamic data compression technology
CN109088636A (en) * 2018-07-25 2018-12-25 郑州云海信息技术有限公司 A kind of data processing method, system and electronic equipment and storage medium
CN111010189A (en) * 2019-10-21 2020-04-14 清华大学 Multi-path compression method and device for data set and storage medium
US20200133858A1 (en) * 2018-10-26 2020-04-30 EMC IP Holding Company LLC Method, apparatus and computer program product for storing data
CN114142866A (en) * 2021-11-26 2022-03-04 北京人大金仓信息技术股份有限公司 Data compression method and device, electronic equipment and storage medium
CN114665886A (en) * 2022-04-13 2022-06-24 杭州脑芯科技有限公司 Data compression method, chip, equipment and storage medium for electroencephalogram data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237301A (en) * 2008-02-22 2008-08-06 深圳市深信服电子科技有限公司 Dynamic data compression technology
CN109088636A (en) * 2018-07-25 2018-12-25 郑州云海信息技术有限公司 A kind of data processing method, system and electronic equipment and storage medium
US20200133858A1 (en) * 2018-10-26 2020-04-30 EMC IP Holding Company LLC Method, apparatus and computer program product for storing data
CN111010189A (en) * 2019-10-21 2020-04-14 清华大学 Multi-path compression method and device for data set and storage medium
CN114142866A (en) * 2021-11-26 2022-03-04 北京人大金仓信息技术股份有限公司 Data compression method and device, electronic equipment and storage medium
CN114665886A (en) * 2022-04-13 2022-06-24 杭州脑芯科技有限公司 Data compression method, chip, equipment and storage medium for electroencephalogram data

Also Published As

Publication number Publication date
CN114665886A (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN107729989B (en) Device and method for executing artificial neural network forward operation
US9384168B2 (en) Vector matrix product accelerator for microprocessor integration
CN111240743B (en) Artificial intelligence integrated circuit
WO2023198150A1 (en) Data compression method for electroencephalogram data, chip, device, and storage medium
US20220083857A1 (en) Convolutional neural network operation method and device
US11487342B2 (en) Reducing power consumption in a neural network environment using data management
CN111491169B (en) Digital image compression method, device, equipment and medium
CN115880132A (en) Graphics processor, matrix multiplication task processing method, device and storage medium
CN111507465A (en) Configurable convolutional neural network processor circuit
CN110515587B (en) Multiplier, data processing method, chip and electronic equipment
Li et al. A hardware-efficient computing engine for FPGA-based deep convolutional neural network accelerator
WO2021073638A1 (en) Method and apparatus for running neural network model, and computer device
CN111258541B (en) Multiplier, data processing method, chip and electronic equipment
WO2023040389A1 (en) Data type conversion method, storage medium, device, and printed circuit board
CN110673802B (en) Data storage method and device, chip, electronic equipment and board card
CN111381875B (en) Data comparator, data processing method, chip and electronic equipment
CN111382853B (en) Data processing device, method, chip and electronic equipment
CN111382852B (en) Data processing device, method, chip and electronic equipment
CN111382856B (en) Data processing device, method, chip and electronic equipment
CN110515586B (en) Multiplier, data processing method, chip and electronic equipment
WO2023232079A1 (en) Data storage method, data access method, data computing method, and related product
US20230214327A1 (en) Data processing device and related product
CN210006084U (en) Multiplier and method for generating a digital signal
CN111381802B (en) Data comparator, data processing method, chip and electronic equipment
CN113128673B (en) Data processing method, storage medium, neural network processor and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23787792

Country of ref document: EP

Kind code of ref document: A1