Windows10环境下解压使用Glint360K数据集
Glint360K数据集介绍
关于Glint360k数据集的介绍:
参见:知乎https://zhuanlan.zhihu/p/265673438
数据集已经开源:
GitHub开源链接https://github/deepinsight/insightface/tree/master/recognition/partial_fc#glint360k
论文地址lhttps://arxiv/abs/2010.05222
在GitHub上找到数据集的百度云下载链接,提取码:o3az 下载数据集。
下载完成后,得到这样的文件
github教程上虽然给了解压命令,但是是针对Linux系统的,那么针对Windows系统,怎么做呢?答案就是使用Git
下载并安装Git
Git下载链接:https://git-scm/download/win
Git安装教程https://www.jianshu/p/414ccd423efc
第一步解压
Git的安装完成后,打开数据文件夹
鼠标右键,点击"Git Bash Here"
然后输入官方给出的命令:
cat glint360k_* | tar -xzvf -
1
不要忘记了最后的"-"
数据集很大,耐心等待
解压完后,就会得到这样的文件数据集:
到这一步,文件是可以直接使用的。
比如.bin文件,.rec文件,具体的,小伙伴们自己可以查找相关资料
此图来自实验室李学长的指导,数据集在Windows 10上的解压,离不开学长的帮助,在此鸣谢!!Thank you!
第二步解压
在得到这些文件以后,如何查看数据集的图片呢?
链接如下:https://github/deepinsight/insightface/blob/master/recognition/partial_fc/unpack_glint360k.py
单个文件不好下载,就可以直接复制下面的代码,然后命名为unpack_glint360k.py
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') # pylint: disable=redefined-variable-type
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)
_img = mx.image.imdecode(_img).asnumpy()[:, :, ::-1] # to bgr
image_path = os.path.join(class_path, "%d_%d.jpg" % (label, imgid))
cv2.imwrite(image_path, _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)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
然后使用cmd命令行运行
python unpack_glint360k.py --include=E:\glint360k\glint360k --output=E:\glint360k_unzip
1
#E:\glint360k\glint360k 是指解压出来的文件所在的文件夹,如下图所示
#E:\glint360k_unzip 是你希望最后解压出来的文件在哪个文件夹
#这是我解压时的设置
1
2
3
输入命令运行后,就开始解压了:
tip:
1.python的相关依赖需要自己安装
2.我这里是把解压的py文件放到数据集文件夹下,所以需要进行路径切换
数据集很大,耐心等待
数据集很大,耐心等待
数据集很大,耐心等待
最后数据集解压完成!!!
放几张数据集的图片
至此,数据集在Windows 10上就解压完毕了!!!!
————————————————
版权声明:本文为CSDN博主「Walden-2020」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn/weixin_43408232/article/details/109687884
更多推荐
Windows10 使用Glint360K数据集
发布评论