An electroencephalogram sleep staging review priority generation method, system, electronic device and storage medium
Patent Information
- Application Number
- CN202610880826.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-17
- Publication Date
- 2026-09-29
AI Technical Summary
[0004]现有自动睡眠分期方法至少存在以下不足:第一、模型输出的预测标签通常被同等对待,缺少片段级可靠性评价;第二、部分方法虽然能够输出预测概率或置信度,但未充分结合预测熵和最高概率与次高概率之间的间隔来衡量不确定性;第三、N1阶段具有明显的过渡性和模糊性,容易与W、N2和REM混淆,但现有方法通常缺少针对N1相关片段的复核提示;第四、睡眠阶段在生理上连续变化,而标准睡眠分期采用离散标签,阶段转移邻近片段往往具有混合特征,现有方法通常未将阶段转移信息用于复核优先级生成
(1)本发明不限定自动睡眠分期模型的具体网络结构、特征提取方式或训练方式,只要求模型能够输出类别概率,因此可作为多种自动睡眠分期模型的后处理复核模块。
Smart Images

Figure CN122839102A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of biomedical signal processing and artificial intelligence-assisted analysis technology, specifically to a method, system, electronic device, and storage medium for generating priority for EEG sleep staging review. Background Technology
[0002] Sleep staging is a fundamental step in sleep monitoring and sleep structure analysis. Typically, overnight EEG recordings are divided into consecutive 30-second segments, each labeled as wakefulness (W), non-rapid eye movement (N1) sleep, N2 sleep, N3 sleep, and rapid eye movement (REM) sleep. Traditional sleep staging relies on professionals interpreting each segment individually, which is labor-intensive and prone to scoring discrepancies in N1 stages, sleep stage transition areas, and segments with poor signal quality.
[0003] With the development of deep learning technology, automated EEG sleep staging models can now output the predicted stage and its corresponding probability for each sleep segment based on single-channel or multi-channel EEG signals. However, existing methods often focus on improving overall classification accuracy, typically outputting predicted labels directly without further differentiation on the reliability of the prediction results. In actual review, human reviewers need to know not only the sleep stages predicted by the model, but also which sleep segments are more likely to have prediction errors, which segments are near stage boundaries, and which segments may involve N1 stage-related confusion.
[0004] Existing automatic sleep staging methods have at least the following shortcomings: First, the predicted labels output by the model are usually treated equally, lacking segment-level reliability evaluation; Second, although some methods can output predicted probabilities or confidence levels, they do not fully combine prediction entropy and the interval between the highest and second-highest probabilities to measure uncertainty; Third, the N1 stage has obvious transition and ambiguity, and is easily confused with W, N2, and REM, but existing methods usually lack review prompts for N1-related segments; Fourth, sleep stages change continuously physiologically, while standard sleep staging uses discrete labels, and adjacent segments of stage transitions often have mixed characteristics, and existing methods usually do not use stage transition information for review priority generation. Summary of the Invention
[0005] To address the problems existing in the prior art, the present invention provides a method, system, electronic device, and storage medium for generating priority for EEG sleep staging review.
[0006] To achieve the above objectives, the technical solution of the present invention is as follows: A method for generating priority for EEG sleep staging review is provided, the innovation of which lies in the following steps: S1. Divide the continuous EEG sleep recording into several equal-length sleep segments, and output the five-class probability vector of each sleep segment through an automatic sleep staging model; S2. Based on the five-class probability vector obtained in S1, the sleep stage corresponding to the maximum predicted probability of each sleep segment is taken as the predicted sleep stage of that sleep segment, and a sequence of predicted sleep stages for consecutive sleep segments is generated. S3. Based on the predicted sleep stages obtained in S2, calculate the prediction confidence, prediction entropy, and probability interval for each sleep segment, and calculate the comprehensive uncertainty score. S4. Based on the N1 stage probability information obtained from S1, set the N1 related fuzzy verification standard, and add the N1 related fuzzy verification mark to the sleep stage that meets the N1 related fuzzy verification standard. S5. Based on the predicted sleep stage sequence of continuous sleep segments in S2, determine whether there is a stage transition point based on whether the predicted sleep stages of two adjacent sleep segments are the same, construct a set of stage transition points, and calculate the distance from any sleep segment to the nearest stage transition point. If the distance is less than a preset window threshold, add a stage transition neighbor marker. S6. Calculate the verification score based on the comprehensive uncertainty score, N1-related fuzzy verification mark, and stage transition proximity mark. Normalize the verification score, classify the verification level according to the normalized verification score, and output the verification result.
[0007] Preferably, the specific process of S1 is as follows: Continuous EEG sleep recordings are divided into n equal-length sleep segments. For the i-th sleep segment, the automatic sleep staging model outputs a five-category probability vector, represented as: In the formula, K represents the number of sleep stage categories. In the five-category sleep stage classification task, K=5, and the corresponding sleep stage set is {W, N1, N2, N3, REM}, with the sum of the probabilities of each category being 1. k Index for sleep stage categories; Let be the five-class probability vector of the i-th sleep segment; For the i-th sleep segment, is the th The probability of different sleep stages; Preferably, S2 is specifically represented as follows: For the five-class probability vector of the i-th sleep segment The sleep stage corresponding to the highest predicted probability of a sleep segment is taken as the predicted sleep stage of that sleep segment, using the following formula: In the formula, The predicted sleep stage for the i-th sleep segment is represented as follows: The predicted sleep stage sequence for n equal-length sleep segments is represented as follows: .
[0008] Preferably, the specific process of S3 is as follows: S3.1 Calculate the prediction confidence level For the i-th sleep segment, its prediction confidence The calculation formula is: S3.2 Calculate the predicted entropy For the i-th sleep segment, its prediction entropy The calculation formula is: When the predicted probabilities are concentrated in a single class Smaller; when the predicted probabilities of multiple categories are relatively close, An increase indicates greater uncertainty in the prediction of that sleep segment; S3.3 Calculate the probability interval Sort the five-class probabilities of the i-th sleep segment in descending order, and denote the highest predicted probability as . The second highest prediction probability is denoted as Then the probability interval Represented as: S3.4 Calculate the comprehensive uncertainty score Based on prediction confidence Predicting entropy and probability interval Calculate the comprehensive uncertainty score ; The weighted fusion method is used to calculate the overall uncertainty score, and the formula is as follows: In the formula, , and These are the weighting coefficients, and + + =1, the weighting coefficient can be adjusted according to the verification data, review requirements or different application scenarios; () indicates a low confidence level term; This represents the normalized prediction entropy term; Indicates a low-probability interval term; Preferably, the specific process of S4 is as follows: Let the index of stage N1 in the set of sleep stage categories be 2, that is, for stage N1 sleep...k Let the probability be 2, and the predicted probability that the i-th sleep segment belongs to stage N1 be denoted as . When the i-th sleep segment satisfies any of the following N1-related fuzzy verification criteria, an N1-related fuzzy verification mark is added to it. : (1) The predicted sleep stage is N1. ; (2) N1 is the category corresponding to the second highest predicted probability of this sleep segment. ; (3) Predicted probability of N1 Greater than the preset threshold , ; When any of the above conditions are met, the N1-related fuzzy verification mark is... ,otherwise ; This indicates that the i-th sleep segment is labeled as an N1-related fuzzy kernel segment. This indicates that the flag was not triggered.
[0009] Preferably, the specific process of S5 is as follows: The predicted sleep stage sequence for consecutive sleep segments is as follows: In the formula, This represents the predicted sleep stage of the i-th sleep segment. If the predicted sleep stages of two adjacent sleep segments are different, that is: It is then assumed that there is a stage transition point between sleep segments i and i+1; All stage transition points constitute a set : gather The data in the table is an index of the sleep segment to the left of each stage transition point; For any sleep segment, calculate its distance to the nearest stage transition point, denoted as . The calculation formula is: in, For from set The integer index retrieved from the array; Indicates the first The sleep segment and the first The stage transition points between sleep segments; if no stage transition point exists, then let ; Centered on the phase transition point, it covers both forward and backward. A sleep segment; when At that time, add a stage transition neighbor marker to the i-th sleep stage. Phase transition neighbor marker Represented as: When d i ≤w, Add a phase transfer neighbor marker When d i >w, No stage transfer neighbor marker added This is the preset window threshold.
[0010] Preferably, the specific process of S6 is as follows: S6.1, Based on the comprehensive uncertainty score N1 related fuzzy verification markers and phase transition neighbor markers Generate review scores : in, and To label the weights; and All are binary labels, with values of 0 or 1; S6.2, according to A queue of sleep segments to be reviewed is generated by sorting them from high to low. Normalization : in, and These are the minimum and maximum values of the review enhancement score in the current continuous sleep recording, respectively; when = At that time, all fragments can be... Set to 0; S6.3 The review level is generated according to the following rules: (1) When At that time, a first-level review priority is generated, indicating that it is recommended to review it first; (2) When At that time, a secondary review priority is generated, indicating that it is recommended to pay close attention to this matter; (3) When At that time, a three-level review priority is generated, indicating that it can be viewed when review resources allow; (4) When In such cases, the segment may be excluded from the priority review queue or retained as a regular review segment. S6.4 Review Reason Generation The reasons for review are automatically generated based on the triggering conditions, including low confidence, high prediction entropy, low probability interval, target confusion related to sleep stage, and adjacent stage transition. S6.5 Output the verification results Based on the review score, review priority, and review reason generated by S9, the review results are output, including sleep segment number, predicted sleep stage, and prediction confidence. Predicting entropy probability interval Comprehensive uncertainty score N1 related fuzzy verification markers and phase transition neighbor markers Review priority and reasons for review.
[0011] The present invention also provides a system for implementing the above-mentioned method for generating priority of EEG sleep stage review, the innovation of which is: including a probability acquisition module, an uncertainty calculation module, a target stage marking module, a transfer proximity marking module, a priority generation module and a result output module; The probability acquisition module is used to implement S1 and S2, the uncertainty calculation module is used to implement S3, the target stage marking module is used to implement S4, the transfer neighbor marking module is used to implement S5, and the priority generation module and the result output module are used to implement S6.
[0012] The present invention also provides an electronic device for implementing the above-mentioned method for generating priority for EEG sleep staging review. Its innovation lies in that it includes one or more processors and a memory, the memory storing a computer program. When the computer program is executed by one or more processors, the electronic device executes the method for generating priority for EEG sleep staging review.
[0013] The present invention also provides a computer-readable storage medium for implementing the above-mentioned method for generating priority of EEG sleep staging review. Its innovation lies in that: the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the above-mentioned method for generating priority of EEG sleep staging review. Computer-readable storage media include read-only memory, random access memory, magnetic disk, optical disk, removable storage device or other media capable of storing program code.
[0014] This invention provides a method, system, electronic device, and storage medium for generating priority for EEG sleep staging review, which has the following beneficial effects: (1) This invention does not limit the specific network structure, feature extraction method or training method of the automatic sleep staging model, but only requires that the model can output class probability. Therefore, it can be used as a post-processing verification module for various automatic sleep staging models.
[0015] (2) This invention does not rely on real labels to participate in the generation of review priorities and is applicable to the sorting of review results in actual deployment; real labels are only used in retrospective study verification.
[0016] (3) This invention uses three perspectives—low confidence, high prediction entropy, and small probability interval—to characterize uncertainty, which can reflect the fragment-level prediction ambiguity more comprehensively than a single confidence index.
[0017] (4) The present invention introduces a target easily confused sleep stage review marker and a stage transition proximity marker, which can prompt reviewers to pay attention to N1 related ambiguous segments and segments near the sleep stage boundary, thereby improving the relevance and interpretability of the review queue.
[0018] (5) The present invention outputs the reasons for review, so that reviewers can not only obtain the order of the segments to be reviewed, but also understand the basis for recommending each segment for review. Attached Figure Description
[0019] Figure 1 This is an overall flowchart of the method for generating priority for EEG sleep staging review in this invention.
[0020] Figure 2 This is a flowchart illustrating the calculation process for prediction confidence, prediction entropy, and probability interval in this invention.
[0021] Figure 3 This is a schematic diagram illustrating the generation of the comprehensive uncertainty score in this invention.
[0022] Figure 4 This is a schematic diagram of the N1 verification mark generation in this invention.
[0023] Figure 5 This is a schematic diagram of the generation of neighboring markers for stage transition in this invention.
[0024] Figure 6 This is a schematic diagram illustrating the review priority and review reason output in this invention.
[0025] Figure 7 This is a block diagram of the brainwave sleep staging review priority generation system of the present invention. Detailed Implementation
[0026] The present invention will be further described in detail below with reference to specific embodiments and accompanying drawings, but the scope of protection of the present invention is not limited to the content described.
[0027] This invention proposes a method for generating review priorities for EEG sleep staging based on uncertainty and stage transition information. This method utilizes the five-category probability vector output by an automatic sleep staging model to calculate prediction confidence, prediction entropy, and probability interval, constructing a comprehensive uncertainty score. It then combines N1-related information and stage transition proximity information to generate review priorities and reasons for review, thereby assisting human reviewers in prioritizing high-risk sleep segments within a limited review time.
[0028] Appendix Figure 1 This invention provides an overall flowchart for a method to generate priority for EEG sleep staging review. The specific steps of this method are as follows: S1. Obtain the category probability sequence output by the automatic sleep staging model. The continuous EEG sleep recordings are divided into n equal-length sleep segments (each segment is preferably 30 seconds long). For the i-th sleep segment, the automatic sleep staging model outputs a five-category probability vector, represented as follows: In the formula, K represents the number of sleep stage categories. In the five-category sleep stage classification task, K=5, and the corresponding sleep stage set is {W, N1, N2, N3, REM}, with the sum of the probabilities of each category being 1. k Index for sleep stage categories; Let be the five-class probability vector of the i-th sleep segment; For the i-th sleep segment, is the... The probability of different sleep stages; Automatic sleep staging models are not limited to specific network structures, feature extraction methods, or training methods, as long as they can output sleep stage category probabilities for each sleep segment. Automatic sleep staging models can be machine learning classifier-based models, convolutional neural network models, recurrent neural network models, convolutional-recurrent joint models, attention mechanism models, Transformer models, or fully convolutional sleep staging models; for example, YASA, U-Sleep, DeepSleepNet, TinySleepNet, SeqSleepNet, AttnSleep, SleepTransformer, or other trained automatic sleep staging models that can output five-category probability vectors (W, N1, N2, N3, REM) can be used.
[0029] S2. Determine the predicted sleep stage for each sleep segment. The five-class probability vector of the i-th sleep segment obtained based on S1 The sleep stage corresponding to the highest predicted probability is taken as the predicted sleep stage for that sleep segment, using the following formula: In the formula, This represents the predicted sleep stage of the i-th sleep segment.
[0030] The predicted sleep stage sequence of n equal-length sleep segments is represented as follows: .
[0031] S3. Calculate the prediction confidence level Prediction confidence is used to represent the degree of certainty regarding the current prediction result. For the i-th sleep segment, its prediction confidence is... The calculation formula is: In the formula, The larger the value, the more certain the current predicted sleep stage is; The smaller the value, the less certainty there is about the current predicted sleep stage, and the more likely the current sleep segment has a high verification value.
[0032] The confidence sequence of n sleep segments of equal length is as follows: .
[0033] S4. Calculate the prediction entropy Prediction entropy measures the degree of uncertainty in a five-category probability distribution. For the i-th sleep segment, its prediction entropy is... The calculation formula is: When the predicted probabilities are concentrated in a single class Smaller; when the predicted probabilities of multiple categories are relatively close, An increase indicates greater uncertainty in the prediction of that sleep segment. For example: if The probabilities of the two sleep stages are 38% and 34% respectively, which are quite close. The calculated value is approximately 1.369, which is relatively large. If... The probability of it being one of the sleep stages is 0.95, which differs significantly from the other predicted probabilities. It is approximately 0.265, which is relatively small.
[0034] The predicted entropy sequence of n sleep segments of equal length is: .
[0035] S5. Calculate the probability interval Sort the five-class probabilities of the i-th sleep segment in descending order, and denote the highest predicted probability as . The second highest prediction probability is denoted as Then the probability interval Represented as: In the formula, The larger the value, the more significant the difference between the highest candidate sleep stage and the second highest candidate sleep stage. The smaller the value, the stronger the competition between the two candidate stages, and the more likely the sleep segment is to have stage ambiguity.
[0036] The probability interval sequence of n sleep segments of equal length is: The flowchart for calculating prediction confidence, prediction entropy, and probability interval is as follows: Figure 2 As shown.
[0037] S6. Calculate the overall uncertainty score. Based on prediction confidence Predicting entropy and probability interval Calculate the comprehensive uncertainty score .
[0038] The weighted fusion method is used to calculate the overall uncertainty score, and the formula is as follows: In the formula, , and These are the weighting coefficients, and + + =1, the weighting coefficient can be adjusted according to the verification data, review requirements or different application scenarios. () indicates a low confidence level term; This represents the normalized prediction entropy term; ) represents a low-probability interval term. The larger the value, the more priority the i-th sleep segment needs to be reviewed.
[0039] In one implementation, the overall uncertainty score can also be calculated in the following way: The higher the overall uncertainty score, the higher the review priority for the corresponding sleep segment. The overall uncertainty score for all sleep segments... The scores are sorted from highest to lowest. A diagram illustrating the generation of comprehensive uncertainty scores is shown below. Figure 3 As shown, Figure 3 In this context, Scori represents the overall uncertainty score, which is equivalent to... .
[0040] In the specific implementation process, the comprehensive uncertainty score is considered. The underlying prediction uncertainty is used to characterize the i-th sleep segment. (Comprehensive uncertainty score) This can serve as the basis for subsequent review score calculations, and the final review priority is determined by the comprehensive uncertainty score. The N1-related fuzzy verification mark and the stage transition neighbor mark are generated together.
[0041] S7. Generate N1-related fuzzy verification markers. N1 is a transitional stage in sleep stages and is easily confused with W, N2, and REM. In order to prompt human reviewers to pay attention to N1-related segments, this invention generates N1 review markers based on N1-related probability information.
[0042] Let the index of stage N1 in the set of sleep stage categories be 2, that is, for stage N1 sleep... k Let the probability be 2, and the predicted probability that the i-th sleep segment belongs to stage N1 be denoted as . When the i-th sleep segment satisfies any of the following conditions, add an N1-related fuzzy verification mark to it. : (1) The predicted sleep stage is N1, i.e. ; (2) N1 is the category corresponding to the second highest predicted probability of this sleep segment, i.e. ; (3) Predicted probability of N1 Greater than the preset threshold ,Right now .
[0043] When any one of the above conditions is met, the N1-related fuzzy verification mark is... ,otherwise ; This indicates that the i-th sleep segment is labeled as an N1-related fuzzy kernel segment. This indicates that the flag was not triggered.
[0044] A schematic diagram of N1-related fuzzy verification mark generation is shown below. Figure 4 As shown, even if a sleep segment is not N1 in the final prediction stage, it can still be marked as an N1-related verification segment as long as N1 exists as a high-probability candidate category.
[0045] S8, Generation Phase: Transfer Neighbor Markers The predicted sleep stage sequence for consecutive sleep segments is as follows: In the formula, This represents the predicted sleep stage of the i-th sleep segment. If the predicted sleep stages of two adjacent sleep segments are different, that is: It is then assumed that there is a stage transition point between sleep segments i and i+1; All stage transition points constitute a set : gather The data in the table is the index of the sleep segment to the left of each stage transition point.
[0046] For any sleep segment, calculate its distance to the nearest stage transition point, denoted as . , The calculation formula is: in, For from set The integer index retrieved from the array; Indicates the first The sleep segment and the first The stage transition points between sleep segments. If no stage transition point exists, then let .
[0047] i represents the index of the sleep segment whose distance is to be calculated. This represents the index of the sleep segment to the left of the nearest stage transition point to the i-th sleep segment. Both are segment indices. When calculating the distance, the actual position of the stage transition point is located using j+0.5, and the absolute value of the difference between it and the center position of segment i is added to 0.5 as the distance metric.
[0048] Centered on the phase transition point, it covers both forward and backward. A sleep segment; when At that time, add a stage transition neighbor marker to the i-th sleep stage. Phase transition neighbor marker Represented as: When d i ≤w, Add a phase transfer neighbor marker When d i >w, No stage transfer neighbor marker added The optimal value for w is 2, meaning the preset window range is two sleep segments before and after the stage transition point, for a total of four segments, corresponding to approximately one minute before and after the transition point in physiological time (each segment is 30 seconds). A schematic diagram of stage transition proximity marker generation with w=2 is shown below. Figure 5 As shown.
[0049] S9. Generate review score, review priority, and review reason. S9.1, Based on the comprehensive uncertainty score ,N-related fuzzy verification markers and phase transition neighbor markers Generate review scores : in, and Weights were assigned to the labels to adjust for the target's easily confused sleep stage review labels. and phase transition neighbor marker Impact on review priority. and All are binary labels, with values of 0 or 1. The larger the value, the more priority the sleep segment needs to be reviewed.
[0050] S9.2, according to A queue of sleep segments to be reviewed is generated by sorting them from high to low. Normalization : in, and These are the minimum and maximum values of the review enhancement score in the current continuous sleep recording, respectively. When = At that time, all fragments can be... Set it to 0.
[0051] S9.3 The review level is generated according to the following rules: (1) When At that time, a first-level review priority is generated, indicating that it is recommended to review it first; (2) When At that time, a secondary review priority is generated, indicating that it is recommended to pay close attention to this matter; (3) When At that time, a three-level review priority is generated, indicating that it can be viewed when review resources allow; (4) When In some cases, the segment may be excluded from the priority review queue or retained as a regular review segment.
[0052] In another implementation, the review score can also be used. The ranking ratio generates the review priority. For example, the top 10% of sleep segments in Ri are set as Level 1 review priority, the 10% to 30% of sleep segments are set as Level 2 review priority, the 30% to 50% of sleep segments are set as Level 3 review priority, and the remaining segments are treated as regular segments.
[0053] The reasons for review are automatically generated based on triggering conditions, including but not limited to low confidence, high prediction entropy, low probability interval, ambiguity related to easily confused sleep stages, and adjacent stage transitions. For example, when the prediction confidence of a sleep segment is low, the probability interval is small, and it is located near a stage transition point, the review reason "low confidence; low probability interval; adjacent stage transition" can be generated. When a sleep segment is predicted as N1 and the prediction entropy is high, the review reason "high prediction entropy; N1 related ambiguity" can be generated.
[0054] S10, Output the verification results.
[0055] Based on the review score, review priority, and review reason generated by S9, the review results are output, including sleep segment number, predicted sleep stage, and prediction confidence. Predicting entropy probability interval Comprehensive uncertainty score N1 related fuzzy verification markers and phase transition neighbor markers Review priority and review reasons. A diagram illustrating the review priority and review reasons is shown below. Figure 6 As shown.
[0056] In research validation scenarios where real sleep stages are manually labeled, real labels can be used to evaluate the effectiveness of the review cohort, such as calculating the false capture rate, review precision, error enrichment factor, N1 false capture rate, and stage transition area false capture rate. It should be noted that real labels are only used for retrospective evaluation and are not involved in the calculation of the overall uncertainty score or the review priority generation process.
[0057] This invention also provides a system for generating priority for EEG sleep staging review based on uncertainty and stage transition information, such as... Figure 7 As shown, it includes a probability acquisition module, an uncertainty calculation module, a target stage marking module, a transition neighbor marking module, a priority generation module, and a result output module.
[0058] The probability acquisition module is used to acquire the category probability sequence output by the automatic sleep staging model for continuous EEG sleep segments and determine the predicted sleep stage, which is used to implement S1 and S2.
[0059] The uncertainty calculation module calculates prediction confidence, prediction entropy, probability interval, and comprehensive uncertainty score based on the category probability sequence, which is used to implement S3-S6.
[0060] The target stage marking module is used for N1-related fuzzy verification marking, and is used to implement S7.
[0061] The transition neighbor marker module identifies stage transition points based on the predicted sleep stage sequence and generates stage transition neighbor markers to implement S8.
[0062] The priority generation module combines the comprehensive uncertainty score, N1-related fuzzy verification mark, and stage transition proximity mark to generate verification priorities and verification reasons, which are used to implement S9.
[0063] The result output module is used to output the verification results, which is used to implement S10.
[0064] This invention also provides an electronic device for generating EEG sleep staging review priorities based on uncertainty and stage transition information, comprising one or more processors and a memory, wherein the memory stores a computer program. When the computer program is executed by one or more processors, the electronic device performs the aforementioned EEG sleep staging review priority generation method.
[0065] The present invention can also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the above-described method for generating priority for EEG sleep staging review. The computer-readable storage medium includes a read-only memory, a random access memory, a magnetic disk, an optical disk, a portable storage device, or other media capable of storing program code.
[0066] Based on the above technical solution, the present invention provides the following embodiments to further illustrate the present invention: Example 1 This embodiment includes five consecutive 30-second EEG sleep segments. The class probability order output by the automatic sleep staging model is assumed to be W, N1, N2, N3, REM. The overall uncertainty score is calculated using the following formula: Let N1 be the probability threshold. Phase transition window Mark weights , .
[0067] The model output probabilities for the 5 sleep segments are as follows: The probability vector for the first segment is [0.82, 0.08, 0.05, 0.02, 0.03], and the predicted sleep stage is W; The probability vector for the second segment is [0.38, 0.34, 0.14, 0.04, 0.10], and the predicted sleep stage is W; The probability vector for the third segment is [0.20, 0.43, 0.25, 0.02, 0.10], and the predicted sleep stage is N1; The probability vector for the fourth segment is [0.05, 0.18, 0.62, 0.10, 0.05], predicting the sleep stage as N2; The probability vector for the 5th segment is [0.03, 0.07, 0.83, 0.04, 0.03], and the predicted sleep stage is N2.
[0068] Based on the predicted stage sequence [W, W, N1, N2, N2], stage transitions can be identified between the second and third segments, and between the third and fourth segments. According to the window range ( =2), and the corresponding segment is marked as a neighboring segment of the stage transition. That is, the set of stage transition points is: ={2,3}, representing the stage transition points between the 2nd and 3rd segments and between the 3rd and 4th segments, respectively. Calculate the distance to the nearest stage transition point. Therefore: d1=2, d2=1, d3=1, d4=1, d5=2. Since this embodiment sets the stage transition window w=2, all 5 sleep segments are within the stage transition proximity range, and stage transition proximity markers are added to all of them, i.e.: 1= 2= 3= 4= 5 = 1.
[0069] According to the N1-related fuzzy verification labeling rule, N1 is the second highest probability category in the first segment, therefore =1; In the second segment, N1 is the second highest probability category, and the probability of N1 is 0.34, which is greater than... =0.30, therefore 2=1; the third segment is predicted as N1, therefore 3=1; In the fourth segment, N1 is the second highest probability category, therefore 4=1; In the 5th segment, N1 is the second highest probability category, therefore 5 = 1. Therefore: A1 = A2 = A3 = A4 = A5 = 1.
[0070] Taking the second sleep segment as an example, its prediction confidence level is: , =1.368, probability interval is And N1 is the second highest probability candidate category, therefore This fragment is located within the vicinity of the stage transition, therefore According to the comprehensive uncertainty formula, the comprehensive uncertainty score of this segment is approximately... The score for the review enhancement is: Therefore, the second sleep segment is given a higher review priority, and the review reason can be output as "low confidence; high prediction entropy; small probability interval; N1 correlation ambiguity; neighboring stage transition".
[0071] Similarly, the third sleep segment, predicted as N1 and located in the vicinity of the stage transition, can also be assigned a higher review priority. The first and fifth sleep segments, with higher prediction confidence and larger probability intervals, have relatively lower review priorities.
[0072] Through the above implementation process, the present invention can generate a queue of sleep segments to be reviewed based on the model output probability, N1 related fuzzy information and stage transition proximity information without using artificial real sleep stage labels, and provide a corresponding review reason for each segment.
[0073] This method does not require real labels to participate in the generation of review priorities. It only relies on the probability information that can be output by the automatic sleep staging model to rank sleep segments by risk. At the same time, this method combines N1 stage-related information and stage transition information to prompt human reviewers to pay attention to N1-related confusing segments and segments near the stage boundary, which helps to improve the review efficiency and interpretability of EEG sleep staging results.
[0074] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for generating priority for EEG sleep staging review, characterized in that: Specifically, the steps include the following: S1. Divide the continuous EEG sleep recording into several equal-length sleep segments, and output the five-class probability vector of each sleep segment through an automatic sleep staging model; S2. Based on the five-class probability vector obtained in S1, the sleep stage corresponding to the maximum predicted probability of each sleep segment is taken as the predicted sleep stage of that sleep segment, and a sequence of predicted sleep stages for consecutive sleep segments is generated. S3. Based on the predicted sleep stages obtained in S2, calculate the prediction confidence, prediction entropy, and probability interval for each sleep segment, and calculate the comprehensive uncertainty score. S4. Based on the N1 stage probability information obtained from S1, set the N1 related fuzzy verification standard, and add the N1 related fuzzy verification mark to the sleep stage that meets the N1 related fuzzy verification standard. S5. Based on the predicted sleep stage sequence of continuous sleep segments in S2, determine whether there is a stage transition point based on whether the predicted sleep stages of two adjacent sleep segments are the same, construct a set of stage transition points, and calculate the distance from any sleep segment to the nearest stage transition point. If the distance is less than a preset window threshold, add a stage transition neighbor marker. S6. Calculate the verification score based on the comprehensive uncertainty score, N1-related fuzzy verification mark, and stage transition proximity mark. Normalize the verification score, classify the verification level according to the normalized verification score, and output the verification result.
2. The method for generating priority for EEG sleep staging review according to claim 1, characterized in that: The specific process of S1 is as follows: Continuous EEG sleep recordings are divided into n equal-length sleep segments. For the i-th sleep segment, the automatic sleep staging model outputs a five-category probability vector, represented as: In the formula, K represents the number of sleep stage categories. In the five-category sleep stage classification task, K=5, and the corresponding sleep stage set is {W,N1, N2, N3, REM}, with the sum of the probabilities of each category being 1. k Index for sleep stage categories; Let be the five-class probability vector of the i-th sleep segment; For the i-th sleep segment, is the th The probability of different sleep stages.
3. The method for generating priority for EEG sleep staging review according to claim 2, characterized in that: S2 is specifically represented as follows: For the five-class probability vector of the i-th sleep segment The sleep stage corresponding to the highest predicted probability of a sleep segment is taken as the predicted sleep stage of that sleep segment, using the following formula: In the formula, The predicted sleep stage for the i-th sleep segment is represented as follows: The predicted sleep stage sequence for n equal-length sleep segments is represented as follows: .
4. The method for generating priority for EEG sleep staging review according to claim 3, characterized in that: The specific process of S3 is as follows: S3.1 Calculate the prediction confidence level For the i-th sleep segment, its prediction confidence The calculation formula is: S3.2 Calculate the predicted entropy For the i-th sleep segment, its prediction entropy The calculation formula is: When the predicted probabilities are concentrated in a single class Smaller; when the predicted probabilities of multiple categories are relatively close, An increase indicates greater uncertainty in the prediction of that sleep segment; S3.3 Calculate the probability interval Sort the five-class probabilities of the i-th sleep segment in descending order, and denote the highest predicted probability as . The second highest prediction probability is denoted as Then the probability interval Represented as: S3.4 Calculate the comprehensive uncertainty score Based on prediction confidence Predicting entropy and probability interval Calculate the comprehensive uncertainty score ; The weighted fusion method is used to calculate the overall uncertainty score, and the formula is as follows: In the formula, , and These are the weighting coefficients, and + + =1, the weighting coefficient can be adjusted according to the verification data, review requirements or different application scenarios; () indicates a low confidence level term; This represents the normalized prediction entropy term; This represents a low-probability interval term.
5. The method for generating priority for EEG sleep staging review according to claim 4, characterized in that: The specific process of S4 is as follows: Let the index of stage N1 in the set of sleep stage categories be 2, that is, for stage N1 sleep... k Let the probability be 2, and the predicted probability that the i-th sleep segment belongs to stage N1 be denoted as . When the i-th sleep segment satisfies any of the following N1-related fuzzy verification criteria, an N1-related fuzzy verification mark is added to it. : (1) The predicted sleep stage is N1. ; (2) N1 is the category corresponding to the second highest predicted probability of this sleep segment. ; (3) Predicted probability of N1 Greater than the preset threshold , ; When any of the above conditions are met, the N1-related fuzzy verification mark is... ,otherwise ; This indicates that the i-th sleep segment is labeled as an N1-related fuzzy kernel segment. This indicates that the flag was not triggered.
6. The method for generating priority for EEG sleep staging review according to claim 5, characterized in that: The specific process of S5 is as follows: The predicted sleep stage sequence for consecutive sleep segments is as follows: In the formula, This represents the predicted sleep stage of the i-th sleep segment. If the predicted sleep stages of two adjacent sleep segments are different, that is: It is then assumed that there is a stage transition point between sleep segments i and i+1; All stage transition points constitute a set : gather The data in the table is the index of the sleep segment to the left of each stage transition point; For any sleep segment, calculate its distance to the nearest stage transition point, denoted as . The calculation formula is: in, For from set The integer index retrieved from the array; Indicates the first The sleep segment and the first The stage transition locations between sleep segments; If there is no stage transition point, then let ; Centered on the phase transition point, it covers both forward and backward. A sleep segment; when At that time, add a stage transition neighbor marker to the i-th sleep stage. Phase transition neighbor marker Represented as: When d i ≤w, Add a phase transfer neighbor marker When d i >w, No stage transfer neighbor marker added This is the preset window threshold.
7. The method for generating priority for EEG sleep staging review according to claim 6, characterized in that: The specific process of S6 is as follows: S6.1, Based on the comprehensive uncertainty score N1 related fuzzy verification markers and phase transition neighbor markers Generate review scores : in, and To label the weights; and All are binary labels, with values of 0 or 1; S6.2, according to A queue of sleep segments to be reviewed is generated by sorting them from high to low. Normalization : in, and These are the minimum and maximum values of the review enhancement score in the current continuous sleep recording, respectively; when = At that time, all fragments can be... Set to 0; S6.3 The review level is generated according to the following rules: (1) When At that time, a first-level review priority is generated, indicating that it is recommended to review it first; (2) When At that time, a secondary review priority is generated, indicating that it is recommended to pay close attention to this matter; (3) When At that time, a three-level review priority is generated, indicating that it can be viewed when review resources allow; (4) When In such cases, the segment may be excluded from the priority review queue or retained as a regular review segment. S6.4 Review Reason Generation The reasons for review are automatically generated based on the triggering conditions, including low confidence, high prediction entropy, low probability interval, target confusion related to sleep stage, and adjacent stage transition. S6.5 Output the verification results Based on the review score, review priority, and review reason generated by S9, the review results are output, including sleep segment number, predicted sleep stage, and prediction confidence. Predicting entropy probability interval Comprehensive uncertainty score N1 related fuzzy verification markers and phase transition neighbor markers Review priority and reasons for review.
8. A system for implementing the method for generating priority for EEG sleep staging review according to any one of claims 1-7, characterized in that: It includes a probability acquisition module, an uncertainty calculation module, a target stage marking module, a transition neighbor marking module, a priority generation module, and a result output module; The probability acquisition module is used to implement S1 and S2, the uncertainty calculation module is used to implement S3, the target stage marking module is used to implement S4, the transfer neighbor marking module is used to implement S5, and the priority generation module and the result output module are used to implement S6.
9. An electronic device that implements the brainwave sleep staging review priority generation method according to any one of claims 1-7, characterized in that: It includes one or more processors and a memory, in which a computer program is stored. When the computer program is executed by one or more processors, the electronic device executes the brainwave sleep staging review priority generation method.
10. A computer-readable storage medium for implementing the brainwave sleep staging review priority generation method according to any one of claims 1-7, characterized in that: A computer program is stored on a computer-readable storage medium, which, when executed by a processor, implements the above-mentioned method for generating priority for EEG sleep staging review. Computer-readable storage media include read-only memory, random access memory, magnetic disk, optical disk, removable storage device or other media capable of storing program code.