{"id":13535535,"url":"https://github.com/yl-1993/learn-to-cluster","last_synced_at":"2025-10-14T15:25:12.031Z","repository":{"id":37768305,"uuid":"179097519","full_name":"yl-1993/learn-to-cluster","owner":"yl-1993","description":"Learning to Cluster Faces (CVPR 2019, CVPR 2020)","archived":false,"fork":false,"pushed_at":"2021-12-27T12:53:50.000Z","size":239,"stargazers_count":713,"open_issues_count":13,"forks_count":143,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-02T01:34:44.737Z","etag":null,"topics":["cvpr2019","cvpr2020","face-clustering","face-recognition","gcn","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yl-1993.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-02T14:37:56.000Z","updated_at":"2025-03-18T08:38:09.000Z","dependencies_parsed_at":"2022-07-12T16:52:04.680Z","dependency_job_id":null,"html_url":"https://github.com/yl-1993/learn-to-cluster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yl-1993/learn-to-cluster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yl-1993%2Flearn-to-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yl-1993%2Flearn-to-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yl-1993%2Flearn-to-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yl-1993%2Flearn-to-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yl-1993","download_url":"https://codeload.github.com/yl-1993/learn-to-cluster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yl-1993%2Flearn-to-cluster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019316,"owners_count":26086711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cvpr2019","cvpr2020","face-clustering","face-recognition","gcn","pytorch"],"created_at":"2024-08-01T08:00:57.953Z","updated_at":"2025-10-14T15:25:11.988Z","avatar_url":"https://github.com/yl-1993.png","language":"Python","funding_links":[],"categories":["Face Clustering:"],"sub_categories":[],"readme":"# Learning to Cluster Faces\n\nThis repo provides an official implementation for [1, 2] and a re-implementation of [3].\n\n## Paper\n1. [Learning to Cluster Faces on an Affinity Graph](https://arxiv.org/abs/1904.02749), CVPR 2019 (**Oral**) [[Project Page](http://yanglei.me/project/ltc)]\n2. [Learning to Cluster Faces via Confidence and Connectivity Estimation](https://arxiv.org/abs/2004.00445), CVPR 2020 [[Project Page](http://yanglei.me/project/ltc_v2)]\n3. [Linkage-based Face Clustering via Graph Convolution Network](https://arxiv.org/abs/1903.11306), CVPR 2019\n\n\n## Requirements\n* Python \u003e= 3.6\n* PyTorch \u003e= 0.4.0\n* [faiss](https://github.com/facebookresearch/faiss)\n* [mmcv](https://github.com/open-mmlab/mmcv)\n\n\n## Setup and get data\n\nInstall dependencies\n```bash\nconda install faiss-gpu -c pytorch\npip install -r requirements.txt\n```\n\n## Datasets\nPlease refer to [DATASET.md](https://github.com/yl-1993/learn-to-cluster/blob/master/DATASET.md) for data preparation.\n\n\n## Model zoo\nPretrained models are available in the [model zoo](https://github.com/yl-1993/learn-to-cluster/blob/master/MODEL_ZOO.md).\n\n\n## Run\n\n0. Fetch code \u0026 Create soft link\n\n```bash\ngit clone git@github.com:yl-1993/learn-to-cluster.git\ncd learn-to-cluster\nln -s xxx/data data\n```\n\n1. Run algorithms\n\nFollow the instructions in [dsgcn](dsgcn/), [vegcn](vegcn/) and [lgcn](lgcn/) to run algorithms.\n\n\n## Results on part1_test (584K)\n\n| Method | Precision | Recall | F-score |\n| ------ |:---------:|:------:|:-------:|\n| Chinese Whispers (k=80, th=0.6, iters=20) | 55.49 | 52.46 | 53.93 |\n| Approx Rank Order (k=80, th=0) | 99.77 | 7.2 | 13.42 |\n| MiniBatchKmeans (ncluster=5000, bs=100) | 45.48 | 80.98 | 58.25 |\n| KNN DBSCAN (k=80, th=0.7, eps=0.25, min=1) | 95.25 | 52.79 | 67.93 |\n| FastHAC (dist=0.72, single) | 92.07 | 57.28 | 70.63 |\n| [DaskSpectral](https://ml.dask.org/clustering.html#spectral-clustering) (ncluster=8573, affinity='rbf') | 78.75 | 66.59 | 72.16 |\n| [CDP](https://github.com/XiaohangZhan/cdp) (single model, th=0.7)  | 80.19 | 70.47 | 75.02 |\n| [L-GCN](https://github.com/yl-1993/learn-to-cluster/tree/master/lgcn) (k_at_hop=[200, 10], active_conn=10, step=0.6, maxsz=300)  | 74.38 | 83.51 | 78.68 |\n| GCN-D (2 prpsls) | 95.41 | 67.77 | 79.25 |\n| GCN-D (5 prpsls) | 94.62 | 72.59 | 82.15 |\n| GCN-D (8 prpsls) | 94.23 | 79.69 | 86.35 |\n| GCN-D (20 prplss) | 94.54 | 81.62 | 87.61 |\n| GCN-D + GCN-S (2 prpsls) | 99.07 | 67.22 | 80.1 |\n| GCN-D + GCN-S (5 prpsls) | 98.84 | 72.01 | 83.31 |\n| GCN-D + GCN-S (8 prpsls) | 97.93 | 78.98 | 87.44 |\n| GCN-D + GCN-S (20 prpsls) | 97.91 | 80.86 | 88.57 |\n| GCN-V | 92.45 | 82.42 | 87.14 |\n| GCN-V + GCN-E | 92.56 | 83.74 | 87.93 |\n\nNote that the `prpsls` in above table indicate the number of parameters for generating proposals, rather than the actual number of proposals.\nFor example, `2 prpsls` generates 34578 proposals and `20 prpsls` generates 283552 proposals.\n\n\n## Benchmarks (5.21M)\n\n`1, 3, 5, 7, 9` denotes different scales of clustering.\nDetails can be found in [Face Clustering Benchmarks](https://github.com/yl-1993/learn-to-cluster/wiki/Face-Clustering-Benchmarks).\n\n| Pairwise F-score | 1 | 3 | 5 | 7 | 9 |\n| ---------------- |:-:|:-:|:-:|:-:|:-:|\n| CDP (single model, th=0.7) | 75.02 | 70.75 | 69.51 | 68.62 | 68.06 |\n| LGCN | 78.68 | 75.83 | 74.29 | 73.7 | 72.99 |\n| GCN-D (2 prpsls) | 79.25 | 75.72 | 73.90 | 72.62 | 71.63 |\n| GCN-D (5 prpsls) | 82.15 | 77.71 | 75.5 | 73.99 | 72.89 |\n| GCN-D (8 prpsls) | 86.35 | 82.41 | 80.32 | 78.98 | 77.87 |\n| GCN-D (20 prpsls) | 87.61 | 83.76 | 81.62 | 80.33 | 79.21 |\n| GCN-V | 87.14 | 83.49 | 81.51 | 79.97 | 78.77 |\n| GCN-V + GCN-E | 87.93 | 84.04 | 82.1 | 80.45 | 79.3 |\n\n| BCubed F-score | 1 | 3 | 5 | 7 | 9 |\n| -------------- |:-:|:-:|:-:|:-:|:-:|\n| CDP (single model, th=0.7) | 78.7 | 75.82 | 74.58 | 73.62 | 72.92 |\n| LGCN | 84.37 | 81.61 | 80.11 | 79.33 | 78.6 |\n| GCN-D (2 prpsls) | 78.89 | 76.05 | 74.65 | 73.57 | 72.77 |\n| GCN-D (5 prpsls) | 82.56 | 78.33 | 76.39 | 75.02 | 74.04 |\n| GCN-D (8 prpsls) | 86.73 | 83.01 | 81.1 | 79.84 | 78.86 |\n| GCN-D (20 prpsls) | 87.76 | 83.99 | 82 | 80.72 | 79.71 |\n| GCN-V | 85.81 | 82.63 | 81.05 | 79.92 | 79.08 |\n| GCN-V + GCN-E | 86.09 | 82.84 | 81.24 | 80.09 | 79.25 |\n\n| NMI | 1 | 3 | 5 | 7 | 9 |\n| --- |:-:|:-:|:-:|:-:|:-:|\n| CDP (single model, th=0.7) | 94.69 | 94.62 | 94.63 | 94.62 | 94.61 |\n| LGCN | 96.12 | 95.78 | 95.63 | 95.57 | 95.49 |\n| GCN-D (2 prpsls) | 94.68 | 94.66 | 94.63 | 94.59 | 94.55 |\n| GCN-D (5 prpsls) | 95.64 | 95.19 | 95.03 | 94.91 | 94.83 |\n| GCN-D (8 prpsls) | 96.75 | 96.29 | 96.08 | 95.95 | 95.85 |\n| GCN-D (20 prpsls) | 97.04 | 96.55 | 96.33 | 96.18 | 96.07 |\n| GCN-V | 96.37 | 96.01 | 95.83 | 95.69 | 95.6 |\n| GCN-V + GCN-E | 96.41 | 96.03 | 95.85 | 95.71 | 95.62 |\n\n\n## Results on YouTube-Faces\n\n| Method | Pairwise F-score | BCubed F-score | NMI |\n| ------ |:---------:|:------:|:-------:|\n| Chinese Whispers (k=160, th=0.75, iters=20) | 72.9 | 70.55 | 93.25 |\n| Approx Rank Order (k=200, th=0) | 76.45 | 75.45 | 94.34 |\n| Kmeans (ncluster=1436) | 67.86 | 75.77 | 93.99 |\n| KNN DBSCAN (k=160, th=0., eps=0.3, min=1) | 91.35 | 89.34 | 97.52 |\n| FastHAC (dist=0.72, single) | 93.07 | 87.98 | 97.19 |\n| GCN-D (4 prpsls) | 94.44 | 91.33 | 97.97 |\n\n\n## Results on DeepFashion\n\n| Method | Pairwise F-score | BCubed F-score | NMI |\n| ------ |:---------:|:------:|:-------:|\n| Chinese Whispers (k=5, th=0.7, iters=20) | 31.22 | 53.25 | 89.8 |\n| Approx Rank Order (k=10, th=0) | 25.04 | 52.77 | 88.71 |\n| Kmeans (ncluster=3991) | 32.02 | 53.3 | 88.91 |\n| KNN DBSCAN (k=4, th=0., eps=0.1, min=2) | 25.07 | 53.23 | 90.75 |\n| FastHAC (dist=0.4, single) | 22.54 | 48.77 | 90.44 |\n| Meanshift (bandwidth=0.5) | 31.61 | 56.73 | 89.29 |\n| Spectral (ncluster=3991, affinity='rbf') | 29.6 | 47.12 | 86.95 |\n| DaskSpectral (ncluster=3991, affinity='rbf') | 24.25 | 44.11 | 86.21 |\n| CDP (single model, k=2, th=0.5, maxsz=200) | 28.28 | 57.83 | 90.93 |\n| L-GCN (k_at_hop=[5, 5], active_conn=5, step=0.5, maxsz=50)  | 30.7 | 60.13 | 90.67 |\n| GCN-D (2 prpsls) | 29.14 | 59.09 | 89.48 |\n| GCN-D (8 prpsls) | 32.52 | 57.52 | 89.54 |\n| GCN-D (20 prpsls) | 33.25 | 56.83 | 89.36 |\n| GCN-V | 33.59 | 59.41 | 90.88 |\n| GCN-V + GCN-E | 38.47 | 60.06 | 90.5 |\n\n## Face Recognition\n\nFor training face recognition and feature extraction, you may use any frameworks below, including but not limited to:\n\n[https://github.com/yl-1993/hfsoftmax](https://github.com/yl-1993/hfsoftmax)\n\n[https://github.com/XiaohangZhan/face_recognition_framework](https://github.com/XiaohangZhan/face_recognition_framework)\n\n\n## Citation\nPlease cite the following paper if you use this repository in your reseach.\n\n```\n@inproceedings{yang2019learning,\n  title={Learning to Cluster Faces on an Affinity Graph},\n  author={Yang, Lei and Zhan, Xiaohang and Chen, Dapeng and Yan, Junjie and Loy, Chen Change and Lin, Dahua},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},\n  year={2019}\n}\n@inproceedings{yang2020learning,\n  title={Learning to Cluster Faces via Confidence and Connectivity Estimation},\n  author={Yang, Lei and Chen, Dapeng and Zhan, Xiaohang and Zhao, Rui and Loy, Chen Change and Lin, Dahua},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyl-1993%2Flearn-to-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyl-1993%2Flearn-to-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyl-1993%2Flearn-to-cluster/lists"}