Skip to content

Commit 9576428

Browse files
authored
Merge pull request #52 from Ar-Ray-code/feat/update_params_and_interface
Feat/update params and interface
2 parents 9184a21 + 6a43456 commit 9576428

File tree

12 files changed

+170
-54
lines changed

12 files changed

+170
-54
lines changed

yolox_ros_cpp/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ ros2 launch yolox_ros_cpp yolox_tflite.launch.py
195195
- See [here](https://github.com/fateshelled/YOLOX-ROS/blob/dev_cpp/yolox_ros_cpp/yolox_ros_cpp/labels/coco_names.txt) for label format.
196196
- `num_classes`: 80
197197
- `model_version`: 0.1.1rc0
198-
- `openvino/device`: CPU
199-
- `conf`: 0.3
198+
- `openvino/device`: AUTO
200199
- `nms`: 0.45
201200
- `imshow_isshow`: true
202201
- `src_image_topic_name`: /image_raw

yolox_ros_cpp/yolox_cpp/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>yolox_cpp</name>
5-
<version>0.3.3</version>
5+
<version>0.4.0</version>
66
<description>The yolox_cpp package</description>
77
<maintainer email="[email protected]">fateshelled</maintainer>
88
<license>Apache-2.0 License</license>

yolox_ros_cpp/yolox_cpp/src/yolox_openvino.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ namespace yolox_cpp{
1717
const auto network = ie.read_model(path_to_model);
1818

1919
// Step 3. Loading a model to the device
20+
std::vector<std::string> available_devices = ie.get_available_devices();
21+
std::cout << "======= AVAILABLE DEVICES FOR OPENVINO =======" << std::endl;
22+
for (auto device : available_devices) {
23+
std::cout << "- " << device << std::endl;
24+
}
25+
std::cout << "==============================================" << std::endl;
2026
std::cout << "Loading a model to the device: " << device_name_ << std::endl;
2127
auto compiled_model = ie.compile_model(network, device_name);
2228

yolox_ros_cpp/yolox_param/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>yolox_param</name>
5-
<version>0.3.2</version>
5+
<version>0.4.0</version>
66
<description>YOLOX-ROS Parameter Package</description>
77
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
88
<license>Apache-2.0</license>

yolox_ros_cpp/yolox_param/src/yolox_parameters.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ yolox_parameters:
66
model_path:
77
type: string
88
description: "Path to the model file."
9-
default_value: "./src/YOLOX-ROS/weights/tflite/model.tflite"
9+
default_value: "example.onnx"
1010
class_labels_path:
1111
type: string
1212
description: "Path to the class labels file."
@@ -38,9 +38,9 @@ yolox_parameters:
3838
openvino_device:
3939
type: string
4040
description: "OpenVINO device."
41-
default_value: "CPU"
41+
default_value: "AUTO"
4242
validation: {
43-
one_of<>: [["CPU", "GPU", "MYRIAD"]]
43+
one_of<>: [["AUTO", "CPU", "GPU", "NPU", "MYRIAD"]]
4444
}
4545
onnxruntime_use_cuda:
4646
type: bool
@@ -86,3 +86,11 @@ yolox_parameters:
8686
type: string
8787
description: "Publish bounding box topic name."
8888
default_value: "yolox/bounding_boxes"
89+
use_bbox_ex_msgs:
90+
type: bool
91+
description: "Enable or disable bbox_ex_msgs. If true, disable vision_msgs::Detection2DArray."
92+
default_value: false
93+
publish_resized_image:
94+
type: bool
95+
description: "Enable or disable resized image."
96+
default_value: false

yolox_ros_cpp/yolox_ros_cpp/include/yolox_ros_cpp/yolox_ros_cpp.hpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#include <cmath>
44
#include <chrono>
55

6-
#include <image_transport/image_transport.hpp>
76
#include <cv_bridge/cv_bridge.hpp>
7+
#include <image_transport/image_transport.hpp>
88
#include <rclcpp/rclcpp.hpp>
99
#include <rclcpp_components/register_node_macro.hpp>
10-
10+
#include <sensor_msgs/msg/image.hpp>
11+
#include <std_msgs/msg/header.hpp>
12+
#include <vision_msgs/msg/detection2_d_array.hpp>
1113

1214
#include "bboxes_ex_msgs/msg/bounding_box.hpp"
1315
#include "bboxes_ex_msgs/msg/bounding_boxes.hpp"
@@ -17,28 +19,29 @@
1719
#include "yolox_param/yolox_param.hpp"
1820

1921
namespace yolox_ros_cpp{
20-
2122
class YoloXNode : public rclcpp::Node
2223
{
2324
public:
24-
YoloXNode(const rclcpp::NodeOptions&);
25+
YoloXNode(const rclcpp::NodeOptions &);
26+
private:
27+
void onInit();
28+
void colorImageCallback(const sensor_msgs::msg::Image::ConstSharedPtr &);
29+
30+
static bboxes_ex_msgs::msg::BoundingBoxes objects_to_bboxes(const cv::Mat &, const std::vector<yolox_cpp::Object> &, const std_msgs::msg::Header &);
31+
static vision_msgs::msg::Detection2DArray objects_to_detection2d(const std::vector<yolox_cpp::Object> &, const std_msgs::msg::Header &);
2532

2633
protected:
2734
std::shared_ptr<yolox_parameters::ParamListener> param_listener_;
2835
yolox_parameters::Params params_;
2936
private:
30-
void onInit();
31-
rclcpp::TimerBase::SharedPtr init_timer_;
32-
3337
std::unique_ptr<yolox_cpp::AbcYoloX> yolox_;
3438
std::vector<std::string> class_names_;
3539

40+
rclcpp::TimerBase::SharedPtr init_timer_;
3641
image_transport::Subscriber sub_image_;
37-
void colorImageCallback(const sensor_msgs::msg::Image::ConstSharedPtr&);
3842

3943
rclcpp::Publisher<bboxes_ex_msgs::msg::BoundingBoxes>::SharedPtr pub_bboxes_;
44+
rclcpp::Publisher<vision_msgs::msg::Detection2DArray>::SharedPtr pub_detection2d_;
4045
image_transport::Publisher pub_image_;
41-
42-
bboxes_ex_msgs::msg::BoundingBoxes objects_to_bboxes(const cv::Mat&, const std::vector<yolox_cpp::Object>&, const std_msgs::msg::Header&);
4346
};
4447
}

yolox_ros_cpp/yolox_ros_cpp/launch/yolox_onnxruntime.launch.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ def generate_launch_description():
105105
default_value='/yolox/bounding_boxes',
106106
description='topic name for publishing bounding box message.'
107107
),
108+
DeclareLaunchArgument(
109+
'use_bbox_ex_msgs',
110+
default_value='false',
111+
description='use BoundingBoxArray message type.'
112+
),
113+
DeclareLaunchArgument(
114+
'publish_resized_image',
115+
default_value='false',
116+
description='use BoundingBoxArray message type.'
117+
),
108118
]
109119
container = ComposableNodeContainer(
110120
name='yolox_container',
@@ -113,12 +123,12 @@ def generate_launch_description():
113123
executable='component_container',
114124
composable_node_descriptions=[
115125
ComposableNode(
116-
package='v4l2_camera',
117-
plugin='v4l2_camera::V4L2Camera',
118-
name='v4l2_camera',
126+
package='usb_cam',
127+
plugin='usb_cam::UsbCamNode',
128+
name='usb_cam_node',
119129
parameters=[{
120130
'video_device': LaunchConfiguration('video_device'),
121-
'image_size': [640, 480]
131+
'brightness': 100
122132
}]),
123133
ComposableNode(
124134
package='yolox_ros_cpp',
@@ -142,6 +152,8 @@ def generate_launch_description():
142152
'src_image_topic_name': LaunchConfiguration('src_image_topic_name'),
143153
'publish_image_topic_name': LaunchConfiguration('publish_image_topic_name'),
144154
'publish_boundingbox_topic_name': LaunchConfiguration('publish_boundingbox_topic_name'),
155+
'publish_resized_image': LaunchConfiguration('publish_resized_image'),
156+
'use_bbox_ex_msgs': LaunchConfiguration('use_bbox_ex_msgs'),
145157
}],
146158
),
147159
],

