Skip to content
Snippets Groups Projects
Commit c8dd107a authored by Danjou Pierre's avatar Danjou Pierre
Browse files

FINISHED

last upload
parent 36f859b3
Branches
No related tags found
No related merge requests found
...@@ -11,16 +11,9 @@ import pickle ...@@ -11,16 +11,9 @@ import pickle
# batch.meta
#{b'num_cases_per_batch': 10000, b'label_names': [b'airplane', b'automobile', b'bird', b'cat', b'deer', b'dog', b'frog', b'horse', b'ship', b'truck'], b'num_vis': 3072}
def read_cifar_batch(file): def read_cifar_batch(file):
with open(file, 'rb') as fo: with open(file, 'rb') as fo:
dict = pickle.load(fo, encoding='bytes') dict = pickle.load(fo, encoding='bytes')
# keys = [b'batch_label',
# b'labels',
# b'data',
# b'filenames']
return (np.array(dict[b'data']).astype('float32'), np.array(dict[b'labels']).astype('int64')) return (np.array(dict[b'data']).astype('float32'), np.array(dict[b'labels']).astype('int64'))
def read_cifar(path): def read_cifar(path):
...@@ -47,10 +40,6 @@ def read_cifar(path): ...@@ -47,10 +40,6 @@ def read_cifar(path):
def split_dataset(data, labels, split): def split_dataset(data, labels, split):
"""
Cette fonction divise l'ensemble de notre data en training data set et testing data set.
"""
n = data.shape[0] n = data.shape[0]
indices = np.random.permutation(n) indices = np.random.permutation(n)
train_idx, test_idx = indices[:int(split*n)], indices[int(split*n):] train_idx, test_idx = indices[:int(split*n)], indices[int(split*n):]
...@@ -62,6 +51,7 @@ def split_dataset(data, labels, split): ...@@ -62,6 +51,7 @@ def split_dataset(data, labels, split):
if __name__ == "__main__": if __name__ == "__main__":
path = r'data\cifar-10-batches-py\data_batch_1' path = r'data\cifar-10-batches-py\data_batch_1'
main_path = r'data\cifar-10-batches-py' main_path = r'data\cifar-10-batches-py'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment