EEG 脑网络识别认知分心:基于 XGBoost 的增强识别方法

论文信息


核心创新

该论文提出了一种基于 EEG 脑网络的分析方法,用于识别驾驶分心状态(认知分心 vs 视觉分心):

  1. 多同步指标对比 - SL、PLV、Coherence 三种连接指标
  2. 脑网络拓扑特征 - 连接强度 + 全局拓扑属性
  3. 高精度识别 - 二分类 95.1%,三分类 88.3%
  4. 认知/视觉分心区分 - 首次明确区分两种分心类型

方法详解

1. 问题定义

分心驾驶分类:

分心类型 特征 检测难点
视觉分心(Visual Distraction) “Eye-off-road”,视线离开道路 可通过视线追踪检测
认知分心(Cognitive Distraction) “Mind-off-road”,思维离开驾驶 无法通过外部行为检测

核心挑战: 认知分心无法通过外部行为直接检测,需要依赖 EEG 脑电信号。

2. 实验设计

模拟驾驶场景:

graph LR
    A[正常驾驶] --> B[分心任务]
    B --> C1[认知分心:数学计算]
    B --> C2[认知分心:时钟角度判断]
    B --> C3[视觉分心:数字序列识别]
    B --> C4[视觉分心:手机任务]

分心任务详情:

任务 ID 任务名称 分心类型 任务形式
Task-1 数学计算 认知分心 决策判断
Task-2 时钟角度判断 认知分心 心理计算
Task-3 数字序列识别 视觉分心 视觉追踪
Task-4 手机任务 视觉分心 视觉注意力

实验参数:

  • 参与者:36 人(24 男,12 女)
  • EEG 设备:64 通道电极帽(Brain Products)
  • 采样率:1000 Hz → 512 Hz(预处理后)
  • 任务间隔:≥15 秒(避免疲劳)

3. 脑网络构建

三步流程:

  1. 节点定义: 63 个 EEG 通道作为网络节点
  2. 边连接: 三种同步指标(SL、PLV、Coherence)
  3. 拓扑特征: 4 种全局属性

同步指标对比:

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
"""
论文 Table 1:三种同步指标对比

指标:
1. Synchronization Likelihood (SL) - 非线性同步
2. Phase Locking Value (PLV) - 相位同步
3. Coherence - 频域线性同步

论文 Section 3.3 实现
"""

import numpy as np
from scipy import signal


def compute_sl(eeg1: np.ndarray, eeg2: np.ndarray, m: int = 10, w: int = 5) -> float:
"""
计算同步似然(Synchronization Likelihood)

非线性同步指标,适用于复杂动态系统

Args:
eeg1, eeg2: 两通道 EEG 信号, shape=(N,)
m: 嵌入维度,默认 10
w: 窗口大小,默认 5

Returns:
sl_value: 同步似然值 (0-1)

公式:
SL = (1 / (N - m*w)) * sum(I(||x_i - x_j|| < r))
"""
N = len(eeg1)

# 嵌入向量构建
embed1 = np.zeros((N - m*w, m))
embed2 = np.zeros((N - m*w, m))

for i in range(N - m*w):
embed1[i] = eeg1[i:i+m*w:w]
embed2[i] = eeg2[i:i+m*w:w]

# 距离计算
dist1 = np.linalg.norm(embed1 - embed1[:, np.newaxis], axis=-1)
dist2 = np.linalg.norm(embed2 - embed2[:, np.newaxis], axis=-1)

# 阈值设定(临界距离)
r1 = np.percentile(dist1, 15) # 15% 百分位
r2 = np.percentile(dist2, 15)

# 同步计数
sync_count = np.sum((dist1 < r1) & (dist2 < r2))

# 同步似然
sl_value = sync_count / (N - m*w) ** 2

return sl_value


