一、介绍
Glint360K数据集包含36w类别的17M张图像,不论是类别数还是图像数,相比MS1MV2数据集都有大幅提升。
这是一个号称全球最大最干净的人脸数据集,
下载地址:https://pan.baidu.com/s/1K3UDER9u352oNIyph-FI1w?pwd=3o3i
提取码:3o3i
--来自百度网盘超级会员V5的分享
二、解压和解码
下载好了之后先解压
cat glint360k_* | tar -xzvf -
然后它是.rec格式数据,下面我们将它解码成图片
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import cv2
import mxnet as mx
def main(args):
include_datasets = args.include.split(',')
rec_list = []
for ds in include_datasets:
path_imgrec = os.path.join(ds, 'train.rec')
path_imgidx = os.path.join(ds, 'train.idx')
imgrec = mx.recordio.MXIndexedRecordIO(path_imgidx, path_imgrec, 'r')
rec_list.append(imgrec)
if not os.path.exists(args.output):
os.makedirs(args.output)
#
imgid = 0
for ds_id in range(len(rec_list)):
imgrec = rec_list[ds_id]
s = imgrec.read_idx(0)
header, _ = mx.recordio.unpack(s)
assert header.flag > 0
seq_identity = range(int(header.label[0]), int(header.label[1]))
for identity in seq_identity:
s = imgrec.read_idx(identity)
header, _ = mx.recordio.unpack(s)
for _idx in range(int(header.label[0]), int(header.label[1])):
s = imgrec.read_idx(_idx)
_header, _img = mx.recordio.unpack(s)
label = int(_header.label[0])
class_path = os.path.join(args.output, "id_%d" % label)
if not os.path.exists(class_path):
os.makedirs(class_path)
image_path = os.path.join(class_path, "%d_%d.jpg" % (label, imgid))
with open(image_path, 'wb') as ff:
ff.write(_img)
imgid += 1
if imgid % 10000 == 0:
print(imgid)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='do dataset merge')
# general
parser.add_argument('--include', default='', type=str, help='')
parser.add_argument('--output', default='', type=str, help='')
args = parser.parse_args()
main(args)
命令行:
python unpack_glint360k.py --include=xx/glint360k --output=xx/glint360k_unzip
三、 数据集的表现
学术界的测评比如IJB-C和megaface,利用该数据集很容易刷到SOTA,大家具体可以看论文,这里展示一下IFRT的结果,IFRT又称国产FRVT, IFRT测试集主要有不同肤色的素人构成,相比起IJB-C和megaface更具有模型的区分度。
InsightFace Recognition Test (国产FRVT):
https://github.com/deepinsight/insightface/tree/master/IFRT
相比起目前最好的训练集MS1MV3,Glint360K有十个点的提升
四、 数据集的规模
类别数目和图片数目比主流训练集加起来还要多
Glint360K具有36w类别,和1700w张图片,不论在类别数还是图片数目,相比起MS1MV2都是大幅度的提升。
五、 如何训练大规模的数据
人脸识别任务特点就是数据多,类别大,几百万几千万类别的数据集在大公司非常常见,例如2015年的时候,Google声称他们有800w类别的人脸训练集。训如此规模的数据时,很直接的方法就是混合并行,即backbone使用数据并行,分类层使用模型并行, (
线性变换矩阵)分卡存储,这样优点有两个:
1. 缓解了显存的存储压力。
2. 将 梯度的通信转换成了所有GPU的特征 与 局部分母的通信,大大降低了由于数据并行的带了的通信开销
性能方面:
我们在内部的业务和FRVT竞赛上都验证了这个方法,再学术界的测试集IJBC和Megaface上,使用Glint360K的Full softmax和10%采样会有着相当的结果。
效率方面:
在64块2080Ti,类别数1000w的实验条件下,Partial FC 的速度会是混合并行的3倍,占用的显存也会更低,并且最大支持的类别数也有了一个数量级的飞跃,成功训练起来了一亿id的分类任务。
代码和数据地址:
https://github.com/deepinsight/insightface/tree/master/recognition/partial_fc#glint360k
论文地址:
https://arxiv.org/abs/2010.05222
END