forked from fmassa/object-detection.torch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opts.lua
65 lines (56 loc) · 2.34 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local M = {}
function M.parse(arg)
local cmd = torch.CmdLine()
cmd:text()
cmd:text('Object detection in torch')
cmd:text()
cmd:text('Options:')
local curr_dir = paths.cwd()
local defaultDataSetDir = paths.concat(curr_dir,'datasets')
local defaultDataDir = paths.concat(defaultDataSetDir,'VOCdevkit/')
local defaultROIDBDir = paths.concat(curr_dir,'data','selective_search_data/')
cmd:text('Folder parameters')
cmd:option('-cache',paths.concat(curr_dir,'cachedir'),'Cache dir')
cmd:option('-datadir',defaultDataDir,'Path to dataset')
cmd:option('-roidbdir',defaultROIDBDir,'Path to ROIDB')
cmd:text()
cmd:text('Model parameters')
cmd:option('-algo','SPP','Detection framework. Options: RCNN | SPP')
cmd:option('-netType','zeiler','Options: zeiler | vgg')
cmd:option('-backend','cudnn','Options: nn | cudnn')
cmd:text()
cmd:text('Data parameters')
cmd:option('-year',2007,'DataSet year (for Pascal)')
cmd:option('-ipb',500,'iter per batch')
cmd:option('-ntmd',10,'nTimesMoreData')
cmd:option('-fg_frac',0.25,'fg_fraction')
cmd:option('-classes','all','use all classes (all) or given class')
cmd:text()
cmd:text('Training parameters')
cmd:option('-lr',1e-2,'learning rate')
cmd:option('-num_iter',300,'number of iterations')
cmd:option('-nsmooth',40,'number of iterations before reducing learning rate')
cmd:option('-nred',4,'number of divisions by 2 before stopping learning')
cmd:option('-nildfdx',false,'erase memory of gradients when reducing learning rate')
cmd:text()
cmd:text('Others')
cmd:option('-gpu',1,'gpu device to use')
cmd:option('-numthreads',6,'number of threads to use')
cmd:option('-comment','','additional comment to the name')
cmd:option('-seed',0,'random seed (0 = no fixed seed)')
cmd:option('-retrain','none','modelpath for finetuning')
cmd:text()
local opt = cmd:parse(arg or {})
-- add commandline specified options
opt.save = paths.concat(opt.cache,
cmd:string(opt.netType, opt,
{retrain=true, optimState=true, cache=true,
data=true, gpu=true, numthread=true,
netType=true}))
-- add date/time
opt.save_base = opt.save
local date_time = os.date():gsub(' ','')
opt.save = paths.concat(opt.save, date_time)
return opt
end
return M