本文主要介紹了如何對MsCelebV1-Faces-Aligned.tsv文件進行提取
原創by南山南北秋悲
歡迎引用!請注明原地址 http://www.cnblogs.com/hwd9654/p/6796811.html 謝謝!
最近用caffe做人臉識別,一開始用lfw作為數據庫,但是體量太小,只有五千多人的圖片
后來想用李子青組的casia-webface,從網上找了個,下下來發現居然損壞了,好氣啊! 想去官網申請,卻發現!!!:
- Sign the agreement (The agreement must be signed by the director or the delegate of the deparmart of university. Personal applicant is not acceptable.
。。。。。。不接受個人申請,而lz的學院領導不給簽字 - -
后來索性就直接拿微軟的ms celeb 1m來訓練
簡介如下:官網地址(https://www.microsoft.com/en-us/research/project/ms-celeb-1m-challenge-recognizing-one-million-celebrities-real-world/)
MSR IRC是目前世界上規模最大、水平最高的圖像識別賽事之一,由MSRA(微軟亞洲研究院)圖像分析、大數據挖掘研究組組長張磊發起
ms_celeb_1m就是這個比賽的數據集
從1M個名人中,根據他們的受歡迎程度,選擇100K個。然后,利用搜索引擎,給100K個人,每人搜大概100張圖片。共100K*100=10M個圖片。
有三種下載選項:
1.完整版

需要自己預處理,人臉檢測,人臉對齊。。。
2.微處理版,修剪了一下

3.對齊過的版本

樓主用的是第三個對齊過的版本
下載下來是這么個玩意兒

好了廢話不多說
直接上處理腳本
import base64 import csv import os filename = "J:\dataset\ms_celeb_1m\MsCelebV1-Faces-Aligned.tsv" outputDir = "I:\ms_celeb_1m" with open(filename, 'r') as tsvF: reader = csv.reader(tsvF, delimiter='\t') i = 0 for row in reader: MID, imgSearchRank, faceID, data = row[0], row[1], row[4], base64.b64decode(row[-1]) saveDir = os.path.join(outputDir, MID) savePath = os.path.join(saveDir, "{}-{}.jpg".format(imgSearchRank, faceID)) if not os.path.exists(saveDir): os.mkdir(saveDir) with open(savePath, 'wb') as f: f.write(data) i += 1 if i % 1000 == 0: print("Extracted {} images.".format(i))
自己改下相應路徑就可以用了
處理結果:


有什么疑問可以留言,不定期查看,慢回勿噴。。。
