Skip to content

Commit dd5f855

Browse files
Receptionist fixes (#260)
Co-authored-by: Zoe <ezoe013@gmail.com>
1 parent e88a8dc commit dd5f855

File tree

6 files changed

+31
-27
lines changed

6 files changed

+31
-27
lines changed

common/vision/lasr_vision_clip/nodes/vqa

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class VqaService:
3131
"""
3232
possible_answers = request.possible_answers
3333
answer, cos_score, annotated_img = query_image(
34-
self._model, request.image_raw, possible_answers, annotate=True
34+
request.image_raw, self._model, possible_answers, annotate=True
3535
)
3636

3737
self._debug_pub.publish(annotated_img)

common/vision/lasr_vision_feature_extraction/nodes/service

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def detect(
4848
head_frame,
4949
torso_frame,
5050
full_frame,
51-
head_mask,
52-
torso_mask,
53-
request.image_raw,
51+
image_raw=request.image_raw,
5452
cloth_predictor=cloth_predictor,
5553
)
5654
response = TorchFaceFeatureDetectionDescriptionResponse()

common/vision/lasr_vision_feature_extraction/src/lasr_vision_feature_extraction/__init__.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,6 @@ def predict_frame(
545545
head_frame,
546546
torso_frame,
547547
full_frame,
548-
head_mask,
549-
torso_mask,
550548
cloth_predictor,
551549
image_raw,
552550
clip_service: rospy.ServiceProxy = rospy.ServiceProxy(
@@ -568,10 +566,7 @@ def predict_frame(
568566
).describe()
569567

570568
# 0.5 for True, -0.5 for False
571-
rst_person = {
572-
"glasses": -0.5,
573-
"hat": -0.5,
574-
}
569+
rst_person = {"glasses": -0.5, "hat": -0.5, "hair_shape": "short hair"}
575570

576571
glasses_query = VqaRequest(
577572
possible_answers=["A person wearing glasses", "A person not wearing glasses"],
@@ -583,14 +578,24 @@ def predict_frame(
583578
image_raw=image_raw,
584579
)
585580

581+
hair_query = VqaRequest(
582+
possible_answers=["A person with short hair", "A person with long hair"],
583+
image_raw=image_raw,
584+
)
585+
586586
glasses_response = clip_service(glasses_query)
587-
hat_response = clip_service(hat_query)
588587

589588
if glasses_response.answer == "A person wearing glasses":
590589
rst_person["glasses"] = 0.5
590+
hat_response = clip_service(hat_query)
591591
if hat_response.answer == "A person wearing a hat":
592592
rst_person["hat"] = 0.5
593593

594+
hair_response = clip_service(hair_query)
595+
596+
if hair_response.answer == "A person with long hair":
597+
rst_person["hair_shape"] = "long hair"
598+
594599
result = {
595600
**rst_person,
596601
**rst_cloth,

tasks/receptionist/launch/setup.launch

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
<node pkg="lasr_vision_feature_extraction" type="service" name="torch_service" output="screen"/>
2020
<node pkg="lasr_vision_clip" name="clip_service" type="vqa" output="screen"/>
2121
<arg name="debug" default="true" />
22-
<node pkg="lasr_vision_bodypix" type="mask_service.py" name="bodypix_service" output="screen" args="--debug $(arg debug)"/>
23-
<node pkg="lasr_vision_bodypix" type="keypoint_service.py" name="bodypix__keypoint_service" output="screen" args="--debug $(arg debug)"/>
22+
<node pkg="lasr_vision_bodypix" type="bodypix_services.py" name="bodypix_service" output="screen" args="--debug $(arg debug)"/>
2423
<node pkg="lasr_vision_deepface" type="service" name="deepface_service" output="screen"/>
2524

2625
</launch>

tasks/receptionist/scripts/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
rospy.loginfo(sofa_area.area)
5656
rospy.loginfo(list(sofa_area.exterior.coords))
5757
sofa_area_publisher.publish(
58-
PolygonStamped(
59-
polygon=Polygon(
60-
points=[Point(x=x, y=y, z=0.0) for (x, y) in sofa_area.exterior.coords]
61-
),
62-
header=Header(frame_id="map"),
63-
)
58+
PolygonStamped(
59+
polygon=Polygon(
60+
points=[Point(x=x, y=y, z=0.0) for (x, y) in sofa_area.exterior.coords]
61+
),
62+
header=Header(frame_id="map"),
63+
)
6464
)
65-
#rospy.spin()
65+
# rospy.spin()
6666
# assert sofa_area.is_valid, "Sofa area is not valid"
6767

6868
sofa_point = Point(**sofa_point_param)

tasks/receptionist/src/receptionist/states/introduce.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ def stringify_guest_data(
4848
},
4949
)
5050

51+
relevant_guest_data["attributes"]["has_hair"] = 0.5
52+
5153
guest_str = f"{relevant_guest_data['name']}, their favourite drink is {relevant_guest_data['drink']}. "
5254

5355
if not relevant_guest_data["detection"] or not describe_features:
5456
return guest_str
5557

5658
filtered_attributes = {}
57-
# filtered_attributes["hair"] = {
58-
# "confidence": relevant_guest_data["attributes"]["has_hair"],
59-
# "hair_shape": relevant_guest_data["attributes"]["hair_shape"],
60-
# "hair_colour": relevant_guest_data["attributes"]["hair_colour"],
61-
# }
59+
filtered_attributes["hair"] = {
60+
"confidence": relevant_guest_data["attributes"]["has_hair"],
61+
"hair_shape": relevant_guest_data["attributes"]["hair_shape"],
62+
# "hair_colour": relevant_guest_data["attributes"]["hair_colour"],
63+
}
6264

6365
most_confident_clothes = find_most_confident_clothes(
6466
relevant_guest_data,
@@ -117,8 +119,8 @@ def stringify_guest_data(
117119

118120
if attribute_name == "hair":
119121
hair_shape = attribute_value["hair_shape"]
120-
hair_colour = attribute_value["hair_colour"]
121-
guest_str += f"They have {hair_shape} and {hair_colour}. "
122+
# hair_colour = attribute_value["hair_colour"]
123+
guest_str += f"They have {hair_shape}. "
122124
elif attribute_name == "facial_hair":
123125
if confidence < 0:
124126
guest_str += "They don't have facial hair. "

0 commit comments

Comments
 (0)