Skip to content

andrewsilva9/rail_face_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning:

This repo is not going to be supported in the future. I have the official / supported package to: https://github.com/GT-RAIL/rail_face_detector. GT-RAIL's package will be supported and maintained, so please clone / use that one.

rail_face_detector

Face detection node using caffe and python

Two Minute Intro

This detector uses Caffe to perform face detection. It publishes faces found in images from a subscribed image topic. The face detector itself can be found here: https://github.com/kpzhang93/MTCNN_face_detection_alignment.

The message type coming back from the face detector is a Detections.msg which contains an array of Face.msg objects. Each Face.msg has:

int16 top_left_x        # X pixel value of top-left corner of bounding box
int16 top_left_y        # Y pixel value of top-left corner of bounding box
int16 bot_right_x       # X pixel value of bottom-right corner of bounding box
int16 bot_right_y       # Y pixel value of bottom-right corner of bounding box
int16 nose_x            # X coordinate of the nose
int16 nose_y            # Y coordinate of the nose
int16 left_eye_x        # X coordinate of the left eye
int16 left_eye_y        # Y coordinate of the left eye
int16 right_eye_x       # X coordinate of the right eye
int16 right_eye_y       # Y coordinate of the right eye
int16 left_mouth_x      # X coordinate of the left corner of the mouth
int16 left_mouth_y      # Y coordinate of the left corner of the mouth
int16 right_mouth_x     # X coordinate of the right corner of the mouth
int16 right_mouth_y     # Y coordinate of the right corner of the mouth

Menu

Installation

  1. Install Caffe and PyCaffe (following instructions at http://caffe.berkeleyvision.org/installation.html)
  2. Add this package to your ROS workspace
  3. Run catkin_make and enjoy the ability to use face detection!

If caffe is not in your PYTHONPATH, you will need to explicitly point the node to your /caffe/python directory. To do this:

  1. Open scripts/face_detector.py in this package
  2. Near the top (lines 6-10) set a variable named caffe_root to the absolute path of your /caffe/python directory. There are commented examples for Ubuntu and Mac already there.
  3. Uncomment the sys.path.append(caffe_root) line (line 11)

The node should now run properly.

Testing your Installation

  • Set up an image topic that this node can subscribe to
  • Launch the face_detector_node node with the debug flag and your chosen image topic name (for example, with a Kinect):
roslaunch rail_face_detector detector.launch image_sub_topic_name:=/kinect/qhd/image_color_rect debug:=true

You can also just test the network by running the webcam_runner.py script in the home directory of this package. This uses OpenCV to pull images from your webcam, highlight faces and keypoints, and show the images in real time.

ROS Nodes

face_detector_node

Wrapper for object detection through ROS services. Relevant services and parameters are as follows:

  • Topics
    • detector_node/faces (rail_face_detector/faces)        Topic with face detections performed in the background by running on images as they come in the subscriber.
    • detector_node/debug/face_images ([rail_face_detector/debug/face_images])        Topic with face detections visualized on incoming images as they come in from the subscriber. Only published if debug=true.
  • Parameters
    • image_sub_topic_name (string, default: "/kinect/qhd/image_color_rect")        Image topic name to use for detections.
    • debug (bool, default: false)        Enable or disable debug mode, which publishes incoming images with bounding boxes over faces
    • use_gpu (bool, default: true)        Enable or disable gpu mode. Enabled by default. Significantly speeds up detection.
    • use_compressed_image (bool, default: false)        Change to compressed image stream or not. Simply appends a "/compressed" to the image topic name. This lightens the load your local network if the images are being transmitted to the detector.

Startup

Simply run the launch file to bring up all of the package's functionality (default: use Scene Queries only):

roslaunch rail_face_detector detector.launch

Releases

No releases published

Packages

No packages published