# 车辆行驶预测 **Repository Path**: sg-first/lane-line-prediction ## Basic Information - **Project Name**: 车辆行驶预测 - **Description**: Convolutional Social Pooling for Vehicle Trajectory Prediction改 - **Primary Language**: Python - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-29 - **Last Updated**: 2024-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: GAT, 神经网络 ## README 车道线预测 ========== 每层输入输出 ---------- ### LSTM编码器层 每辆车一个编码器,给该车三秒的数据编码 #### 输入 车辆位置、所在车道、速度、加速度、车辆类型、同一车道前车车辆id、同一车道后车车辆id(三个时间步的数据`shape=(3, n_features)`) #### 输出 编码向量(只需要输出最后一个时间步,即唯一推断的时间步)`shape=(1, 编码向量长度)` ### GAT层 特征矩阵就是LSTM输出的(最后)一个时间步(里面是3s所有车的编码数据)。邻接矩阵基于每个车一定范围内的车数据预先构建 #### 输入 特征矩阵是所有车的LSTM输出拼在一起,组成一个矩阵`shape=(车数量, 编码向量长度)` ### LSTM解码器 每辆车一个解码器。把输入的编码向量重复5次,每次计算一个输出数据,即得到该车1-5s的推断结果 #### 输入 把LSTM编码器的(最后一个时间步)输出和GAT的输出(矩阵里选出该车对应的行)拼在一起`shape=(1, 编码向量长度*2)` #### 输出 5s的解码数据`shape=(5, 解码向量长度)`。需要再给`解码向量`拆分为:车辆在每车道的概率、车辆位置、速度、加速度 其中`车辆在每车道的概率`还需要接个softmax [各种LSTM实现](https://zhuanlan.zhihu.com/p/59862381) 接口设计 ----------- ### 神经网络相关 #### LSTM编码器 一辆车的编码器: ``` python encoder_i = LSTM(encode_size, activation='relu', return_sequences=False, input_shape=(3, n_features))(data_i) ``` #### GAT层 ``` python A = GetAMat(第2s的所有车数据) F = Concatenate(axis=1)([encoder_1, ……, encoder_n]) F = Reshape((3, encode_size))(b) model = GAT()([A, F]) ``` * keras的GAT去网上抄一个 * `GetAMat`是基于表格里数据计算,需要[实现](https://gitee.com/sg-first/lane-line-prediction/issues/I799MX) #### LSTM解码器 一辆车的解码器: ``` python GatEncode_i = Lambda(lambda x: x[:, i, :])(model) encode2_i = Concatenate(axis=1)([encoder_i, GatEncode_i]) encode2_i = RepeatVector(5)(encode2_i) decoder = LSTM(encode2_size, return_sequences=True)(encode2_i) decoder2 = 拆分层()(decoder) ``` `拆分层`需要实现。它需要将`shape=(5, encode2_size)`的decoder每个时间步下的数据拆分为`车辆在每车道的概率、车辆位置、速度、加速度`(包含对`车辆在每车道的概率`的softmax)