自监督学习 BYOL 驾驶员分心检测:97.37% 准确率无需大规模标注

自监督学习 BYOL 驾驶员分心检测:97.37% 准确率无需大规模标注

论文信息

项目 内容
标题 Self-Supervised Learning for Driver Distraction Detection: A Comparative Study with Traditional Supervised Models
作者 Luqman Ali, Mustaqeem Khan, Bilal Ahmad, Muhammad Saqib, Fady Alnajjar, Hamad Aljassmi
机构 United Arab Emirates University, Islamia College Peshawar
期刊 Proceedings of the AAAI Symposium Series, Vol 9(1), pp. 351-359
日期 2026-09-02
DOI 10.1609/aaai-ss.v9i1.43115

核心创新

首次将现代自监督学习(SSL)方法 BYOL 应用于驾驶员分心检测,实现:

指标 SSL (BYOL) 全监督 (SOTA) 差距
准确率 97.37% 99.32% -1.95%
标注数据需求 轻量线性探测 全量标注 >90% 减少
数据集 State Farm State Farm -

问题背景

标注瓶颈

痛点 传统监督学习 SSL 方法
标注成本 每张图片需人工标注 仅需少量标注
新场景适应 需重新标注+训练 冻结编码器+微调
类内变化 需大量样本覆盖 对比学习自动覆盖
扩展性 线性扩展标注 无限无标签数据

BYOL 原理

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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models import resnet50

class BYOL(nn.Module):
"""
Bootstrap Your Own Latent (BYOL)

自监督学习框架,无需负样本:
1. 在线网络:预测目标表示
2. 目标网络:EMA 更新的在线网络
3. 停止梯度 + 预测头

应用于驾驶员分心检测:
- 预训练:大量无标签驾驶员图像
- 微调:少量标注数据 + 线性探测
"""

def __init__(self, hidden_dim=256, projection_dim=256,
prediction_dim=256, ema_decay=0.996):
super().__init__()
self.ema_decay = ema_decay

# 在线网络:ResNet50 编码器 + 投影头 + 预测头
self.online_encoder = resnet50(pretrained=False)
self.online_encoder.fc = nn.Identity() # 移除分类头

# 投影头 (MLP)
self.online_projector = nn.Sequential(
nn.Linear(2048, hidden_dim),
nn.BatchNorm1d(hidden_dim),
nn.ReLU(inplace=True),
nn.Linear(hidden_dim, projection_dim)
)

# 预测头 (MLP)
self.online_predictor = nn.Sequential(
nn.Linear(projection_dim, hidden_dim),
nn.BatchNorm1d(hidden_dim),
nn.ReLU(inplace=True),
nn.Linear(hidden_dim, projection_dim)
)

# 目标网络(在线网络的 EMA 副本)
self.target_encoder = self._copy_model(self.online_encoder)
self.target_projector = self._copy_model(self.online_projector)

# 冻结目标网络梯度
for param in self.target_encoder.parameters():
param.requires_grad = False
for param in self.target_projector.parameters():
param.requires_grad = False

def _copy_model(self, model):
"""创建模型副本"""
copy = type(model)(*list(model.parameters())[0:0]) # 占位
copy.load_state_dict(model.state_dict())
return copy

def forward(self, x1, x2):
"""
Args:
x1, x2: 同一图像的两个增强视图
Returns:
loss: BYOL 损失
"""
# 在线网络前向
online_proj1 = self.online_projector(self.online_encoder(x1))
online_pred1 = self.online_predictor(online_proj1)

online_proj2 = self.online_projector(self.online_encoder(x2))
online_pred2 = self.online_predictor(online_proj2)

# 目标网络前向(无梯度)
with torch.no_grad():
target_proj1 = self.target_projector(self.target_encoder(x1))
target_proj2 = self.target_projector(self.target_encoder(x2))

# BYOL 损失:负余弦相似度
loss = 2 - 2 * (
F.cosine_similarity(online_pred1, target_proj2.detach(), dim=-1).mean() +
F.cosine_similarity(online_pred2, target_proj1.detach(), dim=-1).mean()
) / 2

return loss

@torch.no_grad()
def update_target(self):
"""EMA 更新目标网络"""
for online_p, target_p in zip(
self.online_encoder.parameters(), self.target_encoder.parameters()
):
target_p.data.mul_(self.ema_decay).add_(
online_p.data, alpha=1 - self.ema_decay
)
for online_p, target_p in zip(
self.online_projector.parameters(), self.target_projector.parameters()
):
target_p.data.mul_(self.ema_decay).add_(
online_p.data, alpha=1 - self.ema_decay
)


class DriverDistractionClassifier(nn.Module):
"""
驾驶员分心分类器(线性探测)

使用 BYOL 预训练的编码器 + 线性分类头
"""

def __init__(self, byol_encoder, n_classes=10):
super().__init__()
# 冻结编码器
self.encoder = byol_encoder
for param in self.encoder.parameters():
param.requires_grad = False

# 线性分类头
self.classifier = nn.Linear(2048, n_classes)

def forward(self, x):
with torch.no_grad():
features = self.encoder(x)
return self.classifier(features)


# State Farm 数据集 10 类分心行为
DISTRACTION_CLASSES = [
"safe_driving", # 安全驾驶
"phone_right", # 右手打电话
"phone_left", # 左手打电话
"text_right", # 右手发短信
"text_left", # 左手发短信
"adjusting_radio", # 调收音机
"drinking", # 喝水
"reaching_behind", # 后座取物
"hair_makeup", # 整理头发/化妆
"talking_passenger" # 与乘客交谈
]

if __name__ == "__main__":
# 预训练阶段
byol = BYOL()

# 模拟输入
x1 = torch.randn(32, 3, 224, 224) # 增强视图1
x2 = torch.randn(32, 3, 224, 224) # 增强视图2

loss = byol(x1, x2)
print(f"BYOL Loss: {loss.item():.4f}")

byol.update_target()
print("Target network updated (EMA)")

# 线性探测阶段
classifier = DriverDistractionClassifier(byol.online_encoder, n_classes=10)

x = torch.randn(16, 3, 224, 224)
logits = classifier(x)

print(f"Input: {x.shape}")
print(f"Output: {logits.shape} (10 类分心行为)")
print(f"可训练参数: {sum(p.numel() for p in classifier.parameters() if p.requires_grad):,}")
# 仅线性层可训练:2048 * 10 + 10 = 20,490 参数

实验结果

主要对比

方法 预训练数据 标注数据 准确率 参数量
ResNet50 (全监督) ImageNet State Farm (全量) 99.32% 25.6M
ResNet50 (ImageNet+微调) ImageNet State Farm (全量) 98.75% 25.6M
BYOL (SSL) + 线性探测 State Farm (无标签) State Farm (少量) 97.37% 20,490
BYOL (SSL) + 微调 State Farm (无标签) State Farm (少量) 98.19% 25.6M

消融实验

组件 准确率变化 说明
移除投影头 -2.1% 投影头关键
移除预测头 -1.5% 预测头重要
移除 EMA 更新 -3.8% EMA 是核心
移除数据增强 -4.2% 增强策略关键
ResNet18 替代 ResNet50 -1.3% 更轻量仍可用

跨驾驶员泛化

数据划分 准确率 说明
随机划分 97.37% 标准评估
驾驶员不交叉划分 94.82% 更严格泛化测试
驾驶员不交叉 + 少量标注 92.15% 10% 标注

Grad-CAM 可解释性

论文展示 Grad-CAM 热力图验证注意力机制:

分心类别 注意区域 可解释性
电话右手 右手区域+手机 ✅ 正确
发短信左手 左手+方向盘 ✅ 正确
调收音机 中控台区域 ✅ 正确
后座取物 身体右后方 ✅ 正确

IMS 应用启示

1. 标注成本优化

场景 传统标注成本 SSL 方案成本 节省
新增分心类别 ~$50K (10万张) ~$5K (1万张) 90%
跨地区适配 ~$30K ~$3K 90%
新传感器迁移 ~$50K ~$5K 90%
增量数据利用 仅用标注数据 全量数据 无限无标签

2. 部署方案

graph TB
    A[无标签驾驶员视频<br/>行驶记录] --> B[BYOL 预训练<br/>ResNet50 编码器]
    B --> C[少量标注数据<br/>~1万张]
    C --> D[线性探测<br/>20K 参数]
    D --> E[部署<br/>QCS8255]
    
    F[新增分心行为] --> G[冻结编码器<br/>+新线性层]
    G --> H[快速适配<br/>无需重新预训练]

3. 与现有 DMS 对比

功能 现有监督方案 BYOL SSL 方案 优势
分心检测 99.32% 97.37% -1.95%
新增类别 需重新训练 加线性层 快速迭代
跨地区 需重新标注 无标签+少量标注 90% 成本节省
长尾场景 样本不足 无限利用无标签 覆盖长尾

4. 技术路线建议

阶段 目标 关键步骤 时间
Phase 1 数据收集 收集 100 万帧无标签驾驶视频 1 月
Phase 2 预训练 BYOL 在无标签数据上训练 2 周
Phase 3 标注+线性探测 标注 1 万帧 + 训练线性层 3 天
Phase 4 部署验证 在 QCS8255 上部署,验证精度 1 周
Phase 5 持续迭代 新数据只需重新训练线性层 持续

5. 硬件选型

组件 型号 参数 用途
训练 GPU NVIDIA A100 40GB 40GB HBM2e BYOL 预训练
部署 NPU QCS8255 Hexagon 26 TOPS 实时推理
摄像头 OV2311 IR 2MP 全局快门 驾驶员图像
推理框架 ONNX Runtime INT8 量化 边缘推理

局限与挑战

  1. 2% 精度差距:97.37% vs 99.32%,某些场景可能不接受
  2. 预训练时间:BYOL 预训练需 100+ 小时 GPU 时间
  3. 增强策略敏感:需针对驾驶场景设计增强
  4. 类别不平衡:线性探测仍需平衡采样

总结

BYOL SSL 方案在驾驶员分心检测上的应用标志着从”标注驱动”到”数据驱动”的范式转变:

  1. 97.37% 准确率:仅差 1.95%,但成本节省 90%
  2. 20K 可训练参数:线性探测极轻量,边缘友好
  3. 快速适配:新增分心类别只需重训线性层
  4. 长尾覆盖:无标签数据自动学习罕见场景特征
  5. 可解释性:Grad-CAM 验证注意力区域合理

自监督学习 BYOL 驾驶员分心检测:97.37% 准确率无需大规模标注
https://dapalm.com/2026/09/10/2026-09-10-byol-self-supervised-driver-distraction-97-percent-aaai-2026-ims/
作者
Mars
发布于
2026年9月10日
许可协议