dlib人脸聚类

本文介绍了如何利用dlib库进行人脸聚类。首先,从指定链接获取dlib相关文档和模型,然后将人脸图片放入faces文件夹,模型放入model文件夹。运行face_clustering.py脚本后,结果将保存在out目录。参考了多篇教程文章,包括DLib快速实现人脸识别和人脸聚类的详细步骤。
1、官方提供的模型文件  http://dlib.net/files/
 http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
 http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

dlib相关文档  http://accu.cc/content/daze/dlib/install/

下载下面的model

 

 

2、程序目录如下

 

 

faces 存放要聚类的人脸图片,model  存放下载下来的model,out是输出目录

 

3、face_clustering.py如下

# coding: utf-8
"""
@author: xhb
"""

import sys
import os
import dlib
import glob
import cv2

# 指定路径
c
Abstract—Clustering face images according to their latent identity has two important applications: (i) grouping a collection of face images when no external labels are associated with images, and (ii) indexing for efficient large scale face retrieval. The clustering problem is composed of two key parts: representation and similarity metric for face images, and choice of the partition algorithm. We first propose a representation based on ResNet, which has been shown to perform very well in image classification problems. Given this representation, we design a clustering algorithm, Conditional Pairwise Clustering (ConPaC), which directly estimates the adjacency matrix only based on the similarities between face images. This allows a dynamic selection of number of clusters and retains pairwise similarities between faces. ConPaC formulates the clustering problem as a Conditional Random Field (CRF) model and uses Loopy Belief Propagation to find an approximate solution for maximizing the posterior probability of the adjacency matrix. Experimental results on two benchmark face datasets (LFW and IJB-B) show that ConPaC outperforms well known clustering algorithms such as k-means, spectral clustering and approximate Rank-order. Additionally, our algorithm can naturally incorporate pairwise constraints to work in a semi-supervised way that leads to improved clustering performance. We also propose an k-NN variant of ConPaC, which has a linear time complexity given a k-NN graph, suitable for large datasets. Index Terms—face clustering, face representation, Conditional Random Fields, pairwise constraints, semi-supervised clustering.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

非ban必选

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值