Skip to content

Commit d19705b

Browse files
committed
Merge branch 'master' into feature/51_publish_heartbeat
2 parents 45dd31b + 58af91f commit d19705b

22 files changed

+463
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5+
CMakeLists.txt.user
56

67
# C extensions
78
*.so

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Package | Build status Xenial Kinetic x64 | Description
1515
[openface_ros](https://github.com/tue-robotics/image_recognition/tree/master/openface_ros) | [![Build Status](http://build.ros.org/job/Ksrc_uX__openface_ros__ubuntu_xenial__source/1//badge/icon)](http://build.ros.org/job/Ksrc_uX__openface_ros__ubuntu_xenial__source/1/) | ROS wrapper for Openface (https://github.com/cmusatyalab/openface) to detect and recognize faces in images.
1616
[skybiometry_ros](https://github.com/tue-robotics/image_recognition/tree/master/skybiometry_ros) | [![Build Status](http://build.ros.org/job/Ksrc_uX__skybiometry_ros__ubuntu_xenial__source/1//badge/icon)](http://build.ros.org/job/Ksrc_uX__skybiometry_ros_ubuntu_xenial__source/1/) | ROS wrapper for Skybiometry (https://skybiometry.com/) for getting face properties of a detected face, e.g. age estimation, gender estimation etc.
1717
[openpose_ros](https://github.com/tue-robotics/image_recognition/tree/master/openpose_ros) | [![Build Status](http://build.ros.org/job/Ksrc_uX__openpose_ros__ubuntu_xenial__source/1//badge/icon)](http://build.ros.org/job/Ksrc_uX__openpose_ros_ubuntu_xenial__source/1/) | ROS wrapper for Openpose (https://github.com/CMU-Perceptual-Computing-Lab/) for getting poses of 2D images.
18+
[jetson_inference_ros](https://github.com/tue-robotics/image_recognition/tree/master/jetson_inference_ros) | [![Build Status](http://build.ros.org/job/Ksrc_uX__jetson_inference_ros__ubuntu_xenial__source/1//badge/icon)](http://build.ros.org/job/Ksrc_uX__jetson_inference_ros_ubuntu_xenial__source/1/) | ROS wrapper for Jetson Inference (https://github.com/dusty-nv/jetson-inference) for running inference using TensorRT.
1819
[keras_ros](https://github.com/tue-robotics/image_recognition/tree/master/keras_ros) | [![Build Status](http://build.ros.org/job/Ksrc_uX__keras_ros__ubuntu_xenial__source/1//badge/icon)](http://build.ros.org/job/Ksrc_uX__keras_ros_ubuntu_xenial__source/1/) | ROS wrappers for Keras neural nets.
1920

2021
## Travis CI Build Status

image_recognition_util/package.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
<exec_depend>python-numpy</exec_depend>
1414
<exec_depend>python-opencv</exec_depend>
15+
<exec_depend>rospy</exec_depend>
1516

1617
<test_depend>rostest</test_depend>
1718

18-
</package>
19+
</package>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
3+
import message_filters
4+
import rospy
5+
from cv_bridge import CvBridge
6+
from sensor_msgs.msg import Image
7+
from image_recognition_msgs.msg import Recognitions
8+
from image_recognition_util import image_writer
9+
10+
11+
class OverlayPublisher(object):
12+
13+
def __init__(self):
14+
self._bridge = CvBridge()
15+
16+
# Topics
17+
image_sub = message_filters.Subscriber('image', Image, queue_size=1)
18+
recognitions_sub = message_filters.Subscriber('recognitions', Recognitions, queue_size=1)
19+
20+
self._ts = message_filters.TimeSynchronizer([image_sub, recognitions_sub], queue_size=100)
21+
# self._ts = message_filters.ApproximateTimeSynchronizer([image_sub, recognitions_sub],
22+
# queue_size=10, slop=1.0)
23+
self._ts.registerCallback(self.callback)
24+
25+
self._result_image_publisher = rospy.Publisher("image_recognitions_overlay", Image, queue_size=10)
26+
27+
def callback(self, image_msg, recognitions_msg):
28+
rospy.loginfo('got image cb')
29+
30+
cv_image = self._bridge.imgmsg_to_cv2(image_msg, "bgr8")
31+
annotated_image = image_writer.get_annotated_cv_image(cv_image, recognitions_msg.recognitions)
32+
self._result_image_publisher.publish(self._bridge.cv2_to_imgmsg(annotated_image, "bgr8"))
33+
34+
35+
if __name__ == '__main__':
36+
rospy.init_node('publish_image_with_recognitions_overlay')
37+
OverlayPublisher()
38+
rospy.spin()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(jetson_inference_ros)
3+
4+
## Compile as C++11, supported in ROS Kinetic and newer
5+
add_compile_options(-std=c++11)
6+
7+
## Find catkin macros and libraries
8+
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
9+
## is used, also find other catkin packages
10+
find_package(catkin REQUIRED COMPONENTS
11+
cv_bridge
12+
image_recognition_msgs
13+
image_transport
14+
roscpp
15+
sensor_msgs
16+
)
17+
18+
catkin_package()
19+
20+
include_directories(${catkin_INCLUDE_DIRS})
21+
22+
find_package(jetson-inference)
23+
if(jetson-inference_FOUND) # If we are on Jetson, use the actual impl, otherwise a mock
24+
find_package(CUDA REQUIRED)
25+
find_package(Qt4 REQUIRED)
26+
include(${QT_USE_FILE})
27+
add_definitions(${QT_DEFINITIONS})
28+
include_directories(${CUDA_INCLUDE_DIRS})
29+
add_library(detect_net src/detect_net.cpp)
30+
target_link_libraries(detect_net ${catkin_LIBRARIES} jetson-inference)
31+
else()
32+
message(WARNING "Jetson-inference not found, using a mock instead ...")
33+
message(WARNING "The library can be installed using scripts/install_jetson_inference.bash")
34+
add_library(detect_net src/detect_net_mock.cpp)
35+
target_link_libraries(detect_net ${catkin_LIBRARIES})
36+
endif()
37+
add_dependencies(detect_net ${catkin_EXPORTED_TARGETS})
38+
39+
add_executable(detect_net_ros src/detect_net_ros.cpp)
40+
target_link_libraries(detect_net_ros detect_net)

jetson_inference_ros/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
jetson_inference_ros
2+
====================================
3+
4+
ROS Wrapper for Jetson inference https://github.com/dusty-nv/jetson-inference
5+
6+
## Description
7+
Provides a service and topic interface for jetson inference. For now only the detect nets
8+
9+
### Some illustrations (pednet, bottlenet, facenet)
10+
11+
![Pedestrians](doc/pedestrians.png)
12+
![Bottles](doc/bottles.png)
13+
![Faces](doc/faces.png)
14+
15+
## Installation on Jetson TX2
16+
17+
Run the install jetson-inference script
18+
19+
rosrun jetson_inference_ros install_jetson_inference.bash
20+
21+
If the jetson-inference cannot be found using CMake, it will compile a mock.
22+
300 KB
Loading

jetson_inference_ros/doc/faces.png

134 KB
Loading
696 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<launch>
2+
3+
<arg name="networks_path" default="/home/ubuntu/jetson-inference/data/networks" />
4+
<arg name="prototxt_path" default="ped-100/deploy.prototxt" />
5+
<arg name="model_path" default="ped-100/snapshot_iter_70800.caffemodel" />
6+
7+
<group ns="camera/rgb">
8+
<node pkg="jetson_inference_ros" type="detect_net_ros" name="detect_net" output="screen">
9+
<param name="prototxt_path" value="$(arg networks_path)/$(arg prototxt_path)" />
10+
<param name="model_path" value="$(arg networks_path)/$(arg model_path)" />
11+
<remap from="image" to="image_rect_color" />
12+
</node>
13+
<node pkg="image_recognition_util" type="publish_image_with_recognitions_overlay" name="overlay">
14+
<remap from="image" to="image_rect_color" />
15+
</node>
16+
</group>
17+
</launch>

0 commit comments

Comments
 (0)