-
Notifications
You must be signed in to change notification settings - Fork 18
/
config.py
53 lines (37 loc) · 1.18 KB
/
config.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
from abc import ABC
from collections import defaultdict
class AbstractConfig(ABC):
@property
def checkpoint_path(self):
raise NotImplementedError("You should defined 'checkpoint_path'.")
@property
def mean(self):
raise NotImplementedError("You should defined 'mean'.")
@property
def std(self):
raise NotImplementedError("You should defined 'std'.")
@property
def resize_to(self):
raise NotImplementedError("You should defined 'resize_to'.")
crop_to = None
class Default(AbstractConfig):
mean = ( 0.485, 0.456, 0.406 )
std = ( 0.229, 0.224, 0.225 )
resize_to = ( 224, 224 )
class Inception(AbstractConfig):
mean = ( 0.5, 0.5, 0.5 )
std = ( 0.5, 0.5, 0.5 )
resize_to = ( 299, 299 )
class C3D(AbstractConfig):
checkpoint_path = "pretrained_models/c3d.pickle"
import numpy as np
mean = np.load("data/c3d_mean.npy")
mean = mean.squeeze(0).transpose(1, 2, 3, 0)
mean /= 255.
std = ( 0.5, 0.5, 0.5 )
resize_to = ( 171, 128 )
crop_to = ( 112, 112 )
config = defaultdict(lambda: Default)
config['inception_v3'] = Inception
config['inception_v4'] = Inception
config['c3d'] = C3D