Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Online learning dev #5

Open
wants to merge 13 commits into
base: indigo_dev
Choose a base branch
from

Conversation

cagbal
Copy link

@cagbal cagbal commented Jul 28, 2017

Hi,
I added some new functionalities to the repo all of them written in Python such as:

  1. Deep learning + clustering based online learning function. By using this method, the system can automatically learn new faces and save them in its database. Please refer to flowchart for the working mechanism. It says -1 to unknown persons, and assigns a new positive integer to known people. If it does not assign a new label to a new person, please consider changing the parameters inside the online_recognition_params.yaml file.
  2. Added Dlib's face detection package which is HOG(Histogram of Oriented Gradients). Thanks to dlib, now we can extract the facial key points, they are not published, but the program uses them internally.
  3. recognition_method parameter is given to program as argument, so if it is set to 4, program automatically switches to new learning system by killing face_recognizer and face_capture_nodes.
  4. @ipa-rmb said that the new system should be compatible with the old client. So, the client's update_label and delete_label features can be used for this new system.
  5. Added toggle online learning service. Initially, online learning is always off. You can turn it on by calling the service.
  6. Unfortunately, some new dependencies must be installed. So, I wrote an install.sh script. Please refer to it to install them.

Flowchart:
flowchart_of_online_learning

After the installations, please set the correct paths of openface and model directories inside the face_detector_params.yaml and online_face_recognizer_params.yaml. If you suggest a automatized way to do this, I would really appreciate that.

TODO

  • Keep track of the labels. @ipa-rmb, I could not add it yet. It will take some time.
  • After the pull request is accepted(integration is completed), the documentation needs to be updated as well.

This is my first pull-request for this repo. So, I appreciate your valuable comments. Thanks.
ipa-cgo (cagatay odabasi)

Copy link
Owner

@ipa-rmb ipa-rmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update your code according to the comments, then I will check it again. And please use the nice drawing for documenting your code on ros wiki.

@@ -21,7 +21,7 @@ faces_min_search_scale_y: 30
# when this flag is activated, the 3d size of a face is determined and only reasonable sizes may continue in the processing pipeline
# moreover, if activated, the background behind the head is cleared in the color image resulting in more robust recognition performance
# bool
reason_about_3dface_size: true
reason_about_3dface_size: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you turn this off on purpose? Why? If not, turn it on again.


# openface folder
# string
openface_directory: "/home/cag/openface/openface/"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use "~/openface/openface" . If you only read from there and never write, you can drop this parameter and use rospack to find the path because you need to wrap openface in a ROS package anyways (see comment at your install script).

for Care-O-bot default is cam3d_nodelet_manager -->
<arg name="start_manager" default="false"/> <!-- if you do not like to use the nodelet manager provided by the openni driver, specify your own by setting this parameter to true and providing the name of your manager with argument nodelet_manager-->
<arg name="display_results_with_image_view" default="true"/> <!-- set to false if you do not like to display the camera image with names attached to detected faces within an image_view window -->
<arg name="recognition_method" default="1"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some comment here what the different options are and what they mean, e.g. <!-- specifies recognition algorithm: 0 = Fisherfaces, 1 = Eigenfaces, 2 = LDA2D, 3 = PCA2D, 4 = Deep learning based online recognition (attention: choices 0 and 1 work with a single person in the training data, options 2 and 3 will cause a crash of the program if you do not train at least 2 different people) -->

Make 2 as default option as it was initially. 1=Eigenfaces performs badly.

<?xml version="1.0"?>

<launch>
<arg name="camera_namespace" default=""/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a default value like "camera"

<launch>
<arg name="camera_namespace" default=""/>
<arg name="in_topic_name" value="/face_detector/face_positions"/>
<arg name="recognition_method" />
Copy link
Owner

@ipa-rmb ipa-rmb Jul 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please repeat the comment about the different options here and set a default value, e.g. 2.
<!-- specifies recognition algorithm: 0 = Fisherfaces, 1 = Eigenfaces, 2 = LDA2D, 3 = PCA2D, 4 = Deep learning based online recognition (attention: choices 0 and 1 work with a single person in the training data, options 2 and 3 will cause a crash of the program if you do not train at least 2 different people) -->

