Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add always_publish arg #134

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
knorth55 marked this conversation as resolved.
Show resolved Hide resolved
self.always_publish))

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