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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
| class NHTSAContextualDMS: """ NHTSA情境感知DMS原型 多源数据融合:视觉+物理+外部 """ def __init__(self): self.visual_data = None self.physical_data = None self.external_data = None def receive_visual_data(self, dms_output): """ 接收视觉数据 DMS摄像头眼动追踪 """ self.visual_data = { 'gaze_zone': dms_output['gaze_zone'], 'gaze_duration': dms_output['gaze_duration'], 'eye_closure': dms_output['eye_closure'], 'blink_rate': dms_output['blink_rate'] } def receive_physical_data(self, sensor_output): """ 接收物理数据 方向盘/座椅/安全带传感器 """ self.physical_data = { 'steering_torque': sensor_output['steering_torque'], 'seat_pressure': sensor_output['seat_pressure'], 'belt_tension': sensor_output['belt_tension'], 'wheel_correction': sensor_output['wheel_correction_frequency'] } def receive_external_data(self, adas_output): """ 接收外部数据 ADAS道路情境感知 """ self.external_data = { 'road_context': adas_output['road_context'], 'hazards': adas_output['hazards'], 'vehicle_speed': adas_output['speed'], 'lane_change_intent': adas_output['lane_change_intent'] } def fuse_contextual_data(self): """ NHTSA情境数据融合 多源数据综合判定驾驶员状态 """ if self.visual_data is None or self.physical_data is None or self.external_data is None: return None road_context = self.external_data['road_context'] gaze_zone = self.visual_data['gaze_zone'] wheel_correction = self.physical_data['wheel_correction'] if road_context == 'dense_traffic': if gaze_zone in ['left_window', 'right_window']: if wheel_correction < 5: return { 'driver_state': 'attentive', 'context_match': True, 'warning_action': 'suppress', 'reason': 'NHTSA: dense traffic surroundings check is normal' } if road_context == 'roundabout': if gaze_zone in ['left_window', 'right_window', 'mirror']: return { 'driver_state': 'attentive', 'context_match': True, 'warning_action': 'suppress', 'reason': 'NHTSA: roundabout check is normal' } if road_context == 'normal': if gaze_zone == 'forward': if wheel_correction > 5: return { 'driver_state': 'attentive', 'context_match': True, 'warning_action': 'none', 'reason': 'NHTSA: normal driving attention' } if self.visual_data['eye_closure'] > 0.3: if wheel_correction < 3: return { 'driver_state': 'fatigue', 'context_match': False, 'warning_action': 'trigger', 'reason': 'NHTSA: fatigue detected (PERCLOS + wheel correction)' } if gaze_zone in ['center_console', 'below', 'passenger']: return { 'driver_state': 'distraction', 'context_match': False, 'warning_action': 'trigger', 'reason': 'NHTSA: distraction detected (gaze off-road)' } return { 'driver_state': 'attentive', 'context_match': False, 'warning_action': 'none', 'reason': 'NHTSA: default attentive state' } def assess_driver_acceptance(self, contextual_result): """ NHTSA驾驶员接受度评估 情境匹配时驾驶员接受度高 """ if contextual_result['warning_action'] == 'suppress': return { 'acceptance_level': 'high', 'perception': 'system_understands_me', 'user_feedback': 'positive' } if contextual_result['warning_action'] == 'trigger': if not contextual_result['context_match']: return { 'acceptance_level': 'mixed', 'perception': 'system_monitors_me', 'user_feedback': 'mixed' } return { 'acceptance_level': 'neutral', 'perception': 'system_inactive', 'user_feedback': 'neutral' }
if __name__ == "__main__": nhtsa_dms = NHTSAContextualDMS() nhtsa_dms.receive_visual_data({ 'gaze_zone': 'left_window', 'gaze_duration': 2, 'eye_closure': 0.1, 'blink_rate': 15 }) nhtsa_dms.receive_physical_data({ 'steering_torque': 2.5, 'seat_pressure': 50, 'belt_tension': 10, 'wheel_correction_frequency': 3 }) nhtsa_dms.receive_external_data({ 'road_context': 'dense_traffic', 'hazards': ['pedestrian'], 'speed': 20, 'lane_change_intent': False }) result = nhtsa_dms.fuse_contextual_data() print(f"NHTSA密集交通场景: {result}") acceptance = nhtsa_dms.assess_driver_acceptance(result) print(f"驾驶员接受度: {acceptance}")
|