Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
a54e3a76
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,发现更多精彩内容 >>
提交
a54e3a76
编写于
3月 07, 2018
作者:
L
luoqi06
提交者:
Dong Li
3月 07, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Perception : fix compile warning and cleaning
上级
fba674f1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
30 deletion
+29
-30
modules/perception/obstacle/camera/common/util.cc
modules/perception/obstacle/camera/common/util.cc
+18
-19
modules/perception/obstacle/camera/common/util.h
modules/perception/obstacle/camera/common/util.h
+6
-6
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_detector.cc
...era/detector/yolo_camera_detector/yolo_camera_detector.cc
+2
-2
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_detector_test.cc
...etector/yolo_camera_detector/yolo_camera_detector_test.cc
+1
-1
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_tensorrt_detector_test.cc
...olo_camera_detector/yolo_camera_tensorrt_detector_test.cc
+2
-2
未找到文件。
modules/perception/obstacle/camera/common/util.cc
浏览文件 @
a54e3a76
...
...
@@ -54,9 +54,8 @@ std::vector<cv::Scalar> color_table = {
cv
::
Scalar
(
255
,
255
,
255
),
};
bool
load_visual_object_form_file
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
bool
LoadVisualObjectFromFile
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
FILE
*
fp
=
fopen
(
file_name
.
c_str
(),
"r"
);
if
(
!
fp
)
{
std
::
cout
<<
"load file: "
<<
file_name
<<
" error!"
<<
std
::
endl
;
...
...
@@ -78,7 +77,7 @@ bool load_visual_object_form_file(
double
y2
=
0.0
;
int
ret
=
fscanf
(
fp
,
"%s %lf %lf %f %lf %lf %lf %lf %f %f %f %f %f %f %f %f "
"%
lf %l
f"
,
"%
f %
f"
,
type
,
&
trash
,
&
trash
,
&
obj
->
alpha
,
&
x1
,
&
y1
,
&
x2
,
&
y2
,
&
obj
->
height
,
&
obj
->
width
,
&
obj
->
length
,
&
obj
->
center
.
x
(),
&
obj
->
center
.
y
(),
&
obj
->
center
.
z
(),
&
obj
->
theta
,
...
...
@@ -87,7 +86,7 @@ bool load_visual_object_form_file(
obj
->
upper_left
[
1
]
=
y1
>
0
?
y1
:
0
;
obj
->
lower_right
[
0
]
=
x2
<
1920
?
x2
:
1920
;
obj
->
lower_right
[
1
]
=
y2
<
1080
?
y2
:
1080
;
obj
->
type
=
get_object_t
ype
(
std
::
string
(
type
));
obj
->
type
=
GetObjectT
ype
(
std
::
string
(
type
));
obj
->
type_probs
[
static_cast
<
int
>
(
obj
->
type
)]
=
static_cast
<
float
>
(
obj
->
score
);
...
...
@@ -99,8 +98,8 @@ bool load_visual_object_form_file(
return
true
;
}
bool
write_visual_object_to_f
ile
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
bool
WriteVisualObjectToF
ile
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
FILE
*
fp
=
fopen
(
file_name
.
c_str
(),
"w"
);
if
(
!
fp
)
{
std
::
cout
<<
"write file: "
<<
file_name
<<
" error!"
<<
std
::
endl
;
...
...
@@ -108,7 +107,7 @@ bool write_visual_object_to_file(const std::string &file_name,
}
for
(
auto
&
obj
:
*
visual_objects
)
{
std
::
string
type
=
get_type_t
ext
(
obj
->
type
);
std
::
string
type
=
GetTypeT
ext
(
obj
->
type
);
fprintf
(
fp
,
"%s %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f "
...
...
@@ -123,8 +122,8 @@ bool write_visual_object_to_file(const std::string &file_name,
return
true
;
}
bool
load_gt_form_f
ile
(
const
std
::
string
&
gt_path
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
bool
LoadGTfromF
ile
(
const
std
::
string
&
gt_path
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
)
{
std
::
ifstream
gt_file
(
gt_path
);
std
::
string
line
;
...
...
@@ -145,7 +144,7 @@ bool load_gt_form_file(const std::string >_path,
// theta
// position?
obj
->
type
=
get_object_t
ype
(
tokens
[
0
]);
obj
->
type
=
GetObjectT
ype
(
tokens
[
0
]);
// obj->alpha = std::stod(tokens[3]);
obj
->
alpha
=
std
::
stod
(
tokens
[
14
]);
...
...
@@ -188,8 +187,8 @@ bool load_gt_form_file(const std::string >_path,
return
true
;
}
void
draw_visual_obje
cts
(
const
std
::
vector
<
VisualObjectPtr
>
&
visual_objects
,
cv
::
Mat
*
img
)
{
void
DrawVisualObej
cts
(
const
std
::
vector
<
VisualObjectPtr
>
&
visual_objects
,
cv
::
Mat
*
img
)
{
for
(
const
auto
&
obj
:
visual_objects
)
{
// 3D BBox
#if 0
...
...
@@ -260,8 +259,8 @@ void draw_visual_objects(const std::vector<VisualObjectPtr> &visual_objects,
}
}
void
draw_gt_objects_t
ext
(
const
std
::
vector
<
VisualObjectPtr
>
&
visual_objects
,
cv
::
Mat
*
img
)
{
void
DrawGTObjectsT
ext
(
const
std
::
vector
<
VisualObjectPtr
>
&
visual_objects
,
cv
::
Mat
*
img
)
{
for
(
const
auto
&
obj
:
visual_objects
)
{
// 2D BBox
int
x1
=
static_cast
<
int
>
(
obj
->
upper_left
[
0
]);
...
...
@@ -288,7 +287,7 @@ void draw_gt_objects_text(const std::vector<VisualObjectPtr> &visual_objects,
}
}
std
::
string
get_type_t
ext
(
ObjectType
type
)
{
std
::
string
GetTypeT
ext
(
ObjectType
type
)
{
if
(
type
==
ObjectType
::
VEHICLE
)
{
return
"car"
;
}
...
...
@@ -302,7 +301,7 @@ std::string get_type_text(ObjectType type) {
return
"unknown"
;
}
ObjectType
get_object_t
ype
(
const
std
::
string
&
type
)
{
ObjectType
GetObjectT
ype
(
const
std
::
string
&
type
)
{
std
::
string
temp_type
=
type
;
std
::
transform
(
temp_type
.
begin
(),
temp_type
.
end
(),
temp_type
.
begin
(),
(
int
(
*
)(
int
))
std
::
tolower
);
...
...
@@ -343,8 +342,8 @@ ObjectType get_object_type(const std::string &type) {
}
}
bool
load_text_proto_message_file
(
const
std
::
string
&
path
,
google
::
protobuf
::
Message
*
msg
)
{
bool
LoadTextProtoMessageFile
(
const
std
::
string
&
path
,
google
::
protobuf
::
Message
*
msg
)
{
if
(
msg
==
nullptr
)
{
AERROR
<<
"msg is a null pointer."
;
return
false
;
...
...
modules/perception/obstacle/camera/common/util.h
浏览文件 @
a54e3a76
...
...
@@ -86,20 +86,20 @@ inline void l2norm(float *feat_data, int feat_dim) {
}
}
bool
load_visual_object_form_f
ile
(
const
std
::
string
&
file_name
,
bool
LoadVisualObjectFromF
ile
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
);
bool
write_visual_object_to_f
ile
(
const
std
::
string
&
file_name
,
bool
WriteVisualObjectToF
ile
(
const
std
::
string
&
file_name
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
);
bool
load_gt_form_f
ile
(
const
std
::
string
&
gt_path
,
bool
LoadGTfromF
ile
(
const
std
::
string
&
gt_path
,
std
::
vector
<
VisualObjectPtr
>
*
visual_objects
);
std
::
string
get_type_t
ext
(
ObjectType
type
);
std
::
string
GetTypeT
ext
(
ObjectType
type
);
ObjectType
get_object_t
ype
(
const
std
::
string
&
type_text
);
ObjectType
GetObjectT
ype
(
const
std
::
string
&
type_text
);
bool
load_text_proto_message_f
ile
(
const
std
::
string
&
path
,
bool
LoadTextProtoMessageF
ile
(
const
std
::
string
&
path
,
google
::
protobuf
::
Message
*
msg
);
}
// namespace perception
...
...
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_detector.cc
浏览文件 @
a54e3a76
...
...
@@ -52,7 +52,7 @@ bool YoloCameraDetector::Init(const CameraDetectorInitOptions &options) {
string
yolo_config
=
apollo
::
common
::
util
::
GetAbsolutePath
(
yolo_root
,
"config.pt"
);
load_text_proto_message_f
ile
(
yolo_config
,
&
yolo_param_
);
LoadTextProtoMessageF
ile
(
yolo_config
,
&
yolo_param_
);
load_intrinsic
(
options
);
if
(
!
init_cnn
(
yolo_root
))
{
return
false
;
...
...
@@ -186,7 +186,7 @@ bool YoloCameraDetector::init_cnn(const string &yolo_root) {
output_names
.
push_back
(
net_param
.
seg_blob
());
FeatureParam
feat_param
;
load_text_proto_message_f
ile
(
feature_file
,
&
feat_param
);
LoadTextProtoMessageF
ile
(
feature_file
,
&
feat_param
);
for
(
auto
extractor
:
feat_param
.
extractor
())
{
output_names
.
push_back
(
extractor
.
feat_blob
());
}
...
...
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_detector_test.cc
浏览文件 @
a54e3a76
...
...
@@ -247,7 +247,7 @@ TEST(YoloCameraDetectorTest, input_tensor_test) {
adu
::
perception
::
yolo
::
YoloParam
yolo_param
;
adu
::
perception
::
yolo
::
YoloParam
origin_yolo_param
;
load_text_proto_message_f
ile
(
yolo_config
,
yolo_param
);
LoadTextProtoMessageF
ile
(
yolo_config
,
yolo_param
);
origin_yolo_param
.
CopyFrom
(
yolo_param
);
{
...
...
modules/perception/obstacle/camera/detector/yolo_camera_detector/yolo_camera_tensorrt_detector_test.cc
浏览文件 @
a54e3a76
...
...
@@ -40,9 +40,9 @@ TEST(YoloCameraTensorRTDetectorTest, yolo_camera_detector_test) {
adu::perception::yolo::YoloParam origin_yolo_param;
int origin_gpu_flag = FLAGS_camera_detector_gpu;
load_text_proto_message_f
ile(yolo_test_config, yolo_param);
LoadTextProtoMessageF
ile(yolo_test_config, yolo_param);
// roipooling feature extractor
load_text_proto_message_f
ile(yolo_config, origin_yolo_param);
LoadTextProtoMessageF
ile(yolo_config, origin_yolo_param);
{
yolo_param.mutable_model_param()->set_model_type(yolo::ModelType::TensorRT);
yolo_param.mutable_model_param()->set_proto_file("tensorrt.pt");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录