본문 바로가기
Study (Data Science)/Paper Research

Triplet Loss (FaceNet / 2015.03)

by 콜라찡 2023. 3. 15.

Triplet Loss

https://arxiv.org/pdf/1503.03832.pdf

Paper

Points

  • Unified system으로 using embeddings generated by the same network architecture에서 can perform multiple tasks할 수 있게 되었음. 일타삼피 (세가지 기능). 상호작용을 단순화할 수 있고 효율적임.
  • 학습에 triplet loss를 사용하여 fast convergence 수렴 가능하도록 함.
  • 기존에는 Inception architecture를 사용하여 어쩔 수 없는 병목 구조가 있었는데, 이 구조는 병목이 없음.

"Inception"은 Google에서 개발한 딥러닝 모델 아키텍처로, 2014년 ImageNet Large Scale Visual Recognition Challenge(ILSVRC)에서 우승한 모델입니다.

Inception 모델은 다양한 커널 크기와 풀링 연산을 동시에 사용하는 "inception module"이라는 구조를 사용하여, 이미지 분류, 객체 검출 등 다양한 컴퓨터 비전 태스크에서 좋은 성능을 보입니다. 이를 통해 모델의 파라미터 수를 크게 줄이고, 연산 속도를 높이면서도 정확도를 유지할 수 있습니다.

또한, Inception 모델은 다양한 크기의 입력 이미지를 처리할 수 있는 "fully convolutional network" 구조를 도입하여, 이미지 분류 외에도 객체 검출, 분할 등 다양한 컴퓨터 비전 태스크에 적용할 수 있습니다.

 

Abstract & Introduction

  • Unified system L2 distance, 즉 유클리드 거리로 매핑하여서, verification (동일인물인지), recognition (누구인지), clustering (비슷한 얼굴들)을 더욱 직관적으로 분리할 수 있게됨.
    • Verification : 그냥 거리에 threshold 값을 넣어서 구분. 여기서는 1.1을 기준으로, 그 이하면 동일인물로 가려냄.
    • Recognition : k-NN (k-Nearest Neighbors) 분류로 쉽게 처리됨. 논문은 데이터가 많아서 kNN보다 LMNN을 사용.
    • Clustering : k-means clustering, Agglomerative clustering로 해결

The abstract describes a system called FaceNet that can efficiently implement face recognition and verification at scale. It directly learns a mapping from face images to a compact Euclidean space where distances correspond to the measure of similarity between faces.

Once this embedding has been produced, then the afore-mentioned tasks become straight-forward: face verifica-tion simply involves thresholding the distance between thetwo embeddings; recognition becomes a k-NN classification problem; and clustering can be achieved using off-the-shelf techniques such as k-means or agglomerative cluster-ing

 

k-NN (k-Nearest Neighbors) 분류는 지도학습(supervised learning)의 일종으로, 새로운 데이터 포인트를 분류할 때 가장 가까운 k개의 훈련 데이터 포인트(이웃)를 찾아서, 이웃들의 레이블(label) 중 가장 많은 것으로 새로운 데이터 포인트의 레이블을 예측하는 알고리즘입니다.

예를 들어, 붓꽃 데이터셋에서 붓꽃의 꽃받침 길이와 너비를 특징(feature)으로 사용하여 붓꽃의 품종을 예측하는 문제를 생각해보면, 새로운 붓꽃 데이터가 주어졌을 때, k-NN 알고리즘을 사용하여 이 데이터의 근접 이웃 k개를 찾은 후, 이웃들의 품종 중 가장 많은 것을 선택하여 새로운 데이터의 품종을 예측할 수 있습니다.

 

kNN(k-Nearest Neighbors)과 LMNN(Large Margin Nearest Neighbor)은 모두 지도학습(supervised learning)의 일종으로, 분류(classification) 문제를 해결하는 알고리즘입니다.

