Skip to content

Commit 86e4526

Browse files
author
Aysegul Dundar
committed
model.net converted to ascii
for compatibility across devices
1 parent 783379e commit 86e4526

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

face-detector-elab/model.net

-226 KB
Binary file not shown.

face-detector-elab/run.lua

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ require 'qtuiloader'
1616
require 'camera'
1717
require 'image'
1818
require 'nnx'
19-
2019
print '==> processing options'
2120

2221
opt = lapp[[
@@ -55,7 +54,7 @@ function prune(detections)
5554
local duplicate = 0
5655
for j, prune in ipairs(pruned) do
5756
-- if two detections left top corners are in close proximity discard one
58-
-- 70 is a proximity threshold can be changed
57+
-- 70 is a proximity threshold can be changed
5958
if (torch.abs(prune.x-detect.x)+torch.abs(prune.y-detect.y)<70) then
6059
duplicate = 1
6160
end
@@ -64,14 +63,14 @@ function prune(detections)
6463
if duplicate == 0 then
6564
pruned[index] = {x=detect.x, y=detect.y, w=detect.w, h=detect.h}
6665
index = index+1
67-
end
66+
end
6867
end
6968

7069
return pruned
7170
end
7271

7372
-- load pre-trained network from disk
74-
network1 = torch.load(opt.network) --load a network split in two: network and classifier
73+
network1 = torch.load(opt.network, 'ascii') --load a network split in two: network and classifier
7574
network = network1.modules[1] -- split network
7675
network1.modules[2].modules[3] = nil -- remove logsoftmax
7776
classifier1 = network1.modules[2] -- split and reconstruct classifier
@@ -123,13 +122,13 @@ function process()
123122
frame = camera:forward()
124123

125124
-- (2) transform it into Y space and global normalize:
126-
frameY = image.rgb2y(frame)
125+
frameY = image.rgb2y(frame)
127126
-- global normalization:
128127
local fmean = frameY:mean()
129128
local fstd = frameY:std()
130129
frameY:add(-fmean)
131130
frameY:div(fstd)
132-
131+
133132
-- (3) create multiscale pyramid
134133
pyramid, coordinates = packer:forward(frameY)
135134
-- local contrast normalization:
@@ -141,7 +140,7 @@ function process()
141140
distributions = unpacker:forward(multiscale, coordinates)
142141
-- (6) parse distributions to extract blob centroids
143142
threshold = widget.verticalSlider.value/100 -1.5
144-
143+
145144

146145
rawresults = {}
147146
for i,distribution in ipairs(distributions) do

0 commit comments

Comments
 (0)