From a975155828a1c02495d46a392558f35dd7a5bba0 Mon Sep 17 00:00:00 2001 From: nagadomi Date: Mon, 30 Nov 2015 17:19:50 +0900 Subject: [PATCH] Change downscaling filters when photo training --- lib/pairwise_transform.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/pairwise_transform.lua b/lib/pairwise_transform.lua index 25000ce..32ad572 100644 --- a/lib/pairwise_transform.lua +++ b/lib/pairwise_transform.lua @@ -74,16 +74,23 @@ local function active_cropping(x, y, size, p, tries) end end function pairwise_transform.scale(src, scale, size, offset, n, options) - local filters = { - "Box","Box", -- 0.012756949974688 - "Blackman", -- 0.013191924552285 - --"Cartom", -- 0.013753536746706 - --"Hanning", -- 0.013761314529647 - --"Hermite", -- 0.013850225205266 - "Sinc", -- 0.014095824314306 - "Lanczos", -- 0.014244299255442 - "Catrom" - } + local filters; + + if options.style == "photo" then + filters = { + "Box", "lanczos", "Catrom" + } + else + filters = { + "Box","Box", -- 0.012756949974688 + "Blackman", -- 0.013191924552285 + --"Catrom", -- 0.013753536746706 + --"Hanning", -- 0.013761314529647 + --"Hermite", -- 0.013850225205266 + "Sinc", -- 0.014095824314306 + "Lanczos", -- 0.014244299255442 + } + end local unstable_region_offset = 8 local downscale_filter = filters[torch.random(1, #filters)] local y = preprocess(src, size, options)