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
| class MultiRadarFusion: """ 多雷达融合检测 Volvo EX90使用7个雷达,通过融合提升检测可靠性 """ def __init__(self, num_radars=7): self.num_radars = num_radars self.detectors = [RadarVitalSignsDetector() for _ in range(num_radars)] def detect_presence(self, radar_signals): """ 融合检测车内生命体 Args: radar_signals: (7, N) 7个雷达的信号 Returns: result: { 'presence': bool, 'location': str, 'occupant_type': str, 'confidence': float } """ detections = [] for i, signal in enumerate(radar_signals): phase = self.detectors[i].extract_phase(signal) breath_rate, conf = self.detectors[i].detect_breathing(phase) if conf > 2.0: occupant = self.detectors[i].classify_occupant(breath_rate, 0.5) detections.append({ 'radar_id': i, 'breath_rate': breath_rate, 'confidence': conf, 'occupant_type': occupant }) if len(detections) == 0: return { 'presence': False, 'location': 'none', 'occupant_type': 'none', 'confidence': 0.0 } best = max(detections, key=lambda x: x['confidence']) location_map = { 0: 'front_left', 1: 'front_right', 2: 'rear_left', 3: 'rear_right', 4: 'b_pillar_left', 5: 'b_pillar_right', 6: 'trunk' } return { 'presence': True, 'location': location_map[best['radar_id']], 'occupant_type': best['occupant_type'], 'confidence': best['confidence'] / 10.0 }
|