Skip to content

Commit

Permalink
Merge pull request #134 from tkmtnt7000/always-subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Dec 15, 2023
2 parents ff92ae3 + 928a1d5 commit 87bf4a0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 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
10 changes: 6 additions & 4 deletions python/coral_usb/human_pose_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ def image_cb(self, msg):
label_proba=[np.average(score) for score in scores]
)

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:
self.img = img
Expand All @@ -203,6 +199,12 @@ 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)

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 87bf4a0

Please sign in to comment.