-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathmain.py
103 lines (88 loc) · 3.62 KB
/
main.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import pyffe
from pyffe.models import mAlexNet, AlexNet
dataset_prefix = 'splits'
PKLot = pyffe.Dataset(dataset_prefix + '/PKLot')
CNRParkAB = pyffe.Dataset(dataset_prefix + '/CNRParkAB')
CNRExt = pyffe.Dataset(dataset_prefix + '/CNRPark-EXT')
Combined = pyffe.Dataset(dataset_prefix + '/Combined')
input_format = pyffe.InputFormat(
new_width=256,
new_height=256,
crop_size=224,
scale=1. / 256,
mirror=True
)
model = mAlexNet(input_format, num_output=2, batch_sizes=[64, 100])
bigmodel = AlexNet(input_format, num_output=2, batch_sizes=[64, 50])
solver = pyffe.Solver(
base_lr=0.0008,
train_epochs=6,
lr_policy="step",
gamma=0.75,
stepsize_epochs=2,
val_interval_epochs=0.15,
val_epochs=0.1,
display_per_epoch=30,
snapshot_interval_epochs=0.15,
)
exps = [
# exp 1.1 and 1.2
pyffe.Experiment(model, solver, PKLot.train, val=[PKLot.val, CNRExt.val], test=[PKLot.test, CNRExt.test]),
pyffe.Experiment(bigmodel, solver, PKLot.train, val=[PKLot.val, CNRExt.val], test=[PKLot.test, CNRExt.test]),
# exp 2.1 and 2.2
pyffe.Experiment(model, solver, CNRParkAB.all, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test]),
pyffe.Experiment(bigmodel, solver, CNRParkAB.all, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test]),
# exp 3.1 and 3.2
pyffe.Experiment(model, solver, Combined.CNRParkAB_Ext_train, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test] ),
pyffe.Experiment(bigmodel, solver, Combined.CNRParkAB_Ext_train, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test] ),
# exp 4.1 and 4.2
pyffe.Experiment(model, solver, Combined.CNRParkAB_Ext_train_C1C8, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test] ),
pyffe.Experiment(bigmodel, solver, Combined.CNRParkAB_Ext_train_C1C8, val=[CNRExt.val, PKLot.val], test=[CNRExt.test, PKLot.test] ),
# Inter-weather experiments
pyffe.Experiment(model, solver, CNRExt.sunny, val=[CNRExt.overcast, CNRExt.rainy, PKLot.val], test=[CNRExt.overcast, CNRExt.rainy, PKLot.test]),
pyffe.Experiment(model, solver, CNRExt.overcast, val=[CNRExt.sunny, CNRExt.rainy, PKLot.val], test=[CNRExt.sunny, CNRExt.rainy, PKLot.test]),
pyffe.Experiment(model, solver, CNRExt.rainy, val=[CNRExt.sunny, CNRExt.overcast, PKLot.val], test=[CNRExt.sunny, CNRExt.overcast, PKLot.test]),
# Inter-camera experiments
pyffe.Experiment(model, solver, CNRExt.camera8,
val=[CNRExt.camera1,
CNRExt.camera2,
CNRExt.camera3,
CNRExt.camera4,
CNRExt.camera5,
CNRExt.camera6,
CNRExt.camera7,
PKLot.val,
CNRExt.camera9],
test=[CNRExt.camera1,
CNRExt.camera2,
CNRExt.camera3,
CNRExt.camera4,
CNRExt.camera5,
CNRExt.camera6,
CNRExt.camera7,
PKLot.test,
CNRExt.camera9]),
pyffe.Experiment(model, solver, CNRExt.camera1,
val=[PKLot.val,
CNRExt.camera2,
CNRExt.camera3,
CNRExt.camera4,
CNRExt.camera5,
CNRExt.camera6,
CNRExt.camera7,
CNRExt.camera8,
CNRExt.camera9],
test=[PKLot.test,
CNRExt.camera2,
CNRExt.camera3,
CNRExt.camera4,
CNRExt.camera5,
CNRExt.camera6,
CNRExt.camera7,
CNRExt.camera8,
CNRExt.camera9]),
]
for exp in exps:
exp.setup('runs/')
exp.run(plot=False) # run without live plot
pyffe.summarize(exps).to_csv('results.csv')