-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main.lua
77 lines (57 loc) · 2.42 KB
/
test_main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require "nn"
require "dataset"
require "gnuplot"
require "image"
function get_label (one_hot_vector)
for i = 1, one_hot_vector:size()[1] do
if one_hot_vector[i] == 1 then
return i
end
end
return 0
end
--------------------------------------------------------------
-- Parse command line options
--------------------------------------------------------------
cmd = torch.CmdLine()
cmd:text()
cmd:text("Argument")
cmd:argument("-test_data", "test data file (.t7)")
cmd:argument("-dataset_attributes", "dataset attributes (mean & std)")
cmd:argument("-pretrained_model", "pretrained model (.net)")
cmd:text("Options")
cmd:option("-out", "out.png", "out file (.png)")
cmd:option("-gpu", false, "use gpu")
cmd:option("-log", "", "output log file")
params = cmd:parse(arg)
if params.log ~= "" then
cmd:log(params.log, params)
end
--------------------------------------------------------------
--------------------------------------------------------------
-- Load test data
--------------------------------------------------------------
cmd:text("")
dataset_attributes = torch.load(params.dataset_attributes)
test_data = massa.load_normalized_dataset(params.test_data, dataset_attributes.mean, dataset_attributes.std)
model = torch.load(params.pretrained_model)
--------------------------------------------------------------
--------------------------------------------------------------
-- Parse command line options
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
-- Parse command line options
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------