yolox_ros_cpp/yolox_ros_cpp/launch/yolox_openvino.launch.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ def generate_launch_description():
7171
default_value='/yolox/bounding_boxes',
7272
description='topic name for publishing bounding box message.'
7373
),
74+
DeclareLaunchArgument(
75+
'use_bbox_ex_msgs',
76+
default_value='false',
77+
description='use BoundingBoxArray message type.'
78+
),
79+
DeclareLaunchArgument(
80+
'publish_resized_image',
81+
default_value='false',
82+
description='use BoundingBoxArray message type.'
83+
),
7484
]
7585
container = ComposableNodeContainer(
7686
name='yolox_container',
@@ -79,12 +89,12 @@ def generate_launch_description():
7989
executable='component_container',
8090
composable_node_descriptions=[
8191
ComposableNode(
82-
package='v4l2_camera',
83-
plugin='v4l2_camera::V4L2Camera',
84-
name='v4l2_camera',
92+
package='usb_cam',
93+
plugin='usb_cam::UsbCamNode',
94+
name='usb_cam_node',
8595
parameters=[{
8696
'video_device': LaunchConfiguration('video_device'),
87-
'image_size': [640, 480]
97+
'brightness': 100
8898
}]),
8999
ComposableNode(
90100
package='yolox_ros_cpp',
@@ -104,6 +114,8 @@ def generate_launch_description():
104114
'src_image_topic_name': LaunchConfiguration('src_image_topic_name'),
105115
'publish_image_topic_name': LaunchConfiguration('publish_image_topic_name'),
106116
'publish_boundingbox_topic_name': LaunchConfiguration('publish_boundingbox_topic_name'),
117+
'publish_resized_image': LaunchConfiguration('publish_resized_image'),
118+
'use_bbox_ex_msgs': LaunchConfiguration('use_bbox_ex_msgs'),
107119
}],
108120
),
109121
],

