1
0
Fork 0
mirror of synced 2024-05-17 03:12:18 +12:00
This commit is contained in:
nagadomi 2017-02-19 01:42:40 +09:00
parent 8b5ccbed08
commit 385020e0e1

View file

@ -127,11 +127,11 @@ function pairwise_transform_utils.active_cropping(x, y, lowres_y, size, scale, p
if p < r then
local xi = 0
local yi = 0
if x:size(2) > size + 1 then
xi = torch.random(0, x:size(2) - (size + 1)) * scale
end
if x:size(3) > size + 1 then
yi = torch.random(0, x:size(3) - (size + 1)) * scale
xi = torch.random(0, x:size(3) - (size + 1)) * scale
end
if x:size(2) > size + 1 then
yi = torch.random(0, x:size(2) - (size + 1)) * scale
end
local yc = iproc.crop(y, xi, yi, xi + size, yi + size)
local xc = iproc.crop(x, xi / scale, yi / scale, xi / scale + size / scale, yi / scale + size / scale)