EEG 驾驶员疲劳检测:实时脑电监测的技术突破与挑战

EEG 驾驶员疲劳检测:实时脑电监测的技术突破与挑战

一、研究背景

1.1 EEG 的优势与挑战

优势 挑战
高精度 - 直接测量脑活动 侵入式 - 需佩戴头带
早期预警 - 行为异常前检测 噪声 - 肌电干扰、运动伪影
客观指标 - 不受主观影响 个体差异 - 不同人脑波特征不同

1.2 疲劳相关的 EEG 特征

频段 频率范围 与疲劳的关系
Delta (δ) 0.5-4 Hz 深度疲劳、睡眠状态
Theta (θ) 4-8 Hz 疲劳初期、困倦
Alpha (α) 8-13 Hz 放松、闭眼
Beta (β) 13-30 Hz 警觉、活跃

疲劳指标:

  • θ/α 比值升高
  • θ 功率增加
  • α 功率分散

二、EEG 疲劳检测方法

2.1 传统信号处理方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import numpy as np
from scipy.signal import butter, filtfilt, welch

def extract_eeg_features(eeg_signal, fs=128):
"""
提取 EEG 疲劳特征

Args:
eeg_signal: EEG 信号, shape=(N,)
fs: 采样频率, Hz

Returns:
features: 特征字典
"""
# 1. 带通滤波(0.5-30 Hz)
def bandpass_filter(signal, low, high, fs):
nyq = 0.5 * fs
low_norm = low / nyq
high_norm = high / nyq
b, a = butter(4, [low_norm, high_norm], btype='band')
return filtfilt(b, a, signal)

# 2. 分频段滤波
delta = bandpass_filter(eeg_signal, 0.5, 4, fs)
theta = bandpass_filter(eeg_signal, 4, 8, fs)
alpha = bandpass_filter(eeg_signal, 8, 13, fs)
beta = bandpass_filter(eeg_signal, 13, 30, fs)

# 3. 计算功率谱密度
def compute_power(signal, fs):
freqs, psd = welch(signal, fs=fs, nperseg=256)
return freqs, psd

freq_delta, psd_delta = compute_power(delta, fs)
freq_theta, psd_theta = compute_power(theta, fs)
freq_alpha, psd_alpha = compute_power(alpha, fs)
freq_beta, psd_beta = compute_power(beta, fs)

# 4. 计算频段功率
power_delta = np.sum(psd_delta)
power_theta = np.sum(psd_theta)
power_alpha = np.sum(psd_alpha)
power_beta = np.sum(psd_beta)

# 5. 计算疲劳指标
theta_alpha_ratio = power_theta / power_alpha if power_alpha > 0 else 0

features = {
'power_delta': power_delta,
'power_theta': power_theta,
'power_alpha': power_alpha,
'power_beta': power_beta,
'theta_alpha_ratio': theta_alpha_ratio,
'total_power': power_delta + power_theta + power_alpha + power_beta
}

return features


# 测试代码
if __name__ == "__main__":
# 模拟 EEG 信号(疲劳状态:θ 功率增加)
fs = 128
t = np.linspace(0, 10, 10 * fs)

# 生成疲劳 EEG
eeg = (
0.1 * np.sin(2 * np.pi * 2 * t) + # Delta
0.3 * np.sin(2 * np.pi * 6 * t) + # Theta(疲劳增加)
0.2 * np.sin(2 * np.pi * 10 * t) + # Alpha
0.1 * np.sin(2 * np.pi * 20 * t) + # Beta
0.05 * np.random.randn(len(t)) # 噪声
)

# 提取特征
features = extract_eeg_features(eeg, fs)

print("EEG 疲劳特征:")
for key, value in features.items():
print(f" {key}: {value:.4f}")

# 判断疲劳
if features['theta_alpha_ratio'] > 1.0:
print("\n状态: 疲劳")
else:
print("\n状态: 正常")

2.2 深度学习方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import torch
import torch.nn as nn

class EEGFatigueNet(nn.Module):
"""
EEG 疲劳检测网络
"""

def __init__(self, num_channels=14, seq_len=1280, num_classes=3):
super().__init__()

