Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
42d5e5e2
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,发现更多精彩内容 >>
提交
42d5e5e2
编写于
1月 23, 2019
作者:
K
kechxu
提交者:
Calvin Miao
1月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: implement records_to_data_for_learning
上级
c6012dba
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
8 deletion
+73
-8
modules/prediction/common/feature_output.cc
modules/prediction/common/feature_output.cc
+2
-5
modules/prediction/common/feature_output.h
modules/prediction/common/feature_output.h
+2
-1
modules/prediction/evaluator/vehicle/lane_scanning_evaluator.cc
...s/prediction/evaluator/vehicle/lane_scanning_evaluator.cc
+1
-1
modules/prediction/pipeline/BUILD
modules/prediction/pipeline/BUILD
+8
-0
modules/prediction/pipeline/records_to_data_for_learning.cc
modules/prediction/pipeline/records_to_data_for_learning.cc
+60
-0
modules/prediction/proto/feature.proto
modules/prediction/proto/feature.proto
+0
-1
未找到文件。
modules/prediction/common/feature_output.cc
浏览文件 @
42d5e5e2
...
...
@@ -16,7 +16,6 @@
#include "modules/prediction/common/feature_output.h"
#include <string>
#include <vector>
#include "modules/common/util/file.h"
...
...
@@ -59,7 +58,7 @@ void FeatureOutput::Insert(const Feature& feature) {
void
FeatureOutput
::
InsertDataForLearning
(
const
Feature
&
feature
,
const
std
::
vector
<
double
>&
feature_values
,
const
std
::
vector
<
double
>&
labels
)
{
const
std
::
string
&
category
)
{
DataForLearning
*
data_for_learning
=
list_data_for_learning_
.
add_data_for_learning
();
data_for_learning
->
set_id
(
feature
.
id
());
...
...
@@ -67,9 +66,7 @@ void FeatureOutput::InsertDataForLearning(
for
(
size_t
i
=
0
;
i
<
feature_values
.
size
();
++
i
)
{
data_for_learning
->
add_features_for_learning
(
feature_values
[
i
]);
}
for
(
size_t
i
=
0
;
i
<
labels
.
size
();
++
i
)
{
data_for_learning
->
add_labels
(
labels
[
i
]);
}
data_for_learning
->
set_category
(
category
);
}
void
FeatureOutput
::
Write
()
{
...
...
modules/prediction/common/feature_output.h
浏览文件 @
42d5e5e2
...
...
@@ -17,6 +17,7 @@
#pragma once
#include <vector>
#include <string>
#include "modules/prediction/proto/offline_features.pb.h"
...
...
@@ -58,7 +59,7 @@ class FeatureOutput {
*/
static
void
InsertDataForLearning
(
const
Feature
&
feature
,
const
std
::
vector
<
double
>&
feature_values
,
const
std
::
vector
<
double
>&
labels
);
const
std
::
string
&
category
);
/**
* @brief Write features to a file
...
...
modules/prediction/evaluator/vehicle/lane_scanning_evaluator.cc
浏览文件 @
42d5e5e2
...
...
@@ -74,7 +74,7 @@ void LaneScanningEvaluator::Evaluate(
std
::
vector
<
double
>
labels
=
{
0.0
};
if
(
FLAGS_prediction_offline_dataforlearning
)
{
FeatureOutput
::
InsertDataForLearning
(
*
latest_feature_ptr
,
feature_values
,
labels
);
"cruise"
);
ADEBUG
<<
"Save extracted features for learning locally."
;
}
else
{
// TODO(jiacheng): once the model is trained, implement this online part.
...
...
modules/prediction/pipeline/BUILD
浏览文件 @
42d5e5e2
...
...
@@ -29,4 +29,12 @@ cc_binary(
],
)
cc_binary
(
name
=
"records_to_data_for_learning"
,
srcs
=
[
"records_to_data_for_learning.cc"
],
deps
=
[
"//modules/prediction/common:message_process"
,
],
)
cpplint
()
modules/prediction/pipeline/records_to_data_for_learning.cc
0 → 100644
浏览文件 @
42d5e5e2
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "cyber/common/file.h"
#include "modules/common/util/string_util.h"
#include "modules/prediction/common/feature_output.h"
#include "modules/prediction/common/message_process.h"
#include "modules/prediction/common/prediction_system_gflags.h"
#include "modules/prediction/util/data_extraction.h"
namespace
apollo
{
namespace
prediction
{
void
GenerateDataForLearning
()
{
if
(
!
FeatureOutput
::
Ready
())
{
AERROR
<<
"Feature output is not ready."
;
return
;
}
if
(
FLAGS_prediction_offline_bags
.
empty
())
{
return
;
}
std
::
vector
<
std
::
string
>
inputs
;
common
::
util
::
Split
(
FLAGS_prediction_offline_bags
,
':'
,
&
inputs
);
for
(
const
auto
&
input
:
inputs
)
{
std
::
vector
<
std
::
string
>
offline_bags
;
GetRecordFileNames
(
boost
::
filesystem
::
path
(
input
),
&
offline_bags
);
std
::
sort
(
offline_bags
.
begin
(),
offline_bags
.
end
());
AINFO
<<
"For input "
<<
input
<<
", found "
<<
offline_bags
.
size
()
<<
" rosbags to process"
;
for
(
std
::
size_t
i
=
0
;
i
<
offline_bags
.
size
();
++
i
)
{
AINFO
<<
"
\t
Processing: [ "
<<
i
<<
" / "
<<
offline_bags
.
size
()
<<
" ]: "
<<
offline_bags
[
i
];
MessageProcess
::
ProcessOfflineData
(
offline_bags
[
i
]);
}
}
FeatureOutput
::
Close
();
}
}
// namespace prediction
}
// namespace apollo
int
main
(
int
argc
,
char
*
argv
[])
{
google
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
apollo
::
prediction
::
GenerateDataForLearning
();
return
0
;
}
modules/prediction/proto/feature.proto
浏览文件 @
42d5e5e2
...
...
@@ -3,7 +3,6 @@ syntax = "proto2";
package
apollo
.
prediction
;
import
"modules/common/proto/geometry.proto"
;
import
"modules/common/proto/pnc_point.proto"
;
import
"modules/perception/proto/perception_obstacle.proto"
;
import
"modules/prediction/proto/lane_graph.proto"
;
import
"modules/prediction/proto/prediction_point.proto"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录