-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataset.py
58 lines (44 loc) · 2.08 KB
/
dataset.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
from base.dataset import GenericDataArranger, GenericDataset
from torch.utils.data import Dataset as PytorchDataset
import numpy as np
from PIL import Image
class Dataset(GenericDataset):
def __init__(self, data_list, continuous_label_dim, modality, multiplier, feature_dimension, window_length, mode, mean_std=None,
time_delay=0, feature_extraction=0):
super().__init__(data_list, continuous_label_dim, modality, multiplier, feature_dimension, window_length, mode, mean_std=mean_std,
time_delay=time_delay, feature_extraction=feature_extraction)
class DataArranger(GenericDataArranger):
def __init__(self, dataset_info, dataset_path, debug):
super().__init__(dataset_info, dataset_path, debug)
@staticmethod
def get_feature_list():
feature_list = ["video","mfcc","vggish"]
return feature_list
def partition_range_fn(self):
partition_range = {
'train': [],
'validate': [],
'test': [],
# 'extra': []}
'extra': [np.arange(0, 141)]}
# partition_range = {
# 'train': [np.arange(0, 62), np.arange(61, 124), np.arange(124, 186), np.arange(186, 248)],
# 'validate': [np.arange(248, 319)],
# 'test': [],
# 'extra': [np.arange(319, 418)]}
if self.debug == 1:
partition_range = {
'train': [np.arange(0, 1), np.arange(1, 2), np.arange(2, 3), np.arange(3, 4), np.arange(4, 5), ],
'validate': [np.arange(5, 6)],
'test': [np.arange(6, 7)],
'extra': [np.arange(7, 8)]}
# partition_range = {
# 'train': [np.arange(0, 1), np.arange(1, 2), np.arange(2, 3), np.arange(3, 4)],
# 'validate': [np.arange(5, 6)],
# 'test': [np.arange(6, 7)],
# 'extra': [np.arange(7, 8)]}
return partition_range
@staticmethod
def assign_fold_to_partition():
fold_to_partition = {'train': 0, 'validate': 0, 'test': 0, 'extra': 1}
return fold_to_partition