openface/batch-represent/opts.lua

36 lines
1.0 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-08 07:28:05 +08:00
paths.concat(script_path(), '..', 'models', 'openface', 'nn4.v2.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')
cmd:text()
local opt = cmd:parse(arg or {})
os.execute('mkdir -p ' .. opt.outDir)
return opt
end
return M