Skip to content

Commit

Permalink
Reformatted the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Benteng Ma committed Jun 25, 2024
1 parent 2864f87 commit 4dc892d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ def predict_frame(
).describe()

result = {
**rst_person,
**rst_person,
**rst_cloth,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,22 @@ def from_parent_instance(
)

def describe(self) -> dict:
has_hair = self.attributes['hair'] - 0.5
hair_colour = _max_value_tuple(self.selective_attribute_dict['hair_colour']) - 0.5
hair_shape = _max_value_tuple(self.selective_attribute_dict['hair_shape']) - 0.5
facial_hair = 1 - self.attributes['No_Beard'] - 0.5
glasses = self.attributes['Eyeglasses'] - 0.5
hat = self.attributes['Wearing_Hat'] - 0.5
has_hair = self.attributes["hair"] - 0.5
hair_colour = (
_max_value_tuple(self.selective_attribute_dict["hair_colour"]) - 0.5
)
hair_shape = _max_value_tuple(self.selective_attribute_dict["hair_shape"]) - 0.5
facial_hair = 1 - self.attributes["No_Beard"] - 0.5
glasses = self.attributes["Eyeglasses"] - 0.5
hat = self.attributes["Wearing_Hat"] - 0.5

result = {
'has_hair': has_hair,
'hair_colour': hair_colour,
'hair_shape': hair_shape,
'facial_hair': facial_hair,
'glasses': glasses,
'hat': hat,
"has_hair": has_hair,
"hair_colour": hair_colour,
"hair_shape": hair_shape,
"facial_hair": facial_hair,
"glasses": glasses,
"hat": hat,
}

return result
Expand Down Expand Up @@ -137,9 +139,9 @@ def from_parent_instance(

def describe(self) -> dict:
result = {
'top': self.attributes['top'] / 2,
'outwear': self.attributes['outwear'] / 2,
'dress': self.attributes['dress'] / 2,
"top": self.attributes["top"] / 2,
"outwear": self.attributes["outwear"] / 2,
"dress": self.attributes["dress"] / 2,
}

for attribute in [
Expand Down
1 change: 1 addition & 0 deletions skills/src/lasr_skills/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .recognise import Recognise
from .detect_gesture import DetectGesture
from .learn_face import LearnFace

# from .look_at_person import LookAtPerson
from .wait import Wait
from .look_to_given_point import LookToGivenPoint
Expand Down
10 changes: 8 additions & 2 deletions skills/src/lasr_skills/describe_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import smach
import cv2_img
import numpy as np

if "tiago" in os.environ["ROS_MASTER_URI"]:
from lasr_skills import Say
from lasr_vision_msgs.srv import (
Expand Down Expand Up @@ -67,7 +68,12 @@ def __init__(self):

smach.StateMachine.add(
"GET_IMAGE_AGAIN",
GetCroppedImage(object_name="person", crop_method=crop_method, rgb_topic=rgb_topic, use_mask=True),
GetCroppedImage(
object_name="person",
crop_method=crop_method,
rgb_topic=rgb_topic,
use_mask=True,
),
transitions={"succeeded": "CONVERT_IMAGE", "failed": "SAY_CONTINUE"},
)

Expand All @@ -81,7 +87,7 @@ def __init__(self):
"aborted": "failed",
},
)

smach.StateMachine.add(
"CONVERT_IMAGE", ImageMsgToCv2(), transitions={"succeeded": "SEGMENT"}
)
Expand Down

0 comments on commit 4dc892d

Please sign in to comment.