diff --git a/README.md b/README.md index 031c0ea..4009948 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ cd bnn.torch/; luarocks make; cd ..; Install the modified optnet package ```bash -cd optimize-net/; luarocks make; cd ..; +cd optimize-net/; luarocks make rocks/optnet-scm-1.rockspec; cd ..; ``` Run the following command to prepare the files required by the demo. This will download 10 images from the MPII dataset alongside the dataset structure converted to .t7 diff --git a/main.lua b/main.lua index ce107dc..677483d 100644 --- a/main.lua +++ b/main.lua @@ -4,7 +4,7 @@ require 'cudnn' require 'paths' require 'bnn' -require 'optim' +local optnet = require 'optnet' require 'gnuplot' require 'image' @@ -16,13 +16,16 @@ torch.setheaptracking(true) torch.setdefaulttensortype('torch.FloatTensor') torch.setnumthreads(1) -local model = torch.load('models/humanpose_binary.t7') +local model = torch.load('models/human_pose_binary.t7') model:evaluate() local fileLists = utils.getFileList(opts) local predictions = {} local output = torch.CudaTensor(1,16,64,64) +optimize_opts = {inplace=true, reuseBuffers=true, mode='inference'} +optnet.optimizeMemory(model, torch.zeros(1,3,256,256):cuda(), optimize_opts) + if opts.mode == 'eval' then xlua.progress(0,#fileLists) end for i = 1, #fileLists do fileLists[i].image = 'dataset/mpii/images/'..fileLists[i].image