Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SemiSmoothNewton.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephan Hilb
SemiSmoothNewton.jl
Commits
4a819a2c
Commit
4a819a2c
authored
Jul 3, 2024
by
Andreas Langer
Committed by
Stephan Hilb
Jul 3, 2024
Browse files
Options
Downloads
Patches
Plain Diff
add adaptive inpainting experiments
parent
9c422a52
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/run_experiments.jl
+31
-24
31 additions, 24 deletions
scripts/run_experiments.jl
with
31 additions
and
24 deletions
scripts/run_experiments.jl
+
31
−
24
View file @
4a819a2c
...
@@ -1335,14 +1335,17 @@ end
...
@@ -1335,14 +1335,17 @@ end
# NOTE: used also by inpaint_denoise experiment
# NOTE: used also by inpaint_denoise experiment
function
inpaint
(
ctx
)
function
inpaint
(
ctx
)
# expect ctx.params.g_arr
# expect ctx.params.g_arr
duration
=
@elapsed
begin
#project_image! = project_l2_lagrange!
#project_image! = project_l2_lagrange!
project_image!
=
project_qi_lagrange!
project_image!
=
project_qi_lagrange!
# convert to cartesian coordinates
# convert to cartesian coordinates
g_arr
=
from_img
(
ctx
.
params
.
g_arr
)
g_arr
=
from_img
(
ctx
.
params
.
g_arr
)
mask_arr
=
from_img
(
ctx
.
params
.
mask_arr
)
mask_arr
=
from_img
(
ctx
.
params
.
mask_arr
)
dim_g
=
size
(
g_arr
)
dim_refine
=
floor
.
(
Int
,
size
(
g_arr
)
./
2
^
(
ctx
.
params
.
n_refine
/
2
))
N_refine
=
floor
.
(
Int
,
log2
(
(
dim_g
[
1
]
-
1
)
*
(
dim_g
[
2
]
-
1
)
/
((
dim_refine
[
1
]
-
1
)
*
(
dim_refine
[
2
]
-
1
))
))
println
(
"Number of refinements: "
,
N_refine
)
mesh
=
init_grid
(
g_arr
,
floor
.
(
Int
,
size
(
g_arr
)
./
2
^
(
ctx
.
params
.
n_refine
/
2
))
...
)
mesh
=
init_grid
(
g_arr
,
floor
.
(
Int
,
size
(
g_arr
)
./
2
^
(
ctx
.
params
.
n_refine
/
2
))
...
)
mesh_area
=
area
(
mesh
)
mesh_area
=
area
(
mesh
)
...
@@ -1406,7 +1409,8 @@ function inpaint(ctx)
...
@@ -1406,7 +1409,8 @@ function inpaint(ctx)
# refinement stop criterion
# refinement stop criterion
k_refine
+=
1
k_refine
+=
1
k_refine
>
ctx
.
params
.
n_refine
&&
break
# k_refine > ctx.params.n_refine && break
k_refine
>
N_refine
&&
break
println
(
"refine ..."
)
println
(
"refine ..."
)
#estimate_res!(st)
#estimate_res!(st)
marked_cells
=
Set
(
mark
(
st
;
theta
=
0.5
))
marked_cells
=
Set
(
mark
(
st
;
theta
=
0.5
))
...
@@ -1435,16 +1439,18 @@ function inpaint(ctx)
...
@@ -1435,16 +1439,18 @@ function inpaint(ctx)
interpolate_image_data!
()
interpolate_image_data!
()
end
end
end
end
#CSV.write(joinpath(ctx.outdir, "energies.csv"), df)
end
# @elapsed
u_sampled
=
sample
(
st
.
u
)
u_sampled
=
sample
(
st
.
u
)
saveimg
(
joinpath
(
ctx
.
outdir
,
"g.png"
),
grayclamp
.
(
to_img
(
g_arr
)))
saveimg
(
joinpath
(
ctx
.
outdir
,
"g.png"
),
grayclamp
.
(
to_img
(
g_arr
)))
saveimg
(
joinpath
(
ctx
.
outdir
,
"output.png"
),
grayclamp
.
(
to_img
(
u_sampled
)))
saveimg
(
joinpath
(
ctx
.
outdir
,
"output.png"
),
grayclamp
.
(
to_img
(
u_sampled
)))
psnr
=
assess_psnr
(
u_sampled
,
g_arr
)
ssim
=
assess_ssim
(
u_sampled
,
g_arr
)
#save_csv(joinpath(ctx.outdir, "mesh.csv"), st.u)
#save_csv(joinpath(ctx.outdir, "mesh.csv"), st.u)
savedata
(
joinpath
(
ctx
.
outdir
,
"data.tex"
);
savedata
(
joinpath
(
ctx
.
outdir
,
"data.tex"
);
ctx
.
params
.
eps_newton
,
ctx
.
params
.
n_refine
,
ctx
.
params
.
eps_newton
,
ctx
.
params
.
n_refine
,
st
.
alpha1
,
st
.
alpha2
,
st
.
lambda
,
st
.
beta
,
st
.
gamma1
,
st
.
gamma2
,
st
.
alpha1
,
st
.
alpha2
,
st
.
lambda
,
st
.
beta
,
st
.
gamma1
,
st
.
gamma2
,
width
=
size
(
u_sampled
,
1
),
height
=
size
(
u_sampled
,
2
))
width
=
size
(
u_sampled
,
1
),
height
=
size
(
u_sampled
,
2
)
,
duration
,
psnr
,
ssim
,
N_refine
)
return
st
return
st
end
end
...
@@ -1452,10 +1458,10 @@ function experiment_inpaint_adaptive(ctx)
...
@@ -1452,10 +1458,10 @@ function experiment_inpaint_adaptive(ctx)
g_arr
=
loadimg
(
joinpath
(
ctx
.
indir
,
"input.png"
))
g_arr
=
loadimg
(
joinpath
(
ctx
.
indir
,
"input.png"
))
mask_arr
=
loadimg
(
joinpath
(
ctx
.
indir
,
"mask.png"
))
mask_arr
=
loadimg
(
joinpath
(
ctx
.
indir
,
"mask.png"
))
mesh
=
init_grid
(
g_arr
;)
mesh
=
init_grid
(
g_arr
;)
for
coarsen
in
0
:
15
params
=
(
params
=
(
name
=
"test"
,
name
=
"test"
,
n_refine
=
5
,
n_refine
=
coarsen
,
g_arr
,
mask_arr
,
mesh
,
g_arr
,
mask_arr
,
mesh
,
#alpha1 = 0.2, alpha2 = 8., lambda = 1.,
#alpha1 = 0.2, alpha2 = 8., lambda = 1.,
alpha1
=
0.
,
alpha2
=
50.
,
lambda
=
1.
,
alpha1
=
0.
,
alpha2
=
50.
,
lambda
=
1.
,
...
@@ -1470,7 +1476,8 @@ function experiment_inpaint_adaptive(ctx)
...
@@ -1470,7 +1476,8 @@ function experiment_inpaint_adaptive(ctx)
params
.
beta
,
params
.
S
,
params
.
beta
,
params
.
S
,
width
=
size
(
g_arr
,
1
),
height
=
size
(
g_arr
,
2
))
width
=
size
(
g_arr
,
1
),
height
=
size
(
g_arr
,
2
))
ctx
(
inpaint
;
params
...
)
ctx
(
inpaint
,
"s-identity_alpha1_
$
(round(Int, params.alpha1))_alpha2_
$
(round(Int, params.alpha2))_coarse_
$
(params.n_refine)"
;
params
...
)
end
end
end
function
experiment_inpaint_denoise
(
ctx
)
function
experiment_inpaint_denoise
(
ctx
)
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment