想要做一个web版的猜画小歌,先去爬数据集。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from urllib import request


def download():
f = open("categories.txt", "r")
classes = f.readlines()
f.close()
classes = [c.replace('\n', '').replace(' ', '_') for c in classes]
base = 'https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/'
i = 0
for c in classes:
cls_url = c.replace('_', '%20')
path = base + cls_url + '.npy'
print(path + " is Download" + str(i) + "/345\n")
i += 1
request.urlretrieve(path, 'data/' + c + '.npy')


download()

然而,这网络……简直无力吐槽了,或者试一下多线程下载