-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdataset_loader.py
32 lines (25 loc) · 957 Bytes
/
dataset_loader.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
# -*- coding:utf-8 -*-
from os.path import join
import numpy as np
from constants import *
from sklearn.model_selection import train_test_split
class DatasetLoader:
def load_from_save(self):
images = np.load(join(SAVE_DIRECTORY, 'sf=' + str(SCALEFACTOR) + '_' +SAVE_DATASET_IMAGES_FILENAME))
images = images.reshape([-1, SIZE_FACE, SIZE_FACE, 1])
labels = np.load(join(SAVE_DIRECTORY, 'sf=' + str(SCALEFACTOR) + '_' +SAVE_DATASET_LABELS_FILENAME)).\
reshape([-1, len(EMOTIONS)])
self._images, self._images_test, self._labels, self._labels_test = train_test_split\
(images, labels, test_size=0.10, random_state=42)
@property
def images(self):
return self._images
@property
def labels(self):
return self._labels
@property
def images_test(self):
return self._images_test
@property
def labels_test(self):
return self._labels_test