千里挑一的我乎漂亮妹子照片墙(数据初探3)
自己挖的坑,接上一弹留下的作业:
过程实现:
1.根据抓取的url本地存储图片;
2.用face_recognition筛选出人脸,阿猫阿狗的删除;
3.用pillow打上妹子的知乎ID;
4.人工剔除部分动画类妹子图片(可以省略);
5.处理华南理工大学数据集中的妹子颜值评分;
6.继续用face_recognition库中的face_distance获取图片的相似度(L2范数)。
原本是计划用face_recognition提取面部特征矩阵,
然后用Sklearn进行聚类分析,但是face_distance也可以做个大概判断。
PS:这个face_recognition很强大
ageitgey/face_recognition
· 找到照片中的人脸Find faces in a photograph
https://github.com/ageitgey/face_recognition/blob/master/examples/find_faces_in_picture.py
· 识别照片中的面部特征Identify specific facial features in a photograph
https://github.com/ageitgey/face_recognition/blob/master/examples/find_facial_features_in_picture.py
def face_distance(face_encodings, face_to_compare):
"""
Given a list of face encodings, compare them to a known face encoding and get a euclidean distance
for each comparison face. The distance tells you how similar the faces are.
:param faces: List of face encodings to compare
:param face_to_compare: A face encoding to compare against
:return: A numpy ndarray with the distance for each face in the same order as the 'faces' array
"""
if len(face_encodings) == 0:
return np.empty((0))
return np.linalg.norm(face_encodings - face_to_compare, axis=1)
试验结果:
1.共提取了3600多张颜值较高的妹子图片;
2.用随机1000张生成照片墙,结果太大,我乎不能上传;
3.文中插图为照片墙的部分截图,另完整一千妹子照片墙下载:
https://pan.baidu.com/s/1dFaVyCx(17.1M)
4.需要原始数据(大图及华南理工数据集)可以站内私信。
还想知道更多分析?
稍后一一奉上~~~
或者你自己撸吧:Python数据采集处理分析挖掘可视化应用实例