File size: 1,270 Bytes
8d6cd57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
""" hardcoded parameter

these can be changed in a jupyter notebook during runtime via

>>> import parameter
>>> parameter.parameter = new_value

"""

from torch.optim import Adam

###############
## hardcoded ##
###############


# Input
image_dim = 64
colors_dim = 3
labels_dim = 37 #3
input_size = (colors_dim,image_dim,image_dim)


#############
## mutable ##
#############

class Parameter:
    """ container for hyperparameters"""

    def __init__(self):
        # Encoder/Decoder
        self.latent_dim = 8
        self.decoder_dim = self.latent_dim  # differs from latent_dim if PCA applied before decoder

        # General
        self.learning_rate = 0.0002
        self.betas = (0.5,0.999)  ## 0.999 is default beta2 in tensorflow
        self.optimizer = Adam
        self.negative_slope = 0.2 # for LeakyReLU
        self.momentum = 0.99 # for BatchNorm

        # Loss weights
        self.alpha = 1 # switch VAE (1) / AE (0)
        self.beta = 1 # weight for KL-loss
        self.gamma = 1024 # weight for learned-metric-loss (https://arxiv.org/pdf/1512.09300.pdf)
        self.delta = 1 # weight for class-loss
        self.zeta = 0.5 # weight for MSE-loss

    def return_parameter_dict(self):
        return(self.__dict__)

parameter = Parameter()