1
0
Fork 0
mirror of synced 2024-05-19 20:32:22 +12:00

Change the jpeg config for the photo model

This commit is contained in:
nagadomi 2015-11-15 09:36:40 +09:00
parent c4657b4720
commit b5db84d42e
2 changed files with 14 additions and 5 deletions

View file

@ -189,13 +189,19 @@ function pairwise_transform.jpeg(src, style, level, size, offset, n, options)
end
elseif style == "photo" then
if level == 1 then
return pairwise_transform.jpeg_(src, {torch.random(80, 95)},
return pairwise_transform.jpeg_(src, {torch.random(30, 75)},
size, offset, n,
options)
elseif level == 2 then
return pairwise_transform.jpeg_(src, {torch.random(65, 85)},
size, offset, n,
options)
if torch.uniform() > 0.6 then
return pairwise_transform.jpeg_(src, {torch.random(30, 60)},
size, offset, n, options)
else
local quality1 = torch.random(40, 60)
local quality2 = quality1 - torch.random(5, 10)
return pairwise_transform.jpeg_(src, {quality1, quality2},
size, offset, n, options)
end
else
error("unknown noise level: " .. level)
end

View file

@ -2,5 +2,8 @@
th convert_data.lua -data_dir ./data/ukbench
th train.lua -method scale -data_dir ./data/ukbench -model_dir models/ukbench -test images/lena.jpg -thread 4
#th train.lua -style photo -method noise -noise_level 2 -data_dir ./data/ukbench -model_dir models/ukbench -test images/lena.png -nr_rate 0.9 -jpeg_sampling_factors 420 # -thread 4 -backend cudnn
#th tools/cleanup_model.lua -model models/ukbench/noise2_model.t7 -oformat ascii
th train.lua -method scale -data_dir ./data/ukbench -model_dir models/ukbench -test images/lena.jpg # -thread 4 -backend cudnn
th tools/cleanup_model.lua -model models/ukbench/scale2.0x_model.t7 -oformat ascii