forked from anuragranj/spynet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
executable file
·44 lines (33 loc) · 1012 Bytes
/
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
-- Copyright 2016 Anurag Ranjan and the Max Planck Gesellschaft.
-- All rights reserved.
-- This software is provided for research purposes only.
-- By using this software you agree to the terms of the license file
-- in the root folder.
-- For commercial use, please contact [email protected].
require 'torch'
require 'cutorch'
require 'paths'
require 'xlua'
require 'optim'
require 'nn'
torch.setdefaulttensortype('torch.FloatTensor')
local opts = paths.dofile('opts.lua')
opt = opts.parse(arg)
print('Saving everything to: ' .. opt.save)
os.execute('mkdir -p ' .. opt.save)
paths.dofile('util.lua')
paths.dofile('model.lua')
opt.imageSize = model.imageSize or opt.imageSize
opt.outputSize = model.outputSize or opt.outputSize
print(opt)
cutorch.setDevice(opt.GPU) -- by default, use GPU 1
torch.manualSeed(opt.manualSeed)
paths.dofile('data.lua')
paths.dofile('train.lua')
paths.dofile('test.lua')
epoch = opt.epochNumber
for i=1,opt.nEpochs do
train()
test()
epoch = epoch + 1
end