{"id":161,"date":"2024-03-23T09:21:19","date_gmt":"2024-03-23T14:21:19","guid":{"rendered":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/?p=161"},"modified":"2024-03-23T09:21:27","modified_gmt":"2024-03-23T14:21:27","slug":"karens-status-report-for-3-23","status":"publish","type":"post","link":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/2024\/03\/23\/karens-status-report-for-3-23\/","title":{"rendered":"Karen&#8217;s Status Report for 3\/23"},"content":{"rendered":"<p><span style=\"font-weight: 400\">This week I wrapped up the <\/span><a href=\"https:\/\/github.com\/karenjennyli\/focus-tracker\/blob\/main\/video_processing\/phone_detector.py\"><span style=\"font-weight: 400\">phone pick-up detection implementation<\/span><\/a><span style=\"font-weight: 400\">. I completed another round of training of the YOLOv8 phone object detector, using over 1000 annotated images that I collected myself. This round of data contained more colors of phones and orientations of phones, making the detector more robust. I also integrated MediaPipe\u2019s hand landmarker into the phone pick-up detector. By comparing the location of the phone detected and the hand over a series of frames, we can ensure that the phone detected is actually in the user\u2019s hand. This further increases the robustness of the phone detection.<\/span><\/p>\n<p><span style=\"font-weight: 400\">After this, I began working on facial recognition more. This is to ensure that the program is actually analyzing the user\u2019s facial features and not someone else\u2019s face in the frame. It will also ensure that it is actually the user working and that they did not replace themselves with another person to complete the work session for them.<\/span><\/p>\n<p><span style=\"font-weight: 400\">I had first found a simple Python <\/span><a href=\"https:\/\/github.com\/ageitgey\/face_recognition\"><span style=\"font-weight: 400\">face recognition library<\/span><\/a><span style=\"font-weight: 400\">, which I did some initial testing of. Although it has a very simple and usable interface, I realized the performance was not sufficient as it had too many false positives. Here you can see it identifies two people as \u201cKaren\u201d when only one of them is actually Karen.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-162\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/4dNqN5ybMDoCU0f_3Q5gxuRYFVUDCiJmDWwhT7Vk9qCVsDZQimqiYi9nSQcMrUISfuy5TgLvpk69bcp4Sut_0cpoCFQhXO_jArEdf6pzAafF5Wdj0Iunz6uy_Icv-300x181.png\" alt=\"\" width=\"300\" height=\"181\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/4dNqN5ybMDoCU0f_3Q5gxuRYFVUDCiJmDWwhT7Vk9qCVsDZQimqiYi9nSQcMrUISfuy5TgLvpk69bcp4Sut_0cpoCFQhXO_jArEdf6pzAafF5Wdj0Iunz6uy_Icv-300x181.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/4dNqN5ybMDoCU0f_3Q5gxuRYFVUDCiJmDWwhT7Vk9qCVsDZQimqiYi9nSQcMrUISfuy5TgLvpk69bcp4Sut_0cpoCFQhXO_jArEdf6pzAafF5Wdj0Iunz6uy_Icv-768x463.png 768w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/4dNqN5ybMDoCU0f_3Q5gxuRYFVUDCiJmDWwhT7Vk9qCVsDZQimqiYi9nSQcMrUISfuy5TgLvpk69bcp4Sut_0cpoCFQhXO_jArEdf6pzAafF5Wdj0Iunz6uy_Icv-1024x617.png 1024w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/4dNqN5ybMDoCU0f_3Q5gxuRYFVUDCiJmDWwhT7Vk9qCVsDZQimqiYi9nSQcMrUISfuy5TgLvpk69bcp4Sut_0cpoCFQhXO_jArEdf6pzAafF5Wdj0Iunz6uy_Icv.png 1600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">I then looked into another Python face recognition library called <\/span><a href=\"https:\/\/github.com\/serengil\/deepface\/tree\/master\"><span style=\"font-weight: 400\">DeepFace<\/span><\/a><span style=\"font-weight: 400\">. This has a more complex interface, but provides much more customizability as it contains various different models that can be used for face detection and recognition. I did some extensive experimentation and research of the different model options for performance and speed, and have landed on using <\/span><a href=\"https:\/\/github.com\/szad670401\/Fast-MTCNN\"><span style=\"font-weight: 400\">Fast-MTCNN<\/span><\/a><span style=\"font-weight: 400\"> for facial detection and <\/span><a href=\"https:\/\/arxiv.org\/abs\/2206.10520\"><span style=\"font-weight: 400\">SFace<\/span><\/a><span style=\"font-weight: 400\"> for facial recognition.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Here you can see the results of my tests for speed for each model:<\/span><\/p>\n<pre>\u276f python3 evaluate_models.py\r\n24-03-21 13:19:19 - Time taken for predictions with VGG-Face: 0.7759 seconds\r\n24-03-21 13:19:20 - Time taken for predictions with Facenet: 0.5508 seconds\r\n24-03-21 13:19:22 - Time taken for predictions with Facenet512: 0.5161 seconds\r\n24-03-21 13:19:22 - Time taken for predictions with OpenFace: 0.3438 seconds\r\n24-03-21 13:19:24 - Time taken for predictions with ArcFace: 0.5124 seconds\r\n24-03-21 13:19:24 - Time taken for predictions with Dlib: 0.2902 seconds\r\n24-03-21 13:19:24 - Time taken for predictions with SFace: 0.2892 seconds\r\n24-03-21 13:19:26 - Time taken for predictions with GhostFaceNet: 0.4941 seconds<\/pre>\n<p><span style=\"font-weight: 400\">Here are some screenshots of tests I ran for performance and speed on different face detectors.<\/span><\/p>\n<p><span style=\"font-weight: 400\">OpenCV face detector (poor performance):<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-163\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.03403496742248535-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.03403496742248535-300x225.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.03403496742248535.png 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Fast-MTCNN face detector (better performance):<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-164\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.13716673851013184-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.13716673851013184-300x225.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-content\/uploads\/sites\/302\/2024\/03\/Time-0.13716673851013184.png 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Here is an outline of the overall implementation I would like to follow:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Use MediaPipe\u2019s facial landmarking to rough crop out the face<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">During calibration<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Do a rough crop out of face using MediaPipe<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Extract face using face detector<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Get template embedding<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">During work session<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Do a rough crop out of face 0 using MediaPipe<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Extract face using face detector<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Get embedding and compare with template embedding<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If below threshold, face 0 is a match<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If face 0 is a match, everything is good so continue<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If face 0 isn\u2019t a match, do same process with face 1 to see if there is match<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If face 0 and face 1 aren\u2019t matches, fallback to using face 0<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">During work session<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If there haven\u2019t been any face matches in x minute, then user is no longer there<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Although I hoped to have a full implementation of facial recognition completed, I spent more time this week just exploring and testing the different facial recognition options available to find the best option for our application, and outlining an implementation that would work with this option. Overall, my progress is still on schedule taking into account the slack time added.<\/span><\/p>\n<div id=\"accel-snackbar\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This week I wrapped up the phone pick-up detection implementation. I completed another round of training of the YOLOv8 phone object detector, using over 1000 annotated images that I collected myself. This round of data contained more colors of phones and orientations of phones, making the detector more robust. I also integrated MediaPipe\u2019s hand landmarker &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/2024\/03\/23\/karens-status-report-for-3-23\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Karen&#8217;s Status Report for 3\/23&#8221;<\/span><\/a><\/p>\n","protected":false},"author":842,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[3],"_links":{"self":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/posts\/161"}],"collection":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/users\/842"}],"replies":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":1,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":165,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/posts\/161\/revisions\/165"}],"wp:attachment":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teame0\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}