Skip to content

Commit

Permalink
Cleaned some commented code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benteng Ma committed Mar 11, 2024
1 parent 7d1d84b commit 8db1cb3
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions skills/src/lasr_skills/describe_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,70 +218,13 @@ def execute(self, userdata):
head_mask_data, head_mask_shape, head_mask_dtype = numpy2message(head_mask)

full_frame = cv2_img.cv2_img_to_msg(img)
# features.extend(self.torch_face_features(
# full_frame,
# head_mask_data, head_mask_shape, head_mask_dtype,
# torso_mask_data, torso_mask_shape, torso_mask_dtype,
# ).detected_features)

rst = self.torch_face_features(
full_frame,
head_mask_data, head_mask_shape, head_mask_dtype,
torso_mask_data, torso_mask_shape, torso_mask_dtype,
).description

# # process part masks
# for (bodypix_mask, part) in zip(userdata.bodypix_masks, ['torso', 'head']):
# part_mask = np.array(bodypix_mask.mask).reshape(
# bodypix_mask.shape[0], bodypix_mask.shape[1])

# # filter out part for current person segmentation
# try:
# part_mask[mask_bin == 0] = 0
# except Exception:
# rospy.logdebug('|> Failed to check {part} is visible')
# continue

# if part_mask.any():
# rospy.logdebug(f'|> Person has {part} visible')
# else:
# rospy.logdebug(
# f'|> Person does not have {part} visible')
# continue

# # do colour processing on the torso
# if part == 'torso':
# try:
# features.append(FeatureWithColour("torso", [
# ColourPrediction(colour, distance)
# for colour, distance
# in closest_colours(np.median(img[part_mask == 1], axis=0), RGB_COLOURS)
# ]))
# except Exception as e:
# rospy.logerr(f"Failed to process colour: {e}")

# # do feature extraction on the head
# if part == 'head':
# try:
# # crop out face
# face_mask = np.array(userdata.bodypix_masks[1].mask).reshape(
# userdata.bodypix_masks[1].shape[0], userdata.bodypix_masks[1].shape[1])

# mask_image_only_face = mask_image.copy()
# mask_image_only_face[face_mask == 0] = 0

# face_region = cv2_img.extract_mask_region(
# img, mask_image_only_face)
# if face_region is None:
# raise Exception(
# "Failed to extract mask region")

# msg = cv2_img.cv2_img_to_msg(face_region)
# features.extend(self.torch_face_features(
# msg, False).detected_features)
# except Exception as e:
# rospy.logerr(f"Failed to process extraction: {e}")

people.append({
'detection': person,
'features': rst
Expand Down

0 comments on commit 8db1cb3

Please sign in to comment.