-
Notifications
You must be signed in to change notification settings - Fork 16
/
main.lua
53 lines (45 loc) · 1.37 KB
/
main.lua
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
----------------------------------------------------------------------
-- train cnn to compute non-rigid deformation field
--
-- Author: Rana Hanocka
----------------------------------------------------------------------
--------------------------------------
-- DEPENDENCIES
--------------------------------------
require 'torch'
require 'cutorch'
require 'paths'
require 'xlua'
require 'optim'
require 'nn'
--------------------------------------
-- CONFIGURATION PARAMS
--------------------------------------
torch.setdefaulttensortype('torch.FloatTensor')
local opts = paths.dofile('opts.lua')
opt = opts.parse(arg)
print(sys.COLORS.red .. '==> load config params')
print(opt)
torch.manualSeed(opt.manualSeed)
--------------------------------------
-- READ IN THE NETWORK ARCHITECURE
--------------------------------------
paths.dofile('util.lua')
paths.dofile('model.lua')
cutorch.setDevice(opt.GPU) -- by default, use GPU 1
print('Saving everything to: ' .. opt.save)
os.execute('mkdir -p ' .. opt.save)
--------------------------------------
-- DEFINE THE DATA, TRAIN, AND TEST ROUTINES
--------------------------------------
paths.dofile('data.lua')
paths.dofile('train.lua')
paths.dofile('test.lua')
paths.dofile('utils/visual_routines.lua') -- functions for visualization
epoch = opt.epochNumber
for i=1,opt.nEpochs do
train()
test()
epoch = epoch + 1
collectgarbage()
end