Skip to content

Commit

Permalink
feat: learn face service.
Browse files Browse the repository at this point in the history
  • Loading branch information
jws-1 committed Feb 1, 2024
1 parent 1dbfac1 commit 6dba695
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
20 changes: 18 additions & 2 deletions common/vision/lasr_vision_deepface/nodes/service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import re
import rospy
import lasr_vision_deepface as face_recognition
from sensor_msgs.msg import Image
from lasr_vision_msgs.srv import Recognise, RecogniseRequest, RecogniseResponse
from lasr_vision_msgs.srv import (
Recognise,
RecogniseRequest,
RecogniseResponse,
LearnFace,
LearnFaceRequest,
LearnFaceResponse,
)


rospy.init_node("recognise_service")

Expand All @@ -29,6 +37,14 @@ def detect(request: RecogniseRequest) -> RecogniseResponse:
return face_recognition.detect(request, debug_publisher)


def learn_face(request: LearnFaceRequest) -> LearnFaceResponse:
face_recognition.learn_face(
"/xtion/rgb/image_raw", request.dataset, request.name, request.n_images
)
return LearnFaceResponse()


rospy.Service("/recognise", Recognise, detect)
rospy.loginfo("Face Recognition service starter")
rospy.Service("/learn_face", LearnFace, learn_face)
rospy.loginfo("Face Recognition service started")
rospy.spin()
1 change: 1 addition & 0 deletions common/vision/lasr_vision_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ add_service_files(
BodyPixDetection.srv
TorchFaceFeatureDetection.srv
Recognise.srv
LearnFace.srv
)

## Generate actions in the 'action' folder
Expand Down
10 changes: 10 additions & 0 deletions common/vision/lasr_vision_msgs/srv/LearnFace.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Name to associate
string name

# Dataset to add face to
string dataset

# Number of images to take
int32 n_images

---

0 comments on commit 6dba695

Please sign in to comment.