Skip to content
Snippets Groups Projects
Commit 83261f3b authored by Stephan Hilb's avatar Stephan Hilb
Browse files

add readme and fix minor stuff

parent b9e15c67
Branches
No related tags found
No related merge requests found
......@@ -6,3 +6,18 @@ Read and use at your own risk.
[1] Stephan Hilb and Andreas Langer. 'A General Decomposition Method
for a Convex Problem Related to Total Variation Minimization'. In preparation.
2022
## Getting started
1. `julia --project=scripts/`
2. `]instantiate`
3. execute statements in `include("scripts/run.jl")`. There is a memory leak
currently, so the Julia session should better be restarted after every
experiment.
### Running parallel scaling tests
1. start Julia with e.g. `julia -p 9 --project=scripts/`
2. `@everywhere using Pkg`
3. `@everywhere Pkg.activate("scripts/")`
4. as above
......@@ -8,6 +8,7 @@ using CSV
using Colors: HSV
using DataFrames
using Distributed
@everywhere using DualTVDD
@everywhere using DualTVDD:
DualTVL1ROFOpProblem,
DualTVDDAlgorithm, ChambolleAlgorithm, NStepAlgorithm, ProjGradAlgorithm,# TVNewtonAlgorithm,
......@@ -60,7 +61,7 @@ function halve(img)
return res
end
# Problems
# Problem Definitions
function DenoiseProblem(img::AbstractArray{T,d}; λ, β = 0.) where {T,d}
B = (1 + β) * I
......@@ -73,9 +74,6 @@ function InpaintProblem(img::AbstractArray{T,d}, imgmask::AbstractArray{Bool,d};
pwop = imgmask .+ β .* Ref(I)
B = Diagonal(vec(inv.(pwop)))
## we grey-out the inpainting area.
## since β > 0 this actually matters and should be a sane default
#g = imgmask .* img .+ .!imgmask .* 0.5
g = imgmask .* img
return DualTVL1ROFOpProblem(g, B, λ)
end
......@@ -280,21 +278,17 @@ function experiment_scaling_opticalflow(ctx)
ntimings = 3
prob = OptFlowProblem(f0, f1; λ, β)
#return prob
galg = ChambolleAlgorithm(prob)
dalg(workers) =
DualTVDDAlgorithm(prob;
workers, M, overlap, ninner, parallel=false, σ=1.,
subalg = x -> ChambolleAlgorithm(x))
alg_ddseq(workers) = DualTVDDAlgorithm(prob; workers, M, overlap, ninner, parallel = false, σ = 1., subalg = x -> ChambolleAlgorithm(x))
alg_ddpar(workers) = DualTVDDAlgorithm(prob; workers, M, overlap, ninner, parallel = true, σ = 0.25, subalg = x -> ChambolleAlgorithm(x))
function timeit(alg)
# precompile
# warmup for precompilation
run_while((_, _) -> false, alg)
times = map(1:ntimings) do _
return @elapsed run_while(alg) do st, k
# min ~107
return energy(fetch(st), prob) > stopenergy
end
end
......@@ -311,13 +305,14 @@ function experiment_scaling_opticalflow(ctx)
nparallel % nw == 0 || continue
push!(df, (
nworkers = nw,
time = timeit(dalg(ws[1:nw]))))
time_ddseq = timeit(alg_ddseq(ws[1:nw])),
time_ddpar = timeit(alg_ddpar(ws[1:nw]))
))
end
display(df)
CSV.write(joinpath(ctx.outdir, "timings.csv"), df)
#saveimg(joinpath(ctx.outdir, "output_glob.png"), fetch_u(states.glob))
savedata(joinpath(ctx.outdir, "data.tex");
lambda=λ, beta=β, Mdir, M=prod(M),
ntimings, stopenergy, ninner,
......@@ -372,7 +367,7 @@ function _experiment_surrogate_outerinner(ctx, ref)
#residual = residual(fetch(state), prob),
)
end
display(df)
#display(df)
CSV.write(joinpath(ctx.outdir, "energies.csv"), df)
#saveimg(joinpath(ctx.outdir, "output_glob.png"), fetch_u(states.glob))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment