解压下载的ms_celeb_1m数据集

2017-09-13 20:36:38来源:CSDN作者:qq_32039433人点击

分享
import base64import csvimport osfilename = "K:/celib/dataset/MsCelebV1-Faces-Aligned.part.04.tsv"outputDir = "K:/celib"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))

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台