Skip to content

Commit

Permalink
colorized face-detect
Browse files Browse the repository at this point in the history
  • Loading branch information
culurciello committed Jun 9, 2014
1 parent 830a143 commit 51a38c1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 0 additions & 2 deletions face-detector-elab/run.lua
Expand Up @@ -16,8 +16,6 @@ require 'qtuiloader'
require 'camera'
require 'image'
require 'nnx'
require 'torchffi'
local ffi = require('ffi')

print '==> processing options'

Expand Down
11 changes: 6 additions & 5 deletions profiling/conv-cpu.lua
@@ -1,11 +1,12 @@

-- libs:
require 'sys'
require 'cunn'
require 'nnx'
--require 'cunn'

-- dev:
cutorch.setDevice(arg[1] or 1)
print('DEVID = ' .. cutorch.getDevice())
--utorch.setDevice(arg[1] or 1)
--print('DEVID = ' .. cutorch.getDevice())

-- params:
batchSize = 32
Expand All @@ -25,7 +26,7 @@ n:add( nn.SpatialConvolutionMM(ninputs, nhiddens, fsize, fsize, stride, stride)
-- pre-alloc states:
n:forward(i)
n:backward(i, n.output)
cutorch.synchronize()
--cutorch.synchronize()

-- nb of operations:
opsPerMAC = 2
Expand All @@ -41,7 +42,7 @@ for t = 1,nbOfAverages do
n:forward(i)
n:backward(i, n.output)
end
cutorch.synchronize()
--cutorch.synchronize()
t = sys.toc()/nbOfAverages

-- result:
Expand Down
14 changes: 9 additions & 5 deletions train-face-detector-elab/run.lua
Expand Up @@ -7,9 +7,13 @@
----------------------------------------------------------------------

require 'pl'
require 'trepl'
require 'torch' -- torch
require 'image' -- to visualize the dataset
require 'nn' -- provides all sorts of trainable modules/layers

----------------------------------------------------------------------
print '==> processing options'
print(sys.COLORS.red .. '==> processing options')

opt = lapp[[
-r,--learningRate (default 1e-3) learning rate
Expand All @@ -33,21 +37,21 @@ torch.setdefaulttensortype('torch.FloatTensor')

-- type:
if opt.type == 'cuda' then
print('==> switching to CUDA')
print(sys.COLORS.red .. '==> switching to CUDA')
require 'cunn'
cutorch.setDevice(opt.devid)
print('==> using GPU #' .. cutorch.getDevice())
print(sys.COLORS.red .. '==> using GPU #' .. cutorch.getDevice())
end

----------------------------------------------------------------------
print '==> load modules'
print(sys.COLORS.red .. '==> load modules')

local data = require 'data'
local train = require 'train'
local test = require 'test'

----------------------------------------------------------------------
print '==> training!'
print(sys.COLORS.red .. '==> training!')

while true do
train(data.trainData)
Expand Down
2 changes: 1 addition & 1 deletion train-face-detector-elab/test.lua
Expand Up @@ -41,7 +41,7 @@ function test(testData)
local time = sys.clock()

-- test over test data
print('==> testing on test set:')
print(sys.COLORS.red .. '==> testing on test set:')
for t = 1,testData:size(),opt.batchSize do
-- disp progress
xlua.progress(t, testData:size())
Expand Down
2 changes: 1 addition & 1 deletion train-face-detector-elab/train.lua
Expand Up @@ -99,7 +99,7 @@ local function train(trainData)
local shuffle = torch.randperm(trainData:size())

-- do one epoch
print('==> doing epoch on training data:')
print(sys.COLORS.magenta .. '==> doing epoch on training data:')
print("==> online epoch # " .. epoch .. ' [batchSize = ' .. opt.batchSize .. ']')
for t = 1,trainData:size(),opt.batchSize do
-- disp progress
Expand Down

0 comments on commit 51a38c1

Please sign in to comment.