-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathtest_opts.lua
48 lines (33 loc) · 1.37 KB
/
test_opts.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
local M = {}
function M.parse(arg)
local cmd = torch.CmdLine()
cmd:text()
cmd:text('Torch-7 Fast Scene Understanding Test script.')
cmd:text('Copyright (c) 2017, Neven and De Brabandere')
cmd:text()
cmd:text('Options:')
------------ Data options --------------------
cmd:option('-dataset', 'cityscapes', 'Options: cityscapes')
cmd:option('-data_root', '/path/to/cityscapes')
cmd:option('-mode', 'val', 'mode: train, trainval, val, test')
------------- Data transformation -------------
cmd:option('-size', 1024, 'rescale longer side to size')
cmd:option('-original_size', 2048, 'original size to rescale to when saving')
------------- Model -----------------------
cmd:option('-model', 'models/fastSceneSegmentationFinal.t7', 'path to model')
------------- SAVE AND DISPLAY ------------
cmd:option('-save', 'false', 'save models')
cmd:option('-save_dir', '/save/dir/', 'save directory')
cmd:option('-display', 'true', 'display')
cmd:text()
local opts = cmd:parse(arg or {})
opts.save = opts.save ~= 'false'
opts.display = opts.display ~= 'false'
if (opts.save) then
if not paths.dirp(opts.save_dir) and not paths.mkdir(opts.save_dir) then
cmd:error('error: unable to create save directory: ' .. opts.save_dir .. '\n')
end
end
return opts
end
return M