Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
994 additions
and
840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
*.pyc | ||
exp/ | ||
data/**/images | ||
src/models/old |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
require 'paths' | ||
paths.dofile('ref.lua') -- Parse command line input and do global variable initialization | ||
paths.dofile('data.lua') -- Set up data processing | ||
paths.dofile('model.lua') -- Read in network model | ||
paths.dofile('train.lua') -- Load up training/testing functions | ||
|
||
-- Set up data loader | ||
torch.setnumthreads(1) | ||
local Dataloader = require 'dataloader' | ||
loader = Dataloader.create(opt) | ||
local Dataloader = paths.dofile('util/dataloader.lua') | ||
loader = Dataloader.create(opt, dataset, ref) | ||
|
||
isFinished = false -- Finish early if validation accuracy plateaus, can be adjusted with opt.threshold | ||
-- Initialize logs | ||
ref.log = {} | ||
ref.log.train = Logger(paths.concat(opt.save, 'train.log'), opt.continue) | ||
ref.log.valid = Logger(paths.concat(opt.save, 'valid.log'), opt.continue) | ||
|
||
-- Main training loop | ||
for i=1,opt.nEpochs do | ||
train() | ||
valid() | ||
collectgarbage() | ||
print("==> Starting epoch: " .. epoch .. "/" .. (opt.nEpochs + opt.epochNumber - 1)) | ||
if opt.trainIters > 0 then train() end | ||
if opt.validIters > 0 then valid() end | ||
epoch = epoch + 1 | ||
if isFinished then break end | ||
collectgarbage() | ||
end | ||
|
||
-- Update options/reference for last epoch | ||
-- Update reference for last epoch | ||
opt.lastEpoch = epoch - 1 | ||
torch.save(opt.save .. '/options.t7', opt) | ||
|
||
-- Generate final predictions on validation set | ||
if opt.finalPredictions == 1 then predict() end | ||
|
||
-- Save model | ||
model:clearState() | ||
torch.save(paths.concat(opt.save,'final_model.t7'), model) | ||
torch.save(paths.concat(opt.save,'options.t7'), opt) | ||
torch.save(paths.concat(opt.save,'optimState.t7'), optimState) | ||
torch.save(paths.concat(opt.save,'final_model.t7'), model) | ||
|
||
-- Generate final predictions on validation set | ||
if opt.finalPredictions then | ||
ref.log = {} | ||
loader.test = Dataloader(opt, dataset, ref, 'test') | ||
predict() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.