def compute_plv(eeg1: np.ndarray, eeg2: np.ndarray) -> float:
"""
计算相位锁定值(Phase Locking Value)

相位同步指标,适用于振荡信号

Args:
eeg1, eeg2: 两通道 EEG 信号

Returns:
plv_value: 相位锁定值 (0-1)

公式:
PLV = |1/N * sum(exp(i*(phi1 - phi2)))|
"""
# 带通滤波(Theta 波:4-8 Hz)
b, a = signal.butter(4, [4/256, 8/256], btype='band')
eeg1_filt = signal.filtfilt(b, a, eeg1)
eeg2_filt = signal.filtfilt(b, a, eeg2)

# 相位提取(Hilbert 变换)
phase1 = np.angle(signal.hilbert(eeg1_filt))
phase2 = np.angle(signal.hilbert(eeg2_filt))

# 相位差
phase_diff = phase1 - phase2

# 相位锁定值
plv_value = np.abs(np.mean(np.exp(1j * phase_diff)))

return plv_value


def compute_coherence(eeg1: np.ndarray, eeg2: np.ndarray, freq_band: tuple = (4, 8)) -> float:
"""
计算相干性(Coherence)

频域线性同步指标

Args:
eeg1, eeg2: 两通道 EEG 信号
freq_band: 频率范围,默认 Theta 波 (4-8 Hz)

Returns:
coherence_value: 相干性值 (0-1)

公式:
Cxy(f) = |Pxy(f)|^2 / (Pxx(f) * Pyy(f))
"""
# 交叉谱密度
f, Pxy = signal.csd(eeg1, eeg2, fs=512, nperseg=256)

# 自谱密度
_, Pxx = signal.welch(eeg1, fs=512, nperseg=256)
_, Pyy = signal.welch(eeg2, fs=512, nperseg=256)

# 相干性计算
Cxy = np.abs(Pxy) ** 2 / (Pxx * Pyy)

# 特定频段平均
freq_mask = (f >= freq_band[0]) & (f <= freq_band[1])
coherence_value = np.mean(Cxy[freq_mask])

return coherence_value


# 实际测试
if __name__ == "__main__":
# 模拟 EEG 数据(正常 vs 认知分心)
np.random.seed(42)

# 正常驾驶(低同步)
eeg_normal1 = np.random.randn(5120)
eeg_normal2 = np.random.randn(5120) + 0.3 * eeg_normal1

# 认知分心(高同步)
eeg_cognitive1 = np.random.randn(5120)
eeg_cognitive2 = 0.7 * eeg_cognitive1 + np.random.randn(5120) * 0.3

# 计算三种指标
print("正常驾驶状态:")
print(f" SL: {compute_sl(eeg_normal1, eeg_normal2):.4f}")
print(f" PLV: {compute_plv(eeg_normal1, eeg_normal2):.4f}")
print(f" Coherence: {compute_coherence(eeg_normal1, eeg_normal2):.4f}")

print("\n认知分心状态:")
print(f" SL: {compute_sl(eeg_cognitive1, eeg_cognitive2):.4f}")
print(f" PLV: {compute_plv(eeg_cognitive1, eeg_cognitive2):.4f}")
print(f" Coherence: {compute_coherence(eeg_cognitive1, eeg_cognitive2):.4f}")

4. 脑网络拓扑特征

四种全局拓扑属性:

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
"""
论文 Section 3.4:脑网络拓扑特征

特征:
1. 平均连接强度(Mean Connectivity Strength)
2. 平均聚类系数(Mean Clustering Coefficient)
3. 平均路径长度(Mean Path Length)
4. 全局效率(Global Efficiency)

复杂网络理论基础
"""

import networkx as nx


def extract_network_features(connectivity_matrix: np.ndarray) -> dict:
"""
提取脑网络拓扑特征

Args:
connectivity_matrix: 连接矩阵, shape=(63, 63)

Returns:
features: 拓扑特征字典
"""
# 构建图
G = nx.from_numpy_array(connectivity_matrix)

# 1. 平均连接强度
mean_strength = np.mean(connectivity_matrix)

# 2. 平均聚类系数(局部连接性)
clustering_coeff = nx.average_clustering(G, weight='weight')

