2025 04 08, 2131 今日內容
2025-04-08, 21:31-今日內容
torch 的randn 和rand 的区别: randn事符合标准正态分布, 也就是mean事0, std 0。 rand就是均匀… 也过诸赵迹 你的 3.2.3 其实已经成功完成了以下任务: fine tune 我门怎么结合feature engineering出来的feature 流程图 结 LSTM 的目的是保留你在原始数据(Drone/ConV)上已经学到的预测能力,只让新模块去适应新的语义环境。 Data waymax流程图。 zeroshot和fine tune Waymax 场景选择, 数据处理, 接入模型的逻辑 flowchart TD #流程图 #流程图 #流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
torch 的randn 和rand 的区别: randn事符合标准正态分布, 也就是mean事0, std 0。 rand就是均匀… torch 的randn 和rand 的区别: randn事符合标准正态分布, 也就是mean事0, std 0。 rand就是均匀分布, 0 到1 的随机数

#pytorch #randn #rand
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
也过诸赵迹 
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
你的 3.2.3 其实已经成功完成了以下任务: 子节 目的 是否合适 3.2.3.1 Entrance direction clustering 提取结构特征,决定是否是“城市交叉口” ✅ 完美放在 Scenario Selection 初步步骤 3.2.3.2 Volume analysis + Poisson 分析是否是“真实/稳定”的车流格局(不爆量不干涸) ✅ 很好地补充行为合理性标准 3.2.3.3 Driver type + behavior check 判断是否有代表性的行为特征(SDC/ConV) ✅ 支撑“行为分布是否合理”这个筛选标准 3.2.3.4 Spatial filtering + KDE 保证有效轨迹,不受静止车或漂移轨迹干扰 ✅ 是结构和行为的空间验证手段 3.2.3.5 Final filtering criteria 归纳所有筛选条件 ✅ 非常清楚,作为收尾完美
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
fine tune 我门怎么结合feature engineering出来的feature 流程图 
#流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
结 LSTM 的目的是保留你在原始数据(Drone/ConV)上已经学到的预测能力,只让新模块去适应新的语义环境。 这个问题问得特别好,理解“为什么冻结 LSTM”,是你掌握 fine-tuning 真正本质的关键之一。
⸻
🧠 一句话解释:
冻结 LSTM 的目的是保留你在原始数据(Drone/ConV)上已经学到的预测能力,只让新模块去适应新的语义环境。
⸻
🔍 详细解释:
你现在的模型结构中有三个主要模块:
模块 原始用途 在 Fine-tune 中的角色 Encoder (LSTM) 学习如何从历史轨迹中理解行为(比如转弯) ✅ 保持不变,保留原来的预测知识(冻结) Adapter (MLP) 没有原始训练过 ✅ 新训练,学习如何解释新的语义特征 Decoder 输出预测结果 ✅ 新训练,适配语义嵌入之后的 latent
⸻
✅ 冻结的目的(为什么要 freeze LSTM):
📌 1. 保留原模型在 Drone 数据上学到的“行为预测能力” • 你的 LSTM encoder 在 drone 场景上已经学会了“左转、右转、直行”的模式。 • 如果你直接训练整个模型,很可能 semantic 的影响会“破坏”原来的行为识别能力(被覆盖或干扰)。
📌 2. 降低训练难度与过拟合风险 • LSTM 参数非常多,全训风险高。 • 而 semantic adapter + decoder 参数少,更容易在小数据量上训练得稳定。
📌 3. 保持 ConV 行为不变,逐步引导它向 CAV 行为靠近 • LSTM 保持原来人类行为模型; • Adapter 把 CAV 的 lane offset、红绿灯这些因素慢慢引入; • Decoder 学会如何“理解这些语义后调整结果”; • 这就是行为从 ConV → CAV 转化的路径。
⸻
⚙️ 如何实现“冻结 LSTM”的代码?
你其实已经做对了!再强调一次关键代码就是这一句:
for param in encoder.parameters(): param.requires_grad = False
这行代码的意思是:
所有 encoder(LSTM)的参数都不允许被优化器更新。
这样在训练的时候,只有 adapter 和 decoder 会被更新:
optimizer = optim.Adam( list(adapter.parameters()) + list(decoder.parameters()), lr=1e-3 )
⸻
🔚 你可以在论文里这么说(精简版本):
To preserve the maneuver-awareness learned from the drone-based training domain, the LSTM encoder is frozen during fine-tuning. This ensures that the model retains its original turn-discriminative capabilities while adapting the decoder to new semantic cues such as lane offset and traffic signal state.
⸻
要不要我帮你写成一个论文图解:“为什么 freeze encoder + train adapter + decoder”?能直接放到你 Chapter 5 的 5.6 段落中当结构说明用。
#finetune #transferlearning #freeze #adapter
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
Data 
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
waymax流程图。 zeroshot和fine tune 
你这一章内容很完整,只是“zero-shot”和“fine-tune”的逻辑对比可以用一个更清晰的文字版流程图来表达,帮助理解整体迁移流程。下面我给你画一个文字流程图(纯文本版的),并解释每一步在你论文里的意思。
⸻
📊【文字版流程图】:Zero-shot vs Fine-tune 模型迁移流程对比图
┌──────────────────────────────────────────────┐
│ 训练好的 turn-aware LSTM 模型 │
│ 训练数据:Drone 摄像头航拍轨迹 + 转弯标签 │
└──────────────────────────────────────────────┘
│
▼
┌────────────────────────────────┐
│ Waymax 数据预处理阶段 │
│ - 场景筛选(结构对齐) │
│ - Trajectory 过滤(去静态车) │
│ - 坐标转换 / 重采样 / 标准化 │
│ - 构造转弯标签(左/直/右) │
└────────────────────────────────┘
│
▼
┌─────────────────────────────┬──────────────────────────────┐
│ Zero-Shot │ Fine-Tune │
└─────────────────────────────┴──────────────────────────────┘
│ │
▼ ▼
┌────────────────────────────┐ ┌─────────────────────────────┐
│ 跳过 semantic features │ │ 添加 semantic features │
│ 仅使用 motion + label 输入 │ │ 构建 MLP adapter 融合上下文 │
└────────────────────────────┘ └─────────────────────────────┘
│ │
▼ ▼
┌────────────────────────────┐ ┌─────────────────────────────┐
│ 使用 encoder + decoder 推理 │ │ 冻结 encoder,训练 decoder + MLP │
│ 无需再训练,直接预测 Waymax │ │ 逐步适应 Waymax 特征结构 │
└────────────────────────────┘ └─────────────────────────────┘
│ │
▼ ▼
┌────────────────────────────┐ ┌─────────────────────────────┐
│ 基准预测性能(RMSE = 2.81m) │ │ 提升后的性能(RMSE = 2.17m) │
│ 可辨别左转/右转,但偏离大 │ │ 预测更贴近车道 + 遵守红绿灯 │
└────────────────────────────┘ └─────────────────────────────┘
⸻
🔍 对比解释(结合你文中原话)
模型阶段 Zero-shot Fine-tune 输入内容 只用运动特征(vx, vy, ax, ay) + 转弯标签 运动特征 + 语义特征(∆D, 信号灯状态, 车道偏移等) semantic部分 跳过:用0或mask处理 使用 MLP adapter 融合 encoder部分 冻结(直接用 drone 训练的 encoder) 冻结(不改变原先行为建模能力) decoder部分 不再训练 重新训练,适配 Waymax 的行为 优势 快速测试跨域泛化能力;对迁移模型是否有用先观察 利用语义补充弥补 domain gap,提高精度 预测效果 方向大致正确,但空间误差大 轨迹贴近车道中心,更好响应红绿灯,表现出真实交通行为
⸻
📌 你可以怎么写进论文里(推荐段落风格)
你已经写得很好了,但要更清晰区分两者的功能,你可以在 5.6 前加一个 小段落总结 Zero-shot vs Fine-tune 流程图,比如:
To better illustrate the architectural distinction between the zero-shot evaluation and fine-tuned forecasting stages, Figure XX presents a schematic comparison. In the zero-shot setup, the pretrained LSTM model is directly applied to the Waymax domain without incorporating semantic features, relying solely on motion dynamics and maneuver labels. Conversely, in the fine-tuned setup, a semantic adapter module is introduced to encode Waymax-specific features, which are fused into the LSTM encoder. The encoder remains frozen to preserve maneuver-awareness, while the decoder and adapter are retrained to align with the new domain. This dual-path structure allows a clear evaluation of feature-level contribution and transfer robustness.
如果你需要我帮你画出真正的图(可以放进论文的 Figure),我也可以给你生成一张简洁的图解风格图。
要不要我现在给你出图?还是先润色这段描述?
#流程图 #zeroshot #waymax #finetune #transferlearning
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
Waymax 场景选择, 数据处理, 接入模型的逻辑  #流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
flowchart TD subgraph A[Real-World Drone Pipeline] A1[UAV Drone Video at Intersection] A2[YOLOv8 + DeepSORT Tracking] A3[Vehicle Trajectories: x, y, v, a, θ, maneuver] A4[Train Turn-Aware LSTM] A5[Predicted Short-Horizon Trajectories] end
subgraph B[Structured Dataset: Waymo via Waymax]
B1[Waymo Data: Motion, HD Map, Lanes]
B2[Test Turn-Aware LSTM Generalization]
B3[Train HPC-CAV Model: ResNet and LSTM]
end
subgraph C[Simulation: CARLA - Ego Vehicle]
C1[Camera Feed + Ego State: x, y, v, θ]
C2[HPC-CAV Output: Control Commands]
C3[Apply Control to Ego Vehicle]
end
subgraph D[Simulation: VISSIM - ConV Traffic]
D1[Rule-Based Traffic: Wiedemann 99]
D2[Send Leading Vehicle Info to CARLA]
D3[Receive Ego State from CARLA]
D4[Enable Mixed Traffic: CAV + ConVs]
end
%% Flow Connections
A1 --> A2 --> A3 --> A4 --> A5
A5 --> B2
B1 --> B2
B1 --> B3
B3 --> C2
C1 --> C2 --> C3
C3 --> C1
D1 --> D2 --> C1
C1 --> D3 --> D4  #流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
#流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
#流程图
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
#流程图 #匯總今日內容