forked from isseu/emotion-recognition-neural-networks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataset_loader.py
39 lines (31 loc) · 1.09 KB
/
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
33
34
35
36
37
38
39
from os.path import join
import numpy as np
from constants import *
import cv2
class DatasetLoader(object):
def __init__(self):
pass
def load_from_save(self):
self._images = np.load(join(SAVE_DIRECTORY, SAVE_DATASET_IMAGES_FILENAME))
self._labels = np.load(join(SAVE_DIRECTORY, SAVE_DATASET_LABELS_FILENAME))
self._images_test = np.load(join(SAVE_DIRECTORY, SAVE_DATASET_IMAGES_TEST_FILENAME))
self._labels_test = np.load(join(SAVE_DIRECTORY, SAVE_DATASET_LABELS_TEST_FILENAME))
self._images = self._images.reshape([-1, SIZE_FACE, SIZE_FACE, 1])
self._images_test = self._images.reshape([-1, SIZE_FACE, SIZE_FACE, 1])
self._labels = self._labels.reshape([-1, len(EMOTIONS)])
self._labels_test = self._labels.reshape([-1, len(EMOTIONS)])
@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
@property
def num_examples(self):
return self._num_examples