forked from cmusatyalab/openface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opts.lua
37 lines (30 loc) · 1.05 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
local lfs = require 'lfs'
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()
cmd:text('OpenFace')
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',
paths.concat(script_path(), '..', 'models', 'openface', 'nn4.v1.t7'),
'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