openface/batch-represent/opts.lua

38 lines
1.1 KiB
Lua
Raw Normal View History

2015-09-24 06:19:30 +08:00
local M = { }
-- http://stackoverflow.com/questions/6380820/get-containing-path-of-lua-file
function script_path()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*/)")
end
function M.parse(arg)
local cmd = torch.CmdLine()
cmd:text()
2015-10-09 22:48:06 +08:00
cmd:text('OpenFace')
2015-09-24 06:19:30 +08:00
cmd:text()
cmd:text('Options:')
------------ General options --------------------
cmd:option('-outDir', './reps/', 'Subdirectory to output the representations')
cmd:option('-data',
paths.concat(script_path(), '..', 'data', 'lfw', 'dlib-affine-sz:96'),
'Home of dataset')
cmd:option('-model',
2016-01-13 04:46:49 +08:00
paths.concat(script_path(), '..', 'models', 'openface', 'nn4.small2.v1.t7'),
2015-09-24 06:19:30 +08:00
'Path to model to use.')
cmd:option('-imgDim', 96, 'Image dimension. nn1=224, nn4=96')
cmd:option('-batchSize', 50, 'mini-batch size')
cmd:option('-cuda', false, 'Use cuda')
2016-06-20 09:43:48 +08:00
cmd:option('-device', 1, 'Cuda device to use')
2016-01-11 21:25:04 +08:00
cmd:option('-cache', false, 'Cache loaded data.')
2015-09-24 06:19:30 +08:00
cmd:text()
local opt = cmd:parse(arg or {})
os.execute('mkdir -p ' .. opt.outDir)
return opt
end
return M