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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
| import numpy as np
class CameraRadarFusion: """ Deep In Sight + Murata 多模态融合方案 相机: 乘员可见区域检测+分类 雷达: 相机盲区生命体征检测 """ def __init__(self): self.camera_confidence = 0.0 self.radar_confidence = 0.0 self.fusion_result = None def camera_detect(self, image_features: dict) -> dict: """相机检测结果""" return { 'occupants_visible': image_features.get('detected_persons', []), 'child_visible': image_features.get('child_detected', False), 'confidence': image_features.get('confidence', 0.9), 'blind_spot': image_features.get('blind_spot', False) } def radar_detect(self, radar_data: dict) -> dict: """雷达检测结果""" return { 'presence_detected': radar_data.get('presence', False), 'breathing_rate': radar_data.get('breathing_rate', 0), 'heart_rate': radar_data.get('heart_rate', 0), 'location': radar_data.get('location', 'unknown'), 'confidence': radar_data.get('confidence', 0.85) } def fuse(self, cam_result: dict, rad_result: dict) -> dict: """多模态融合""" if cam_result['occupants_visible'] and rad_result['presence_detected']: return { 'status': 'confirmed_occupant', 'category': cam_result.get('occupants_visible', ['adult']), 'breathing': rad_result['breathing_rate'] > 0, 'confidence': 0.98 } if cam_result['blind_spot'] and rad_result['presence_detected']: return { 'status': 'hidden_occupant_alert', 'category': 'potential_child', 'breathing': rad_result['breathing_rate'] > 0, 'heart_rate': rad_result['heart_rate'], 'confidence': 0.90, 'action': 'CPD_ALERT' } if cam_result['occupants_visible'] and not rad_result['presence_detected']: return { 'status': 'camera_only_detection', 'confidence': 0.60, 'note': 'Possible false positive - verify' } return { 'status': 'empty_cabin', 'confidence': 0.99 }
class RPPGVitalSigns: """ rPPG (remote photoplethysmography) 远程光电容积脉搏波 Deep In Sight展示: 使用标准车内相机图像 估计心率和生命体征,无需物理接触 原理: 皮肤颜色微小变化反映血液脉动 """ def __init__(self, fs: float = 30.0): self.fs = fs def extract_skin_roi(self, face_landmarks: np.ndarray) -> np.ndarray: """从面部landmarks提取皮肤ROI""" forehead = face_landmarks[19:25] cheek_l = face_landmarks[31:36] cheek_r = face_landmarks[37:42] roi_points = np.vstack([forehead, cheek_l, cheek_r]) return roi_points def extract_pulse_signal(self, frames: np.ndarray, roi_mask: np.ndarray) -> np.ndarray: """ 从视频帧序列提取脉搏信号 Args: frames: (T, H, W, 3) RGB视频帧 roi_mask: (H, W) 皮肤区域mask Returns: pulse_signal: (T,) 脉搏信号 """ T = frames.shape[0] pulse = np.zeros(T) for t in range(T): frame = frames[t] skin_pixels = frame[roi_mask > 0] if len(skin_pixels) > 0: green_mean = np.mean(skin_pixels[:, 1]) pulse[t] = green_mean from scipy import signal as sig pulse = sig.detrend(pulse, type='linear') nyq = self.fs / 2 b, a = sig.butter(4, [0.7/nyq, 3.0/nyq], btype='band') pulse_filtered = sig.filtfilt(b, a, pulse) return pulse_filtered def estimate_heart_rate(self, pulse_signal: np.ndarray) -> float: """从脉搏信号估计心率""" from scipy import signal as sig freqs = np.fft.rfftfreq(len(pulse_signal), d=1/self.fs) fft_mag = np.abs(np.fft.rfft(pulse_signal)) mask = (freqs >= 0.7) & (freqs <= 3.0) peak_idx = np.argmax(fft_mag[mask]) peak_freq = freqs[mask][peak_idx] hr_bpm = peak_freq * 60 return hr_bpm
class LowPowerIntrusionDetection: """ 低功耗入侵检测模式 Deep In Sight方案: 雷达持续运行检测入侵 检测到后唤醒相机确认 功耗: 雷达~0.5W vs 相机~2-3W """ def __init__(self): self.radar_active = True self.camera_active = False self.detection_threshold = 0.6 def run_radar_scan(self) -> dict: """雷达持续扫描""" return { 'presence': True, 'distance': 0.5, 'movement': True, 'confidence': 0.75 } def process(self, radar_result: dict) -> dict: """处理逻辑""" if radar_result['confidence'] > self.detection_threshold: self.camera_active = True return { 'action': 'wake_camera', 'reason': 'radar_detected_presence', 'radar_confidence': radar_result['confidence'] } return {'action': 'continue_radar', 'reason': 'no_detection'}
if __name__ == "__main__": print("=" * 60) print("Deep In Sight + Murata 多模态融合感知") print("InCabin Europe 2026") print("=" * 60) fusion = CameraRadarFusion() scenarios = [ ("正常驾驶", {'detected_persons': ['adult_driver'], 'confidence': 0.95, 'blind_spot': False}, {'presence': True, 'breathing_rate': 16, 'heart_rate': 72, 'confidence': 0.90}), ("隐藏儿童(相机盲区)", {'detected_persons': [], 'confidence': 0.3, 'blind_spot': True}, {'presence': True, 'breathing_rate': 28, 'heart_rate': 110, 'confidence': 0.88}), ("空车", {'detected_persons': [], 'confidence': 0.95, 'blind_spot': False}, {'presence': False, 'breathing_rate': 0, 'heart_rate': 0, 'confidence': 0.95}), ("相机误报", {'detected_persons': ['unknown'], 'confidence': 0.4, 'blind_spot': False}, {'presence': False, 'breathing_rate': 0, 'heart_rate': 0, 'confidence': 0.95}), ] print(f"\n{'场景':<20} {'融合结果':<25} {'置信度':<10} {'动作':<15}") print("-" * 70) for name, cam_data, rad_data in scenarios: cam_result = fusion.camera_detect(cam_data) rad_result = fusion.radar_detect(rad_data) result = fusion.fuse(cam_result, rad_result) print(f"{name:<20} {result['status']:<25} " f"{result.get('confidence', 0):.0%} " f"{result.get('action', 'none'):<15}") print(f"\n{'='*60}") print("rPPG 生命体征估计") print(f"{'='*60}") rppg = RPPGVitalSigns(fs=30) np.random.seed(42) T = 900 frames = np.random.randint(0, 255, (T, 64, 64, 3), dtype=np.uint8) t = np.arange(T) / 30.0 pulse_freq = 1.2 for i in range(T): frames[i, 20:40, 20:40, 1] = 128 + 10 * np.sin(2 * np.pi * pulse_freq * t[i]) roi_mask = np.zeros((64, 64)) roi_mask[20:40, 20:40] = 1 pulse = rppg.extract_pulse_signal(frames, roi_mask) hr = rppg.estimate_heart_rate(pulse) print(f" 视频时长: {T/30:.1f}s") print(f" 估计心率: {hr:.0f} bpm") print(f" 真实值: 72 bpm") print(f" 误差: {abs(hr-72):.0f} bpm") print(f"\n{'='*60}") print("低功耗入侵检测功耗分析") print(f"{'='*60}") intrusion = LowPowerIntrusionDetection() result = intrusion.run_radar_scan() action = intrusion.process(result) print(f" 雷达持续模式: ~0.5W (24h = 12Wh)") print(f" 相机持续模式: ~2.5W (24h = 60Wh)") print(f" 雷达触发相机: 平均 ~0.8W (节省68%)") print(f" 当前动作: {action['action']}") print(f"\n关键洞察 (Deep In Sight CTO Inchan Ji):") print(f" '相机有明确局限性,但雷达可以克服这些挑战并实现新应用'") print(f" '雷达系统正变得比相机系统更经济'") print(f" '这为OEM和Tier1创造了添加新感知能力的真实机会'")
|