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
| DSM_SCORING_2027 = { "fatigue_detection": { "max_points": 5, "scenarios": [ {"id": "F-01", "name": "PERCLOS检测", "threshold": "≥30%", "points": 2}, {"id": "F-02", "name": "微睡眠检测", "threshold": "≤3s响应", "points": 2}, {"id": "F-03", "name": "持续疲劳警告", "threshold": "二级警告", "points": 1} ] }, "distraction_detection": { "max_points": 6, "scenarios": [ {"id": "D-01", "name": "手机使用", "threshold": "≤3s检测", "points": 2}, {"id": "D-02", "name": "视线偏离", "threshold": "≥3s偏离", "points": 2}, {"id": "D-03", "name": "手动分心", "threshold": "手离开方向盘", "points": 1}, {"id": "D-04", "name": "认知分心", "threshold": "眼动熵值", "points": 1} ] }, "impairment_detection": { "max_points": 4, "scenarios": [ {"id": "I-01", "name": "酒精损伤", "threshold": "行为模式异常", "points": 2}, {"id": "I-02", "name": "药物损伤", "threshold": "多模态检测", "points": 2} ] } }
def calculate_dsm_score(test_results: dict) -> float: """ 计算Euro NCAP 2027 DSM评分 Args: test_results: 各场景检测结果 Returns: total_score: 总分 (0-15) """ total_score = 0.0 for category, config in DSM_SCORING_2027.items(): for scenario in config['scenarios']: scenario_id = scenario['id'] if test_results.get(scenario_id, {}).get('passed', False): base_points = scenario['points'] * 0.8 response_time = test_results.get(scenario_id, {}).get('response_time', 10) if response_time <= 1.0: base_points += scenario['points'] * 0.2 total_score += base_points return min(total_score, 15.0)
|