(Research) Face Recognition (1) – Project Introduction

Let's explore the Face Recognition Project! 😊

In this project, we will maximize the use of open-source resources with the following objectives:

1️⃣ Understand key libraries and source code
2️⃣ Set up the required development environment
3️⃣ Optimize performance for better accuracy and efficiency
4️⃣ Share results and discuss potential improvements

The goal is to go beyond simple implementation, actively improving the system and exploring ways to enhance its capabilities. 🚀

First, we will download a high-performance open-source project from GitHub and install it in our respective environments.

⚠️ Important Note:
Blindly running the pip install ... command may lead to unexpected errors and troubleshooting challenges right from the start.

💡 Make sure to carefully read the instructions and follow each step properly to ensure a smooth installation process. 🚀


[Requirements: A photo of your own face 😊]



Face Recognition (In Progress)

📌 Goal

A simple face recognition library that allows face detection and manipulation using Python or CLI.


📌 Services

Face Detection
Facial Feature Extraction
Face Recognition


📌 Required Libraries & Installation Guide

⚠️ Important Note: Run all installation commands as an administrator (Windows users should omit sudo).

[OpenCV]

📌 Description:

  • OpenCV does not officially support pip installation, but there are community projects on GitHub that enable it.
  • Install all required libraries to ensure proper functionality.

🔹 Download & Install (Run as Administrator)

bash
pip install filterpy pip install opencv-contrib-python pip install opencv-python

[dlib] (C++ Library)

📌 Description

Built on deep learning, designed for facial recognition applications.
Achieves 99.38% accuracy on the Labeled Faces in the Wild (LFW) dataset.
Provides a simple face recognition tool via CLI that processes images in a folder.

🔗 Download: http://dlib.net/


📌 Windows Installation – Important Note ⚠️

Using pip install dlib on Windows can cause multiple installation issues and is often problematic.

💡 Recommended approach: Instead of using pip install, download the latest ZIP file from the official website and install manually.

                                 
  • Installing dlib in an Anaconda Environment

    For users running Anaconda, access the downloaded folder through Anaconda 3 Powershell Prompt and follow the installation steps.


    📌 Installation Process (Approx. 10 minutes)

    Navigate to the downloaded dlib folder and run the following command:

    bash
    python setup.py build

    ⚠️ Important Notes

    1️⃣ Path Adjustments Required

    • Many open-source scripts include predefined file paths that may not match your local setup.
    • Manually update paths in each script to ensure they match your directory structure.

    2️⃣ Example Path Modifications
    📌 Original:

    python
    xxx_train("knn_examples/train")

    📌 Modified:

    python
    xxx_train("./examples/knn_examples/train")

    Ensuring correct file paths is essential to prevent errors and ensure proper execution. 🚀

     
  • python setup.py install

Installation Verification

To confirm that dlib has been successfully installed, run the following commands in Python:

python
>>> import dlib # If no errors occur, the installation was successful >>> dlib.__version__ # Check the installed dlib version

[face_recognition]

📌 Description

A powerful Python library for face detection and recognition.

🔹 Download & Installation

Run the following command to install:

bash
pip install face_recognition

🔹 Installation Verification

To confirm successful installation, run:

python
>>> import face_recognition # If no errors occur, the installation was successful

📌 Development Environment

OS: Windows 10
IDE: VS Code
Additional Installations: dlib, face_recognition, OpenCV
Python Version: Python 3.3+ or Python 2.7


📌 Example Code

🔗 GitHub Repository: Market_std_ref_face_recognition

Features

Find faces in pictures

Find all the faces that appear in a picture:

                                                                 


import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_locations = face_recognition.face_locations(image)

Find and manipulate facial features in pictures

Get the locations and outlines of each person's eyes, nose, mouth and chin.

import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_landmarks_list = face_recognition.face_landmarks(image)

Finding facial features is super useful for lots of important stuff. But you can also use it for really stupid stuff like applying digital make-up (think 'Meitu'):

얼굴 특징 : 눈 , 코 , 입술 


얼굴 탐지



Identify faces in pictures

Recognize who appears in each photo.



import face_recognition
known_image = face_recognition.load_image_file("biden.jpg")
unknown_image = face_recognition.load_image_file("unknown.jpg")

biden_encoding = face_recognition.face_encodings(known_image)[0]
unknown_encoding = face_recognition.face_encodings(unknown_image)[0]

results = face_recognition.compare_faces([biden_encoding], unknown_encoding)

You can even use this library with other Python libraries to do real-time face recognition:

                               

See this example for the code.



Comments

Popular posts from this blog

[MaritimeCyberTrend] Relationship and prospects between U.S. Chinese maritime operations and maritime cybersecurity

인공지능 서비스 - 챗봇, 사전에 충분한 지식을 전달하고 함께 학습 하기!

[Curriculum] Sungkyunkwan University - Department of Information Security - Course Sequence by Areas of Interest