Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
0823cf39
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0823cf39
编写于
6月 09, 2019
作者:
P
panjiacheng
提交者:
HongyiSun
6月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: encode all lane features and put them into a vector.
上级
16b6d7f3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
1 deletion
+36
-1
modules/prediction/common/prediction_gflags.cc
modules/prediction/common/prediction_gflags.cc
+5
-1
modules/prediction/common/prediction_gflags.h
modules/prediction/common/prediction_gflags.h
+1
-0
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.cc
...rediction/evaluator/vehicle/lane_aggregating_evaluator.cc
+28
-0
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.h
...prediction/evaluator/vehicle/lane_aggregating_evaluator.h
+2
-0
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
0823cf39
...
...
@@ -167,7 +167,11 @@ DEFINE_string(torch_pedestrian_interaction_prediction_layer_file,
DEFINE_string
(
torch_lane_aggregating_obstacle_encoding_file
,
"/apollo/modules/prediction/data/"
"lane_aggregating_obstacle_encoding_layer.pt"
,
""
);
"lane aggregating obstacle encoding layer"
);
DEFINE_string
(
torch_lane_aggregating_lane_encoding_file
,
"/apollo/modules/prediction/data/"
"lane_aggregating_lane_encoding_layer.pt"
,
"lane aggregating lane encoding layer"
);
DEFINE_int32
(
max_num_obstacles
,
300
,
"maximal number of obstacles stored in obstacles container."
);
DEFINE_double
(
valid_position_diff_threshold
,
0.5
,
...
...
modules/prediction/common/prediction_gflags.h
浏览文件 @
0823cf39
...
...
@@ -96,6 +96,7 @@ DECLARE_string(torch_pedestrian_interaction_social_embedding_file);
DECLARE_string
(
torch_pedestrian_interaction_single_lstm_file
);
DECLARE_string
(
torch_pedestrian_interaction_prediction_layer_file
);
DECLARE_string
(
torch_lane_aggregating_obstacle_encoding_file
);
DECLARE_string
(
torch_lane_aggregating_lane_encoding_file
);
DECLARE_string
(
evaluator_vehicle_rnn_file
);
DECLARE_string
(
evaluator_vehicle_cruise_mlp_file
);
DECLARE_int32
(
max_num_obstacles
);
...
...
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.cc
浏览文件 @
0823cf39
...
...
@@ -47,6 +47,8 @@ void LaneAggregatingEvaluator::LoadModel() {
torch
::
set_num_threads
(
1
);
torch_obstacle_encoding_ptr_
=
torch
::
jit
::
load
(
FLAGS_torch_lane_aggregating_obstacle_encoding_file
,
device_
);
torch_lane_encoding_ptr_
=
torch
::
jit
::
load
(
FLAGS_torch_lane_aggregating_lane_encoding_file
,
device_
);
}
bool
LaneAggregatingEvaluator
::
Evaluate
(
Obstacle
*
obstacle_ptr
)
{
...
...
@@ -100,6 +102,32 @@ bool LaneAggregatingEvaluator::Evaluate(Obstacle* obstacle_ptr) {
->
forward
(
obstacle_encoding_inputs
).
toTensor
().
to
(
torch
::
kCPU
);
// 2. Encode the lane features.
std
::
vector
<
std
::
vector
<
double
>>
lane_feature_values
;
std
::
vector
<
int
>
lane_sequence_idx_to_remove
;
if
(
!
ExtractStaticEnvFeatures
(
obstacle_ptr
,
lane_graph_ptr
,
&
lane_feature_values
,
&
lane_sequence_idx_to_remove
))
{
AERROR
<<
"Failed to extract static environmental features around obs_id = "
<<
id
;
}
std
::
vector
<
torch
::
Tensor
>
lane_encoding_list
;
for
(
const
auto
&
single_lane_feature_values
:
lane_feature_values
)
{
if
(
single_lane_feature_values
.
size
()
!=
SINGLE_LANE_FEATURE_SIZE
)
{
AERROR
<<
"Obstacle ["
<<
id
<<
"] has incorrect lane feature size."
;
return
false
;
}
std
::
vector
<
torch
::
jit
::
IValue
>
single_lane_encoding_inputs
;
torch
::
Tensor
single_lane_encoding_inputs_tensor
=
torch
::
zeros
({
1
,
static_cast
<
int
>
(
single_lane_feature_values
.
size
())});
for
(
size_t
i
=
0
;
i
<
single_lane_feature_values
.
size
();
++
i
)
{
single_lane_encoding_inputs_tensor
[
0
][
i
]
=
static_cast
<
float
>
(
single_lane_feature_values
[
i
]);
}
single_lane_encoding_inputs
.
push_back
(
std
::
move
(
single_lane_encoding_inputs_tensor
));
torch
::
Tensor
single_lane_encoding
=
torch_lane_encoding_ptr_
->
forward
(
single_lane_encoding_inputs
).
toTensor
().
to
(
torch
::
kCPU
);
lane_encoding_list
.
push_back
(
std
::
move
(
single_lane_encoding
));
}
// 3. Aggregate the lane features.
...
...
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.h
浏览文件 @
0823cf39
...
...
@@ -92,6 +92,8 @@ class LaneAggregatingEvaluator : public Evaluator {
// torch_single_lstm_ptr_ = nullptr;
std
::
shared_ptr
<
torch
::
jit
::
script
::
Module
>
torch_obstacle_encoding_ptr_
=
nullptr
;
std
::
shared_ptr
<
torch
::
jit
::
script
::
Module
>
torch_lane_encoding_ptr_
=
nullptr
;
torch
::
Device
device_
;
static
const
size_t
OBSTACLE_FEATURE_SIZE
=
20
*
9
;
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录