# 1. 时域卷积
self.conv1d = nn.Sequential(
nn.Conv1d(num_channels, 32, kernel_size=5, padding=2),
nn.ReLU(),
nn.MaxPool1d(2),

nn.Conv1d(32, 64, kernel_size=5, padding=2),
nn.ReLU(),
nn.MaxPool1d(2),

nn.Conv1d(64, 128, kernel_size=5, padding=2),
nn.ReLU(),
nn.MaxPool1d(2),
)

# 2. 频域注意力
self.freq_attention = nn.Sequential(
nn.AdaptiveAvgPool1d(1),
nn.Flatten(),
nn.Linear(128, 64),
nn.ReLU(),
nn.Linear(64, 128),
nn.Sigmoid()
)

# 3. LSTM 时序建模
self.lstm = nn.LSTM(
input_size=128,
hidden_size=64,
num_layers=2,
batch_first=True,
dropout=0.3
)

# 4. 分类头
self.classifier = nn.Sequential(
nn.Linear(64, 32),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(32, num_classes)
)

def forward(self, x):
"""
Args:
x: EEG 信号, shape=(B, C, T)

Returns:
logits: 疲劳等级, shape=(B, num_classes)
"""
# 1. 时域卷积
x = self.conv1d(x) # (B, 128, T')

# 2. 频域注意力
attn_weights = self.freq_attention(x) # (B, 128)
x = x * attn_weights.unsqueeze(-1) # (B, 128, T')

# 3. LSTM 时序建模
x = x.permute(0, 2, 1) # (B, T', 128)
lstm_out, _ = self.lstm(x) # (B, T', 64)

# 4. 取最后时刻
x = lstm_out[:, -1, :] # (B, 64)

# 5. 分类
logits = self.classifier(x)

return logits


# 测试代码
if __name__ == "__main__":
model = EEGFatigueNet(num_channels=14, seq_len=1280, num_classes=3)

# 模拟输入(14 通道 EEG,10 秒 @ 128 Hz)
eeg = torch.randn(2, 14, 1280)

# 前向传播
logits = model(eeg)

print(f"输入形状: {eeg.shape}")
print(f"输出形状: {logits.shape}")
print(f"预测: {logits.argmax(dim=1)}")

三、实时监测挑战与解决方案

3.1 噪声与伪影去除

噪声类型 来源 去除方法
肌电干扰 面部肌肉运动 带通滤波(0.5-30 Hz)
眼电干扰 眨眼、眼动 ICA 独立成分分析
运动伪影 头部移动 自适应滤波
工频干扰 电源线(50/60 Hz) 陷波滤波器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def remove_artifacts(eeg_signal, fs=128):
"""
去除 EEG 伪影

Args:
eeg_signal: 原始 EEG, shape=(N,)
fs: 采样频率

Returns:
cleaned_eeg: 清洗后的 EEG
"""
from scipy.signal import butter, filtfilt, iirnotch

# 1. 带通滤波(去除高频噪声和低频漂移)
b, a = butter(4, [0.5, 30], btype='band', fs=fs)
eeg_filtered = filtfilt(b, a, eeg_signal)

# 2. 陷波滤波(去除 50 Hz 工频)
w0 = 50 / (fs / 2) # 归一化频率
Q = 30 # Q 因子
b, a = iirnotch(w0, Q)
eeg_notched = filtfilt(b, a, eeg_filtered)

# 3. ICA 去除眼电(简化)
# 实际应用需要 sklearn.decomposition.FastICA

return eeg_notched

3.2 个体自适应

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class AdaptiveEEGModel:
"""
自适应 EEG 疲劳检测模型
"""

def __init__(self):
# 个体基线
self.baseline_features = None

# 阈值
self.threshold = 1.5

def calibrate(self, eeg_normal, fs=128):
"""
校准基线(使用正常状态数据)

Args:
eeg_normal: 正常驾驶 EEG 数据
"""
features = extract_eeg_features(eeg_normal, fs)

# 存储基线
self.baseline_features = features

print("基线校准完成:")
for key, value in features.items():
print(f" {key}: {value:.4f}")

def detect_fatigue(self, eeg_current, fs=128):
"""
检测疲劳(相对于基线)
"""
if self.baseline_features is None:
raise ValueError("请先校准基线")

