# face-recognition **Repository Path**: vbsoft2018/face-recognition ## Basic Information - **Project Name**: face-recognition - **Description**: 脸部识别 人眼特征检测 活体检测 人脸旋转与侧脸拉正 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2019-12-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # face-recognition项目介绍 这个项目有两个大功能:人脸预处理和CNN人脸训练与识别
由于不能上传大文件,需要下载shape_predictor_68_face_landmarks文件,在该文件夹内提供了下载链接
人脸数据需要自己造,暂不提供 # 需要注意 由于dlib新版API只支持python3.6,在其他版本的python环境中需要进行重构
对人脸切割部分代码进行以下的重构 ```python cutting_position = (d.left(), d.top(), d.right(), d.bottom()) # 切割出人脸 im = Image.open(path) region = im.crop(cutting_position) # 人脸缩放 a = 500 # 人脸方格大小 if region.size[0] >= a or region.size[1] >= a: region.thumbnail((a, a), Image.ANTIALIAS) else: region = region.resize((a, a), Image.ANTIALIAS) # 将Image转化为cv2 region = cv2.cvtColor(np.asarray(region), cv2.COLOR_RGB2BGR) # 保存人脸 cv2.imshow('region', region) print(type(region)) cv2.waitKey(0) ``` # 1、人脸预处理
人脸活体检测:从原始图片中识别出人脸的位置,以及68个特征点位置,借助shape_predictor_68_face_landmarks模型。
![image](https://github.com/duhanmin/face-recognition/blob/master/images/4.png)

脸部检测提取:从原始图片中将人脸提取出来
![image](https://github.com/duhanmin/face-recognition/blob/master/images/5.png)

脸部检测提取:人脸旋转,可以将侧脸拉正
![image](https://github.com/duhanmin/face-recognition/blob/master/images/3.png)

# 2、CNN人脸训练与识别
网络方案:2个卷积、2个pooling、两个全连接、所有激活函数均采用leaky_relu
原始数据截图:
![image](https://github.com/duhanmin/face-recognition/blob/master/images/1.png)

处理后的数据:
![image](https://github.com/duhanmin/face-recognition/blob/master/images/2.png)

训练效果:
![image](https://github.com/duhanmin/face-recognition/blob/master/images/6.png)

测试效果:
![image](https://github.com/duhanmin/face-recognition/blob/master/images/7.png)

# 赞助