A loop-free real-time streaming system applied to electroencephalogram
By combining a lock-free circular buffer with deep learning algorithms, the real-time performance and flexibility issues of the EEG system were resolved, achieving efficient data processing and feature extraction, and improving the system's response speed and adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NINGXIA XIANGRUI INTELLIGENT TECH CO LTD
- Filing Date
- 2025-01-16
- Publication Date
- 2026-04-28
AI Technical Summary
Existing EEG systems are inadequate in terms of real-time performance and flexibility. Fixed-size buffers can lead to data loss or overflow, and locking operations increase system overhead and affect response speed.
It employs a lock-free circular buffer and processing unit, stores EEG signals through a circular array, and utilizes deep learning algorithms for data preprocessing and classification, eliminating the bottleneck caused by lock operations and achieving multi-threaded concurrency.
It improves the system's real-time performance and response speed, reduces program overhead, adapts to different data volume changes, and meets the feature extraction needs of different individuals.
Smart Images

Figure CN119587047B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of brain neurophysiological detection technology, specifically relating to a lock-free ring real-time streaming system for electroencephalography (EEG). Background Technology
[0002] Electroencephalography (EEG), an important non-invasive technique, is used to record the electrical activity of the brain and plays a crucial role in neuroscience research, psychological research, and the diagnosis of clinical neurological diseases (such as epilepsy detection). By placing electrodes on the scalp, the EEG system can capture and transmit the minute electrical signals generated by the activity of brain cells, providing real-time information on the dynamic changes in the brain.
[0003] However, current EEG systems face several challenges in terms of real-time performance: 1. Defects in data buffering mechanisms: Existing EEG signal acquisition systems use fixed-size buffers and operate in a one-time access manner. This design lacks flexibility and cannot adapt to changes in data flow under different experimental conditions. For example, when signal acquisition is accelerated or experimental conditions change, the buffer cannot quickly adjust its access resources, easily leading to data loss or overflow. 2. Fixed-size buffers cannot enable simultaneous access by multiple objects. Locking mechanisms are needed during data access to ensure data consistency and integrity. However, the use of locks significantly increases system program overhead. In a multi-threaded environment, this can lead to thread contention and waiting, affecting the real-time system response speed. Especially under high-load conditions with frequent data updates, excessive locking operations may cause latency to exceed the real-time requirements of the system design, thereby reducing the EEG system's ability to respond to rapid dynamic changes in EEG signals.
[0004] Therefore, the present invention provides a lockless loop real-time streaming system for electroencephalography to solve the above-mentioned technical problems. Summary of the Invention
[0005] To address the aforementioned problems, the present invention aims to provide a lock-free, real-time streaming system for electroencephalography (EEG) that can flexibly adapt to dynamic changes in data flow, effectively reduce system overhead, and improve program execution speed and response efficiency.
[0006] The present invention provides a lockless circular real-time streaming system for electroencephalography (EEG), comprising an acquisition unit, a first lockless circular buffer connected to the acquisition unit, a buffer unit connected to the first lockless circular buffer, a second lockless circular buffer connected to the buffer unit, and a processing unit connected to the second lockless circular buffer.
[0007] The acquisition unit is used to acquire the EEG signals sent by the EEG cap and transmit the EEG signals to the first unlocked circular buffer; and the acquisition unit has the function of adjusting the transmission time length of the EEG signals to the first unlocked circular buffer.
[0008] The first unlock-free circular buffer is used to store the EEG signals received from the acquisition unit in an unlock-free manner; and the data storage structure of the first unlock-free circular buffer is in the form of a circular array.
[0009] The buffer unit is used to read an EEG signal of a preset length from the first unlocked circular buffer, perform data preprocessing on the EEG signal to obtain relevant feature data, and store, package and / or transmit the feature data to the second unlocked circular buffer.
[0010] The second lock-free circular buffer is used to store feature data received from the buffer unit in a lock-free manner; and the data storage structure of the second lock-free circular buffer is in the form of a circular array.
[0011] The processing unit is used to extract feature data from the second unlocked circular buffer, suspend the thread, and use a deep learning algorithm to classify the feature data.
[0012] Preferably, the data preprocessing operation includes an anomaly detection operation and a data feature extraction operation; the anomaly detection operation uses statistical methods to determine whether the EEG signal read from the first unlocked circular buffer is a useless abnormal signal. If it is determined to be an abnormal signal, the EEG signal is discarded; if it is determined to be a normal EEG signal, the subsequent data feature extraction operation is performed.
[0013] Preferably, the data feature extraction operation uses different algorithms to extract EEG signals of a preset length for analysis. After obtaining the analysis results, the feature extraction matrix is adjusted in a timely manner based on the analysis results. Based on the adjusted feature extraction matrix, features are extracted from EEG signals that are determined to be normal to obtain feature data.
[0014] Preferably, the step of using statistical methods to determine whether the EEG signal read from the first unlocked circular buffer is a useless abnormal signal specifically includes: a calculation operation, calculating the mean, variance, and standard deviation of the EEG signal read from the first unlocked circular buffer to obtain the calculation result; and a comparison operation, comparing the calculation result with a preset normal range value, and determining that the EEG signal is an abnormal signal if it exceeds the preset normal range value.
[0015] Preferably, the acquisition unit, the first unlocked circular buffer, the buffer unit, the second unlocked circular buffer, and the processing unit are connected via a specific high-speed communication interface.
[0016] Compared with related technologies, the present invention provides a lock-free circular real-time streaming system for electroencephalography (EEG), comprising an acquisition unit, a first lock-free circular buffer, a buffer unit, a second lock-free circular buffer, and a processing unit; the acquisition unit is used to acquire EEG signals; the first lock-free circular buffer is used to store the EEG signals received from the acquisition unit in a lock-free manner; the buffer unit is used to perform data preprocessing operations on the EEG signals read from the first lock-free circular buffer to obtain relevant feature data, and to store, package, and / or transmit the feature data to the second lock-free circular buffer; the second lock-free circular buffer is used to store the feature data received from the buffer unit in a lock-free manner; the processing unit is used to extract feature data from the second lock-free circular buffer, suspend the thread, and use a deep learning algorithm to classify the feature data. In the above structure, the first and second lock-free circular buffers do not require locks to achieve data consistency, thereby reducing program complexity and overhead. They also allow continuous data streams to be managed within a single circular structure, flexibly handling different data volumes and enabling real-time data processing and storage, reducing latency. Furthermore, the lock-free design of the first and second circular buffers allows multiple operations to run simultaneously, eliminating thread contention bottlenecks and improving system real-time performance and response speed. The buffer unit enables real-time preprocessing of EEG signal data while transmitting data, allowing for secondary modification of characteristics for different populations, making data preprocessing more tailored to individual needs. Attached Figure Description
[0017] Figure 1 This is a structural block diagram of a lockless circular real-time streaming system for electroencephalography (EEG) according to the present invention.
[0018] Figure 2 This is a schematic diagram of the structure of the first unlocked circular buffer or the second unlocked circular buffer in this invention. Detailed Implementation
[0019] This invention provides a lock-free, real-time streaming system for electroencephalography (EEG), aiming to solve the problems of high program overhead, poor applicability, and low response efficiency in existing EEG systems.
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Please see the appendix Figures 1-2As shown, the present invention provides a lockless circular real-time streaming system for electroencephalography (EEG), including an acquisition unit 1, a first lockless circular buffer 2 connected to the acquisition unit 1, a buffer unit 3 connected to the first lockless circular buffer 2, a second lockless circular buffer 4 connected to the buffer unit 3, and a processing unit 5 connected to the second lockless circular buffer 4.
[0022] The acquisition unit 1 is used to acquire the EEG signals sent by the EEG cap and transmit the EEG signals to the first unlocked circular buffer 2; and the acquisition unit 1 has the function of adjusting the transmission time length of the EEG signals to the first unlocked circular buffer 2.
[0023] The first unlocked circular buffer 2 is used to store the EEG signals received from the acquisition unit 1 in an unlocked manner; and the data storage structure of the first unlocked circular buffer 2 is in the form of a circular array.
[0024] The buffer unit 3 is used to read a preset length of EEG signal from the first unlocked circular buffer 2, perform data preprocessing on the EEG signal to obtain relevant feature data, and store, package and / or transmit the feature data to the second unlocked circular buffer 4.
[0025] The second lock-free circular buffer 4 is used to store feature data received from the buffer unit 3 in a lock-free manner; and the data storage structure of the second lock-free circular buffer 4 is in the form of a circular array.
[0026] The processing unit 5 is used to extract feature data from the second unlocked circular buffer 4, suspend the thread, and use a deep learning algorithm to classify the feature data.
[0027] In the above structure, the first lock-free circular buffer 2 and the second lock-free circular buffer 4 do not require locks to achieve data consistency, thereby reducing program complexity and overhead. They also allow continuous data streams to be managed within a circular structure, flexibly handling different data volumes and enabling real-time data processing and storage, reducing latency. Furthermore, the lock-free design of the first lock-free circular buffer 2 and the second lock-free circular buffer 4 allows multiple operations to be performed simultaneously, eliminating thread contention bottlenecks and improving system real-time performance and response speed. The buffer unit 3 enables real-time preprocessing of EEG signal data while transmitting data, allowing for secondary modification of characteristics for different populations, making data preprocessing more adaptable to different individuals.
[0028] It should be noted that the first lock-free circular buffer 2 and the second lock-free circular buffer 4 adopt the form of a circular array. Through multi-threaded communication and logic design, the operation of the buffer unit 3 and the processing unit 5 from one array will not cause conflict. Therefore, there is no need to add locks, which allows the operation to be performed simultaneously, greatly improving the concurrency of the operation. At the same time, the access logic is designed to avoid accessing incorrect data, ensuring the accuracy of access. The operation has almost no delay, thereby reducing latency.
[0029] In this embodiment, the data preprocessing operation includes anomaly detection and data feature extraction. The anomaly detection operation uses statistical methods to determine whether the EEG signal read from the first unlocked circular buffer 2 is a useless abnormal signal. If it is determined to be an abnormal signal, the EEG signal is discarded. If it is determined to be a normal EEG signal, the subsequent data feature extraction operation is performed. The data feature extraction operation uses different algorithms to extract EEG signals of a preset length for analysis. After obtaining the analysis results, the feature extraction matrix is adjusted in a timely manner based on the analysis results. Based on the adjusted feature extraction matrix, features are extracted from the EEG signals determined to be normal to obtain feature data.
[0030] Specifically, the method of using statistical methods to determine whether the EEG signal read from the first unlocked circular buffer is a useless abnormal signal includes: a calculation operation, which calculates the mean, variance, and standard deviation of the EEG signal read from the first unlocked circular buffer 2 to obtain the calculation result; and a comparison operation, which compares the calculation result with a preset normal range value, and if it exceeds the preset normal range value, the EEG signal is determined to be an abnormal signal.
[0031] In this embodiment, the acquisition unit 1, the first unlocked circular buffer 2, the buffer unit 3, the second unlocked circular buffer 4, and the processing unit 5 are connected via a specific high-speed communication interface. This high-speed communication interface features data encryption, error checking, and flow control functions, ensuring secure, accurate, and stable data transmission.
[0032] Compared with related technologies, the present invention provides a lock-free circular real-time streaming system for electroencephalography (EEG), comprising an acquisition unit, a first lock-free circular buffer, a buffer unit, a second lock-free circular buffer, and a processing unit; the acquisition unit is used to acquire EEG signals; the first lock-free circular buffer is used to store the EEG signals received from the acquisition unit in a lock-free manner; the buffer unit is used to perform data preprocessing operations on the EEG signals read from the first lock-free circular buffer to obtain relevant feature data, and to store, package, and / or transmit the feature data to the second lock-free circular buffer; the second lock-free circular buffer is used to store the feature data received from the buffer unit in a lock-free manner; the processing unit is used to extract feature data from the second lock-free circular buffer, suspend the thread, and use a deep learning algorithm to classify the feature data. In the above structure, the first and second lock-free circular buffers do not require locks to achieve data consistency, thereby reducing program complexity and overhead. They also allow continuous data streams to be managed within a single circular structure, flexibly handling different data volumes and enabling real-time data processing and storage, reducing latency. Furthermore, the lock-free design of the first and second circular buffers allows multiple operations to run simultaneously, eliminating thread contention bottlenecks and improving system real-time performance and response speed. The buffer unit enables real-time preprocessing of EEG signal data while transmitting data, allowing for secondary modification of characteristics for different populations, making data preprocessing more tailored to individual needs.
[0033] The above-described embodiments should be understood as illustrative, not as limiting the scope of protection of this invention, which is defined by the claims. For those skilled in the art, non-essential improvements and adjustments made to this invention without departing from its essence and scope still fall within the scope of protection of this invention.
Claims
1. A lock-free, real-time streaming system for electroencephalography (EEG), characterized in that, The system includes a data acquisition unit, a first unlocked circular buffer connected to the data acquisition unit, a buffer unit connected to the first unlocked circular buffer, a second unlocked circular buffer connected to the buffer unit, and a processing unit connected to the second unlocked circular buffer. The acquisition unit is used to acquire the EEG signals sent by the EEG cap and transmit the EEG signals to the first unlocked circular buffer; and the acquisition unit has the function of adjusting the transmission time length of the EEG signals to the first unlocked circular buffer. The first unlock-free circular buffer is used to store the EEG signals received from the acquisition unit in an unlock-free manner; and the data storage structure of the first unlock-free circular buffer is in the form of a circular array. The buffer unit is used to read an EEG signal of a preset length from the first unlocked circular buffer, perform data preprocessing on the EEG signal to obtain relevant feature data, and store, package and / or transmit the feature data to the second unlocked circular buffer. The second lock-free circular buffer is used to store feature data received from the buffer unit in a lock-free manner; and the data storage structure of the second lock-free circular buffer is in the form of a circular array. The processing unit is used to extract feature data from the second unlocked circular buffer, suspend the thread, and use a deep learning algorithm to classify the feature data. The data preprocessing operation includes anomaly detection and data feature extraction. The anomaly detection operation uses statistical methods to determine whether the EEG signal read from the first unlocked circular buffer is a useless abnormal signal. If it is determined to be an abnormal signal, the EEG signal is discarded. If it is determined to be a normal EEG signal, the subsequent data feature extraction operation is performed. The data feature extraction operation uses different algorithms to extract EEG signals of a preset length for analysis. After obtaining the analysis results, the feature extraction matrix is adjusted in a timely manner based on the analysis results. Based on the adjusted feature extraction matrix, features are extracted from EEG signals that are determined to be normal to obtain feature data. The acquisition unit, the first unlocked circular buffer, the buffer unit, the second unlocked circular buffer, and the processing unit are connected via a specific high-speed communication interface.
2. The lock-free real-time streaming system for electroencephalography (EEG) according to claim 1, characterized in that, The method of using statistical methods to determine whether the EEG signal read from the first unlocked circular buffer is a useless abnormal signal specifically includes: a calculation operation, which calculates the mean, variance, and standard deviation of the EEG signal read from the first unlocked circular buffer to obtain the calculation result; and a comparison operation, which compares the calculation result with a preset normal range value, and if it exceeds the preset normal range value, the EEG signal is determined to be an abnormal signal.
Citation Information
Patent Citations
Personalized model with regular integration of data
CN107092771A
Data processing method and device, and electronic equipment
CN114090275A