Skip to content

Commit

Permalink
feat: add traffic_light_recognition packages (autowarefoundation#94)
Browse files Browse the repository at this point in the history
* release v0.4.0

* check if gdown command exists (autowarefoundation#707)

* Add nodelets of tlr nodes (autowarefoundation#715)

* Add classifier nodelet

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Replace boost::shared_ptr into std::shared_ptr

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Add lock guard

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Add detetcor nodelet

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Integrate main into node

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Add SubscriberStatusCallback

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add image_transport_decompresser nodelet

Signed-off-by: Yukihiro Saito <[email protected]>

* Add visualizer nodelet

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* fixed bug

Signed-off-by: Yukihiro Saito <[email protected]>

* Fix plugin name

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Launch nodelet

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* Fix classifier constructor

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add decompresser node

Signed-off-by: Yukihiro Saito <[email protected]>

* fix typo

Signed-off-by: Yukihiro Saito <[email protected]>

* fixed bug

Signed-off-by: Yukihiro Saito <[email protected]>

* fixed bug

Signed-off-by: Yukihiro Saito <[email protected]>

* cosmetic change

Signed-off-by: Yukihiro Saito <[email protected]>

* add param

Signed-off-by: Yukihiro Saito <[email protected]>

* fix bug

Signed-off-by: Yukihiro Saito <[email protected]>

* Fix build warning

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* change rgb

Signed-off-by: Yukihiro Saito <[email protected]>

* change rgb

Signed-off-by: Yukihiro Saito <[email protected]>

Co-authored-by: Yukihiro Saito <[email protected]>

* remove libutils dependency when unable gpu (autowarefoundation#761)

* Fix typo cliped -> clipped (autowarefoundation#776)

Signed-off-by: Kosuke Takeuchi <[email protected]>

* install launch when disable gpu (autowarefoundation#829)

* add launch and xml install when disable gpu

* remove unnecessary install

* change raw pointer to vector and shared_ptr (#817)

* change raw pointer to vector and shared_ptr

* fix bug

* Fix/cublas dependency (autowarefoundation#849)

* fix cublas depencency

* fix cublas depencency

* remove ROS1 packages temporarily

Signed-off-by: mitsudome-r <[email protected]>

* Revert "remove ROS1 packages temporarily"

This reverts commit 9b343cf4c11815735a176ef31f9e6e9948f20c74.

Signed-off-by: mitsudome-r <[email protected]>

* add COLCON_IGNORE to ros1 packages

Signed-off-by: mitsudome-r <[email protected]>

* Rename launch files to launch.xml (autowarefoundation#28)

* Port traffic light classifier (autowarefoundation#70)

* port package.xml and CMakeLists.txt

Signed-off-by: mitsudome-r <[email protected]>

* port ROS messages

Signed-off-by: mitsudome-r <[email protected]>

* port to ros2

Signed-off-by: mitsudome-r <[email protected]>

* make wget buildtool_depend

Signed-off-by: mitsudome-r <[email protected]>

* remove main function

Signed-off-by: mitsudome-r <[email protected]>

* add connectCb as a timer callback

Signed-off-by: mitsudome-r <[email protected]>

* fix indentation

Signed-off-by: mitsudome-r <[email protected]>

* remove catkin includes and libraries from CMakeLists.txt

Signed-off-by: mitsudome-r <[email protected]>

* [traffic_light_ssd_fine_detector] port to ROS2 (autowarefoundation#113)

Signed-off-by: mitsudome-r <[email protected]>

* Ros2 port traffic light map (autowarefoundation#99)

* remove colcon ignore

* ported CMakelists

* port package

* remove colcon ignore

* ported CMakelists

* port package

* ported traffic_light_map_detector to ROS2 - compiling

* port launch and config files, tidied up

* change rclcpp duration arguments

* launch file corrections

* lookupTransform uses exact timestamp

* Convert calls of Duration to Duration::from_seconds where appropriate (autowarefoundation#131)

* Rename h files to hpp (autowarefoundation#142)

* Change includes

* Rename files

* Adjustments to make things compile

* Other packages

* Adjust copyright notice on 532 out of 699 source files (autowarefoundation#143)

* Use quotes for includes where appropriate (autowarefoundation#144)

* Use quotes for includes where appropriate

* Fix lint tests

* Make tests pass hopefully

* fixing trasient_local in ROS2 packages (autowarefoundation#160)

* adding linters in traffic_light_map_based_detector (autowarefoundation#179)

* traffic_light_classifier: Fix engine save dir (autowarefoundation#250)

Signed-off-by: wep21 <[email protected]>

* traffic light map based detector: Fix launch (autowarefoundation#253)

Signed-off-by: wep21 <[email protected]>

* Ros2 v0.8.0 traffic light map based detector (autowarefoundation#262)

* change alpha (autowarefoundation#903)

Signed-off-by: Yukihiro Saito <[email protected]>

* fix typos in perception (autowarefoundation#862)

Co-authored-by: Yukihiro Saito <[email protected]>
Co-authored-by: Kazuki Miyahara <[email protected]>

* Ros2 v0.8.0 traffic light classifier (autowarefoundation#261)

* fix typos in perception (autowarefoundation#862)

* update README.md in perception (autowarefoundation#1007)

* update traffic light recognition model (autowarefoundation#1086)

* update traffic light recognition model

* download model when hash has changed

* fix CMakeLists

* udpate tl model to scale ai dataset one (autowarefoundation#1118)

Co-authored-by: Kazuki Miyahara <[email protected]>
Co-authored-by: Satoshi Tanaka <[email protected]>
Co-authored-by: Taichi Higashide <[email protected]>

* Ros2 v0.8.0 traffic light ssd fine detector (autowarefoundation#260)

* fix typos in perception (autowarefoundation#862)

* update README.md in perception (autowarefoundation#1007)

* update traffic light recognition model (autowarefoundation#1086)

* update traffic light recognition model

* download model when hash has changed

* fix CMakeLists

* udpate tl model to scale ai dataset one (autowarefoundation#1118)

Co-authored-by: Kazuki Miyahara <[email protected]>
Co-authored-by: Satoshi Tanaka <[email protected]>
Co-authored-by: Taichi Higashide <[email protected]>

* Rename ROS-related .yaml to .param.yaml (autowarefoundation#352)

* Rename ROS-related .yaml to .param.yaml

Signed-off-by: Kenji Miyake <[email protected]>

* Remove prefix 'default_' of yaml files

Signed-off-by: Kenji Miyake <[email protected]>

* Rename vehicle_info.yaml to vehicle_info.param.yaml

Signed-off-by: Kenji Miyake <[email protected]>

* Rename diagnostic_aggregator's param files

Signed-off-by: Kenji Miyake <[email protected]>

* Fix overlooked parameters

Signed-off-by: Kenji Miyake <[email protected]>

* Ros2 v0.8.0 beta rm std msgs ssd traffic light (autowarefoundation#395) (autowarefoundation#400)

* rm std_msgs float32

* fix typo

Co-authored-by: taikitanaka3 <[email protected]>

* add use_sim-time option (autowarefoundation#454)

* Fix rolling build errors (autowarefoundation#1225)

* Add missing include files

Signed-off-by: Kenji Miyake <[email protected]>

* Replace rclcpp::Duration

Signed-off-by: Kenji Miyake <[email protected]>

* Use reference for exceptions

Signed-off-by: Kenji Miyake <[email protected]>

* Use from_seconds

Signed-off-by: Kenji Miyake <[email protected]>

* Sync public repo (autowarefoundation#1228)

* [simple_planning_simulator] add readme (autowarefoundation#424)

* add readme of simple_planning_simulator

Signed-off-by: Takamasa Horibe <[email protected]>

* Update simulator/simple_planning_simulator/README.md

* set transit_margin_time to intersect. planner (autowarefoundation#460)

* Fix pose2twist (autowarefoundation#462)

Signed-off-by: Takagi, Isamu <[email protected]>

* Ros2 vehicle info param server (autowarefoundation#447)

* add vehicle_info_param_server

* update vehicle info

* apply format

* fix bug

* skip unnecessary search

* delete vehicle param file

* fix bug

* Ros2 fix topic name part2 (autowarefoundation#425)

* Fix topic name of traffic_light_classifier

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix topic name of traffic_light_visualization

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix topic name of traffic_light_ssd_fine_detector

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix topic name of traffic_light_map_based_detector

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix lint traffic_light_recognition

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix lint traffic_light_ssd_fine_detector

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix lint traffic_light_classifier

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix lint traffic_light_classifier

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix lint traffic_light_ssd_fine_detector

Signed-off-by: Takagi, Isamu <[email protected]>

* Fix issues in hdd_reader (autowarefoundation#466)

* Fix some issues detected by Coverity Scan and Clang-Tidy

* Update launch command

* Add more `close(new_sock)`

* Simplify the definitions of struct

* fix: re-construct laneletMapLayer for reindex RTree (autowarefoundation#463)

* Rviz overlay render fix (autowarefoundation#461)

* Moved painiting in SteeringAngle plugin to update()

Signed-off-by: Adam Dabrowski <[email protected]>

* super class now back to MFD

Signed-off-by: Adam Dabrowski <[email protected]>

* uncrustified

Signed-off-by: Adam Dabrowski <[email protected]>

* acquire data in mutex

Signed-off-by: Adam Dabrowski <[email protected]>

* back to RTD as superclass

Signed-off-by: Adam Dabrowski <[email protected]>

* Rviz overlay render in update (autowarefoundation#465)

* Moved painiting in SteeringAngle plugin to update()

Signed-off-by: Adam Dabrowski <[email protected]>

* super class now back to MFD

Signed-off-by: Adam Dabrowski <[email protected]>

* uncrustified

Signed-off-by: Adam Dabrowski <[email protected]>

* acquire data in mutex

Signed-off-by: Adam Dabrowski <[email protected]>

* removed unnecessary includes and some dead code

Signed-off-by: Adam Dabrowski <[email protected]>

* Adepted remaining vehicle plugin classes to render-in-update concept. Returned to MFD superclass

Signed-off-by: Adam Dabrowski <[email protected]>

* restored RTD superclass

Signed-off-by: Adam Dabrowski <[email protected]>

Co-authored-by: Takamasa Horibe <[email protected]>
Co-authored-by: tkimura4 <[email protected]>
Co-authored-by: Takagi, Isamu <[email protected]>
Co-authored-by: Kazuki Miyahara <[email protected]>
Co-authored-by: Makoto Tokunaga <[email protected]>
Co-authored-by: Adam Dąbrowski <[email protected]>

* Unify Apache-2.0 license name (autowarefoundation#1242)

* Remove use_sim_time for set_parameter (autowarefoundation#1260)

Signed-off-by: wep21 <[email protected]>

* handle wrong route (autowarefoundation#1312)

Signed-off-by: wep21 <[email protected]>

Co-authored-by: Yukihiro Saito <[email protected]>

* Dealing with wrong image size (autowarefoundation#1320)

* Dealing with wrong image size

* Fix typo

Signed-off-by: wep21 <[email protected]>

Co-authored-by: Yukihiro Saito <[email protected]>

* Perception components (autowarefoundation#1368)

* [bev_optical_flow]: component node

Signed-off-by: wep21 <[email protected]>

* [object_merger]: component node

Signed-off-by: wep21 <[email protected]>

* [object_range_splitter]: component node

Signed-off-by: wep21 <[email protected]>

* [shape_estimation]: component node

Signed-off-by: wep21 <[email protected]>

* [map_based_prediction]: component node

Signed-off-by: wep21 <[email protected]>

* [naive_path_prediction]: component node

Signed-off-by: wep21 <[email protected]>

* [roi_image_saver]: component node

Signed-off-by: wep21 <[email protected]>

* [lidar_apollo_instance_segmentation]: component node

Signed-off-by: wep21 <[email protected]>

* [object_flow_fusion]: component node

Signed-off-by: wep21 <[email protected]>

* [traffic_light_map_based_detector]: component node

Signed-off-by: wep21 <[email protected]>

* [dynamic_object_visualization]: component node

Signed-off-by: wep21 <[email protected]>

* Fix typo

Signed-off-by: wep21 <[email protected]>

* Use sensor data qos for traffic light recognition (autowarefoundation#1440)

Signed-off-by: wep21 <[email protected]>

* Fix/ssd fine detector (autowarefoundation#1421) (autowarefoundation#1468)

* modify fitInFrame

* cosmetic change

* bug fix

* bug fix

* cosmetic change

Co-authored-by: Yukihiro Saito <[email protected]>

* Feature/tl map based detector ros2 (autowarefoundation#1475)

* refactor and rectified distortion (autowarefoundation#1397)

* refactor and rectified distortion

* fix typo

* cosmetic change

* add readme

* cosmetic change

* cosmetic change

* update readme

* Update perception/traffic_light_recognition/traffic_light_map_based_detector/src/node.cpp

Co-authored-by: Akihito Ohsato <[email protected]>

* use image geometry (autowarefoundation#1439)

Co-authored-by: Akihito Ohsato <[email protected]>

* Apply lint

Signed-off-by: wep21 <[email protected]>

Co-authored-by: Yukihiro Saito <[email protected]>
Co-authored-by: Akihito Ohsato <[email protected]>

* Add pre-commit (autowarefoundation#1560)

* add pre-commit

* add pre-commit-config

* add additional settings for private repository

* use default pre-commit-config

* update pre-commit setting

* Ignore whitespace for line breaks in markdown

* Update .github/workflows/pre-commit.yml

Co-authored-by: Kazuki Miyahara <[email protected]>

* exclude svg

* remove pretty-format-json

* add double-quote-string-fixer

* consider COLCON_IGNORE file when seaching modified package

* format file

* pre-commit fixes

* Update pre-commit.yml

* Update .pre-commit-config.yaml

Co-authored-by: Kazuki Miyahara <[email protected]>
Co-authored-by: pre-commit <[email protected]>
Co-authored-by: Kenji Miyake <[email protected]>

* Fix build error with TensorRT v8 (autowarefoundation#1612)

* Fix build error with TensorRT v8

Signed-off-by: wep21 <[email protected]>

* Fix typo

Signed-off-by: wep21 <[email protected]>

* Add markdownlint and prettier (autowarefoundation#1661)

* Add markdownlint and prettier

Signed-off-by: Kenji Miyake <[email protected]>

* Ignore .param.yaml

Signed-off-by: Kenji Miyake <[email protected]>

* Apply format

Signed-off-by: Kenji Miyake <[email protected]>

* suppress warnings for declare parameters (autowarefoundation#1724)

* fix for lanelet2_extension

* fix for traffic light ssd fine detector

* fix for topic_state_monitor

* fix for dummy diag publisher

* fix for remote cmd converter

* fix for vehicle_info_util

* fix for multi object tracker

* fix for freespace planner

* fix for autoware_error_monitor

* add Werror for multi object tracker

* fix for multi object tracker

* add Werror for liraffic light ssd fine detector

* add Werror for topic state monitor

* add Werror

* add Werror

* add Werror

* add Werror

* fix style

* suppress warnings for traffic light classifier (autowarefoundation#1762)

* add Werror

* fix type

* fix unused

* Fix -Wunused-parameter (autowarefoundation#1836)

* Fix -Wunused-parameter

Signed-off-by: Kenji Miyake <[email protected]>

* Fix mistake

Signed-off-by: Kenji Miyake <[email protected]>

* fix spell

* Fix lint issues

Signed-off-by: Kenji Miyake <[email protected]>

* Ignore flake8 warnings

Signed-off-by: Kenji Miyake <[email protected]>

Co-authored-by: Hiroki OTA <[email protected]>

* Fix compiler warnings (autowarefoundation#1837)

* Fix -Wunused-private-field

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wunused-variable

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wformat-security

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Winvalid-constexpr

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wdelete-non-abstract-non-virtual-dtor

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wdelete-abstract-non-virtual-dtor

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Winconsistent-missing-override

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wrange-loop-construct

Signed-off-by: Kenji Miyake <[email protected]>

* Fix "invalid application of 'sizeof' to an incomplete type"

Signed-off-by: Kenji Miyake <[email protected]>

* Ignore -Wgnu-anonymous-struct and -Wnested-anon-types

Signed-off-by: Kenji Miyake <[email protected]>

* Fix lint

Signed-off-by: Kenji Miyake <[email protected]>

* Ignore -Wno-deprecated-declarations in CUDA-related packages

Signed-off-by: Kenji Miyake <[email protected]>

* Fix mistake

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wunused-parameter

Signed-off-by: Kenji Miyake <[email protected]>

* Fix clang warnings (autowarefoundation#1859)

* Fix -Wreturn-std-move

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wunused-private-field

Signed-off-by: Kenji Miyake <[email protected]>

* Ignore -Wnonportable-include-path for mussp

Signed-off-by: Kenji Miyake <[email protected]>

* Fix -Wunused-const-variable

Signed-off-by: Kenji Miyake <[email protected]>

* Fix "can not be used when making a shared object"

Signed-off-by: Kenji Miyake <[email protected]>

* Invoke code formatter at pre-commit (autowarefoundation#1935)

* Run ament_uncrustify at pre-commit

* Reformat existing files
* Fix copyright and cpplint errors

Signed-off-by: Kenji Miyake <[email protected]>
Co-authored-by: Kenji Miyake <[email protected]>

* add sort-package-xml hook in pre-commit (autowarefoundation#1881)

* add sort xml hook in pre-commit

* change retval to exit_status

* rename

* add prettier plugin-xml

* use early return

* add license note

* add tier4 license

* restore prettier

* change license order

* move local hooks to public repo

* move prettier-xml to pre-commit-hooks-ros

* update version for bug-fix

* apply pre-commit

* Fix readme traffic light map based detector (autowarefoundation#2282)

* fix type of ~input/route in readme

* fix some grammar mistakes

* Change formatter to clang-format and black (autowarefoundation#2332)

* Revert "Temporarily comment out pre-commit hooks"

This reverts commit 748e9cdb145ce12f8b520bcbd97f5ff899fc28a3.

* Replace ament_lint_common with autoware_lint_common

Signed-off-by: Kenji Miyake <[email protected]>

* Remove ament_cmake_uncrustify and ament_clang_format

Signed-off-by: Kenji Miyake <[email protected]>

* Apply Black

Signed-off-by: Kenji Miyake <[email protected]>

* Apply clang-format

Signed-off-by: Kenji Miyake <[email protected]>

* Fix build errors

Signed-off-by: Kenji Miyake <[email protected]>

* Fix for cpplint

* Fix include double quotes to angle brackets

Signed-off-by: Kenji Miyake <[email protected]>

* Apply clang-format

Signed-off-by: Kenji Miyake <[email protected]>

* Fix build errors

Signed-off-by: Kenji Miyake <[email protected]>

* Add COLCON_IGNORE (autowarefoundation#500)

Signed-off-by: Kenji Miyake <[email protected]>

* [traffic_light_ssd_fine_detector] support autoware auto msgs (autowarefoundation#514)

* remove COLCON_IGNORE

* support autoware auto msgs

* fix sort pacakagge

* [traffic_light_map_based_detector] support autoware auto msgs (autowarefoundation#511)

* [traffic_light_classifier] support autoware auto msgs (autowarefoundation#504)

* update README of traffic_light_classifier (autowarefoundation#649)

* update README of traffic_light_classifier

* Update label explanation (autowarefoundation#652)

* Update README.md

* fix format

* fix markdown lint

* update readme

Co-authored-by: Taichi Higashide <[email protected]>

* add readme for traffic light ssd fine detector (autowarefoundation#637)

* declare variable before subscriber registration (autowarefoundation#705)

* update traffic light classifier readme (autowarefoundation#726)

* Update traffic light topic name (autowarefoundation#729)

* Update traffic light topic name

Signed-off-by: wep21 <[email protected]>

* Update traffic light topic name in perception

Signed-off-by: wep21 <[email protected]>

Co-authored-by: mitsudome-r <[email protected]>
Co-authored-by: Daichi Murakami <[email protected]>
Co-authored-by: Daisuke Nishimatsu <[email protected]>
Co-authored-by: Yukihiro Saito <[email protected]>
Co-authored-by: Taichi Higashide <[email protected]>
Co-authored-by: Kosuke Takeuchi <[email protected]>
Co-authored-by: Nikolai Morin <[email protected]>
Co-authored-by: Ryohsuke Mitsudome <[email protected]>
Co-authored-by: simon-t4 <[email protected]>
Co-authored-by: nik-tier4 <[email protected]>
Co-authored-by: Kazuki Miyahara <[email protected]>
Co-authored-by: Satoshi Tanaka <[email protected]>
Co-authored-by: Kenji Miyake <[email protected]>
Co-authored-by: taikitanaka3 <[email protected]>
Co-authored-by: tkimura4 <[email protected]>
Co-authored-by: Takamasa Horibe <[email protected]>
Co-authored-by: Takagi, Isamu <[email protected]>
Co-authored-by: Makoto Tokunaga <[email protected]>
Co-authored-by: Adam Dąbrowski <[email protected]>
Co-authored-by: Akihito Ohsato <[email protected]>
Co-authored-by: Keisuke Shima <[email protected]>
Co-authored-by: pre-commit <[email protected]>
Co-authored-by: Hiroki OTA <[email protected]>
Co-authored-by: Takeshi Ishita <[email protected]>
Co-authored-by: Kenji Miyake <[email protected]>
Co-authored-by: kminoda <[email protected]>
Co-authored-by: Yusuke Muramatsu <[email protected]>
  • Loading branch information
1 parent ea6439f commit 7da1565
Show file tree
Hide file tree
Showing 35 changed files with 3,582 additions and 0 deletions.
1 change: 1 addition & 0 deletions perception/traffic_light_classifier/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/*
184 changes: 184 additions & 0 deletions perception/traffic_light_classifier/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
cmake_minimum_required(VERSION 3.5)
project(traffic_light_classifier)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-deprecated-declarations -Werror)
endif()

option(CUDA_VERBOSE "Verbose output of CUDA modules" OFF)
# set flags for CUDA availability
option(CUDA_AVAIL "CUDA available" OFF)
find_package(CUDA)
if (CUDA_FOUND)
find_library(CUBLAS_LIBRARIES cublas HINTS
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib
)
if (CUDA_VERBOSE)
message(STATUS "CUDA is available!")
message(STATUS "CUDA Libs: ${CUDA_LIBRARIES}")
message(STATUS "CUDA Headers: ${CUDA_INCLUDE_DIRS}")
endif ()
set(CUDA_AVAIL ON)
else()
message(STATUS "CUDA NOT FOUND")
set(CUDA_AVAIL OFF)
endif (CUDA_FOUND)

# set flags for TensorRT availability
option(TRT_AVAIL "TensorRT available" OFF)
# try to find the tensorRT modules
find_library(NVINFER NAMES nvinfer)
find_library(NVONNXPARSER nvonnxparser)
find_library(NVINFER_PLUGIN NAMES nvinfer_plugin)
if(NVINFER AND NVONNXPARSER AND NVINFER_PLUGIN)
if (CUDA_VERBOSE)
message(STATUS "TensorRT is available!")
message(STATUS "NVINFER: ${NVINFER}")
message(STATUS "NVPARSERS: ${NVPARSERS}")
message(STATUS "NVINFER_PLUGIN: ${NVINFER_PLUGIN}")
message(STATUS "NVONNXPARSER: ${NVONNXPARSER}")
endif ()
set(TRT_AVAIL ON)
else()
message(STATUS "TensorRT is NOT Available")
set(TRT_AVAIL OFF)
endif()

# set flags for CUDNN availability
option(CUDNN_AVAIL "CUDNN available" OFF)
# try to find the CUDNN module
find_library(CUDNN_LIBRARY
NAMES libcudnn.so${__cudnn_ver_suffix} libcudnn${__cudnn_ver_suffix}.dylib ${__cudnn_lib_win_name}
PATHS $ENV{LD_LIBRARY_PATH} ${__libpath_cudart} ${CUDNN_ROOT_DIR} ${PC_CUDNN_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}
PATH_SUFFIXES lib lib64 bin
DOC "CUDNN library." )
if(CUDNN_LIBRARY)
if (CUDA_VERBOSE)
message(STATUS "CUDNN is available!")
message(STATUS "CUDNN_LIBRARY: ${CUDNN_LIBRARY}")
endif ()
set(CUDNN_AVAIL ON)

else()
message(STATUS "CUDNN is NOT Available")
set(CUDNN_AVAIL OFF)
endif()

# Download caffemodel and prototxt
set(PRETRAINED_MODEL_LINK "https://drive.google.com/uc?id=15CQceCn9TZDU6huKJacQvUnDiLHionb3")
set(PRETRAINED_MODEL_HASH 7dc31c696b0400ddfc2cc5521586fa51)
set(LAMP_LABEL_LINK "https://drive.google.com/uc?id=1D7n3oGSWLkWgxET6PcWqEzOhmmPcqM52")
set(LAMP_LABEL_HASH 20167c8e9a1f9d2ec7b0b0088c4100f0)

find_program(GDOWN_AVAIL "gdown")
if (NOT GDOWN_AVAIL)
message(STATUS "gdown: command not found. External files could not be downloaded.")
endif()
set(PATH "${CMAKE_CURRENT_SOURCE_DIR}/data")
if (NOT EXISTS "${PATH}")
execute_process(COMMAND mkdir -p ${PATH})
endif()
set(FILE "${PATH}/traffic_light_classifier_mobilenetv2.onnx")
message(STATUS "Checking and downloading traffic_light_classifier_mobilenetv2.onnx")
if (EXISTS "${FILE}")
file(MD5 "${FILE}" EXISTING_FILE_HASH)
if (NOT "${PRETRAINED_MODEL_HASH}" EQUAL "${EXISTING_FILE_HASH}")
message(STATUS "... file hash changed. Downloading now ...")
execute_process(COMMAND gdown --quiet "${PRETRAINED_MODEL_LINK}" -O ${PATH}/traffic_light_classifier_mobilenetv2.onnx)
endif()
else()
message(STATUS "... file does not exist. Downloading now ...")
execute_process(COMMAND gdown --quiet "${PRETRAINED_MODEL_LINK}" -O ${PATH}/traffic_light_classifier_mobilenetv2.onnx)
endif()

set(FILE "${PATH}/lamp_labels.txt")
message(STATUS "Checking and downloading lamp_labels.txt")
if (EXISTS "${FILE}")
file(MD5 "${FILE}" EXISTING_FILE_HASH)
if (NOT "${LAMP_LABEL_HASH}" EQUAL "${EXISTING_FILE_HASH}")
message(STATUS "... file does not exist. Downloading now ...")
execute_process(COMMAND gdown --quiet "${LAMP_LABEL_LINK}" -O ${PATH}/lamp_labels.txt)
endif()
else()
message(STATUS "... file does not exist. Downloading now ...")
execute_process(COMMAND gdown --quiet "${LAMP_LABEL_LINK}" -O ${PATH}/lamp_labels.txt)
endif()

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)

if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
add_definitions(-DENABLE_GPU)

include_directories(
utils
${OpenCV_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
)

ament_auto_add_library(libutils SHARED
utils/trt_common.cpp
)
target_link_libraries(libutils
${OpenCV_LIBRARIES}
${NVINFER}
${NVONNXPARSER}
${NVINFER_PLUGIN}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${CUDNN_LIBRARY}
${Boost_LIBRARIES}
)

ament_auto_add_library(traffic_light_classifier_nodelet SHARED
src/color_classifier.cpp
src/cnn_classifier.cpp
src/nodelet.cpp
)
target_link_libraries(traffic_light_classifier_nodelet
libutils
${OpenCV_LIBRARIES}
)
rclcpp_components_register_node(traffic_light_classifier_nodelet
PLUGIN "traffic_light::TrafficLightClassifierNodelet"
EXECUTABLE traffic_light_classifier_node
)

ament_auto_package(INSTALL_TO_SHARE
data
launch
)

else()
message(STATUS "CUDA and/or TensorRT were not found. build only color classifier")

include_directories(
${OpenCV_INCLUDE_DIRS}
)

ament_auto_add_library(traffic_light_classifier_nodelet SHARED
src/color_classifier.cpp
src/nodelet.cpp
)
target_link_libraries(traffic_light_classifier_nodelet
${OpenCV_LIBRARIES}
)

rclcpp_components_register_node(traffic_light_classifier_nodelet
PLUGIN "traffic_light::TrafficLightClassifierNodelet"
EXECUTABLE traffic_light_classifier_node
)

ament_auto_package(INSTALL_TO_SHARE
data
launch
)

endif()
131 changes: 131 additions & 0 deletions perception/traffic_light_classifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# traffic_light_classifier

## Purpose

traffic_light_classifier is a package for classifying traffic light labels using cropped image around a traffic light. This package has two classifier models: `cnn_classifier` and `hsv_classifier`.

## Inner-workings / Algorithms

### cnn_classifier

Traffic light labels are classified by MobileNetV2.

### hsv_classifier

Traffic light colors (green, yellow and red) are classified in HSV model.

### About Label

The message type is designed to comply with the unified road signs proposed at the [Vienna Convention](https://en.wikipedia.org/wiki/Vienna_Convention_on_Road_Signs_and_Signals#Traffic_lights). This idea has been also proposed in [Autoware.Auto](https://gitlab.com/autowarefoundation/autoware.auto/autoware_auto_msgs/-/merge_requests/16).

There are rules for naming labels that nodes receive. One traffic light is represented by the following character string separated by commas. `color1-shape1, color2-shape2` .

For example, the simple red and red cross traffic light label must be expressed as "red-circle, red-cross".

These colors and shapes are assigned to the message as follows:
![TrafficLightDataStructure.jpg](./image/TrafficLightDataStructure.jpg)

## Inputs / Outputs

### Input

| Name | Type | Description |
| --------------- | ---------------------------------------------------------- | ---------------------- |
| `~/input/image` | `sensor_msgs::msg::Image` | input image |
| `~/input/rois` | `autoware_auto_perception_msgs::msg::TrafficLightRoiArray` | rois of traffic lights |

### Output

| Name | Type | Description |
| -------------------------- | -------------------------------------------------------- | ------------------- |
| `~/output/traffic_signals` | `autoware_auto_perception_msgs::msg::TrafficSignalArray` | classified signals |
| `~/output/debug/image` | `sensor_msgs::msg::Image` | image for debugging |

## Parameters

### Node Parameters

| Name | Type | Description |
| ----------------- | ---- | ------------------------------------------- |
| `classifier_type` | int | if the value is `1`, cnn_classifier is used |

### Core Parameters

#### 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 |

#### hsv_classifier

| Name | Type | Description |
| -------------- | ---- | ---------------------------------------------- |
| `green_min_h` | int | the minimum hue of green color |
| `green_min_s` | int | the minimum saturation of green color |
| `green_min_v` | int | the minimum value (brightness) of green color |
| `green_max_h` | int | the maximum hue of green color |
| `green_max_s` | int | the maximum saturation of green color |
| `green_max_v` | int | the maximum value (brightness) of green color |
| `yellow_min_h` | int | the minimum hue of yellow color |
| `yellow_min_s` | int | the minimum saturation of yellow color |
| `yellow_min_v` | int | the minimum value (brightness) of yellow color |
| `yellow_max_h` | int | the maximum hue of yellow color |
| `yellow_max_s` | int | the maximum saturation of yellow color |
| `yellow_max_v` | int | the maximum value (brightness) of yellow color |
| `red_min_h` | int | the minimum hue of red color |
| `red_min_s` | int | the minimum saturation of red color |
| `red_min_v` | int | the minimum value (brightness) of red color |
| `red_max_h` | int | the maximum hue of red color |
| `red_max_s` | int | the maximum saturation of red color |
| `red_max_v` | int | the maximum value (brightness) of red color |

## Assumptions / Known limits

<!-- Write assumptions and limitations of your implementation.
Example:
This algorithm assumes obstacles are not moving, so if they rapidly move after the vehicle started to avoid them, it might collide with them.
Also, this algorithm doesn't care about blind spots. In general, since too close obstacles aren't visible due to the sensing performance limit, please take enough margin to obstacles.
-->

## (Optional) Error detection and handling

<!-- Write how to detect errors and how to recover from them.
Example:
This package can handle up to 20 obstacles. If more obstacles found, this node will give up and raise diagnostic errors.
-->

## (Optional) Performance characterization

<!-- Write performance information like complexity. If it wouldn't be the bottleneck, not necessary.
Example:
### Complexity
This algorithm is O(N).
### Processing time
...
-->

## References/External links

[1] M. Sandler, A. Howard, M. Zhu, A. Zhmoginov and L. Chen, "MobileNetV2: Inverted Residuals and Linear Bottlenecks," 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, 2018, pp. 4510-4520, doi: 10.1109/CVPR.2018.00474.

## (Optional) Future extensions / Unimplemented parts

<!-- Write future extensions of this package.
Example:
Currently, this package can't handle the chattering obstacles well. We plan to add some probabilistic filters in the perception layer to improve it.
Also, there are some parameters that should be global(e.g. vehicle size, max steering, etc.). These will be refactored and defined as global parameters so that we can share the same parameters between different nodes.
-->
29 changes: 29 additions & 0 deletions perception/traffic_light_classifier/cfg/HSVFilter.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /usr/bin/env python

# set up parameters that we care about
PACKAGE = 'traffic_light_classifier'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator ()
# def add (self, name, paramtype, level, description, default = None, min = None, max = None, edit_method = ""):
gen.add ("green_min_h", int_t, 0, "min h green", 50, 0, 180)
gen.add ("green_max_h", int_t, 0, "max h green", 120, 0, 180)
gen.add ("green_min_s", int_t, 0, "min s green", 100, 0, 255)
gen.add ("green_max_s", int_t, 0, "max s green", 200, 0, 255)
gen.add ("green_min_v", int_t, 0, "min v green", 150, 0, 255)
gen.add ("green_max_v", int_t, 0, "max v green", 255, 0, 255)
gen.add ("yellow_min_h", int_t, 0, "min h yellow", 0, 0, 180)
gen.add ("yellow_max_h", int_t, 0, "max h yellow", 50, 0, 180)
gen.add ("yellow_min_s", int_t, 0, "min s yellow", 80, 0, 255)
gen.add ("yellow_max_s", int_t, 0, "max s yellow", 200, 0, 255)
gen.add ("yellow_min_v", int_t, 0, "min v yellow", 150, 0, 255)
gen.add ("yellow_max_v", int_t, 0, "max v yellow", 255, 0, 255)
gen.add ("red_min_h", int_t, 0, "min h red", 160, 0, 180)
gen.add ("red_max_h", int_t, 0, "max h red", 180, 0, 180)
gen.add ("red_min_s", int_t, 0, "min s red", 100, 0, 255)
gen.add ("red_max_s", int_t, 0, "max s red", 255, 0, 255)
gen.add ("red_min_v", int_t, 0, "min v red", 150, 0, 255)
gen.add ("red_max_v", int_t, 0, "max v red", 255, 0, 255)

exit (gen.generate (PACKAGE, "traffic_light_classifier", "HSVFilter"))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2020 Tier IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef TRAFFIC_LIGHT_CLASSIFIER__CLASSIFIER_INTERFACE_HPP_
#define TRAFFIC_LIGHT_CLASSIFIER__CLASSIFIER_INTERFACE_HPP_

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

#include <autoware_auto_perception_msgs/msg/traffic_signal.hpp>

#include <vector>

namespace traffic_light
{
class ClassifierInterface
{
public:
virtual bool getTrafficSignal(
const cv::Mat & input_image,
autoware_auto_perception_msgs::msg::TrafficSignal & traffic_signal) = 0;
};
} // namespace traffic_light

#endif // TRAFFIC_LIGHT_CLASSIFIER__CLASSIFIER_INTERFACE_HPP_
Loading

0 comments on commit 7da1565

Please sign in to comment.