# 3. 平均路径长度(全局连接性)
try:
path_length = nx.average_shortest_path_length(G, weight='weight')
except:
path_length = np.inf # 不连通图

# 4. 全局效率(信息传递效率)
global_efficiency = nx.global_efficiency(G)

return {
'mean_strength': mean_strength,
'clustering_coeff': clustering_coeff,
'path_length': path_length,
'global_efficiency': global_efficiency
}


# 实际测试
if __name__ == "__main__":
# 模拟连接矩阵(正常 vs 认知分心)

# 正常驾驶(稀疏连接)
normal_matrix = np.random.rand(63, 63) * 0.3
normal_matrix = (normal_matrix + normal_matrix.T) / 2 # 对称化

# 认知分心(密集连接)
cognitive_matrix = np.random.rand(63, 63) * 0.7 + 0.2
cognitive_matrix = (cognitive_matrix + cognitive_matrix.T) / 2

# 提取特征
normal_features = extract_network_features(normal_matrix)
cognitive_features = extract_network_features(cognitive_matrix)

print("正常驾驶网络特征:")
for key, value in normal_features.items():
print(f" {key}: {value:.4f}")

print("\n认知分心网络特征:")
for key, value in cognitive_features.items():
print(f" {key}: {value:.4f}")

5. XGBoost 分类器

分类流程:

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
"""
论文 Section 3.5:XGBoost 分类器

分类任务:
- 二分类:正常 vs 分心(95.1%)
- 三分类:正常 vs 认知分心 vs 视觉分心(88.3%)

特征:SL 网络拓扑特征最优
"""

import xgboost as xgb
from sklearn.model_selection import cross_val_score
from sklearn.metrics import accuracy_score, confusion_matrix


class DistractionClassifier:
"""
分心状态分类器

论文 Table 2 结果:
- XGBoost 在所有特征组合中表现最优
- SL 网络拓扑特征区分认知/视觉分心最优
"""

def __init__(self, task: str = 'binary'):
"""
Args:
task: 'binary'(二分类)或 'ternary'(三分类)
"""
self.task = task

# XGBoost 参数(论文参数)
self.model = xgb.XGBClassifier(
n_estimators=100,
max_depth=6,
learning_rate=0.1,
subsample=0.8,
colsample_bytree=0.8,
objective='binary:logistic' if task == 'binary' else 'multi:softmax',
eval_metric='logloss',
random_state=42
)

def train(self, features: np.ndarray, labels: np.ndarray):
"""
训练模型

Args:
features: 拓扑特征矩阵, shape=(N_samples, N_features)
labels: 标签(0=正常,1=分心 或 0=正常,1=认知分心,2=视觉分心)
"""
self.model.fit(features, labels)

def predict(self, features: np.ndarray) -> np.ndarray:
"""
预测分心状态

Args:
features: 拓扑特征矩阵

Returns:
predictions: 预测标签
"""
return self.model.predict(features)

def evaluate(self, features: np.ndarray, labels: np.ndarray) -> dict:
"""
评估模型性能

Returns:
metrics: {'accuracy': float, 'confusion_matrix': np.ndarray}
"""
predictions = self.predict(features)
accuracy = accuracy_score(labels, predictions)
cm = confusion_matrix(labels, predictions)

return {
'accuracy': accuracy,
'confusion_matrix': cm
}


# 实际测试
if __name__ == "__main__":
# 模拟数据(论文 Table 2)
np.random.seed(42)

# 生成模拟特征
n_samples = 100
n_features = 12 # 4 拓扑特征 × 3 网络

# 正常驾驶特征(低同步)
normal_features = np.random.randn(40, n_features) * 0.3 + 0.2

# 认知分心特征(高同步,特定模式)
cognitive_features = np.random.randn(30, n_features) * 0.5 + 0.6
cognitive_features[:, :4] += 0.2 # SL 特征增强

