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
| """ Euro NCAP 2026 乘员体型分类 基于CDC 2000 Growth Charts的身高-体重判定
CDC生长曲线数据: - 男性身高曲线(2-20岁) - 女性身高曲线(2-20岁) - 成人BMI曲线(20+岁)
体型分类: - 5th percentile:身高约150cm(女性),体重约45kg - 50th percentile:身高约170cm,体重约70kg - 95th percentile:身高约185cm(男性),体重约90kg """
import numpy as np from typing import Tuple, Optional from dataclasses import dataclass
@dataclass class OccupantStature: """乘员体型分类数据""" stature_percentile: str height_estimate_cm: float weight_estimate_kg: float confidence: float sitting_height_cm: float shoulder_width_cm: float hip_width_cm: float
class CDCGrowthCurveClassifier: """ CDC生长曲线体型分类器 基于2000 CDC Growth Charts进行身高-体重判定 CDC数据要点: - 5th percentile女性身高(20岁):约150.5cm - 50th percentile女性身高(20岁):约162.5cm - 95th percentile女性身高(20岁):约174.5cm - 5th percentile男性身高(20岁):约163.5cm - 50th percentile男性身高(20岁):约176.5cm - 95th percentile男性身高(20岁):约186.5cm 欧洲人体型修正: - 欧洲人平均身高略高于美国 - Euro NCAP采用AF05-AM95标准 """ def __init__(self): self.height_percentiles = { '5th': { 'male': 163.5, 'female': 150.5, 'adult': 150.0 }, '50th': { 'male': 176.5, 'female': 162.5, 'adult': 170.0 }, '95th': { 'male': 186.5, 'female': 174.5, 'adult': 185.0 } } self.weight_percentiles = { '5th': { 'male': 55.0, 'female': 45.0, 'adult': 50.0 }, '50th': { 'male': 75.0, 'female': 60.0, 'adult': 70.0 }, '95th': { 'male': 95.0, 'female': 80.0, 'adult': 90.0 } } def classify_stature(self, height_estimate_cm: float, weight_estimate_kg: Optional[float] = None, sitting_height_cm: Optional[float] = None, shoulder_width_cm: Optional[float] = None) -> OccupantStature: """ 体型分类 判定逻辑: 1. 身高作为主要判定依据 2. 体重作为辅助判定 3. 坐高、肩宽作为补充参考 Args: height_estimate_cm: 身高估计 weight_estimate_kg: 体重估计(可选) sitting_height_cm: 坐高(可选) shoulder_width_cm: 肩宽(可选) Returns: OccupantStature: 体型分类结果 """ height_thresholds = { '5th': self.height_percentiles['5th']['adult'] + 5, '50th': self.height_percentiles['50th']['adult'] + 10, '95th': self.height_percentiles['95th']['adult'] - 5 } if height_estimate_cm <= height_thresholds['5th']: percentile = '5th' confidence_height = 0.9 elif height_estimate_cm <= height_thresholds['50th']: percentile = '50th' confidence_height = 0.85 else: percentile = '95th' confidence_height = 0.9 confidence_weight = 0.0 if weight_estimate_kg is not None: weight_thresholds = { '5th': self.weight_percentiles['5th']['adult'] + 5, '50th': self.weight_percentiles['50th']['adult'] + 10, '95th': self.weight_percentiles['95th']['adult'] - 5 } weight_percentile = self._classify_weight(weight_estimate_kg, weight_thresholds) if weight_percentile == percentile: confidence_weight = 0.8 else: confidence_weight = 0.5 total_confidence = confidence_height * 0.7 + confidence_weight * 0.3 sitting_height = sitting_height_cm or self._estimate_sitting_height(height_estimate_cm) shoulder_width = shoulder_width_cm or self._estimate_should_width(height_estimate_cm) hip_width = self._estimate_hip_width(weight_estimate_kg or 70.0) return OccupantStature( stature_percentile=percentile, height_estimate_cm=height_estimate_cm, weight_estimate_kg=weight_estimate_kg or 70.0, confidence=total_confidence, sitting_height_cm=sitting_height, shoulder_width_cm=shoulder_width, hip_width_cm=hip_width ) def _classify_weight(self, weight_kg: float, thresholds: Dict) -> str: """体重分类""" if weight_kg <= thresholds['5th']: return '5th' elif weight_kg <= thresholds['50th']: return '50th' else: return '95th' def _estimate_sitting_height(self, height_cm: float) -> float: """ 坐高估计 坐高与身高比例约0.52-0.54(成年人) """ sitting_ratio = 0.53 return height_cm * sitting_ratio def _estimate_should_width(self, height_cm: float) -> float: """ 肩宽估计 肩宽与身高比例约0.23-0.25(成年人) """ shoulder_ratio = 0.24 return height_cm * shoulder_ratio def _estimate_hip_width(self, weight_kg: float) -> float: """ 腰宽估计 腰宽与体重相关,约30-40cm """ return 35.0 + (weight_kg - 70) * 0.1
if __name__ == "__main__": classifier = CDCGrowthCurveClassifier() print(f"=== CDC生长曲线体型分类测试 ===") test_heights = [145, 160, 175, 190] for height in test_heights: result = classifier.classify_stature(height_estimate_cm=height) print(f"\n身高 {height}cm:") print(f" 分类:{result.stature_percentile} percentile") print(f" 体重估计:{result.weight_estimate_kg:.1f} kg") print(f" 坐高估计:{result.sitting_height_cm:.1f} cm") print(f" 置信度:{result.confidence:.2f}")
|