Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
54 lines (46 loc) · 1.62 KB

File metadata and controls

54 lines (46 loc) · 1.62 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
----------------------------------------------------------------------
--require('mobdebug').start()
require 'torch' -- torch
require 'nn'
require 'rnn'
require 'xlua'
dofile ('model/structured_hinge_loss.lua') -- new loss function
d = dofile('common/data.lua')
m = dofile('model/model.lua')
eval = dofile('evaluate.lua')
----------------------------------------------------------------------
if not opt then
print '==> processing options'
cmd = torch.CmdLine()
cmd:text()
cmd:text('Bi-RNN for Audio Segmentation')
cmd:text()
cmd:text('Options:')
-- general
cmd:option('-seed', 1234, 'the seed to generate numbers')
-- data
cmd:option('-features_path', 'data/word_duration/test/', 'the path to the features file')
cmd:option('-labels_path', 'data/word_duration/test/', 'the path to the labels file')
cmd:option('-input_dim', 13, 'the input size')
-- train
cmd:option('-model', 'results/model.net', 'the path to the model directory')
cmd:option('-type', 'double', 'data type: double | cuda')
-- loss
cmd:option('-eps', 2, 'the tolerance value for the loss function')
cmd:text()
opt = cmd:parse(arg or {})
end
----------------------------------------------------------------------
torch.manualSeed(opt.seed)
local eps = 2
d:new()
print '==> Loading data set'
x, y, f_n = d:read_data(opt.features_path, opt.labels_path, opt.input_dim, 'test.t7')
print '==> define loss'
criterion = nn.StructuredHingeLoss(eps)
print(criterion)
print '==> loading model'
model = torch.load(opt.model)
print(model)
print '==> predict '
local loss, score = eval:evaluate(model, criterion, x, y, f_n, true)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.