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 166 167 168 169 170 171
| """ BAE Project Intuity 注视追踪自适应显示系统 跨领域应用于汽车 DMS
战斗机场景:根据飞行员注视点动态调整 AR 显示内容 汽车场景:根据驾驶员注视区域动态调整 HUD 警告信息 """
import numpy as np from dataclasses import dataclass from typing import Tuple, List
@dataclass class GazePoint: """注视点""" x: float y: float timestamp: float confidence: float
class AttentionAwareDisplay: """ 注意力感知显示系统 源自战斗机 AR 头盔设计理念: - 检测飞行员/驾驶员注视区域 - 在注视区域附近叠加关键信息 - 周边威胁用空间音频提示 """ ZONES = { "road_center": (0.5, 0.5), "left_mirror": (0.2, 0.4), "right_mirror": (0.8, 0.4), "dashboard": (0.5, 0.8), "hud_area": (0.5, 0.3), } def __init__(self): self.gaze_history: List[GazePoint] = [] self.current_zone = "road_center" self.alert_priority = {"critical": 0, "warning": 1, "info": 2} def update_gaze(self, gaze: GazePoint): """更新注视点""" self.gaze_history.append(gaze) if len(self.gaze_history) > 300: self.gaze_history.pop(0) self.current_zone = self._classify_gaze_zone(gaze) def _classify_gaze_zone(self, gaze: GazePoint) -> str: """分类注视区域""" min_dist = float('inf') closest_zone = "road_center" for zone, (zx, zy) in self.ZONES.items(): dist = np.sqrt((gaze.x - zx)**2 + (gaze.y - zy)**2) if dist < min_dist: min_dist = dist closest_zone = zone return closest_zone def get_display_strategy(self) -> dict: """ 根据注视区域生成显示策略 Returns: 显示策略字典 """ strategies = { "road_center": { "hud_mode": "minimal", "alert_position": "peripheral", "audio_cue": True, "priority": "only_critical" }, "left_mirror": { "hud_mode": "side_alert", "alert_position": "left_edge", "audio_cue": False, "priority": "blind_spot_warning" }, "right_mirror": { "hud_mode": "side_alert", "alert_position": "right_edge", "audio_cue": False, "priority": "blind_spot_warning" }, "dashboard": { "hud_mode": "enhanced", "alert_position": "center", "audio_cue": True, "priority": "all" }, } return strategies.get(self.current_zone, strategies["road_center"]) def detect_cognitive_overload(self) -> bool: """ 检测认知过载 战机理念:注视点频繁跳跃 = 认知过载 汽车应用:视线分散 = 分心驾驶 """ if len(self.gaze_history) < 60: return False recent = self.gaze_history[-60:] jumps = 0 for i in range(1, len(recent)): dx = recent[i].x - recent[i-1].x dy = recent[i].y - recent[i-1].y if np.sqrt(dx**2 + dy**2) > 0.15: jumps += 1 jump_rate = jumps / (len(recent) / 30) return jump_rate > 3.0 def get_recommendation(self) -> str: """获取交互建议""" if self.detect_cognitive_overload(): return "COGNITIVE_OVERLOAD: 减少HUD信息,使用空间音频引导注意力" strategy = self.get_display_strategy() zone = self.current_zone if zone == "road_center": return "FOCUS_OK: 驾驶员注视道路,HUD保持最小化" elif zone in ["left_mirror", "right_mirror"]: return f"ZONE_CHECK: 驾驶员查看{zone},激活盲区检测" elif zone == "dashboard": return "DASHBOARD: 驾驶员看仪表盘,增强HUD关键信息" return "UNKNOWN"
if __name__ == "__main__": system = AttentionAwareDisplay() for i in range(60): g = GazePoint( x=0.5 + np.random.normal(0, 0.03), y=0.5 + np.random.normal(0, 0.03), timestamp=i * 33, confidence=0.95 ) system.update_gaze(g) print(f"正常驾驶: {system.get_recommendation()}") zones = [(0.2, 0.4), (0.8, 0.4), (0.5, 0.8), (0.3, 0.6)] for i in range(60): z = zones[i % 4] g = GazePoint( x=z[0] + np.random.normal(0, 0.02), y=z[1] + np.random.normal(0, 0.02), timestamp=i * 33, confidence=0.90 ) system.update_gaze(g) print(f"分心驾驶: {system.get_recommendation()}")
|