kNN은 주어진 샘플 데이터의 k개의 가까운 이웃들의 클래스를 기반으로 해당 샘플 데이터를 분류하는 알고리즘입니다. kNN은 간단하고 직관적인 방법으로, 새로운 데이터가 주어졌을 때 매우 빠르게 분류 결과를 도출할 수 있습니다. 그러나, kNN은 데이터가 매우 많아지거나 차원이 높아지면 연산량이 급격히 증가하고, 이웃의 선택 방법에 따라 분류 결과가 크게 달라질 수 있다는 단점이 있습니다.

반면에, LMNN은 kNN과 유사하지만, 이웃 데이터들 간의 거리를 최대한 늘리는 방향으로 학습하는 알고리즘입니다. 이를 통해 분류 결과의 일관성과 정확도를 높이는 데 목적이 있습니다. LMNN은 kNN보다 높은 성능을 보이지만, 연산량이 많은 단점이 있습니다.

따라서, kNN은 간단하고 빠르지만, 데이터가 많거나 차원이 높아질 경우에 한계가 있습니다. LMNN은 kNN보다 성능이 높지만, 연산량이 많아서 학습 시간이 오래 걸릴 수 있습니다. 따라서, 문제에 따라 적합한 알고리즘을 선택하여 사용해야 합니다.

 

k-means clustering은 주어진 데이터셋을 k개의 클러스터로 나누는 알고리즘으로, 클러스터링을 위해 초기 중심점(centroid)을 무작위로 선택한 후, 각 데이터 포인트를 가장 가까운 중심점이 속한 클러스터에 할당합니다. 이후, 각 클러스터에 속한 데이터 포인트들의 평균값을 새로운 중심점으로 업데이트하고, 이 과정을 반복하면서 클러스터링을 수행합니다. 이 알고리즘은 간단하면서도 높은 성능을 보이지만, 초기 중심점을 잘못 선택하면 수렴이 불안정해질 수 있습니다.

 

Agglomerative clustering은 병합 군집화 알고리즘으로, 각 데이터 포인트를 개별적인 클러스터로 시작하여 가장 가까운 클러스터끼리 순차적으로 병합하면서 전체 데이터셋을 클러스터링하는 알고리즘입니다. 이 알고리즘은 계층적 클러스터링(hierarchical clustering)을 수행하며, 각 단계에서 가장 가까운 클러스터를 병합하여 계층적인 클러스터링을 생성합니다. 이 알고리즘은 데이터셋이 작을 때는 좋은 성능을 보이지만, 대규모 데이터셋에서는 계산 비용이 매우 높아지는 단점이 있습니다.

Dataset

 

https://arxiv.org/pdf/1503.03832.pdf

Model

https://typeset.io/pdf/facenet-a-unified-embedding-for-face-recognition-and-135p2gog88.pdf
https://typeset.io/pdf/facenet-a-unified-embedding-for-face-recognition-and-135p2gog88.pdf

Activation Function

 

Loss Function

 

Result of experiment

https://typeset.io/pdf/facenet-a-unified-embedding-for-face-recognition-and-135p2gog88.pdf

On the widely used Labeled Faces in the Wild (LFW)dataset, our system achieves a new record accuracy of99.63%. On YouTube Faces DB it achieves 95.12%. Oursystem cuts the error rate in comparison to the best pub-lished result [15] by 30% on both datasets.

 

 

Relationship w/ Keyword

This paper is related to triplet loss because it proposes a novel training procedure for learning face embeddings using the triplet loss function. The goal of this approach is to learn an embedding space where distances between faces correspond directly with their similarity, such that similar faces are closer together and dissimilar ones further apart. Triplet selection plays a crucial role in ensuring fast convergence during training by selecting triplets that violate the constraint defined by the Euclidean distance metric used in computing losses. This method has shown promising results on benchmark datasets like LFW (Labeled Faces in Wild) and can be easily adapted for other tasks beyond face recognition or verification as well.

Limitation

 

728x90

댓글