-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathparse.lua
More file actions
54 lines (46 loc) · 2.05 KB
/
parse.lua
File metadata and controls
54 lines (46 loc) · 2.05 KB
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
local function parse(arg)
local cmd = torch.CmdLine()
cmd:text()
cmd:text('Options:')
cmd:option('-dataset', 'none', 'svhn | cifar10 | siftflow | ucf101')
cmd:option('-model', 'none', 'Model definition file')
cmd:option('-saveDir', 'none', 'Path to save the results')
cmd:option('-lr', 0.1, 'Initial learning rate')
cmd:option('-nGPU', 4, 'Number of GPUs')
cmd:option('-chunkSize', 'none', 'Size of chunk')
cmd:option('-nChunks', 100, 'Number of total chunks')
cmd:option('-batchSize', 256, 'Size of mini-batch')
cmd:option('-dataDir', 'none', 'Path to dataset')
cmd:option('-nClasses', 10, 'Number of classes in the dataset')
cmd:option('-nThreads', 4, 'Number of data provider threads')
cmd:option('-shuffle', 'true', 'Whether shuffle the samples in each epoch')
cmd:option('-chunk', 1, 'Number of chunks that have gone')
cmd:option('-testOnly', 'false', 'Only test on the entire test set')
cmd:option('-seed', 0, 'RNG seed')
cmd:option('-momentum', 0.9, 'momentum')
cmd:option('-weightDecay', 1e-4, 'weight decay')
cmd:option('-resume', 'none', 'Path to resume file')
cmd:option('-loadModel', 'none', 'Path to pretrained Model')
cmd:option('-clipSize', 1, 'Number of frames')
cmd:text()
local opt = cmd:parse(arg or {})
if opt.saveDir == 'none' then
opt.saveDir = './tempSaveDir'
end
if opt.chunkSize == 'none' then
opt.chunkSize = nil
end
if opt.dataDir == 'none' then
opt.dataDir = './data/' .. opt.dataset
end
opt.shuffle = opt.shuffle ~= 'false'
opt.testOnly = opt.testOnly ~= 'false'
if opt.resume == 'none' then
opt.resume = nil
end
if opt.loadModel == 'none' then
opt.loadModel = nil
end
return opt
end
return parse