Skip to content

Commit

Permalink
Merge branch 'master' into PR/publish_skel
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 authored Dec 15, 2023
2 parents 583c89e + 87bf4a0 commit c5cc935
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when an object is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.6`)
Expand Down Expand Up @@ -551,6 +555,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when a face is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.6`)
Expand Down Expand Up @@ -615,6 +623,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when a human pose is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.2`)
Expand Down Expand Up @@ -713,6 +725,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when an object is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.6`)
Expand Down Expand Up @@ -789,6 +805,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when a face is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.6`)
Expand Down Expand Up @@ -869,6 +889,10 @@ rosrun image_view image_view image:=/edgetpu_panorama_semantic_segmenter/output/

- Set `compressed` to subscribe compressed image

- `~always_subscribe` (`Bool`, default: `True`)

- Set false to publish when a human pose is detected.

#### Dynamic parameters

- `~score_thresh`: (`Float`, default: `0.2`)
Expand Down
8 changes: 5 additions & 3 deletions python/coral_usb/detector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def image_cb(self, msg):
label_names=[self.label_names[lbl] for lbl in labels],
label_proba=scores)

self.pub_rects.publish(rect_msg)
self.pub_class.publish(cls_msg)

if self.enable_visualization:
with self.lock:
self.img = img
Expand All @@ -143,6 +140,11 @@ def image_cb(self, msg):
self.labels = labels
self.scores = scores

if not self.always_publish and len(cls_msg.labels) <= 0:
return
self.pub_rects.publish(rect_msg)
self.pub_class.publish(cls_msg)

def visualize_cb(self, event):
if (not self.visualize or self.img is None or self.encoding is None
or self.header is None or self.bboxes is None
Expand Down
15 changes: 9 additions & 6 deletions python/coral_usb/human_pose_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,6 @@ def image_cb(self, msg):
label_names=[self.label_names[lbl] for lbl in labels],
label_proba=[np.average(score) for score in scores]
)
for i in range(len(skels_msg.skeletons)):
skels_msg.human_ids.append(Int32(data=i))
self.pub_skel.publish(skels_msg)
self.pub_pose.publish(poses_msg)
self.pub_rects.publish(rects_msg)
self.pub_class.publish(cls_msg)

if self.enable_visualization:
with self.lock:
Expand All @@ -221,6 +215,15 @@ def image_cb(self, msg):
self.points = points
self.visibles = visibles

if not self.always_publish and len(cls_msg.label_names) <= 0:
return
self.pub_pose.publish(poses_msg)
self.pub_rects.publish(rects_msg)
self.pub_class.publish(cls_msg)
for i in range(len(skels_msg.skeletons)):
skels_msg.human_ids.append(Int32(data=i))
self.pub_skel.publish(skels_msg)

def visualize_cb(self, event):
if (not self.visualize or self.img is None or self.encoding is None
or self.points is None or self.visibles is None):
Expand Down
5 changes: 5 additions & 0 deletions python/coral_usb/node_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def __init__(self, model_file=None, label_file=None, namespace='~'):
self.timer = rospy.Timer(
rospy.Duration(self.duration), self.visualize_cb)

self.always_publish = rospy.get_param("~always_publish", True)
rospy.loginfo(
"Publish even if object/human_pose is not found : {}".format(
self.always_publish))

def subscribe(self):
if self.transport_hint == 'compressed':
self.sub_image = rospy.Subscriber(
Expand Down

0 comments on commit c5cc935

Please sign in to comment.