Home

Awesome

Learning to Cluster Faces

This repo provides an official implementation for [1, 2] and a re-implementation of [3].

Paper

  1. Learning to Cluster Faces on an Affinity Graph, CVPR 2019 (Oral) [Project Page]
  2. Learning to Cluster Faces via Confidence and Connectivity Estimation, CVPR 2020 [Project Page]
  3. Linkage-based Face Clustering via Graph Convolution Network, CVPR 2019

Requirements

Setup and get data

Install dependencies

conda install faiss-gpu -c pytorch
pip install -r requirements.txt

Datasets

Please refer to DATASET.md for data preparation.

Model zoo

Pretrained models are available in the model zoo.

Run

  1. Fetch code & Create soft link
git clone git@github.com:yl-1993/learn-to-cluster.git
cd learn-to-cluster
ln -s xxx/data data
  1. Run algorithms

Follow the instructions in dsgcn, vegcn and lgcn to run algorithms.

Results on part1_test (584K)

MethodPrecisionRecallF-score
Chinese Whispers (k=80, th=0.6, iters=20)55.4952.4653.93
Approx Rank Order (k=80, th=0)99.777.213.42
MiniBatchKmeans (ncluster=5000, bs=100)45.4880.9858.25
KNN DBSCAN (k=80, th=0.7, eps=0.25, min=1)95.2552.7967.93
FastHAC (dist=0.72, single)92.0757.2870.63
DaskSpectral (ncluster=8573, affinity='rbf')78.7566.5972.16
CDP (single model, th=0.7)80.1970.4775.02
L-GCN (k_at_hop=[200, 10], active_conn=10, step=0.6, maxsz=300)74.3883.5178.68
GCN-D (2 prpsls)95.4167.7779.25
GCN-D (5 prpsls)94.6272.5982.15
GCN-D (8 prpsls)94.2379.6986.35
GCN-D (20 prplss)94.5481.6287.61
GCN-D + GCN-S (2 prpsls)99.0767.2280.1
GCN-D + GCN-S (5 prpsls)98.8472.0183.31
GCN-D + GCN-S (8 prpsls)97.9378.9887.44
GCN-D + GCN-S (20 prpsls)97.9180.8688.57
GCN-V92.4582.4287.14
GCN-V + GCN-E92.5683.7487.93

Note that the prpsls in above table indicate the number of parameters for generating proposals, rather than the actual number of proposals. For example, 2 prpsls generates 34578 proposals and 20 prpsls generates 283552 proposals.

Benchmarks (5.21M)

1, 3, 5, 7, 9 denotes different scales of clustering. Details can be found in Face Clustering Benchmarks.

Pairwise F-score13579
CDP (single model, th=0.7)75.0270.7569.5168.6268.06
LGCN78.6875.8374.2973.772.99
GCN-D (2 prpsls)79.2575.7273.9072.6271.63
GCN-D (5 prpsls)82.1577.7175.573.9972.89
GCN-D (8 prpsls)86.3582.4180.3278.9877.87
GCN-D (20 prpsls)87.6183.7681.6280.3379.21
GCN-V87.1483.4981.5179.9778.77
GCN-V + GCN-E87.9384.0482.180.4579.3
BCubed F-score13579
CDP (single model, th=0.7)78.775.8274.5873.6272.92
LGCN84.3781.6180.1179.3378.6
GCN-D (2 prpsls)78.8976.0574.6573.5772.77
GCN-D (5 prpsls)82.5678.3376.3975.0274.04
GCN-D (8 prpsls)86.7383.0181.179.8478.86
GCN-D (20 prpsls)87.7683.998280.7279.71
GCN-V85.8182.6381.0579.9279.08
GCN-V + GCN-E86.0982.8481.2480.0979.25
NMI13579
CDP (single model, th=0.7)94.6994.6294.6394.6294.61
LGCN96.1295.7895.6395.5795.49
GCN-D (2 prpsls)94.6894.6694.6394.5994.55
GCN-D (5 prpsls)95.6495.1995.0394.9194.83
GCN-D (8 prpsls)96.7596.2996.0895.9595.85
GCN-D (20 prpsls)97.0496.5596.3396.1896.07
GCN-V96.3796.0195.8395.6995.6
GCN-V + GCN-E96.4196.0395.8595.7195.62

Results on YouTube-Faces

MethodPairwise F-scoreBCubed F-scoreNMI
Chinese Whispers (k=160, th=0.75, iters=20)72.970.5593.25
Approx Rank Order (k=200, th=0)76.4575.4594.34
Kmeans (ncluster=1436)67.8675.7793.99
KNN DBSCAN (k=160, th=0., eps=0.3, min=1)91.3589.3497.52
FastHAC (dist=0.72, single)93.0787.9897.19
GCN-D (4 prpsls)94.4491.3397.97

Results on DeepFashion

MethodPairwise F-scoreBCubed F-scoreNMI
Chinese Whispers (k=5, th=0.7, iters=20)31.2253.2589.8
Approx Rank Order (k=10, th=0)25.0452.7788.71
Kmeans (ncluster=3991)32.0253.388.91
KNN DBSCAN (k=4, th=0., eps=0.1, min=2)25.0753.2390.75
FastHAC (dist=0.4, single)22.5448.7790.44
Meanshift (bandwidth=0.5)31.6156.7389.29
Spectral (ncluster=3991, affinity='rbf')29.647.1286.95
DaskSpectral (ncluster=3991, affinity='rbf')24.2544.1186.21
CDP (single model, k=2, th=0.5, maxsz=200)28.2857.8390.93
L-GCN (k_at_hop=[5, 5], active_conn=5, step=0.5, maxsz=50)30.760.1390.67
GCN-D (2 prpsls)29.1459.0989.48
GCN-D (8 prpsls)32.5257.5289.54
GCN-D (20 prpsls)33.2556.8389.36
GCN-V33.5959.4190.88
GCN-V + GCN-E38.4760.0690.5

Face Recognition

For training face recognition and feature extraction, you may use any frameworks below, including but not limited to:

https://github.com/yl-1993/hfsoftmax

https://github.com/XiaohangZhan/face_recognition_framework

Citation

Please cite the following paper if you use this repository in your reseach.

@inproceedings{yang2019learning,
  title={Learning to Cluster Faces on an Affinity Graph},
  author={Yang, Lei and Zhan, Xiaohang and Chen, Dapeng and Yan, Junjie and Loy, Chen Change and Lin, Dahua},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2019}
}
@inproceedings{yang2020learning,
  title={Learning to Cluster Faces via Confidence and Connectivity Estimation},
  author={Yang, Lei and Chen, Dapeng and Zhan, Xiaohang and Zhao, Rui and Loy, Chen Change and Lin, Dahua},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  year={2020}
}