{"id":26,"date":"2022-10-08T20:10:06","date_gmt":"2022-10-08T16:40:06","guid":{"rendered":"http:\/\/zahramansoori.com\/blog\/?p=26"},"modified":"2022-10-10T20:57:45","modified_gmt":"2022-10-10T17:27:45","slug":"face-recognition-on-python","status":"publish","type":"post","link":"http:\/\/zahramansoori.com\/blog\/2022\/10\/08\/face-recognition-on-python\/","title":{"rendered":"Face Recognition on Python"},"content":{"rendered":"\n<p class=\"has-text-align-left\">A few weeks ago, me &amp; my brother were talking about face recognition on scanned family photos.<br>I got curious to find out how to implement a face recognition on Python.<\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>1. Install Anaconda for Python Package Manager<br><\/strong>It has a shell for downloading packages automatically.<\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>2. Download &amp; Install CMake<br><\/strong>For compiling DLib on Visual Studio 2015<\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>3. Install Visula Studio 2015 (Version is important)<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>4. Download DLib Package and Extract<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>5. Open CMake and configure like below:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"575\" height=\"205\" src=\"http:\/\/zahramansoori.com\/blog\/wp-content\/uploads\/2022\/10\/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3232353839332f64306335663439622d363963302d646565362d333636612d3464626166643464323833312e706e67.png\" alt=\"\" class=\"wp-image-27\" srcset=\"http:\/\/zahramansoori.com\/blog\/wp-content\/uploads\/2022\/10\/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3232353839332f64306335663439622d363963302d646565362d333636612d3464626166643464323833312e706e67.png 575w, http:\/\/zahramansoori.com\/blog\/wp-content\/uploads\/2022\/10\/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3232353839332f64306335663439622d363963302d646565362d333636612d3464626166643464323833312e706e67-300x107.png 300w\" sizes=\"(max-width: 575px) 100vw, 575px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-text-align-left\"><strong>6. Download &amp; Install Face_Recognition Package<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-left\">Using Anaconda Shell<strong>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>conda install -c conda-forge face_recognition<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-left\"><strong>7. Refer to <\/strong><a href=\"https:\/\/pypi.org\/project\/face-recognition\/\">https:\/\/pypi.org\/project\/face-recognition\/<\/a><\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>Note: A basic about face recognition:<br><\/strong>First: Introduce person who you want to detect<br>Second: After Face Recohgnition Engine learnt about that face, Input Unknown (Query) Image<br>Third: Get output. Engine will let you know if it could detect the specific person or not<\/p>\n\n\n\n<p class=\"has-text-align-left\">This algorithm is about &#8220;<strong>Traning<\/strong>&#8221; (Step One) and &#8220;<strong>Test<\/strong>&#8221; (Step Two and Three)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import face_recognition\r\n\u201d\u2019Load Train &amp; Test Images\u201d\u2019\r\nknown_image = face_recognition.load_image_file (\"biden.jpg\")\r\nunknown_image = face_recognition.load_image_file (\"unknown.jpg\")\r\n\r\n\u201d\u2019Step One (Train)\u201d\u2019\r\nbiden_encoding = face_recognition.face_encodings (known_image)&#91;0]\r\n\r\n\u201d\u2019Step Two (Test)\u201d\u2019\r\nunknown_encoding = face_recognition.face_encodings (unknown_image)&#91;0]\r\n\r\n\u201d\u2019Step Three (Get Result)\u201d\u2019\r\nresults = face_recognition.compare_faces (&#91;biden_encoding], unknown_encoding<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago, me &amp; my brother were talking about face recognition on scanned family photos.I got curious to find out how to implement a face recognition on Python. 1. Install Anaconda for Python Package ManagerIt has a shell for downloading packages automatically. 2. Download &amp; Install CMakeFor compiling DLib on Visual Studio 2015 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":28,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[5,8,6,7],"class_list":["post-26","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-ai","tag-artificialintelligence","tag-facerecognition","tag-pythonprogramming"],"_links":{"self":[{"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/posts\/26"}],"collection":[{"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":12,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":53,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions\/53"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/media\/28"}],"wp:attachment":[{"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zahramansoori.com\/blog\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}