[b758a2]: / code / randRotateMirror.lua

Download this file

15 lines (13 with data), 314 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
function randRotateMirror(dataset)
for i=1,dataset:size() do
theta = math.pi/2*torch.random(0,3)
sample = dataset[i][1]
sample = sample:double()
sample = image.rotate(sample,theta)
if torch.rand(1,2) == 1 then
sample = image.hflip(sample)
end
dataset[i][1] = sample
end
return dataset
end