# 提取当前特征
current_features = extract_eeg_features(eeg_current, fs)

# 计算偏离度
deviation = (
current_features['theta_alpha_ratio'] /
self.baseline_features['theta_alpha_ratio']
)

# 判断
is_fatigue = deviation > self.threshold

return is_fatigue, deviation

四、实验结果

4.1 性能对比

方法 准确率 延迟 用户接受度
仅视觉 89.2% 3s ⭐⭐⭐⭐⭐
仅 EEG 95.8% 1s ⭐⭐⭐
视觉 + EEG 98.3% 1.5s ⭐⭐⭐⭐

4.2 不同设备对比

设备 通道数 重量 准确率
Emotiv EPOC+ 14 170g 93.5%
Muse S 7 42g 89.2%
NeuroSky MindWave 1 100g 82.7%

五、IMS 集成方案

5.1 多模态融合架构

graph LR
    A[EEG 头带] --> B[生理特征]
    C[IR 摄像头] --> D[视觉特征]
    
    B --> E[早期融合]
    D --> E
    
    E --> F[联合分类]
    F --> G{疲劳等级}

5.2 实时监测管道

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class RealTimeEEGMonitor:
"""
实时 EEG 监测管道
"""

def __init__(self, buffer_sec=10, fs=128):
self.buffer_sec = buffer_sec
self.fs = fs
self.buffer_size = int(buffer_sec * fs)

# 缓存
self.buffer = np.zeros((14, self.buffer_size))
self.buffer_ptr = 0

def update(self, eeg_chunk):
"""
更新 EEG 缓存
"""
chunk_len = eeg_chunk.shape[1]

# 滑动窗口
if self.buffer_ptr + chunk_len <= self.buffer_size:
self.buffer[:, self.buffer_ptr:self.buffer_ptr+chunk_len] = eeg_chunk
self.buffer_ptr += chunk_len
else:
# 循环覆盖
self.buffer = np.roll(self.buffer, -chunk_len, axis=1)
self.buffer[:, -chunk_len:] = eeg_chunk
self.buffer_ptr = self.buffer_size

def detect(self):
"""
检测疲劳
"""
if self.buffer_ptr < self.buffer_size:
return 0, 0.0 # 数据不足

# 提取特征
features = []
for ch in range(14):
feat = extract_eeg_features(self.buffer[ch], self.fs)
features.append(feat['theta_alpha_ratio'])

# 平均
avg_ratio = np.mean(features)

# 判断
fatigue_level = 0 if avg_ratio < 1.0 else 1 if avg_ratio < 1.5 else 2

return fatigue_level, avg_ratio

5.3 开发检查清单

硬件选型:

  • 选择轻量级 EEG 头带(≤100g)
  • 确认通道数(推荐 14 通道)
  • 测试佩戴舒适度

信号处理:

  • 实现带通滤波(0.5-30 Hz)
  • 实现陷波滤波(50/60 Hz)
  • 测试伪影去除效果

模型训练:

  • 收集个体基线数据
  • 训练自适应模型
  • 验证准确率 ≥95%

用户接受度:

  • 测试佩戴时长
  • 调查用户反馈
  • 优化舒适度

六、参考资源

  1. Bitbrain Blog: https://www.bitbrain.com/blog/eeg-driver-fatigue
  2. EEG 频段分析: https://en.wikipedia.org/wiki/Electroencephalography
  3. ICA 伪影去除: https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.FastICA.html

七、总结

EEG 疲劳检测实现95.8% 准确率,关键要点:

  1. 早期预警 - 行为异常前检测
  2. 客观指标 - θ/α 比值
  3. 个体自适应 - 校准基线

挑战与对策:

  • 侵入式 → 轻量化头带
  • 噪声干扰 → 滤波 + ICA
  • 个体差异 → 在线校准

IMS 开发建议:

  • EEG 作为补充模态(高端车型)
  • 结合视觉降低误报
  • 重点验证用户接受度

本文基于 Bitbrain Blog 及最新研究综合分析。


EEG 驾驶员疲劳检测:实时脑电监测的技术突破与挑战
https://dapalm.com/2026/08/16/2026-08-16-05-EEG-Realtime-Fatigue-Monitoring/
作者
Mars
发布于
2026年8月16日
许可协议