Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ros_camera_bev
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangxue
ros_camera_bev
Commits
67f18462
Commit
67f18462
authored
Jan 18, 2024
by
xin.wang.waytous
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camera-back-warn-flip+rotate
parent
0f05e448
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
17 deletions
+34
-17
CameraBackParam.yaml
src/camera_back_warn/configs/CameraBackParam.yaml
+3
-1
sensor_manager.cpp
src/camera_back_warn/src/sensor_manager.cpp
+10
-2
sensor_manager.h
src/camera_back_warn/src/sensor_manager.h
+2
-2
utils.cpp
src/camera_back_warn/src/utils.cpp
+4
-1
utils.h
src/camera_back_warn/src/utils.h
+4
-1
multi_yolov5m.yaml
src/camera_bev_infer/configs/weights/multi_yolov5m.yaml
+1
-1
sensor_manager.cpp
src/camera_bev_infer/src/sensor_manager.cpp
+2
-1
vision_3d.cpp
src/camera_bev_infer/src/vision_transform/vision_3d.cpp
+8
-8
No files found.
src/camera_back_warn/configs/CameraBackParam.yaml
View file @
67f18462
# /sensor/back_middle/image/bgr
# /sensor/back_middle/image/bgr
back_rgb_sub_topic_name
:
/
sensor/camera/rgb/data
back_rgb_sub_topic_name
:
/
front_rgb/image
berm_signal_sub_topic_name
:
/berm/signal
berm_signal_sub_topic_name
:
/berm/signal
# Publisher
# Publisher
vis_pub_topic_name
:
/perception/back/vis_image
vis_pub_topic_name
:
/perception/back/vis_image
...
@@ -8,6 +8,8 @@ vis_pub_topic_name: /perception/back/vis_image
...
@@ -8,6 +8,8 @@ vis_pub_topic_name: /perception/back/vis_image
config_root_path
:
/home/ubuntu/projects/ros_camera_bev/src/camera_back_warn
config_root_path
:
/home/ubuntu/projects/ros_camera_bev/src/camera_back_warn
rgb_config_path
:
configs/weights/rgb_yolov5.yaml
rgb_config_path
:
configs/weights/rgb_yolov5.yaml
device
:
0
device
:
0
flip
:
false
rotate
:
-1
# -1=0, 0=90, 1=180, 2=270
range_ratio
:
0.01
range_ratio
:
0.01
# // visualization 是否可视化结果
# // visualization 是否可视化结果
...
...
src/camera_back_warn/src/sensor_manager.cpp
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 02:18:07
* @Date: 2023-09-03 02:18:07
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 2023-12-
14 10:14:39
* @LastEditTime: 2023-12-
25 07:50:18
*/
*/
...
@@ -86,6 +86,14 @@ void sensorManager::infer()
...
@@ -86,6 +86,14 @@ void sensorManager::infer()
continue
;
continue
;
}
}
// 旋转+flip
if
(
infer_param
.
flip
){
cv
::
flip
(
rgb
,
rgb
,
0
);
}
if
(
infer_param
.
rotate
>=
0
){
cv
::
rotate
(
rgb
,
rgb
,
infer_param
.
rotate
);
}
// 定义模型的输入输出vector
// 定义模型的输入输出vector
std
::
vector
<
cv
::
Mat
*>
inputs
;
std
::
vector
<
cv
::
Mat
*>
inputs
;
std
::
vector
<
waytous
::
deepinfer
::
interfaces
::
BaseIOPtr
>
outputs
;
std
::
vector
<
waytous
::
deepinfer
::
interfaces
::
BaseIOPtr
>
outputs
;
...
@@ -111,7 +119,7 @@ void sensorManager::infer()
...
@@ -111,7 +119,7 @@ void sensorManager::infer()
if
((
det
->
x2
-
det
->
x1
)
/
rgb
.
cols
>
infer_param
.
range_ratio
||
if
((
det
->
x2
-
det
->
x1
)
/
rgb
.
cols
>
infer_param
.
range_ratio
||
(
det
->
y2
-
det
->
y1
)
/
rgb
.
rows
>
infer_param
.
range_ratio
){
(
det
->
y2
-
det
->
y1
)
/
rgb
.
rows
>
infer_param
.
range_ratio
){
// TODO
// TODO
eon
::
log
::
warn
(
1
000
)
<<
"Warning! Pedestrain existed in back."
;
eon
::
log
::
error
(
0x05400
000
)
<<
"Warning! Pedestrain existed in back."
;
std
::
cout
<<
"Warning! Pedestrain existed in back."
<<
std
::
endl
;
std
::
cout
<<
"Warning! Pedestrain existed in back."
<<
std
::
endl
;
break
;
break
;
}
}
...
...
src/camera_back_warn/src/sensor_manager.h
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 01:53:20
* @Date: 2023-09-03 01:53:20
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 2023-12-1
4 10:13:19
* @LastEditTime: 2023-12-1
9 03:05:34
*/
*/
#ifndef SENSORMANAGER_H
#ifndef SENSORMANAGER_H
...
@@ -91,7 +91,7 @@ public:
...
@@ -91,7 +91,7 @@ public:
};
};
/**
/**
* @name: update
Pointcloud
* @name: update
BermSignal
* @msg: 更新挡墙检测信号
* @msg: 更新挡墙检测信号
* @param std_msgs::StringConstPtr berm_data
* @param std_msgs::StringConstPtr berm_data
* @return {*}
* @return {*}
...
...
src/camera_back_warn/src/utils.cpp
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-07-25 06:16:52
* @Date: 2023-07-25 06:16:52
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 2023-12-
14 09:02:45
* @LastEditTime: 2023-12-
25 07:52:07
*/
*/
...
@@ -32,6 +32,9 @@ bool readInferParam(ImageInferNodeParam& param, const std::string& param_path){
...
@@ -32,6 +32,9 @@ bool readInferParam(ImageInferNodeParam& param, const std::string& param_path){
param
.
rgb_config_path
=
node
[
"rgb_config_path"
].
as
<
std
::
string
>
();
param
.
rgb_config_path
=
node
[
"rgb_config_path"
].
as
<
std
::
string
>
();
param
.
device
=
node
[
"device"
].
as
<
int
>
();
param
.
device
=
node
[
"device"
].
as
<
int
>
();
param
.
flip
=
node
[
"flip"
].
as
<
bool
>
();
param
.
rotate
=
node
[
"rotate"
].
as
<
int
>
();
param
.
range_ratio
=
node
[
"range_ratio"
].
as
<
float
>
();
param
.
range_ratio
=
node
[
"range_ratio"
].
as
<
float
>
();
param
.
vis_res
=
node
[
"vis_res"
].
as
<
bool
>
();
param
.
vis_res
=
node
[
"vis_res"
].
as
<
bool
>
();
...
...
src/camera_back_warn/src/utils.h
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 03:14:28
* @Date: 2023-09-03 03:14:28
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 2023-12-
14 09:01:47
* @LastEditTime: 2023-12-
25 07:46:10
*/
*/
#ifndef UTILS_H_
#ifndef UTILS_H_
...
@@ -35,6 +35,9 @@ struct ImageInferNodeParam{
...
@@ -35,6 +35,9 @@ struct ImageInferNodeParam{
std
::
string
rgb_config_path
;
std
::
string
rgb_config_path
;
int
device
=
0
;
int
device
=
0
;
bool
flip
=
false
;
int
rotate
=
0
;
// 0°
float
range_ratio
=
0
.
01
;
// 检测到的行人长或者宽,大于此比例时,进行警告
float
range_ratio
=
0
.
01
;
// 检测到的行人长或者宽,大于此比例时,进行警告
// visualization 是否可视化结果
// visualization 是否可视化结果
...
...
src/camera_bev_infer/configs/weights/multi_yolov5m.yaml
View file @
67f18462
...
@@ -44,7 +44,7 @@ units:
...
@@ -44,7 +44,7 @@ units:
fixAspectRatio
:
false
fixAspectRatio
:
false
# instance-seg
# instance-seg
nmsThreshold
:
0.45
nmsThreshold
:
0.45
scoreThreshold
:
0.1
# used when inference, can be modified
scoreThreshold
:
0.1
5
# used when inference, can be modified
truncatedThreshold
:
0.05
truncatedThreshold
:
0.05
maxOutputNum
:
1000
maxOutputNum
:
1000
rawDetectionLength
:
32130
# 25200
rawDetectionLength
:
32130
# 25200
...
...
src/camera_bev_infer/src/sensor_manager.cpp
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 02:18:07
* @Date: 2023-09-03 02:18:07
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 202
3-12-06 03:43:35
* @LastEditTime: 202
4-01-18 04:29:42
*/
*/
...
@@ -169,6 +169,7 @@ void sensorManager::publishDetection()
...
@@ -169,6 +169,7 @@ void sensorManager::publishDetection()
// vision_converter_->Process_objects(frame_ptr->img_src_, pcl_cloud, frame_ptr->objs_, *vGrid);
// vision_converter_->Process_objects(frame_ptr->img_src_, pcl_cloud, frame_ptr->objs_, *vGrid);
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
pcl_cloud
,
frame_ptr
->
objs_
,
*
vGrid
);
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
pcl_cloud
,
frame_ptr
->
objs_
,
*
vGrid
);
}
else
{
}
else
{
std
::
cout
<<
"--------------------------------------------- no pcl, using all depth -------------------------------------------- "
<<
std
::
endl
;
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
frame_ptr
->
objs_
,
*
vGrid
);
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
frame_ptr
->
objs_
,
*
vGrid
);
}
}
...
...
src/camera_bev_infer/src/vision_transform/vision_3d.cpp
View file @
67f18462
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 03:13:41
* @Date: 2023-09-03 03:13:41
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: wxin
* @LastEditors: wxin
* @LastEditTime: 202
3-12-13 07:25:53
* @LastEditTime: 202
4-01-18 04:25:22
*/
*/
...
@@ -963,8 +963,8 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
...
@@ -963,8 +963,8 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
}
}
// std::cout<<" instance find table vision "<<double(clock()-start_)/CLOCKS_PER_SEC<<"s"<<std::endl; //输出时间(单位:s)
// std::cout<<" instance find table vision "<<double(clock()-start_)/CLOCKS_PER_SEC<<"s"<<std::endl; //输出时间(单位:s)
float
project_ratio
=
project_count
/
(
mask_count
+
1e-5
);
float
project_ratio
=
project_count
/
(
mask_count
+
1e-5
);
std
::
cout
<<
"obj: "
<<
obj
.
name
<<
"with project ratio: "
<<
project_ratio
<<
std
::
endl
;
bool
valid
=
validTracks
.
find
(
obj
.
track_id
)
!=
validTracks
.
end
();
bool
valid
=
validTracks
.
find
(
obj
.
track_id
)
!=
validTracks
.
end
();
// std::cout<<"obj: "<< obj.name <<" with project ratio: "<< project_ratio << ", " << valid << std::endl;
if
(
valid
){
if
(
valid
){
validTracks
[
obj
.
track_id
]
=
0
;
// update
validTracks
[
obj
.
track_id
]
=
0
;
// update
}
}
...
@@ -1022,10 +1022,10 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
...
@@ -1022,10 +1022,10 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
min_z
=
p3d_
.
z
;
min_z
=
p3d_
.
z
;
}
}
}
}
std
::
cout
<<
"stone with "
<<
points3d
.
size
()
<<
" points, height diff: "
<<
max_z
-
min_z
<<
"m."
<<
std
::
endl
;
filtered
=
(
max_z
-
min_z
<
obstacle_height_threshold
*
0.01
);
filtered
=
(
max_z
-
min_z
<
obstacle_height_threshold
*
0.01
);
if
(
!
filtered
){
if
(
!
filtered
){
validTracks
[
obj
.
track_id
]
=
0
;
// init
validTracks
[
obj
.
track_id
]
=
0
;
// init
std
::
cout
<<
"------------------------ "
<<
obj
.
track_id
<<
" stone with "
<<
points3d
.
size
()
<<
" points, height diff: "
<<
max_z
-
min_z
<<
"m."
<<
std
::
endl
;
}
}
/*else{// 扬尘遮挡,点少
/*else{// 扬尘遮挡,点少
if(unvalidTracks.find(obj.track_id) != unvalidTracks.end()){
if(unvalidTracks.find(obj.track_id) != unvalidTracks.end()){
...
@@ -1056,11 +1056,11 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
...
@@ -1056,11 +1056,11 @@ int Visione_3D::Process_Instance_Objects(object_Seg_info& obj, const cv::Mat& in
if
(
unvalidTracks
.
find
(
obj
.
track_id
)
!=
unvalidTracks
.
end
()){
if
(
unvalidTracks
.
find
(
obj
.
track_id
)
!=
unvalidTracks
.
end
()){
unvalidTracks
[
obj
.
track_id
].
second
++
;
unvalidTracks
[
obj
.
track_id
].
second
++
;
// 长时间跟踪上,但是未被激活,用深度估计激活
// 长时间跟踪上,但是未被激活,用深度估计激活
if
(
unvalidTracks
[
obj
.
track_id
].
second
>=
10
){
//
if(unvalidTracks[obj.track_id].second >= 10){
unvalidTracks
.
erase
(
obj
.
track_id
);
//
unvalidTracks.erase(obj.track_id);
validTracks
[
obj
.
track_id
]
=
0
;
// init
//
validTracks[obj.track_id] = 0; // init
return
-
1
;
// using depth estimination
//
return -1; // using depth estimination
}
//
}
}
else
{
}
else
{
unvalidTracks
[
obj
.
track_id
]
=
std
::
make_pair
(
0
,
0
);
unvalidTracks
[
obj
.
track_id
]
=
std
::
make_pair
(
0
,
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment