Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
16b6d7f3
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,发现更多精彩内容 >>
提交
16b6d7f3
编写于
6月 09, 2019
作者:
P
panjiacheng
提交者:
HongyiSun
6月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: encode obstacle features in lane_aggregating_evaluator.
上级
137b92ae
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
44 addition
and
12 deletion
+44
-12
modules/prediction/common/prediction_gflags.cc
modules/prediction/common/prediction_gflags.cc
+4
-0
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
+36
-1
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.h
...prediction/evaluator/vehicle/lane_aggregating_evaluator.h
+3
-11
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
16b6d7f3
...
...
@@ -164,6 +164,10 @@ DEFINE_string(torch_pedestrian_interaction_prediction_layer_file,
"/apollo/modules/prediction/data/"
"pedestrian_interaction_prediction_layer.pt"
,
"pedestrian interaction prediction layer"
);
DEFINE_string
(
torch_lane_aggregating_obstacle_encoding_file
,
"/apollo/modules/prediction/data/"
"lane_aggregating_obstacle_encoding_layer.pt"
,
""
);
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
浏览文件 @
16b6d7f3
...
...
@@ -95,6 +95,7 @@ DECLARE_string(torch_pedestrian_interaction_position_embedding_file);
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
(
evaluator_vehicle_rnn_file
);
DECLARE_string
(
evaluator_vehicle_cruise_mlp_file
);
DECLARE_int32
(
max_num_obstacles
);
...
...
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.cc
浏览文件 @
16b6d7f3
...
...
@@ -40,7 +40,13 @@ using apollo::perception::PerceptionObstacles;
LaneAggregatingEvaluator
::
LaneAggregatingEvaluator
()
:
device_
(
torch
::
kCPU
)
{
// LoadModel();
LoadModel
();
}
void
LaneAggregatingEvaluator
::
LoadModel
()
{
torch
::
set_num_threads
(
1
);
torch_obstacle_encoding_ptr_
=
torch
::
jit
::
load
(
FLAGS_torch_lane_aggregating_obstacle_encoding_file
,
device_
);
}
bool
LaneAggregatingEvaluator
::
Evaluate
(
Obstacle
*
obstacle_ptr
)
{
...
...
@@ -69,6 +75,35 @@ bool LaneAggregatingEvaluator::Evaluate(Obstacle* obstacle_ptr) {
<<
" lane sequences to scan."
;
// Extract features, and do model inferencing.
// 1. Encode the obstacle features.
std
::
vector
<
double
>
obstacle_feature_values
;
if
(
!
ExtractObstacleFeatures
(
obstacle_ptr
,
&
obstacle_feature_values
))
{
ADEBUG
<<
"Failed to extract obstacle features for obs_id = "
<<
id
;
}
if
(
obstacle_feature_values
.
size
()
!=
OBSTACLE_FEATURE_SIZE
)
{
ADEBUG
<<
"Obstacle ["
<<
id
<<
"] has fewer than "
<<
"expected obstacle feature_values "
<<
obstacle_feature_values
.
size
()
<<
"."
;
return
false
;
}
ADEBUG
<<
"Obstacle feature size = "
<<
obstacle_feature_values
.
size
();
std
::
vector
<
torch
::
jit
::
IValue
>
obstacle_encoding_inputs
;
torch
::
Tensor
obstacle_encoding_inputs_tensor
=
torch
::
zeros
({
1
,
static_cast
<
int
>
(
obstacle_feature_values
.
size
())});
for
(
size_t
i
=
0
;
i
<
obstacle_feature_values
.
size
();
++
i
)
{
obstacle_encoding_inputs_tensor
[
0
][
i
]
=
static_cast
<
float
>
(
obstacle_feature_values
[
i
]);
}
obstacle_encoding_inputs
.
push_back
(
std
::
move
(
obstacle_encoding_inputs_tensor
));
torch
::
Tensor
obstalce_encoding
=
torch_obstacle_encoding_ptr_
->
forward
(
obstacle_encoding_inputs
).
toTensor
().
to
(
torch
::
kCPU
);
// 2. Encode the lane features.
// 3. Aggregate the lane features.
// 4. Make prediction.
return
true
;
}
...
...
modules/prediction/evaluator/vehicle/lane_aggregating_evaluator.h
浏览文件 @
16b6d7f3
...
...
@@ -80,15 +80,7 @@ class LaneAggregatingEvaluator : public Evaluator {
std
::
vector
<
std
::
vector
<
double
>>*
feature_values
,
std
::
vector
<
int
>*
lane_sequence_idx_to_remove
);
// struct LSTMState {
// double timestamp;
// torch::Tensor ct;
// torch::Tensor ht;
// };
// void Clear();
// void LoadModel();
void
LoadModel
();
private:
// std::unordered_map<int, LSTMState> obstacle_id_lstm_state_map_;
...
...
@@ -98,8 +90,8 @@ class LaneAggregatingEvaluator : public Evaluator {
// torch_social_embedding_ptr_ = nullptr;
// std::shared_ptr<torch::jit::script::Module>
// torch_single_lstm_ptr_ = nullptr;
//
std::shared_ptr<torch::jit::script::Module>
// torch_prediction_layer
_ptr_ = nullptr;
std
::
shared_ptr
<
torch
::
jit
::
script
::
Module
>
torch_obstacle_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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录