-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.py
58 lines (43 loc) · 1.47 KB
/
example.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
57
import json
import torch
from dataloaders import get_dataloaders
class Args(object):
def __init__(self):
self.features_paths = {
'ek55': './annotations/epic-kitchens-55-annotations/features',
'ek100': './annotations/epic-kitchens-100-annotations/features',
}
self.frames_paths = {
'ek55': './annotations/epic-kitchens-55-annotations/frames',
'ek100': './annotations/epic-kitchens-100-annotations/frames',
}
self.ek_version = 'ek55' # 'ek55' or 'ek100'
self.fps = 4.0
self.batch_size = 32
self.num_workers = 0
self.num_frames_per_action = 8
self.sample_mode = 'uniform'
self.modalities = 'frames rgb flow obj'
self.validation_ratio = 0.2
self.use_rulstm_splits = False
self.mode = 'train'
self.height = 224
self.width = 224
self.task = 'anticipation'
self.t_buffer = 3.5
self.t_ant = 1.0
def __repr__(self):
return 'Input Args: ' + json.dumps(self.__dict__, indent=4)
if __name__ == '__main__':
# Get args
args = Args()
print(args)
# Dataloaders
dls = get_dataloaders(args)
# Get sample
sample = next(iter(dls['train'].dataset))
for k, v in sample.items():
if torch.is_tensor(v):
print(f'{k}: {v.shape}')
else:
print(f'{k}: {v}')