This is usefull for ImageNet training when it loads a ton of images which are kept in page memory until training starts to lag.
Assume we are on Ubuntu.
First, create a cron job from root:
sudo crontab -e
diff --git a/torchfile.py b/torchfile.py | |
index cba1145..61fea4a 100644 | |
--- a/torchfile.py | |
+++ b/torchfile.py | |
@@ -378,6 +378,16 @@ class T7Reader: | |
obj = lst | |
self.objects[index] = obj | |
return obj | |
+ elif typeidx >= 50: | |
+ size = typeidx |
-- 2014 Sergey Zagoruyko, ENPC-UPEM, IMAGINE, Paris | |
-- Creates a t7 file from local image patches dataset | |
-- http://www.cs.ubc.ca/~mbrown/patchdata/patchdata.html | |
-- usage: | |
-- th create_dataset_file.lua *dataset_name* | |
-- where dataset_name is notredame, liberty or yosemite | |
-- which is also a folder with the same name, containing: | |
-- info.txt, m_50_500000_500000_0.txt and 1024x1024 bmp images | |
-- saves data.t7 file in the corresponding folder | |
require 'sys' |
local tablex = require 'pl.tablex' | |
require 'cunn' | |
require 'cudnn' | |
local utils = dofile '/opt/projects/coco/fastrcnn/models/model_utils.lua' | |
dofile'/home/zagoruys/projects/cifar2.torch/augmentation.lua' | |
local net = torch.load'./model_35.t7' | |
cudnn.convert(net, nn) |
The OpenCV library implements tons of useful image processing and computer vision algorithms, as well as the high-level GUI API. Written in C++, it has bindings in Python, Java, MATLAB/Octave, C#, Perl and Ruby. We present the Lua bindings that are based on Torch, made by VisionLabs with support from Facebook and Google Deepmind.
By combining OpenCV with scientific computation abilities of Torch, one gets an even more powerful framework capable of handling computer vision routines (e.g. face detection), interfacing video streams (including cameras), easier data visualization, GUI interaction and many more. In addition, most of the computationally intensive algorithms are available on GPU via Cutorch. All these features may be essentially useful for those dealing with deep learning applied to images.
The OpenCV library implements tons of useful image processing and computer vision algorithms, as well as the high-level GUI API. Written in C++, it has bindings in Python, Java, MATLAB/Octave, C#, Perl and Ruby. We present the Lua bindings that are based on Torch, made by VisionLabs with support from Facebook and Google Deepmind.
By combining OpenCV with scientific computation abilities of Torch, one gets an even more powerful framework capable of handling computer vision routines (e.g. face detection), interfacing video streams (including cameras), easier data visualization, GUI interaction and many more. In addition, most of the computationally intensive algorithms are available on GPU via Cutorch. All these features may be essentially useful for those dealing with deep learning applied to images.
Trained by facebook using https://github.com/facebook/fb.resnet.torch
The model was converted to nn
backend and BatchNorm folded into convolutional layers with this script
https://github.com/szagoruyko/imagine-nn/blob/utils/utils.lua
gradWeight
and gradBias
were removed from convolutional layers.
require 'xlua' | |
local grad = require 'autograd' | |
local tablex = require 'pl.tablex' | |
grad.optimize(true) | |
local function cast(x) | |
if type(x) == 'table' then | |
for k,v in pairs(x) do x[k] = cast(v) end | |
return x | |
else |
roc = function(scores) | |
local L,I = torch.sort(scores[{{}, 1}], 1, true) | |
local labels = scores[{{},2}]:index(1,I) | |
local fprev = - math.huge | |
local FP = 0.0 | |
local TP = 0.0 | |
local n = labels:size(1) | |
local N = n/2 | |
local P = n/2 | |
local j = 1 |
56.7% top1 center crop accuracy (trained in torch)
https://gist.github.com/szagoruyko/dd032c529048492630fc
62.6% top1 center crop accuracy (trained in torch)