@@ -16,7 +16,6 @@ require 'qtuiloader'
16
16
require ' camera'
17
17
require ' image'
18
18
require ' nnx'
19
-
20
19
print ' ==> processing options'
21
20
22
21
opt = lapp [[
@@ -55,7 +54,7 @@ function prune(detections)
55
54
local duplicate = 0
56
55
for j , prune in ipairs (pruned ) do
57
56
-- 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
59
58
if (torch .abs (prune .x - detect .x )+ torch .abs (prune .y - detect .y )< 70 ) then
60
59
duplicate = 1
61
60
end
@@ -64,14 +63,14 @@ function prune(detections)
64
63
if duplicate == 0 then
65
64
pruned [index ] = {x = detect .x , y = detect .y , w = detect .w , h = detect .h }
66
65
index = index + 1
67
- end
66
+ end
68
67
end
69
68
70
69
return pruned
71
70
end
72
71
73
72
-- 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
75
74
network = network1 .modules [1 ] -- split network
76
75
network1 .modules [2 ].modules [3 ] = nil -- remove logsoftmax
77
76
classifier1 = network1 .modules [2 ] -- split and reconstruct classifier
@@ -123,13 +122,13 @@ function process()
123
122
frame = camera :forward ()
124
123
125
124
-- (2) transform it into Y space and global normalize:
126
- frameY = image .rgb2y (frame )
125
+ frameY = image .rgb2y (frame )
127
126
-- global normalization:
128
127
local fmean = frameY :mean ()
129
128
local fstd = frameY :std ()
130
129
frameY :add (- fmean )
131
130
frameY :div (fstd )
132
-
131
+
133
132
-- (3) create multiscale pyramid
134
133
pyramid , coordinates = packer :forward (frameY )
135
134
-- local contrast normalization:
@@ -141,7 +140,7 @@ function process()
141
140
distributions = unpacker :forward (multiscale , coordinates )
142
141
-- (6) parse distributions to extract blob centroids
143
142
threshold = widget .verticalSlider .value / 100 - 1.5
144
-
143
+
145
144
146
145
rawresults = {}
147
146
for i ,distribution in ipairs (distributions ) do
0 commit comments