Skip to content

Commit 52b35cd

Browse files
committed
add yolox_param
1 parent e1b432b commit 52b35cd

6 files changed

Lines changed: 180 additions & 130 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
project(yolox_param)
3+
4+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5+
add_compile_options(-Wall -Wextra -Wpedantic)
6+
endif()
7+
8+
find_package(ament_cmake_auto REQUIRED)
9+
ament_auto_find_build_dependencies()
10+
11+
find_package(generate_parameter_library REQUIRED)
12+
13+
generate_parameter_library(${PROJECT_NAME}
14+
src/yolox_parameters.yaml
15+
)
16+
17+
if(BUILD_TESTING)
18+
find_package(ament_lint_auto REQUIRED)
19+
ament_lint_auto_find_test_dependencies()
20+
endif()
21+
22+
ament_export_include_directories(include)
23+
ament_auto_package()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>yolox_param</name>
5+
<version>0.3.2</version>
6+
<description>YOLOX-ROS Parameter Package</description>
7+
<maintainer email="ray255ar@gmail.com">Ar-Ray-code</maintainer>
8+
<license>Apache-2.0</license>
9+
10+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
11+
12+
<depend>generate_parameter_library</depend>
13+
<depend>parameter_traits</depend>
14+
<depend>rclcpp_lifecycle</depend>
15+
16+
<test_depend>ament_lint_auto</test_depend>
17+
<test_depend>ament_lint_common</test_depend>
18+
19+
<export>
20+
<build_type>ament_cmake</build_type>
21+
</export>
22+
</package>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
yolox_parameters:
2+
imshow_isshow:
3+
type: bool
4+
description: "Enable or disable imshow."
5+
default_value: false
6+
model_path:
7+
type: string
8+
description: "Path to the model file."
9+
default_value: "./install/yolox_ros_cpp/share/yolox_ros_cpp/weights/tflite/model.tflite"
10+
class_labels_path:
11+
type: string
12+
description: "Path to the class labels file."
13+
default_value: ""
14+
num_classes:
15+
type: int
16+
description: "Number of classes."
17+
default_value: 1
18+
is_nchw:
19+
type: bool
20+
description: "Enable or disable NCHW."
21+
default_value: true
22+
p6:
23+
type: bool
24+
description: "Enable or disable P6."
25+
default_value: false
26+
conf:
27+
type: double
28+
description: "Confidence threshold."
29+
default_value: 0.3
30+
nms:
31+
type: double
32+
description: "NMS threshold."
33+
default_value: 0.45
34+
tensorrt_device:
35+
type: int
36+
description: "TensorRT device."
37+
default_value: 0
38+
openvino_device:
39+
type: string
40+
description: "OpenVINO device."
41+
default_value: "CPU"
42+
onnxruntime_use_cuda:
43+
type: bool
44+
description: "Enable or disable CUDA."
45+
default_value: true
46+
onnxruntime_device_id:
47+
type: int
48+
description: "ONNXRuntime device ID."
49+
default_value: 0
50+
onnxruntime_use_parallel:
51+
type: bool
52+
description: "Enable or disable parallel."
53+
default_value: false
54+
onnxruntime_inter_op_num_threads:
55+
type: int
56+
description: "ONNXRuntime inter op num threads."
57+
default_value: 1
58+
onnxruntime_intra_op_num_threads:
59+
type: int
60+
description: "ONNXRuntime intra op num threads."
61+
default_value: 1
62+
tflite_num_threads:
63+
type: int
64+
description: "TFLite num threads."
65+
default_value: 1
66+
model_type:
67+
type: string
68+
description: "Model type."
69+
default_value: "tflite"
70+
model_version:
71+
type: string
72+
description: "Model version."
73+
default_value: "0.1.1rc0"
74+
src_image_topic_name:
75+
type: string
76+
description: "Source image topic name."
77+
default_value: "image_raw"
78+
publish_image_topic_name:
79+
type: string
80+
description: "Publish image topic name."
81+
default_value: "yolox/image_raw"
82+
publish_boundingbox_topic_name:
83+
type: string
84+
description: "Publish bounding box topic name."
85+
default_value: "yolox/bounding_boxes"

yolox_ros_cpp/yolox_ros_cpp/include/yolox_ros_cpp/yolox_ros_cpp.hpp

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
#include <rclcpp/rclcpp.hpp>
77
#include <rclcpp_components/register_node_macro.hpp>
8-
// #include <ament_index_cpp/get_package_share_directory.hpp>
8+
9+
#include "yolox_param/yolox_param.hpp"
910

1011
#include <cv_bridge/cv_bridge.h>
1112
#include <image_transport/image_transport.hpp>
@@ -22,33 +23,16 @@ namespace yolox_ros_cpp{
2223
{
2324
public:
2425
YoloXNode(const rclcpp::NodeOptions& options);
25-
YoloXNode(const std::string &node_name, const rclcpp::NodeOptions& options);
2626

27+
protected:
28+
std::shared_ptr<yolox_parameters::ParamListener> param_listener_;
29+
yolox_parameters::Params params_;
2730
private:
28-
void initializeParameter();
31+
void onInit();
32+
rclcpp::TimerBase::SharedPtr init_timer_;
33+
2934
std::unique_ptr<yolox_cpp::AbcYoloX> yolox_;
30-
std::string model_path_;
31-
std::string model_type_;
32-
std::string model_version_;
33-
int tensorrt_device_;
34-
std::string openvino_device_;
35-
bool onnxruntime_use_cuda_;
36-
int onnxruntime_device_id_;
37-
bool onnxruntime_use_parallel_;
38-
int onnxruntime_intra_op_num_threads_;
39-
int onnxruntime_inter_op_num_threads_;
40-
int tflite_num_threads_;
41-
float conf_th_;
42-
float nms_th_;
43-
int num_classes_;
44-
bool is_nchw_;
45-
bool p6_;
4635
std::vector<std::string> class_names_;
47-
std::string class_labels_path_;
48-
49-
std::string src_image_topic_name_;
50-
std::string publish_image_topic_name_;
51-
std::string publish_boundingbox_topic_name_;
5236

5337
image_transport::Subscriber sub_image_;
5438
void colorImageCallback(const sensor_msgs::msg::Image::ConstSharedPtr& ptr);
@@ -57,9 +41,6 @@ namespace yolox_ros_cpp{
5741
image_transport::Publisher pub_image_;
5842

5943
bboxes_ex_msgs::msg::BoundingBoxes objects_to_bboxes(cv::Mat frame, std::vector<yolox_cpp::Object> objects, std_msgs::msg::Header header);
60-
61-
std::string WINDOW_NAME_ = "YOLOX";
62-
bool imshow_ = true;
6344
};
6445
}
6546
#endif

yolox_ros_cpp/yolox_ros_cpp/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<depend>sensor_msgs</depend>
2020
<depend>bboxes_ex_msgs</depend>
2121
<depend>yolox_cpp</depend>
22+
<depend>yolox_param</depend>
2223

2324
<test_depend>ament_lint_auto</test_depend>
2425
<test_depend>ament_lint_common</test_depend>

0 commit comments

Comments
 (0)