Change the jpeg config for the photo model
This commit is contained in:
parent
c4657b4720
commit
b5db84d42e
|
@ -189,13 +189,19 @@ function pairwise_transform.jpeg(src, style, level, size, offset, n, options)
|
||||||
end
|
end
|
||||||
elseif style == "photo" then
|
elseif style == "photo" then
|
||||||
if level == 1 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,
|
size, offset, n,
|
||||||
options)
|
options)
|
||||||
elseif level == 2 then
|
elseif level == 2 then
|
||||||
return pairwise_transform.jpeg_(src, {torch.random(65, 85)},
|
if torch.uniform() > 0.6 then
|
||||||
size, offset, n,
|
return pairwise_transform.jpeg_(src, {torch.random(30, 60)},
|
||||||
options)
|
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
|
else
|
||||||
error("unknown noise level: " .. level)
|
error("unknown noise level: " .. level)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
|
|
||||||
th convert_data.lua -data_dir ./data/ukbench
|
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
|
th tools/cleanup_model.lua -model models/ukbench/scale2.0x_model.t7 -oformat ascii
|
||||||
|
|
Loading…
Reference in a new issue