# 视觉分心特征(中等同步,不同模式)
visual_features = np.random.randn(30, n_features) * 0.4 + 0.4
visual_features[:, 4:8] += 0.1 # PLV 特征增强

# 合并数据
features = np.vstack([normal_features, cognitive_features, visual_features])
labels = np.array([0] * 40 + [1] * 30 + [2] * 30)

# 三分类训练
classifier = DistractionClassifier(task='ternary')
classifier.train(features, labels)

# 评估
metrics = classifier.evaluate(features, labels)

print(f"三分类准确率: {metrics['accuracy']:.2%}")
print("\n混淆矩阵:")
print(metrics['confusion_matrix'])

实验结果

性能对比表

特征组合 二分类准确率 三分类准确率 备注
SL 网络特征 92.4% 85.7% 区分认知/视觉分心最优
PLV 网络特征 89.2% 81.3% 相位同步
Coherence 网络特征 87.5% 78.9% 频域同步
三网络组合(最优) 95.1% 88.3% 论文最优结果

关键发现:

  • SL(同步似然)在区分认知/视觉分心时最优
  • 三网络组合特征达到最优性能
  • XGBoost 优于 SVM、Random Forest

脑区激活差异

论文 Figure 3 结果:

脑区 认知分心激活 视觉分心激活
额叶(Frontal) 高激活(认知处理) 中等激活
顶叶(Parietal) 高激活(注意力分配) 高激活
枕叶(Occipital) 低激活 高激活(视觉处理)

IMS应用启示

1. 认知分心检测方案

挑战:

  • Euro NCAP DSM 未明确要求认知分心检测
  • 现有 DMS 无法检测 “Mind-off-road”

方案:

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
class CognitiveDistractionMonitor:
"""
认知分心监控模块

基于 EEG 脑网络分析

局限性:
- 需佩戴 EEG 设备(不适合量产)
- 可作为研究方向参考

未来替代方案:
- 融合多模态信号(心率、呼吸、瞳孔)
- 基于 CAN 数据的间接推断
"""

def __init__(self):
self.classifier = DistractionClassifier(task='ternary')

# EEG 通道映射(63 通道)
self.channels = [
'Fp1', 'Fp2', 'F3', 'F4', 'C3', 'C4', 'P3', 'P4', 'O1', 'O2',
# ... 更多通道
]

def detect_cognitive_distraction(self, eeg_data: np.ndarray) -> dict:
"""
检测认知分心

Args:
eeg_data: EEG 数据, shape=(63, N_samples)

Returns:
result: {'state': 'normal'|'cognitive'|'visual', 'confidence': float}
"""
# 构建脑网络
connectivity_matrix = self._build_connectivity_matrix(eeg_data)

# 提取拓扑特征
features = extract_network_features(connectivity_matrix)

# 分类
state = self.classifier.predict(np.array([list(features.values())]))

# 输出
state_names = ['normal', 'cognitive_distraction', 'visual_distraction']

return {
'state': state_names[state[0]],
'confidence': self.classifier.model.predict_proba(
np.array([list(features.values())])
)[0, state[0]]
}

def _build_connectivity_matrix(self, eeg_data: np.ndarray) -> np.ndarray:
"""构建连接矩阵(SL)"""
n_channels = eeg_data.shape[0]
matrix = np.zeros((n_channels, n_channels))

for i in range(n_channels):
for j in range(i+1, n_channels):
matrix[i, j] = compute_sl(eeg_data[i], eeg_data[j])
matrix[j, i] = matrix[i, j]

return matrix

2. 多模态融合方案(量产可行)

替代 EEG 的量产方案:

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
class MultimodalDistractionMonitor:
"""
多模态分心监控(量产可行方案)

融合信号:
- 视线追踪(GazeCapsNet)
- 瞳孔直径(认知负荷指标)
- 心率变异性(HRV,压力指标)
- CAN 数据(方向盘操作、速度波动)

优点:
- 无需佩戴 EEG
- 可集成现有 DMS 硬件
"""

def __init__(self):
self.gaze_model = GazeCapsNet() # 视线估计

