-
Notifications
You must be signed in to change notification settings - Fork 7
/
run_experiment.py
53 lines (37 loc) · 1.19 KB
/
run_experiment.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
# custom modules
from options import Options
def train():
# setting up, options contains all our params
options = Options(library=0, # use keras
configs=2, # use resnet50 model
transform=1) # use transform for resnet50
# set options to your specific experiment
options.experiment = "fine_tuned_oxford102_model_dropout"
options.dropout = 0.1
options.number = options.dropout
# settings
options.gpu = 2
options.save_test_result = True
# early stopping
options.early_stopping = True
options.patience = 20
# general hyperparameters
options.lr = 1E-2
options.batch_size = 128
# reduce lr on plateau
options.reduce_lr = 0.5
for i in range(0, 9):
# initialize model
model = options.FlowerClassificationModel(options)
# fit model
model.fit()
# evaluate model
model.evaluate()
# reset model for next parameter
model.reset()
# change dropout from 0.1 to 0.9
options.dropout += 0.1
# change the log number saved to checkpoints
options.number = options.dropout
if __name__=='__main__':
train()