Thu, 25 Apr 2024 11:14:41 -0500
DualScaling parametrisation
--- a/src/AlgorithmDualScaling.jl Thu Apr 25 11:16:24 2024 -0500 +++ b/src/AlgorithmDualScaling.jl Thu Apr 25 11:14:41 2024 -0500 @@ -51,15 +51,16 @@ iterate = AlgTools.simple_iterate, params::NamedTuple) where DisplacementT - ################################ + ################################ # Extract and set up parameters - ################################ + ################################ α, ρ = params.α, params.ρ R_K² = ∇₂_norm₂₂_est² γ = 1.0 Λ = params.Λ τ₀, σ₀ = params.τ₀, params.σ₀ + ds = DualScaling(params.ds_exponent, params.ds_threshold) τ = τ₀/γ @assert(1+γ*τ ≥ Λ) @@ -91,7 +92,7 @@ init_data = false end - pdflow!(x, Δx, y, Δy, v_known, DualScaling()) + pdflow!(x, Δx, y, Δy, v_known, ds) ############ # PDPS step @@ -108,7 +109,7 @@ ################################ # Give function value if needed ################################ - v = verbose() do + v = verbose() do ∇₂!(Δy, x) value = norm₂²(b-x)/2 + params.α*γnorm₂₁(Δy, params.ρ) value, x, [NaN, NaN], nothing
--- a/src/OpticalFlow.jl Thu Apr 25 11:16:24 2024 -0500 +++ b/src/OpticalFlow.jl Thu Apr 25 11:14:41 2024 -0500 @@ -60,7 +60,12 @@ ################################# # Struct for flow ################################# -struct DualScaling end +struct DualScaling + exponent :: Integer + threshold :: Real + DualScaling(e = 10, t = 1e-1) = new(e, t) +end + struct Greedy end struct Rotation end @@ -164,8 +169,8 @@ flow!(x, u; threads=(threads==:inner)) C = similar(y) cc = abs.(x-oldx) - cm = max(1e-12,maximum(cc)) - c = 1 .* (1 .- cc./ cm) .^(10) + cm = max(flow.threshold,maximum(cc)) + c = 1 .* (1 .- cc./ cm) .^flow.exponent C[1,:,:] .= c C[2,:,:] .= c y .= C.*y