Skip to content

Commit

Permalink
feat(traffic_light_classifier): add build only option for tensort eng…
Browse files Browse the repository at this point in the history
…ine (#2985)

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
  • Loading branch information
yukke42 authored Mar 6, 2023
1 parent 54d45e5 commit 8c6797e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
17 changes: 9 additions & 8 deletions perception/traffic_light_classifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ These colors and shapes are assigned to the message as follows:

#### cnn_classifier

| Name | Type | Description |
| ----------------- | ---- | ------------------------------------ |
| `model_file_path` | str | path to the model file |
| `label_file_path` | str | path to the label file |
| `precision` | str | TensorRT precision, `fp16` or `int8` |
| `input_c` | str | the channel size of an input image |
| `input_h` | str | the height of an input image |
| `input_w` | str | the width of an input image |
| Name | Type | Description |
| ----------------- | ---- | ------------------------------------------------ |
| `model_file_path` | str | path to the model file |
| `label_file_path` | str | path to the label file |
| `precision` | str | TensorRT precision, `fp16` or `int8` |
| `input_c` | str | the channel size of an input image |
| `input_h` | str | the height of an input image |
| `input_w` | str | the width of an input image |
| `build_only` | bool | shutdown node after TensorRT engin file is built |

#### hsv_classifier

Expand Down
5 changes: 5 additions & 0 deletions perception/traffic_light_classifier/src/cnn_classifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ CNNClassifier::CNNClassifier(rclcpp::Node * node_ptr) : node_ptr_(node_ptr)

trt_ = std::make_shared<Tn::TrtCommon>(model_file_path, precision, input_name, output_name);
trt_->setup();

if (node_ptr_->declare_parameter("build_only", false)) {
RCLCPP_INFO(node_ptr_->get_logger(), "TensorRT engine is built and shutdown node.");
rclcpp::shutdown();
}
}

bool CNNClassifier::getTrafficSignal(
Expand Down

0 comments on commit 8c6797e

Please sign in to comment.