Skip to content
Snippets Groups Projects
Commit 0e07e0d3 authored by BaptisteBrd's avatar BaptisteBrd
Browse files

fonction read cifar

parent 4d02db91
Branches
Tags
No related merge requests found
......@@ -7,8 +7,29 @@ def read_cifar_batch(file):
labels = np.array(dict[b'labels']).astype('int64')
return data, labels
vect1= read_cifar_batch("data/cifar-10-batches-py/data_batch_1")
#vect1= read_cifar_batch("data/cifar-10-batches-py/data_batch_1")
#print(vect1)
#def read_cifar
\ No newline at end of file
def read_cifar(directory):
all_data = []
all_labels = []
for i in range(1,6):
data_v, labels_v = read_cifar_batch(f'{directory}/data_batch_{i}')
all_data.append(data_v)
all_labels.append(labels_v)
data_v, labels_v = read_cifar_batch(f'{directory}/test_batch')
all_data.append(data_v)
all_labels.append(labels_v)
all_data = np.concatenate(all_data, axis = 0)
all_labels = np.concatenate(all_labels, axis = 0)
return(all_data, all_labels)
#vect2= read_cifar("data/cifar-10-batches-py")
#print(vect2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment