疲劳检测算法优化:PERCLOS与时序建模

核心方法: PERCLOS(眼睑闭占时间百分比)


PERCLOS计算

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
class PERCLOSOptimizer:
"""PERCLOS优化器"""

def __init__(self, window_sec: int = 60):
self.window_sec = window_sec
self.eye_openness_history = []

def add_frame(self, eye_openness: float):
self.eye_openness_history.append(eye_openness)
# 保持窗口大小
if len(self.eye_openness_history) > self.window_sec * 30:
self.eye_openness_history.pop(0)

def compute_perclos(self) -> float:
if len(self.eye_openness_history) < self.window_sec * 15:
return 0.0

threshold = 0.2
closed_count = sum(1 for x in self.eye_openness_history if x < threshold)

return closed_count / len(self.eye_openness_history) * 100

def detect_fatigue(self) -> str:
perclos = self.compute_perclos()

if perclos < 30:
return '正常'
elif perclos < 50:
return '轻度疲劳'
else:
return '重度疲劳'

时序建模增强

方法 优势 准确率
滑动窗口 简单 88%
LSTM 捕捉时序依赖 93%
Transformer 长距离依赖 95%

关键词: PERCLOS, 疲劳检测, 时序建模

发布时间: 2026-07-22


疲劳检测算法优化:PERCLOS与时序建模
https://dapalm.com/2026/07/22/2026-07-22-fatigue-detection-perclos-optimization/
作者
Mars
发布于
2026年7月22日
许可协议