Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • stephan.hilb/SemiSmoothNewton.jl
1 result
Select Git revision
Show changes
Commits on Source (5)
......@@ -19,20 +19,27 @@ ctx(experiment_convergence_rate, "fem/convergence/rate")
# pd est, L1-TV, bad
# applications
# misc experiments
# denoising
ctx(experiment_denoise, "fem/denoise")
# inpainting
# inpainting (OLD)
ctx(experiment_inpaint, "fem/inpaint")
# adaptive optical flow
ctx(experiment_optflow_middlebury_all, "fem/optflow/middlebury")
# additional experiments for paper
# combined inpainting + denoising with mixed noise
ctx(experiment_inpaint_denoise, "fem/optflow/inpaint_denoise")
# comparison: warping and adaptivity
ctx(experiment_optflow_middlebury_warping_comparison, "fem/optflow/middlebury_warping_comparison")
function paper1(ctx)
# newton vs other algs
ctx(experiment_convergence_rate, "fem/convergence/rate")
# denoising
ctx(experiment_denoise, "fem/denoise")
# combined inpainting + denoising with mixed noise
ctx(experiment_inpaint_denoise, "fem/inpaint_denoise")
# comparison: warping and adaptivity
ctx(experiment_optflow_middlebury_warping_comparison, "fem/opticalflow/middlebury_warping_comparison")
end
function paper2(ctx)
# comparison: warping and adaptivity
# TODO: adaptivity parameter?
ctx(experiment_optflow_middlebury_warping_comparison, "fem/opticalflow/middlebury_warping_comparison")
end
......@@ -988,10 +988,12 @@ function denoise_pd(ctx)
# semi-implicit primal dual parameters
mu = st.alpha2 + st.beta # T = I, S = I
mu /= 100 # kind of arbitrary?
#mu /= 100 # kind of arbitrary?
tau = 1e-1
L = norm_gradient(mesh)
#tau = 1e-1
tau = 1 / L
#L = 100
sigma = inv(tau * L^2)
theta = NaN # initialized later
......@@ -1022,6 +1024,7 @@ function denoise_pd(ctx)
while true
k += 1
if ctx.params.algorithm == :pd1
theta = 1 / sqrt(1 + 2 * mu * tau) # constant
# no step size control
step_pd2!(st; sigma, tau, theta)
elseif ctx.params.algorithm == :pd2
......@@ -1322,6 +1325,7 @@ function experiment_approximation(ctx)
end
# TODO: deduplicate, cf. optflow()
# NOTE: used also by inpaint_denoise experiment
function inpaint(ctx)
# expect ctx.params.g_arr
......@@ -1350,13 +1354,15 @@ function inpaint(ctx)
if ctx.params.n_refine == 0
# if we use a grid at image resolution, we wan't to avoid
# information loss at all cost.
# projet_l2_pixel is not suited for inpainting as it is a global
# project_l2_pixel is not suited for inpainting as it is a global
# operator, which may leak data from the inpainting domain
interpolate!(st.g, x -> evaluate_bilinear(g_arr, x))
interpolate!(st.tdata, x -> evaluate_bilinear(mask_arr, x))
else
project_image!(st.g, g_arr)
# TODO: maybe a more conservative choice would be good
project_image!(st.tdata, mask_arr)
end
project_image!(st.tdata, mask_arr)
end
save_step(i) =
......@@ -1427,7 +1433,7 @@ function inpaint(ctx)
u_sampled = sample(st.u)
saveimg(joinpath(ctx.outdir, "g.png"), grayclamp.(to_img(g_arr)))
saveimg(joinpath(ctx.outdir, "output.png"), grayclamp.(to_img(u_sampled)))
save_csv(joinpath(ctx.outdir, "mesh.csv"), st.u)
#save_csv(joinpath(ctx.outdir, "mesh.csv"), st.u)
savedata(joinpath(ctx.outdir, "data.tex");
ctx.params.eps_newton, ctx.params.n_refine,
st.alpha1, st.alpha2, st.lambda, st.beta, st.gamma1, st.gamma2,
......@@ -1495,7 +1501,12 @@ function optflow(ctx)
size(ctx.params.imgf0) == size(ctx.params.imgf1) ||
throw(ArgumentError("non-matching image sizes"))
project_image! = project_l2_lagrange!
#project_image! = project_l2_lagrange!
project_image!(f, img) =
ctx.params.n_refine == 0 ?
interpolate!(f, x -> evaluate_bilinear(img, x)) : # fine mesh
project_l2_lagrange! # coarse adaptive mesh
eps_newton = 1e-3 # cauchy criterion for inner newton loop
eps_warp = 0.05
......@@ -1672,6 +1683,13 @@ function experiment_optflow_middlebury_warping_comparison(ctx)
warp = false, refine = false, n_refine = 0)
ctx(experiment_optflow_middlebury_all_benchmarks, "warping";
warp = true, refine = false, n_refine = 0)
end
function experiment_optflow_middlebury_warping_comparison_adaptive(ctx)
ctx(experiment_optflow_middlebury_all_benchmarks, "vanilla";
warp = false, refine = false, n_refine = 0)
ctx(experiment_optflow_middlebury_all_benchmarks, "warping";
warp = true, refine = false, n_refine = 0)
ctx(experiment_optflow_middlebury_all_benchmarks, "adaptive-warping";
warp = true, refine = true, n_refine = 6)
end
......