From fe885a3466a0e419b514239a54f0093a59f40c69 Mon Sep 17 00:00:00 2001 From: nagadomi Date: Sun, 16 Apr 2017 04:38:53 +0900 Subject: [PATCH] Fix -pairwise_y_binary --- lib/pairwise_transform_user.lua | 7 ++++++- lib/pairwise_transform_utils.lua | 6 ------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/pairwise_transform_user.lua b/lib/pairwise_transform_user.lua index 51f3de2..b93c801 100644 --- a/lib/pairwise_transform_user.lua +++ b/lib/pairwise_transform_user.lua @@ -52,7 +52,12 @@ function pairwise_transform.user(x, y, size, offset, n, options) xc:add(-mean) end end - table.insert(batch, {xc, iproc.crop(yc, offset, offset, size - offset, size - offset)}) + yc = iproc.crop(yc, offset, offset, size - offset, size - offset) + if options.pairwise_y_binary then + yc[torch.lt(yc, 0.5)] = 0 + yc[torch.gt(yc, 0)] = 1 + end + table.insert(batch, {xc, yc}) end return batch diff --git a/lib/pairwise_transform_utils.lua b/lib/pairwise_transform_utils.lua index 75bce15..894efb2 100644 --- a/lib/pairwise_transform_utils.lua +++ b/lib/pairwise_transform_utils.lua @@ -108,12 +108,6 @@ function pairwise_transform_utils.preprocess_user(x, y, scale_y, size, options) x = iproc.crop_mod4(x) y = iproc.crop_mod4(y) - - if options.pairwise_y_binary then - y[torch.lt(y, 128)] = 0 - y[torch.gt(y, 0)] = 255 - end - return x, y end function pairwise_transform_utils.active_cropping(x, y, lowres_y, size, scale, p, tries)