Face Recognition
Face Recognition
Identifying faces in images. Used in security and authentication. Privacy concerns.
Face Recognition
Identifying faces in images. Used in security and authentication. Privacy concerns.
Face Recognition is a technology that automatically identifies or verifies a person's face in digital images or video frames. It consists of three stages: face detection, feature extraction, and matching, and its accuracy has improved dramatically with the emergence of deep-learning-based models.
Technically, it uses CNNs (convolutional neural networks) to convert the geometric features of a face into 128- or 512-dimensional embedding vectors. Models such as FaceNet, ArcFace, and DeepFace are widely used and can recognize faces robustly despite changes in lighting, angle, and expression. Recently, technology has been developed that can recognize faces even when a mask is worn.
Face recognition is used in a variety of fields, including smartphone unlocking, access control, payment authentication, and airport security screening. It is divided into 1:1 verification and 1:N identification; the former is mainly used for identity confirmation, the latter for surveillance or searches.
However, there are serious ethical concerns, including privacy violations, accuracy bias by race/gender, and the potential for large-scale surveillance without consent. The EU AI Act generally prohibits real-time biometric identification in public spaces, and many companies have discontinued or restricted their face recognition services.
# face_recognition 라이브러리를 이용한 얼굴 인식
import face_recognition
import cv2
import numpy as np
# 알려진 얼굴 로드 및 인코딩
known_image = face_recognition.load_image_file("known_person.jpg")
known_encoding = face_recognition.face_encodings(known_image)[0]
# 알려진 얼굴 데이터베이스
known_face_encodings = [known_encoding]
known_face_names = ["홍길동"]
# 웹캠으로 실시간 얼굴 인식
video_capture = cv2.VideoCapture(0)
while True:
ret, frame = video_capture.read()
# BGR을 RGB로 변환 (face_recognition은 RGB 사용)
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# 프레임에서 얼굴 위치와 인코딩 추출
face_locations = face_recognition.face_locations(rgb_frame)
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
# 알려진 얼굴과 비교 (유클리드 거리 기반)
distances = face_recognition.face_distance(known_face_encodings, face_encoding)
best_match_idx = np.argmin(distances)
# 임계값 0.6 이하면 동일인으로 판단
if distances[best_match_idx] < 0.6:
name = known_face_names[best_match_idx]
confidence = round((1 - distances[best_match_idx]) * 100, 1)
else:
name = "Unknown"
confidence = 0
# 얼굴 박스와 이름 표시
cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2)
cv2.putText(frame, f"{name} ({confidence}%)",
(left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
cv2.imshow('Face Recognition', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video_capture.release()
cv2.destroyAllWindows()
| Item | Specification | Notes |
|---|---|---|
| Accuracy (LFW benchmark) | 99.5% or higher | SOTA models such as ArcFace and CosFace |
| Inference speed | 10-50ms/face | On GPU; varies with model size |
| Embedding dimension | 128-512 dimensions | Higher is more accurate but increases compute cost |
| Cloud API cost | $0.001-0.01/request | Based on AWS, Azure, GCP |
| Edge device requirements | 4GB RAM, NPU recommended | When deploying on smartphones and IoT devices |
"1:1 verification works, but 1:N identification loses performance as the database grows."
"Just extract the face embedding vector and compare with cosine similarity."
"We need to include masked-face cases in the training data too."
"Without anti-spoofing, it can be bypassed with a photo."
1. No liveness check: Spoofing attacks using photos or videos are possible. Be sure to apply anti-spoofing techniques such as eye blinking and head turning.
2. Lighting/angle bias: If the training data is skewed toward specific conditions, performance drops sharply in real environments. Train on data covering diverse conditions.
3. Race/gender bias: Imbalanced training data can lead to higher misrecognition rates for certain groups. A fairness audit is essential.
4. Collection without consent: Biometric information is classified as sensitive information. Collecting or processing it without explicit consent violates personal data protection law.
Embedding - Representing facial features as vectors
Object Detection - The underlying technology for face detection
Deep Learning - The core technology of face recognition models
Privacy Impact Assessment - Required when introducing a face recognition system
Fairness - Preventing race/gender bias
FaceNet paper - Google's face recognition architecture
face_recognition library - Open-source face recognition for Python
NIST FRVT - Face recognition vendor test results