yolox_ros_cpp/yolox_ros_cpp/launch/yolox_tensorrt.launch.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ def generate_launch_description():
7272
default_value='/yolox/bounding_boxes',
7373
description='topic name for publishing bounding box message.'
7474
),
75+
DeclareLaunchArgument(
76+
'use_bbox_ex_msgs',
77+
default_value='false',
78+
description='use BoundingBoxArray message type.'
79+
),
80+
DeclareLaunchArgument(
81+
'publish_resized_image',
82+
default_value='false',
83+
description='use BoundingBoxArray message type.'
84+
),
7585
]
7686
container = ComposableNodeContainer(
7787
name='yolox_container',
@@ -80,14 +90,13 @@ def generate_launch_description():
8090
executable='component_container',
8191
composable_node_descriptions=[
8292
ComposableNode(
83-
package='v4l2_camera',
84-
plugin='v4l2_camera::V4L2Camera',
85-
name='v4l2_camera',
93+
package='usb_cam',
94+
plugin='usb_cam::UsbCamNode',
95+
name='usb_cam_node',
8696
parameters=[{
8797
'video_device': LaunchConfiguration('video_device'),
88-
'image_size': [640, 480]
89-
}]
90-
),
98+
'brightness': 100
99+
}]),
91100
ComposableNode(
92101
package='yolox_ros_cpp',
93102
plugin='yolox_ros_cpp::YoloXNode',
@@ -106,6 +115,8 @@ def generate_launch_description():
106115
'src_image_topic_name': LaunchConfiguration('src_image_topic_name'),
107116
'publish_image_topic_name': LaunchConfiguration('publish_image_topic_name'),
108117
'publish_boundingbox_topic_name': LaunchConfiguration('publish_boundingbox_topic_name'),
118+
'publish_resized_image': LaunchConfiguration('publish_resized_image'),
119+
'use_bbox_ex_msgs': LaunchConfiguration('use_bbox_ex_msgs'),
109120
}],
110121
),
111122
],

yolox_ros_cpp/yolox_ros_cpp/launch/yolox_tflite.launch.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ def generate_launch_description():
7777
default_value='/yolox/bounding_boxes',
7878
description='topic name for publishing bounding box message.'
7979
),
80+
DeclareLaunchArgument(
81+
'use_bbox_ex_msgs',
82+
default_value='false',
83+
description='use BoundingBoxArray message type.'
84+
),
85+
DeclareLaunchArgument(
86+
'publish_resized_image',
87+
default_value='false',
88+
description='use BoundingBoxArray message type.'
89+
),
8090
]
8191
container = ComposableNodeContainer(
8292
name='yolox_container',
@@ -85,12 +95,12 @@ def generate_launch_description():
8595
executable='component_container',
8696
composable_node_descriptions=[
8797
ComposableNode(
88-
package='v4l2_camera',
89-
plugin='v4l2_camera::V4L2Camera',
90-
name='v4l2_camera',
98+
package='usb_cam',
99+
plugin='usb_cam::UsbCamNode',
100+
name='usb_cam_node',
91101
parameters=[{
92102
'video_device': LaunchConfiguration('video_device'),
93-
'image_size': [640, 480]
103+
'brightness': 100
94104
}]),
95105
ComposableNode(
96106
package='yolox_ros_cpp',
@@ -111,6 +121,8 @@ def generate_launch_description():
111121
'src_image_topic_name': LaunchConfiguration('src_image_topic_name'),
112122
'publish_image_topic_name': LaunchConfiguration('publish_image_topic_name'),
113123
'publish_boundingbox_topic_name': LaunchConfiguration('publish_boundingbox_topic_name'),
124+
'publish_resized_image': LaunchConfiguration('publish_resized_image'),
125+
'use_bbox_ex_msgs': LaunchConfiguration('use_bbox_ex_msgs'),
114126
}],
115127
),
116128
],

0 commit comments

Comments
 (0)