-
Notifications
You must be signed in to change notification settings - Fork 7
/
utils.lua
33 lines (27 loc) · 785 Bytes
/
utils.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
require 'torch'
require 'optim'
require 'os'
require 'optim'
require 'xlua'
--[[
function meters:reset()
self.val:reset()
self.train:reset()
self.clerr:reset()
self.ap:reset()
end --]] logs = {
train_loss_full = {},
train_loss = {},
val_loss = {},
map = {},
clerr = {},
}
function log(meters, logs)
local gnuplot = require 'gnuplot'
gnuplot.pngfigure(paths.concat('outputs' ,opt.output .. 'valtrain_' .. #logs.train_loss ..'.png'))
-- gnuplot.pngfigure(paths.concat('outputs','valtrain_1' .. #logs.train_loss ..'.png'))
gnuplot.plot({'train loss',
torch.range(1, #logs.train_loss),torch.Tensor(logs.train_loss)}, {'val loss',torch.Tensor(logs.val_loss)})
gnuplot.title('loss per epoch' .. opt.output)
gnuplot.plotflush()
end