Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
6cd46fe5
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,发现更多精彩内容 >>
提交
6cd46fe5
编写于
6月 27, 2019
作者:
X
Xiangquan Xiao
提交者:
Kecheng Xu
6月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Robot: Code clean with clang-format.
上级
64516a26
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
78 addition
and
85 deletion
+78
-85
cyber/common/file.cc
cyber/common/file.cc
+10
-10
cyber/common/file.h
cyber/common/file.h
+3
-3
modules/dreamview/backend/simulation_world/simulation_world_service.cc
...view/backend/simulation_world/simulation_world_service.cc
+1
-1
modules/perception/camera/lib/lane/detector/darkSCNN/darkSCNN_lane_detector.cc
...mera/lib/lane/detector/darkSCNN/darkSCNN_lane_detector.cc
+2
-2
modules/perception/inference/inference_factory.cc
modules/perception/inference/inference_factory.cc
+1
-1
modules/perception/inference/paddlepaddle/paddle_net.cc
modules/perception/inference/paddlepaddle/paddle_net.cc
+24
-29
modules/perception/inference/paddlepaddle/paddle_net.h
modules/perception/inference/paddlepaddle/paddle_net.h
+30
-31
modules/perception/lidar/tools/exporter/msg_exporter.cc
modules/perception/lidar/tools/exporter/msg_exporter.cc
+1
-1
modules/perception/lidar/tools/exporter/msg_exporter.h
modules/perception/lidar/tools/exporter/msg_exporter.h
+1
-1
modules/perception/lidar/tools/exporter/msg_exporter_main.cc
modules/perception/lidar/tools/exporter/msg_exporter_main.cc
+3
-3
modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc
...tasks/deciders/path_bounds_decider/path_bounds_decider.cc
+2
-3
未找到文件。
cyber/common/file.cc
浏览文件 @
6cd46fe5
...
...
@@ -18,14 +18,14 @@
#include <dirent.h>
#include <errno.h>
#include <glob.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <glob.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stddef.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fstream>
#include <string>
...
...
@@ -331,7 +331,7 @@ std::string GetCurrentPath() {
return
getcwd
(
tmp
,
sizeof
(
tmp
))
?
std
::
string
(
tmp
)
:
std
::
string
(
""
);
}
bool
GetType
(
const
string
&
filename
,
FileType
*
type
)
{
bool
GetType
(
const
string
&
filename
,
FileType
*
type
)
{
struct
stat
stat_buf
;
if
(
lstat
(
filename
.
c_str
(),
&
stat_buf
)
!=
0
)
{
return
false
;
...
...
@@ -347,7 +347,7 @@ bool GetType(const string& filename, FileType* type) {
return
true
;
}
bool
DeleteFile
(
const
string
&
filename
)
{
bool
DeleteFile
(
const
string
&
filename
)
{
if
(
!
PathExists
(
filename
))
{
return
true
;
}
...
...
@@ -362,12 +362,12 @@ bool DeleteFile(const string& filename) {
}
return
true
;
}
DIR
*
dir
=
opendir
(
filename
.
c_str
());
DIR
*
dir
=
opendir
(
filename
.
c_str
());
if
(
dir
==
nullptr
)
{
AWARN
<<
"failed to opendir: "
<<
filename
;
return
false
;
}
dirent
*
dir_info
=
nullptr
;
dirent
*
dir_info
=
nullptr
;
while
((
dir_info
=
readdir
(
dir
))
!=
nullptr
)
{
if
(
strcmp
(
dir_info
->
d_name
,
"."
)
==
0
||
strcmp
(
dir_info
->
d_name
,
".."
)
==
0
)
{
...
...
@@ -390,7 +390,7 @@ bool DeleteFile(const string& filename) {
return
true
;
}
bool
CreateDir
(
const
string
&
dir
)
{
bool
CreateDir
(
const
string
&
dir
)
{
int
ret
=
mkdir
(
dir
.
c_str
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
ret
!=
0
)
{
AWARN
<<
"failed to create dir. [dir: "
<<
dir
...
...
cyber/common/file.h
浏览文件 @
6cd46fe5
...
...
@@ -195,11 +195,11 @@ std::string GetFileName(const std::string &path,
std
::
string
GetCurrentPath
();
// delete file including file or directory
bool
DeleteFile
(
const
std
::
string
&
filename
);
bool
DeleteFile
(
const
std
::
string
&
filename
);
bool
GetType
(
const
std
::
string
&
filename
,
FileType
*
type
);
bool
GetType
(
const
std
::
string
&
filename
,
FileType
*
type
);
bool
CreateDir
(
const
std
::
string
&
dir
);
bool
CreateDir
(
const
std
::
string
&
dir
);
}
// namespace common
}
// namespace cyber
}
// namespace apollo
...
...
modules/dreamview/backend/simulation_world/simulation_world_service.cc
浏览文件 @
6cd46fe5
...
...
@@ -952,7 +952,7 @@ void SimulationWorldService::UpdatePlanningData(const PlanningData &data) {
planning_data
->
clear_pull_over_status
();
if
(
data
.
has_pull_over_status
())
{
planning_data
->
mutable_pull_over_status
()
->
CopyFrom
(
data
.
pull_over_status
());
data
.
pull_over_status
());
}
}
...
...
modules/perception/camera/lib/lane/detector/darkSCNN/darkSCNN_lane_detector.cc
浏览文件 @
6cd46fe5
...
...
@@ -104,8 +104,8 @@ bool DarkSCNNLaneDetector::Init(const LaneDetectorInitOptions &options) {
const
auto
net_param
=
darkscnn_param_
.
net_param
();
net_inputs_
.
push_back
(
net_param
.
input_blob
());
net_outputs_
.
push_back
(
net_param
.
seg_blob
());
if
(
model_param
.
model_type
()
==
"CaffeNet"
&&
net_param
.
has_vpt_blob
()
&&
net_param
.
vpt_blob
().
size
()
>
0
)
{
if
(
model_param
.
model_type
()
==
"CaffeNet"
&&
net_param
.
has_vpt_blob
()
&&
net_param
.
vpt_blob
().
size
()
>
0
)
{
net_outputs_
.
push_back
(
net_param
.
vpt_blob
());
}
...
...
modules/perception/inference/inference_factory.cc
浏览文件 @
6cd46fe5
...
...
@@ -17,8 +17,8 @@
#include "modules/perception/inference/inference_factory.h"
#include "modules/perception/inference/caffe/caffe_net.h"
#include "modules/perception/inference/tensorrt/rt_net.h"
#include "modules/perception/inference/paddlepaddle/paddle_net.h"
#include "modules/perception/inference/tensorrt/rt_net.h"
namespace
apollo
{
namespace
perception
{
...
...
modules/perception/inference/paddlepaddle/paddle_net.cc
浏览文件 @
6cd46fe5
...
...
@@ -27,8 +27,9 @@ namespace inference {
PaddleNet
::
PaddleNet
(
const
std
::
string
&
model_file
,
const
std
::
string
&
param_file
,
const
std
::
vector
<
std
::
string
>
&
outputs
)
:
model_file_
(
model_file
),
param_file_
(
param_file
),
output_names_
(
outputs
)
{}
:
model_file_
(
model_file
),
param_file_
(
param_file
),
output_names_
(
outputs
)
{}
bool
PaddleNet
::
Init
(
const
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
&
shapes
)
{
paddle
::
AnalysisConfig
config
;
...
...
@@ -48,16 +49,14 @@ bool PaddleNet::Init(const std::map<std::string, std::vector<int>> &shapes) {
std
::
vector
<
int
>
input_shape
;
for
(
auto
name_shape
:
shapes
)
{
std
::
shared_ptr
<
paddle
::
ZeroCopyTensor
>
blob
=
predictor_
->
GetInputTensor
(
name_map_
[
name_shape
.
first
]);
predictor_
->
GetInputTensor
(
name_map_
[
name_shape
.
first
]);
if
(
blob
!=
nullptr
)
{
blob
->
Reshape
(
name_shape
.
second
);
}
input_shape
=
name_shape
.
second
;
}
/////////////////
int
input_num
=
std
::
accumulate
(
input_shape
.
begin
(),
input_shape
.
end
(),
1
,
int
input_num
=
std
::
accumulate
(
input_shape
.
begin
(),
input_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
std
::
vector
<
std
::
vector
<
float
>>
input_data
(
1
);
input_data
[
0
].
resize
(
input_num
);
...
...
@@ -67,7 +66,7 @@ bool PaddleNet::Init(const std::map<std::string, std::vector<int>> &shapes) {
// Prepare inputs
auto
input_names
=
predictor_
->
GetInputNames
();
int
index
=
0
;
for
(
auto
&
name
:
input_names
)
{
for
(
auto
&
name
:
input_names
)
{
auto
input_t
=
predictor_
->
GetInputTensor
(
name
);
input_t
->
Reshape
(
input_shape
);
input_t
->
copy_from_cpu
(
input_data
[
index
].
data
());
...
...
@@ -99,10 +98,10 @@ PaddleNet::PaddleNet(const std::string &model_file,
const
std
::
string
&
param_file
,
const
std
::
vector
<
std
::
string
>
&
outputs
,
const
std
::
vector
<
std
::
string
>
&
inputs
)
:
model_file_
(
model_file
),
param_file_
(
param_file
),
output_names_
(
outputs
),
input_names_
(
inputs
)
{}
:
model_file_
(
model_file
),
param_file_
(
param_file
),
output_names_
(
outputs
),
input_names_
(
inputs
)
{}
std
::
shared_ptr
<
apollo
::
perception
::
base
::
Blob
<
float
>>
PaddleNet
::
get_blob
(
const
std
::
string
&
name
)
{
...
...
@@ -120,13 +119,12 @@ bool PaddleNet::reshape() {
if
(
paddle_blob
!=
nullptr
&&
blob
!=
nullptr
)
{
paddle_blob
->
Reshape
(
blob
->
shape
());
std
::
vector
<
int
>
paddle_blob_shape
=
paddle_blob
->
shape
();
int
count
=
std
::
accumulate
(
paddle_blob_shape
.
begin
(),
paddle_blob_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
int
count
=
std
::
accumulate
(
paddle_blob_shape
.
begin
(),
paddle_blob_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
cudaMemcpy
(
paddle_blob
->
mutable_data
<
float
>
(
paddle
::
PaddlePlace
::
kGPU
),
blob
->
gpu_data
(),
c
ount
*
sizeof
(
float
),
c
udaMemcpyDeviceToDevice
);
blob
->
gpu_data
(),
count
*
sizeof
(
float
),
cudaMemcpyDeviceToDevice
);
}
}
...
...
@@ -160,10 +158,9 @@ void PaddleNet::Infer() {
blob
->
Reshape
(
paddle_blob
->
shape
());
// TODO(KaWai) : use the output_size as the count;
std
::
vector
<
int
>
paddle_blob_shape
=
paddle_blob
->
shape
();
int
count
=
std
::
accumulate
(
paddle_blob_shape
.
begin
(),
paddle_blob_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
int
count
=
std
::
accumulate
(
paddle_blob_shape
.
begin
(),
paddle_blob_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
// int output_size;
// paddle::PaddlePlace* place;
cudaMemcpy
(
blob
->
mutable_gpu_data
(),
...
...
@@ -176,21 +173,19 @@ void PaddleNet::Infer() {
bool
PaddleNet
::
shape
(
const
std
::
string
&
name
,
std
::
vector
<
int
>
*
res
)
{
bool
in_input
=
false
;
bool
in_output
=
false
;
if
(
std
::
find
(
input_names_
.
begin
(),
input_names_
.
end
(),
name
)
!=
input_names_
.
end
())
{
if
(
std
::
find
(
input_names_
.
begin
(),
input_names_
.
end
(),
name
)
!=
input_names_
.
end
())
{
in_input
=
true
;
}
else
if
(
std
::
find
(
output_names_
.
begin
(),
output_names_
.
end
(),
name
)
!=
output_names_
.
end
())
{
}
else
if
(
std
::
find
(
output_names_
.
begin
(),
output_names_
.
end
(),
name
)
!=
output_names_
.
end
())
{
in_output
=
true
;
}
if
(
~
in_input
&&
~
in_output
)
{
return
false
;
}
auto
blob
=
in_input
?
predictor_
->
GetInputTensor
(
name_map_
[
name
])
:
predictor_
->
GetOutputTensor
(
name_map_
[
name
]);
auto
blob
=
in_input
?
predictor_
->
GetInputTensor
(
name_map_
[
name
])
:
predictor_
->
GetOutputTensor
(
name_map_
[
name
]);
if
(
blob
==
nullptr
)
{
return
false
;
}
...
...
modules/perception/inference/paddlepaddle/paddle_net.h
浏览文件 @
6cd46fe5
...
...
@@ -16,15 +16,15 @@
#pragma once
#include <chrono>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <numeric>
#include <iostream>
#include <chrono>
#include <unordered_map>
#include "paddle/paddle_inference_api.h"
...
...
@@ -41,11 +41,11 @@ constexpr uint64_t MemoryPoolInitSizeMb = 100;
class
PaddleNet
:
public
Inference
{
public:
PaddleNet
(
const
std
::
string
&
model_file
,
const
std
::
string
&
param_file
,
const
std
::
vector
<
std
::
string
>
&
outputs
);
const
std
::
vector
<
std
::
string
>
&
outputs
);
PaddleNet
(
const
std
::
string
&
model_file
,
const
std
::
string
&
param_file
,
const
std
::
vector
<
std
::
string
>
&
outputs
,
const
std
::
vector
<
std
::
string
>
&
inputs
);
const
std
::
vector
<
std
::
string
>
&
outputs
,
const
std
::
vector
<
std
::
string
>
&
inputs
);
virtual
~
PaddleNet
()
{}
...
...
@@ -67,30 +67,29 @@ class PaddleNet : public Inference {
BlobMap
blobs_
;
std
::
unordered_map
<
std
::
string
,
std
::
string
>
name_map_
=
{
// object detection
{
"data"
,
"input"
},
{
"obj_pred"
,
"save_infer_model/scale_0"
},
{
"cls_pred"
,
"save_infer_model/scale_1"
},
{
"ori_pred"
,
"save_infer_model/scale_2"
},
{
"dim_pred"
,
"save_infer_model/scale_3"
},
{
"brvis_pred"
,
"save_infer_model/scale_4"
},
{
"ltvis_pred"
,
"save_infer_model/scale_5"
},
{
"rtvis_pred"
,
"save_infer_model/scale_6"
},
{
"brswt_pred"
,
"save_infer_model/scale_7"
},
{
"ltswt_pred"
,
"save_infer_model/scale_8"
},
{
"rtswt_pred"
,
"save_infer_model/scale_9"
},
{
"loc_pred"
,
"save_infer_model/scale_13"
},
{
"conv3_3"
,
"save_infer_model/scale_14"
},
// lane line
{
"softmax"
,
"save_infer_model/scale_0"
},
// lidar cnn_seg
{
"confidence_score"
,
"save_infer_model/scale_0"
},
{
"class_score"
,
"save_infer_model/scale_1"
},
{
"category_score"
,
"save_infer_model/scale_2"
},
{
"instance_pt"
,
"save_infer_model/scale_3"
},
{
"heading_pt"
,
"save_infer_model/scale_4"
},
{
"height_pt"
,
"save_infer_model/scale_5"
}
};
// object detection
{
"data"
,
"input"
},
{
"obj_pred"
,
"save_infer_model/scale_0"
},
{
"cls_pred"
,
"save_infer_model/scale_1"
},
{
"ori_pred"
,
"save_infer_model/scale_2"
},
{
"dim_pred"
,
"save_infer_model/scale_3"
},
{
"brvis_pred"
,
"save_infer_model/scale_4"
},
{
"ltvis_pred"
,
"save_infer_model/scale_5"
},
{
"rtvis_pred"
,
"save_infer_model/scale_6"
},
{
"brswt_pred"
,
"save_infer_model/scale_7"
},
{
"ltswt_pred"
,
"save_infer_model/scale_8"
},
{
"rtswt_pred"
,
"save_infer_model/scale_9"
},
{
"loc_pred"
,
"save_infer_model/scale_13"
},
{
"conv3_3"
,
"save_infer_model/scale_14"
},
// lane line
{
"softmax"
,
"save_infer_model/scale_0"
},
// lidar cnn_seg
{
"confidence_score"
,
"save_infer_model/scale_0"
},
{
"class_score"
,
"save_infer_model/scale_1"
},
{
"category_score"
,
"save_infer_model/scale_2"
},
{
"instance_pt"
,
"save_infer_model/scale_3"
},
{
"heading_pt"
,
"save_infer_model/scale_4"
},
{
"height_pt"
,
"save_infer_model/scale_5"
}};
};
}
// namespace inference
...
...
modules/perception/lidar/tools/exporter/msg_exporter.cc
浏览文件 @
6cd46fe5
...
...
@@ -15,9 +15,9 @@
*****************************************************************************/
#include "modules/perception/lidar/tools/exporter/msg_exporter.h"
#include <pcl/io/pcd_io.h>
#include <opencv2/opencv.hpp>
#include <fstream>
#include <memory>
#include <opencv2/opencv.hpp>
#include <vector>
#include "cyber/common/file.h"
#include "cyber/common/log.h"
...
...
modules/perception/lidar/tools/exporter/msg_exporter.h
浏览文件 @
6cd46fe5
...
...
@@ -16,8 +16,8 @@
#pragma once
#include <Eigen/Dense>
#include <string>
#include <memory>
#include <string>
#include <vector>
#include "cyber/cyber.h"
#include "modules/drivers/proto/pointcloud.pb.h"
...
...
modules/perception/lidar/tools/exporter/msg_exporter_main.cc
浏览文件 @
6cd46fe5
...
...
@@ -14,12 +14,12 @@
* limitations under the License.
*****************************************************************************/
#include "modules/perception/lidar/tools/exporter/msg_exporter.h"
#include <fstream>
#include <memory>
#include "cyber/common/log.h"
#include "cyber/cyber.h"
#include "modules/common/util/string_util.h"
#include "modules/perception/lidar/tools/exporter/msg_exporter.h"
namespace
apollo
{
namespace
perception
{
...
...
@@ -68,8 +68,8 @@ int main(int argc, char** argv) {
}
// apollo::cyber::Logger::Init(argv[0]);
apollo
::
cyber
::
Init
(
argv
[
0
]);
// cybertron init function
std
::
shared_ptr
<
apollo
::
cyber
::
Node
>
node
(
apollo
::
cyber
::
CreateNode
(
"export_node"
));
std
::
shared_ptr
<
apollo
::
cyber
::
Node
>
node
(
apollo
::
cyber
::
CreateNode
(
"export_node"
));
if
(
!
node
)
{
std
::
cout
<<
"Failed to create export node."
<<
std
::
endl
;
return
-
1
;
...
...
modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc
浏览文件 @
6cd46fe5
...
...
@@ -534,9 +534,8 @@ bool PathBoundsDecider::SearchPullOverPosition(
pull_over_space_length
)
{
int
j
=
i
;
bool
is_feasible_window
=
true
;
while
(
j
>=
0
&&
std
::
get
<
0
>
(
path_bound
[
i
])
-
std
::
get
<
0
>
(
path_bound
[
j
])
<
pull_over_space_length
)
{
while
(
j
>=
0
&&
std
::
get
<
0
>
(
path_bound
[
i
])
-
std
::
get
<
0
>
(
path_bound
[
j
])
<
pull_over_space_length
)
{
double
curr_s
=
std
::
get
<
0
>
(
path_bound
[
j
]);
double
curr_right_bound
=
std
::
fabs
(
std
::
get
<
1
>
(
path_bound
[
j
]));
double
curr_road_left_width
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录