<?xml version="1.0"?>

<launch>
<arg name="camera_namespace" default=""/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Remove it if not, it does not make sense to me.

<node name="face_detector_hog" pkg="cob_people_detection" type="face_detector_hog_node.py" output="screen">
<rosparam command="load" file="$(find cob_people_detection)/ros/launch/face_detector_params.yaml"/>
<param name="data_directory" type="string" value="$(find cob_people_detection)/common/files/"/>
<remap from="~head_positions" to="$(arg camera_namespace)$(arg in_topic_name)"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure to use $(arg camera_namespace) in front of the topic?

@@ -1,10 +1,12 @@
<?xml version="1.0"?>

<launch>
<arg name="recognition_method" />
Copy link
Owner

@ipa-rmb ipa-rmb Jul 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some explanatory comment here, e.g.
<!-- #specifies face recognition algorithm: 0 = Fisherfaces, 1 = Eigenfaces, 2 = LDA2D, 3 = PCA2D, 4 = Deep learning based online recognition (attention: choices 0 and 1 work with a single person in the training data, options 2 and 3 will cause a crash of the program if you do not train at least 2 different people)-->

Also set a default value, e.g. 2.

<!-- learn and recognizes faces online and publish their positions -->
<node name="online_face_recognizer" pkg="cob_people_detection" type="online_face_recognition_node.py" output="screen">
<rosparam command="load" file="$(find cob_people_detection)/ros/launch/online_face_recognizer_params.yaml"/>
<remap from="~face_detector/face_positions" to="$(arg camera_namespace)$(arg in_topic_name)"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like your pull request does not affect the camera_namespace argument. Just remove it or make a systematic proposal in all files. But for that start a new pull request.

<?xml version="1.0"?>

<launch>
<arg name="camera_namespace" default=""/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Owner

@ipa-rmb ipa-rmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, only a few simple requests.


<!-- remaining launch files -->
<param name="data_storage_directory" type="string" value="$(env HOME)/.ros/cob_people_detection/files/"/>
<param name="face_detector_method" type="int" value="$(arg face_detector_method)"/> <!-- 0 -> hog: Histogram of Oriented Gradients,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to create this parameter here? Is it used from some program later on?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thanks! I missed it which is not useful anymore.


<!--Face detector-->
<group if="$(arg launch_face_detector)">
<include if="$(arg face_detector_method)" file="$(find cob_people_detection)/ros/launch/face_detector_hog.launch"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? I am always confused with if/unless so is 0=HOG and 1=Viola Jones as commented above?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you are right. I missed it really bad 👎 Sorry for that. I will reverse the order of if/unless.

@@ -1,17 +1,21 @@
<?xml version="1.0"?>

<launch>

<arg name="display_results_with_image_view" default="true"/> <!-- set to false if you do not like to display the camera image with names attached to detected faces within an image_view window -->
<arg name="face_positions_topic_name_in" value="/face_detector/face_positions"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? Does it work with "/" at the beginning? Before it was without.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working with both options, but I returned to its original.

</group>

<!-- remaining launch files -->
<param name="data_storage_directory" type="string" value="$(env HOME)/.ros/cob_people_detection/files/"/>
<group>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of above's group <group if="$(arg launch_face_recognizer)">

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@cagbal
Copy link
Author

cagbal commented Aug 7, 2017

I pushed some commits according to your comments, Also opened a PR in cob_extern repo.

@ipa-rmb
Copy link
Owner

ipa-rmb commented Aug 8, 2017

Looks good. I am going to test the software now.

By the way, did you try whether all dependencies can be installed? Like this:

rosdep install --from-paths src/ -y -i

I am receiving the following error:

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
cob_people_detection: Cannot locate rosdep definition for [libopenface]

@cagbal
Copy link
Author

cagbal commented Aug 8, 2017 via email

@ipa-rmb
Copy link
Owner

ipa-rmb commented Aug 8, 2017

Sorry, this is connected to the missing pull request to cob_extern. Please finish that one first, then we can proceed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants