Permalink
Browse files

Using new file/dir styles for trainer/logger

  • Loading branch information...
1 parent 84f7163 commit e8781bffca347267d4e4ad84381699b2676de49c @clementfarabet clementfarabet committed Jul 13, 2011
@@ -24,9 +24,10 @@ xrequire ('nnx', true)
----------------------------------------------------------------------
-- parse options
--
+dname,fname = sys.fpath()
op = xlua.OptionParser('%prog [options]')
op:option{'-s', '--save', action='store', dest='save',
- default='digit-net',
+ default=fname:gsub('.lua','') .. '/digit.net',
help='file to save network after each epoch'}
op:option{'-l', '--load', action='store', dest='network',
help='reload pretrained network'}
@@ -94,8 +95,8 @@ classes = {'1','2','3','4','5','6','7','8','9','10'}
confusion = nn.ConfusionMatrix(classes)
-trainLogger = nn.Logger(opt.save .. '/train-log')
-testLogger = nn.Logger(opt.save .. '/test-log')
+trainLogger = nn.Logger(sys.dirname(opt.save) .. '/train.log')
+testLogger = nn.Logger(sys.dirname(opt.save) .. '/test.log')
trainer.hookTrainSample = function(trainer, sample)
confusion:add(trainer.module.output, sample[2])
@@ -24,9 +24,10 @@ xrequire ('nnx', true)
----------------------------------------------------------------------
-- parse options
--
+dname,fname = sys.fpath()
op = xlua.OptionParser('%prog [options]')
op:option{'-s', '--save', action='store', dest='save',
- default='face-net',
+ default=fname:gsub('.lua','') .. '/face.net'
help='file to save network after each epoch'}
op:option{'-l', '--load', action='store', dest='network',
help='reload pretrained network'}
@@ -86,8 +87,8 @@ trainer:setShuffle(false)
confusion = nn.ConfusionMatrix{'Faces', 'Background'}
-trainLogger = nn.Logger(opt.save .. '/train-log')
-testLogger = nn.Logger(opt.save .. '/test-log')
+trainLogger = nn.Logger(sys.dirname(opt.save) .. '/train.log')
+testLogger = nn.Logger(sys.dirname(opt.save) .. '/test.log')
trainer.hookTrainSample = function(trainer, sample)
confusion:add(trainer.module.output, sample[2])

0 comments on commit e8781bf

Please sign in to comment.