|
| 1 | +# NEEDS WORK |
| 2 | +# image_recognition_openface |
| 3 | + |
| 4 | +Face recognition with use of Openpose (https://cmusatyalab.github.io/openface/) |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +See https://github.com/tue-robotics/image_recognition |
| 9 | + |
| 10 | +Make sure that openface is correctly installed. Installation instructions can be found here: https://cmusatyalab.github.io/openface/setup/. Make sure you have installed **CUDA8**. CUDA10 is not working: https://github.com/torch/torch7/issues/1180 |
| 11 | + |
| 12 | +```bash |
| 13 | +export TORCH_INSTALL_PATH=~/torch |
| 14 | +export OPENFACE_INSTALL_PATH=~/openface |
| 15 | +git clone https://github.com/torch/distro.git ~/torch --recursive && \ |
| 16 | +cd $TORCH_INSTALL_PATH && bash install-deps && ./install.sh && \ |
| 17 | +for NAME in dpnn nn optim optnet csvigo cutorch cunn fblualib torchx tds; do $TORCH_INSTALL_PATH/install/bin/luarocks install $NAME; done && \ |
| 18 | +sudo -H pip install dlib && \ |
| 19 | +git clone https://github.com/cmusatyalab/openface.git $OPENFACE_INSTALL_PATH && \ |
| 20 | +cd $OPENFACE_INSTALL_PATH && sudo -H python setup.py install && \ |
| 21 | +./models/get-models.sh |
| 22 | +``` |
| 23 | + |
| 24 | +## How-to |
| 25 | + |
| 26 | +### ROS Node |
| 27 | + |
| 28 | +Run the image_recognition_openface node in one terminal (Specify the dlib and openface_net path as ROS parameter): |
| 29 | + |
| 30 | + rosrun image_recognition_openface face_recognition_node |
| 31 | + |
| 32 | +Run the rqt annotation client (https://github.com/tue-robotics/image_recognition_rqt) |
| 33 | + |
| 34 | + rosrun image_recognition_rqt annotation_gui |
| 35 | + |
| 36 | +Setup the service by clicking the gear wheel in the top-right corner. Select the `/annotate` services exposed by the openface ros node. Also don't forget to set-up your labels. |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +Now draw a rectangle around the face you would like to learn. The face recognizer will find the biggest face in the image and store a representation for this face. |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +Now select the label and you will see that the openface ros node stores the face (console output node): |
| 45 | + |
| 46 | + [INFO] [WallTime: 1478636380.407308] Succesfully learned face of 'rokus' |
| 47 | + |
| 48 | +Learn as many faces as you want .. |
| 49 | + |
| 50 | +Next step is starting the image_recognition_Rqt test gui (https://github.com/tue-robotics/image_recognition_rqt) |
| 51 | + |
| 52 | + rosrun image_recognition_rqt test_gui |
| 53 | + |
| 54 | +Again configure the service you want to call with the gear-wheel in the top-right corner of the screen. If everything is set-up, draw a rectangle in the image and ask the service for detections: |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +You will see that the result of the detection will prompt in a dialog combo box. Also the detections will be drawn on the image. |
| 59 | + |
| 60 | +### Command line |
| 61 | + |
| 62 | +Command line interface to test the detection / recognition based on an image: |
| 63 | + |
| 64 | + usage: get_face_recognition IMAGE [-k ALIGN_PATH] [-s NET_PATH] [-v] |
| 65 | + |
| 66 | +Run the command on an example image: |
| 67 | + |
| 68 | + rosrun image_recognition_openface get_face_recognition `rospack find image_recognition_openface`/doc/example.png |
| 69 | + |
| 70 | +This will lookup this image in the image_recognition_openface/doc folder and perform recognitions |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +Output: |
| 75 | + |
| 76 | + [RecognizedFace(roi=(374, 188, 108, 123), l2_distances=[]), RecognizedFace(roi=(72, 147, 88, 105), l2_distances=[]), RecognizedFace(roi=(377, 95, 74, 86), l2_distances=[]), RecognizedFace(roi=(149, 26, 74, 86), l2_distances=[]), RecognizedFace(roi=(52, 47, 75, 86), l2_distances=[]), RecognizedFace(roi=(246, 115, 88, 102), l2_distances=[]), RecognizedFace(roi=(0, 0, 42, 60), l2_distances=[]), RecognizedFace(roi=(336, 33, 74, 86), l2_distances=[]), RecognizedFace(roi=(228, 0, 62, 60), l2_distances=[])] |
| 77 | + |
| 78 | +Since no faces were trained, the l2_distances will not be calculated of-course. |
0 commit comments