diff --git a/lib/pairwise_transform_jpeg_scale.lua b/lib/pairwise_transform_jpeg_scale.lua index b04a13c..23a0b10 100644 --- a/lib/pairwise_transform_jpeg_scale.lua +++ b/lib/pairwise_transform_jpeg_scale.lua @@ -63,22 +63,12 @@ function pairwise_transform.jpeg_scale(src, scale, style, noise_level, size, off assert(y:size(2) % 4 == 0 and y:size(3) % 4 == 0) local down_scale = 1.0 / scale local x - if options.gamma_correction then - local small = iproc.scale_with_gamma22(y, y:size(3) * down_scale, - y:size(2) * down_scale, downsampling_filter, blur) - if options.x_upsampling then - x = iproc.scale(small, y:size(3), y:size(2), "Box") - else - x = small - end + local small = iproc.scale(y, y:size(3) * down_scale, + y:size(2) * down_scale, downsampling_filter, blur) + if options.x_upsampling then + x = iproc.scale(small, y:size(3), y:size(2), "Box") else - local small = iproc.scale(y, y:size(3) * down_scale, - y:size(2) * down_scale, downsampling_filter, blur) - if options.x_upsampling then - x = iproc.scale(small, y:size(3), y:size(2), "Box") - else - x = small - end + x = small end local scale_inner = scale if options.x_upsampling then diff --git a/lib/pairwise_transform_scale.lua b/lib/pairwise_transform_scale.lua index e6b91bd..5af0f94 100644 --- a/lib/pairwise_transform_scale.lua +++ b/lib/pairwise_transform_scale.lua @@ -15,22 +15,12 @@ function pairwise_transform.scale(src, scale, size, offset, n, options) assert(y:size(2) % 4 == 0 and y:size(3) % 4 == 0) local down_scale = 1.0 / scale local x - if options.gamma_correction then - local small = iproc.scale_with_gamma22(y, y:size(3) * down_scale, - y:size(2) * down_scale, downsampling_filter, blur) - if options.x_upsampling then - x = iproc.scale(small, y:size(3), y:size(2), "Box") - else - x = small - end - else - local small = iproc.scale(y, y:size(3) * down_scale, + local small = iproc.scale(y, y:size(3) * down_scale, y:size(2) * down_scale, downsampling_filter, blur) - if options.x_upsampling then - x = iproc.scale(small, y:size(3), y:size(2), "Box") - else - x = small - end + if options.x_upsampling then + x = iproc.scale(small, y:size(3), y:size(2), "Box") + else + x = small end local scale_inner = scale if options.x_upsampling then diff --git a/lib/settings.lua b/lib/settings.lua index 090f9bc..f90d9ad 100644 --- a/lib/settings.lua +++ b/lib/settings.lua @@ -50,7 +50,6 @@ cmd:option("-nr_rate", 0.75, 'trade-off between reducing noise and erasing detai cmd:option("-save_history", 0, 'save all model (0|1)') cmd:option("-plot", 0, 'plot loss chart(0|1)') cmd:option("-downsampling_filters", "Box,Lanczos,Sinc", '(comma separated)downsampling filters for 2x scale training. (Point,Box,Triangle,Hermite,Hanning,Hamming,Blackman,Gaussian,Quadratic,Cubic,Catrom,Mitchell,Lanczos,Bessel,Sinc)') -cmd:option("-gamma_correction", 0, 'Resizing with colorspace correction(sRGB:gamma 2.2) in scale training (0|1)') cmd:option("-max_training_image_size", -1, 'if training image is larger than N, image will be crop randomly when data converting') cmd:option("-use_transparent_png", 0, 'use transparent png (0|1)') cmd:option("-resize_blur_min", 0.95, 'min blur parameter for ResizeImage') @@ -75,7 +74,6 @@ for k, v in pairs(opt) do end to_bool(settings, "plot") to_bool(settings, "save_history") -to_bool(settings, "gamma_correction") to_bool(settings, "use_transparent_png") if settings.plot then diff --git a/tools/benchmark.lua b/tools/benchmark.lua index 1375a61..4cb50f4 100644 --- a/tools/benchmark.lua +++ b/tools/benchmark.lua @@ -26,7 +26,6 @@ cmd:option("-jpeg_quality", 75, 'jpeg quality') cmd:option("-jpeg_times", 1, 'jpeg compression times') cmd:option("-jpeg_quality_down", 5, 'value of jpeg quality to decrease each times') cmd:option("-range_bug", 0, 'Reproducing the dynamic range bug that is caused by MATLAB\'s rgb2ycbcr(1|0)') -cmd:option("-gamma_correction", 0, 'Resizing with colorspace correction(sRGB:gamma 2.2) (0|1)') cmd:option("-save_image", 0, 'save converted images') cmd:option("-save_baseline_image", 0, 'save baseline images') cmd:option("-output_dir", "./", 'output directroy') @@ -50,7 +49,6 @@ if cudnn then cudnn.fastest = true cudnn.benchmark = false end -to_bool(opt, "gamma_correction") to_bool(opt, "save_all") to_bool(opt, "tta") if opt.save_all then @@ -122,17 +120,10 @@ local function baseline_scale(x, filter) filter) end local function transform_scale(x, opt) - if opt.gamma_correction then - return iproc.scale_with_gamma22(x, - x:size(3) * 0.5, - x:size(2) * 0.5, - opt.filter, opt.resize_blur) - else - return iproc.scale(x, - x:size(3) * 0.5, - x:size(2) * 0.5, - opt.filter, opt.resize_blur) - end + return iproc.scale(x, + x:size(3) * 0.5, + x:size(2) * 0.5, + opt.filter, opt.resize_blur) end local function benchmark(opt, x, input_func, model1, model2) diff --git a/train.lua b/train.lua index 1b27949..215b4ce 100644 --- a/train.lua +++ b/train.lua @@ -150,7 +150,6 @@ local function transformer(model, x, is_validation, n, offset) active_cropping_rate = active_cropping_rate, active_cropping_tries = active_cropping_tries, rgb = (settings.color == "rgb"), - gamma_correction = settings.gamma_correction, x_upsampling = not reconstruct.has_resize(model), resize_blur_min = settings.resize_blur_min, resize_blur_max = settings.resize_blur_max}, meta) @@ -188,7 +187,6 @@ local function transformer(model, x, is_validation, n, offset) active_cropping_rate = active_cropping_rate, active_cropping_tries = active_cropping_tries, rgb = (settings.color == "rgb"), - gamma_correction = settings.gamma_correction, x_upsampling = not reconstruct.has_resize(model), resize_blur_min = settings.resize_blur_min, resize_blur_max = settings.resize_blur_max}, meta)