Skip to content

Commit

Permalink
fix: update readme (#2)
Browse files Browse the repository at this point in the history
* first commit

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* Now build works with ROS 2 node structure

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* finalize

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* update

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* for lane detection

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* now works

Signed-off-by: kminoda <koji.minoda@tier4.jp>

* update readme

Signed-off-by: kminoda <koji.minoda@tier4.jp>

---------

Signed-off-by: kminoda <koji.minoda@tier4.jp>
  • Loading branch information
kminoda authored Aug 4, 2023
1 parent c3cf33d commit 75975c8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 29 deletions.
44 changes: 23 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,26 @@ target_link_libraries(lightnet_trt ${CUDA_LIBRARIES} ${OpenCV_LIBS} nvinfer nvin


# ROS 2 package
find_package(autoware_cmake REQUIRED)
autoware_package()

# build nodelet
# TODO

# build node
ament_auto_add_executable(lightnet_trt_node
src/main.cpp
src/lightnet_trt_node.cpp
src/lightnet_trt_core.cpp
)
ament_target_dependencies(lightnet_trt_node)
target_include_directories(lightnet_trt_node PRIVATE modules/ extra/)
target_link_libraries(lightnet_trt_node detector)
target_link_libraries(lightnet_trt_node ${CUDA_LIBRARIES} ${OpenCV_LIBS} nvinfer nvinfer_plugin nvparsers gflags boost_system boost_filesystem "stdc++fs" "stdc++")

ament_auto_package(INSTALL_TO_SHARE
launch
configs
)
if(BUILD_ROS2_LIGHTNET_TRT)
find_package(autoware_cmake REQUIRED)
autoware_package()

# build nodelet
# TODO

# build node
ament_auto_add_executable(lightnet_trt_node
src/main.cpp
src/lightnet_trt_node.cpp
src/lightnet_trt_core.cpp
)
ament_target_dependencies(lightnet_trt_node)
target_include_directories(lightnet_trt_node PRIVATE modules/ extra/)
target_link_libraries(lightnet_trt_node detector)
target_link_libraries(lightnet_trt_node ${CUDA_LIBRARIES} ${OpenCV_LIBS} nvinfer nvinfer_plugin nvparsers gflags boost_system boost_filesystem "stdc++fs" "stdc++")

ament_auto_package(INSTALL_TO_SHARE
launch
configs
)
endif()
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ Inference from images
$ ./lightNet-TRT --flagfile ../configs/lightNet-BDD100K-det-semaseg-1280x960.txt --precision [kFLOAT/kHALF/kINT8] {--dla [0/1]} --d VIDEO
```

### Inference with ROS 2 node

You can build as follows. Note that current implementation requires Autoware installed and sourced.

```bash
mkdir lightnet_trt_ws/src -p
cd lightnet_trt_ws/src
git clone https://github.com/kminoda/lightNet-TRT-ROS2.git
cd ..
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_ROS2_LIGHTNET_TRT=ON
```

Then, you can run the node as follows.

```bash
ros2 launch lightnet_trt lightnet_trt.launch.xml
```

## Implementation

LightNet-TRT is built on the LightNet framework and integrates with TensorRT using the Network Definition API. The implementation is based on the following repositories:
Expand Down
16 changes: 8 additions & 8 deletions launch/lightnet_trt.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<arg name="output/objects" default="/perception/object_recognition/detection/rois0" />

<!-- path to the lightNet-TRT cfg file to be loaded -->
<!-- <arg name="model_cfg" default="$(find-pkg-share lightnet_trt)/configs/lightNet-BDD100K-det-semaseg-1280x960.cfg" /> -->
<!-- <arg name="model_weights" default="$(find-pkg-share lightnet_trt)/configs/lightNet-BDD100K-det-semaseg-1280x960.weights" /> -->
<!-- <arg name="width" default="1280"/> -->
<!-- <arg name="height" default="960"/> -->
<arg name="model_cfg" default="$(find-pkg-share lightnet_trt)/configs/lightNet-BDD100K-det-semaseg-1280x960.cfg" />
<arg name="model_weights" default="$(find-pkg-share lightnet_trt)/configs/lightNet-BDD100K-det-semaseg-1280x960.weights" />
<arg name="width" default="1280"/>
<arg name="height" default="960"/>

<arg name="model_cfg" default="$(find-pkg-share lightnet_trt)/configs/yolov8x-BDD100K-640x640-T4-lane4cls.cfg"/>
<arg name="model_weights" default="$(find-pkg-share lightnet_trt)/configs/yolov8x-BDD100K-640x640-T4-lane4cls-scratch-pseudo-finetune_last.weights"/>
<arg name="width" default="640"/>
<arg name="height" default="640"/>
<!-- <arg name="model_cfg" default="$(find-pkg-share lightnet_trt)/configs/yolov8x-BDD100K-640x640-T4-lane4cls.cfg"/> -->
<!-- <arg name="model_weights" default="$(find-pkg-share lightnet_trt)/configs/yolov8x-BDD100K-640x640-T4-lane4cls-scratch-pseudo-finetune_last.weights"/> -->
<!-- <arg name="width" default="640"/> -->
<!-- <arg name="height" default="640"/> -->

<group>
<node pkg="lightnet_trt" exec="lightnet_trt_node" name="lightnet_trt_node">
Expand Down

0 comments on commit 75975c8

Please sign in to comment.