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
| class FourDRadarPreprocessing: """ 4D雷达预处理框架(arXiv:2609.18542) 三大模块: 1. P3DP: 百分位3D形状保留 → 从雷达张量提取点云 2. MF-KDE: 多帧核密度估计 → 去噪+增密 3. ENS: 嵌入式适配评估 → 精度+实时性+天气+复杂度 """ def P3DP(self, radar_tensor, percentile=95): """ Percentile-based 3D Shape Preservation 传统方法:CFAR(固定阈值)→ 噪声多 P3DP:百分位数自适应 → 保留形状信息 Args: radar_tensor: (Range, Azimuth, Elevation, Doppler) percentile: 百分位阈值 Returns: point_cloud: (N, 5) [x,y,z, intensity, doppler] """ intensity = np.percentile( np.abs(radar_tensor), percentile, axis=3 ) mask = intensity > np.mean(intensity) * 2 points = [] for r, a, e in np.argwhere(mask): x = r * np.cos(e) * np.cos(a) y = r * np.cos(e) * np.sin(a) z = r * np.sin(e) d = np.argmax(np.abs(radar_tensor[r, a, e, :])) points.append([x, y, z, intensity[r, a, e], d]) return np.array(points) def MF_KDE(self, point_clouds, num_frames=5): """ Multi-frame Kernel Density Estimation 跨多帧点云做KDE → 提高密度 + 去除孤立噪声 座舱价值: - 多帧累积 → 儿童呼吸检测信号增强 - KDE去噪 → 去除座椅金属反射 """ from scipy.stats import gaussian_kde all_points = np.concatenate(point_clouds[-num_frames:]) if len(all_points) < 10: return point_clouds[-1] kde = gaussian_kde(all_points[:, :3].T) densities = kde(all_points[:, :3].T) threshold = np.percentile(densities, 50) filtered = all_points[densities > threshold] return filtered def ENS_score(self, accuracy, latency, weather_robustness, complexity): """ Embedded & NetScore (ENS) 综合评估嵌入式部署适配性: - 精度 (accuracy) - 实时性 (latency) - 天气鲁棒性 (weather_robustness) - 模型复杂度 (complexity) """ alpha = 0.3 beta = 0.3 gamma = 0.2 delta = 0.2 score = ( alpha * accuracy / 100 + beta * (1 / latency) + gamma * weather_robustness + delta * (1 / complexity) ) return score
|