# CAN 数据分析
self.can_analyzer = CANDataAnalyzer()

def detect_distraction(self, face_image: np.ndarray, can_data: dict) -> dict:
"""
多模态分心检测

Args:
face_image: 人脸图像
can_data: CAN 数据(方向盘角度、速度等)

Returns:
result: {'distraction_type': str, 'probability': float}
"""
# 视线分析
gaze_result = self.gaze_model(face_image)

# CAN 数据分析
driving_pattern = self.can_analyzer.analyze(can_data)

# 融合判断
# 视线偏离 + CAN 数据波动 → 认知分心可能性高
# 视线偏离 + CAN 数据正常 → 视觉分心

if gaze_result['is_distracted']:
if driving_pattern['variability'] > 0.3:
return {'distraction_type': 'cognitive', 'probability': 0.85}
else:
return {'distraction_type': 'visual', 'probability': 0.92}
else:
return {'distraction_type': 'normal', 'probability': 0.95}


class CANDataAnalyzer:
"""CAN 数据分析器"""

def analyze(self, can_data: dict) -> dict:
"""
分析驾驶行为

指标:
- 方向盘角度波动(Lateral control)
- 速度波动(Speed control)
- 反应时间延迟

论文 Section 2.1:分心驾驶行为特征
"""
steering_angles = can_data['steering_angle']
speeds = can_data['speed']

# 波动计算
steering_variability = np.std(steering_angles)
speed_variability = np.std(speeds)

return {
'variability': (steering_variability + speed_variability) / 2
}

3. Euro NCAP DSM 扩展建议

当前 DSM 要求:

  • 视觉分心检测(D-01/D-02/D-05)
  • 疲劳检测(F-01/F-02)
  • 未明确要求认知分心检测

扩展建议:

功能 Euro NCAP 状态 技术可行性 量产时间
视觉分心检测 ✅ 已要求 高(视线追踪) 2025+
认知分心检测 ❌ 未明确 中(多模态融合) 2027+
酒驾检测 ⚠️ 2026 新增 中(Smart Eye 方案) 2026+

4. 研究方向启示

论文价值:

  1. 首次明确区分认知/视觉分心的脑网络差异
  2. SL 网络拓扑特征可作为认知分心检测的理论基础
  3. XGBoost 分类器性能优于传统方法

IMS 研究建议:

  • 跟踪脑机接口(BCI)在驾驶中的应用
  • 探索多模态融合替代 EEG 的方案
  • 关注 Euro NCAP 2027+ 认知分心检测要求

开发优先级

模块 优先级 开发周期 备注
多模态融合研究 🟡 P1 4周 替代 EEG 方案
CAN 数据分析 🟡 P1 2周 驾驶行为分析
认知分心检测算法 🟢 P2 6周 研究性质
Euro NCAP DSM 扩展 🟢 P2 持续跟踪 等待法规明确

总结

该论文通过 EEG 脑网络分析实现了认知/视觉分心的精确识别:

  • 精度: 三分类 88.3%,SL 特征最优
  • 理论: 脑网络拓扑特征可区分分心类型
  • 局限: 需佩戴 EEG,不适合量产

IMS 开发启示:

  1. 认知分心检测的理论基础(脑网络差异)
  2. 多模态融合替代 EEG(视线+CAN+HRV)
  3. Euro NCAP DSM 扩展方向(2027+)

参考文献

  1. 论文原文:https://pmc.ncbi.nlm.nih.gov/articles/PMC11222012/
  2. 脑网络工具箱:https://github.com/networkx/networkx
  3. XGBoost 文档:https://xgboost.readthedocs.io/
  4. Euro NCAP DSM:https://www.euroncap.com/protocols/

EEG 脑网络识别认知分心:基于 XGBoost 的增强识别方法
https://dapalm.com/2026/07/06/2026-07-06-eeg-cognitive-distraction-brain-network-zh/
作者
Mars
发布于
2026年7月6日
许可协议