Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b4549957 authored by Francesco Tonini's avatar Francesco Tonini
Browse files

Refactor publisher initialization

parent e1eb7a85
Branches
No related tags found
1 merge request!4Update submodules and add timestamp
......@@ -99,6 +99,15 @@ class SoftBiometricsEstimation:
self._cropped_image_callback,
id,
)
self.faces[id]["topics"]["softbio"] = rospy.Publisher(
self.topic_name_softbio(id),
SoftBiometrics,
queue_size=10,
latch=True,
)
self.faces[id]["data"]["age"] = deque([], maxlen=15)
self.faces[id]["data"]["gender"] = deque([], maxlen=15)
elif id not in face_ids and id in subscribed_ids:
self._unsubscribe_face(id)
......@@ -128,21 +137,9 @@ class SoftBiometricsEstimation:
# Pop embeddings and create the message
embeddings = softbio_estimations.pop("encoded")
# Get topics and data for this
# Get topics and data for this face
this_id_topics = self.faces[id]["topics"]
this_id_data = self.faces[id]["data"]
if "softbio" not in this_id_topics.keys():
softbio_pub = rospy.Publisher(
self.topic_name_softbio(id),
SoftBiometrics,
queue_size=10,
latch=True,
)
self.faces[id]["topics"]["softbio"] = softbio_pub
self.faces[id]["data"]["age"] = deque([], maxlen=15)
self.faces[id]["data"]["gender"] = deque([], maxlen=15)
softbio_pub = this_id_topics["softbio"]
mov_avg_estimates = {
"age": this_id_data["age"],
......@@ -324,8 +321,12 @@ class SoftBiometricsEstimation:
continue
age = this_face_data["age"]
age = round(sum(age) / len(age))
gender = this_face_data["gender"]
if len(age) == 0 or len(gender) == 0:
continue
age = round(sum(age) / len(age))
gender = round(sum(gender) / len(gender))
gender_value = KeyValue(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment