-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
executable file
·61 lines (37 loc) · 1.67 KB
/
script.py
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
58
59
60
61
import os
import tarfile
import urllib.request
DOWNLOAD_ROOT = "https://raw.githubusercontent.com/zalandoresearch/fashion-mnist/tree/master/data/"
fashion_path = os.path.join("datasets", "fashion")
list_url =
fashion_urls = [DOWNLOAD_ROOT +]
# ROOT_DOWNLOAD = "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
# PATH_CIFAR = os.path.join("datasets","cifar-10")
# def fetch_cifar_10_data(root_download = ROOT_DOWNLOAD, path_cifar = PATH_CIFAR):
# if not os.path.isdir(path_cifar):
# os.makedirs(path_cifar)
# path_tgz = os.path.join(path_cifar,"cifar-10-python.tar.gz")
# urllib.request.urlretrieve(root_download, path_tgz)
# cifar_tar = tarfile.open(path_tgz)
# cifar_tar.extractall(path=path_cifar)
# cifar_tar.close()
# import pandas as pd
# import pandas as pd
# def load_cifar_10_data(path_cifar=PATH_CIFAR):
# dl_path = os.path.join(path_cifar, "cifar-10-python.csv")
# return pd.read_csv(dl_path)
# PATH_CIFAR_BATCHES = os.path.join(PATH_CIFAR,"cifar-10-batches-py/")
# file = None
# def unpickle(path_cifar_batches = PATH_CIFAR_BATCHES, the_file = file):
# import pickle
# dire = os.path.join(path_cifar_batches, the_file)
# data_dict = open(dire, "rb")
# data = data_dict.read()
# data_dict.close() # the problem is that the data consists of bytes
# return data
# def load_cifar_10_data(path_cifar_batches=PATH_CIFAR_BATCHES):
# files = os.listdir(path_cifar_batches)
# data_list = []
# for file in files:
# data_list.append(unpickle(path_cifar_batches = PATH_CIFAR_BATCHES,the_file =file))
# return files, data_list