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
c63a8eb3
Commit
c63a8eb3
authored
Dec 16, 2021
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
extend image mesh interpolation experiment
parent
1172ce8e
No related branches found
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
+40
-18
40 additions, 18 deletions
scripts/run_experiments.jl
with
40 additions
and
18 deletions
scripts/run_experiments.jl
+
40
−
18
View file @
c63a8eb3
...
...
@@ -6,6 +6,7 @@ import ColorTypes
import
CSV
import
DataFrames
:
DataFrame
import
FileIO
using
ImageQualityIndexes
:
assess_psnr
,
assess_ssim
using
OpticalFlowUtils
using
WriteVTK
:
paraview_collection
using
Plots
...
...
@@ -982,8 +983,11 @@ end
function
experiment_image_mesh_interpolation
(
ctx
)
imgf
=
loadimg
(
joinpath
(
ctx
.
indir
,
"input.png"
))
# TODO: test other meshes
mesh
=
init_grid
(
imgf
)
df_psnr
=
DataFrame
()
df_ssim
=
DataFrame
()
for
mesh_size
in
(
32
,
16
,
13
)
mesh
=
init_grid
(
imgf
,
mesh_size
)
space
=
FeSpace
(
mesh
,
P1
(),
(
1
,))
u
=
FeFunction
(
space
)
...
...
@@ -994,12 +998,30 @@ function experiment_image_mesh_interpolation(ctx)
#"clement" => projec_clement!,
"qi_lagrange"
=>
project_qi_lagrange!
,
#"qi_lagrange_avg" => project_qi_lagrange!,
#
"l2_pixel" => project_l2_pixel!,
"l2_pixel"
=>
project_l2_pixel!
,
]
map
(
methods
)
do
(
name
,
f
)
u
=
FeFunction
(
space
)
f
(
u
,
imgf
)
save_csv
(
joinpath
(
ctx
.
outdir
,
name
*
".csv"
),
u
)
qualities
=
map
(
methods
)
do
(
method
,
f!
)
u
.
data
.=
false
f!
(
u
,
imgf
)
save_csv
(
joinpath
(
ctx
.
outdir
,
"
$(mesh_size)
_
$(method)
.csv"
),
u
)
imgu
=
sample
(
u
)
saveimg
(
joinpath
(
ctx
.
outdir
,
"
$(mesh_size)
_
$(method)
.png"
),
imgu
)
return
method
=>
(
psnr
=
assess_psnr
(
imgu
,
imgf
),
ssim
=
assess_ssim
(
imgu
,
imgf
))
end
psnr
=
map
(
x
->
Symbol
(
first
(
x
))
=>
last
(
x
)
.
psnr
,
qualities
)
ssim
=
map
(
x
->
Symbol
(
first
(
x
))
=>
last
(
x
)
.
ssim
,
qualities
)
push!
(
df_psnr
,
(;
mesh_size
,
psnr
...
))
push!
(
df_ssim
,
(;
mesh_size
,
ssim
...
))
end
CSV
.
write
(
joinpath
(
ctx
.
outdir
,
"psnr.csv"
),
df_psnr
)
CSV
.
write
(
joinpath
(
ctx
.
outdir
,
"ssim.csv"
),
df_ssim
)
#savedata(joinpath(ctx.outdir, "data.tex"); energy_min, algparams...)
end
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
register
or
sign in
to comment