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
dcc884cd
Commit
dcc884cd
authored
Feb 25, 2023
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
add experiment comparing choices of S
parent
bf15de74
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
+42
-8
42 additions, 8 deletions
scripts/run_experiments.jl
with
42 additions
and
8 deletions
scripts/run_experiments.jl
+
42
−
8
View file @
dcc884cd
...
@@ -190,7 +190,7 @@ function L1L2TVState{m}(mesh; T, tdata, S,
...
@@ -190,7 +190,7 @@ function L1L2TVState{m}(mesh; T, tdata, S,
end
end
function
OptFlowState
(
mesh
;
function
OptFlowState
(
mesh
;
alpha1
,
alpha2
,
beta
,
lambda
,
gamma1
,
gamma2
)
alpha1
,
alpha2
,
beta
,
lambda
,
gamma1
,
gamma2
,
Schoice
)
alpha2
>
0
||
beta
>
0
||
alpha2
>
0
||
beta
>
0
||
throw
(
ArgumentError
(
"operator B is singular with these parameters"
))
throw
(
ArgumentError
(
"operator B is singular with these parameters"
))
...
@@ -208,7 +208,7 @@ function OptFlowState(mesh;
...
@@ -208,7 +208,7 @@ function OptFlowState(mesh;
# tdata will be something like nabla(fw)
# tdata will be something like nabla(fw)
T
(
tdata
,
u
)
=
tdata
*
u
T
(
tdata
,
u
)
=
tdata
*
u
T
(
::
typeof
(
adjoint
),
tdata
,
v
)
=
tdata
'
*
v
T
(
::
typeof
(
adjoint
),
tdata
,
v
)
=
tdata
'
*
v
S
(
u
,
nablau
)
=
nablau
'
S
(
u
,
nablau
)
=
Schoice
==
:
nabla
?
nablau
'
:
u
est
=
FeFunction
(
Vest
,
name
=
"est"
)
est
=
FeFunction
(
Vest
,
name
=
"est"
)
g
=
FeFunction
(
Vg
,
name
=
"g"
)
g
=
FeFunction
(
Vg
,
name
=
"g"
)
...
@@ -1526,7 +1526,7 @@ function optflow(ctx)
...
@@ -1526,7 +1526,7 @@ function optflow(ctx)
st
=
OptFlowState
(
mesh
;
st
=
OptFlowState
(
mesh
;
ctx
.
params
.
alpha1
,
ctx
.
params
.
alpha2
,
ctx
.
params
.
alpha1
,
ctx
.
params
.
alpha2
,
ctx
.
params
.
lambda
,
ctx
.
params
.
beta
,
ctx
.
params
.
lambda
,
ctx
.
params
.
beta
,
ctx
.
params
.
gamma1
,
ctx
.
params
.
gamma2
)
ctx
.
params
.
gamma1
,
ctx
.
params
.
gamma2
,
ctx
.
params
.
Schoice
)
function
warp!
()
function
warp!
()
println
(
"warp and reproject ..."
)
println
(
"warp and reproject ..."
)
...
@@ -1582,8 +1582,8 @@ function optflow(ctx)
...
@@ -1582,8 +1582,8 @@ function optflow(ctx)
println
(
"norm_step =
$
norm_step_"
)
println
(
"norm_step =
$
norm_step_"
)
# interior newton stop criterion
# interior newton stop criterion
norm_step_
>
eps_newton
&&
k_newton
<
30
&&
continue
norm_step_
>
eps_newton
&&
k_newton
<
ctx
.
params
.
newton_max_iters
&&
continue
k_newton
>=
30
&&
@warn
"Newton reached maximum number of iterations"
k_newton
>=
ctx
.
params
.
newton_max_iters
&&
@warn
"Newton reached maximum number of iterations"
ctx
.
params
.
warp
||
break
ctx
.
params
.
warp
||
break
k_newton
=
0
k_newton
=
0
...
@@ -1642,7 +1642,7 @@ function optflow(ctx)
...
@@ -1642,7 +1642,7 @@ function optflow(ctx)
saveimg
(
joinpath
(
ctx
.
outdir
,
"fw.png"
),
to_img
(
imgfw
))
saveimg
(
joinpath
(
ctx
.
outdir
,
"fw.png"
),
to_img
(
imgfw
))
savedata
(
joinpath
(
ctx
.
outdir
,
"data.tex"
);
savedata
(
joinpath
(
ctx
.
outdir
,
"data.tex"
);
eps_newton
,
eps_warp
,
ctx
.
params
.
n_refine
,
eps_newton
,
eps_warp
,
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
,
ctx
.
params
.
Schoice
,
width
=
size
(
u_sampled
,
2
),
height
=
size
(
u_sampled
,
3
),
width
=
size
(
u_sampled
,
2
),
height
=
size
(
u_sampled
,
3
),
endpoint_error_mean
,
endpoint_error_stddev
,
endpoint_error_mean
,
endpoint_error_stddev
,
angular_error_mean
,
angular_error_stddev
,
angular_error_mean
,
angular_error_stddev
,
...
@@ -1667,8 +1667,7 @@ function experiment_optflow_middlebury_all_benchmarks(ctx)
...
@@ -1667,8 +1667,7 @@ function experiment_optflow_middlebury_all_benchmarks(ctx)
#example == "Dimetrodon" && continue
#example == "Dimetrodon" && continue
ctx
(
experiment_optflow_middlebury
,
example
;
ctx
(
experiment_optflow_middlebury
,
example
;
alpha1
=
10.
,
alpha2
=
0.
,
lambda
=
1.
,
beta
=
1e-5
,
alpha1
=
10.
,
alpha2
=
0.
,
lambda
=
1.
,
beta
=
1e-5
,
gamma1
=
1e-4
,
gamma2
=
1e-4
)
gamma1
=
1e-4
,
gamma2
=
1e-4
,
Schoice
=
:
nabla
,
newton_max_iters
=
30
)
#return
end
end
end
end
...
@@ -1694,6 +1693,41 @@ function experiment_optflow_middlebury_warping_comparison_adaptive(ctx)
...
@@ -1694,6 +1693,41 @@ function experiment_optflow_middlebury_warping_comparison_adaptive(ctx)
warp
=
true
,
refine
=
true
,
n_refine
=
6
)
warp
=
true
,
refine
=
true
,
n_refine
=
6
)
end
end
function
experiment_optflow_schoice
(
ctx
)
function
run
(
beta
,
Schoice
)
example
=
"Dimetrodon"
duration
=
@elapsed
begin
st
=
ctx
(
experiment_optflow_middlebury
,
example
;
alpha1
=
10.
,
alpha2
=
0.
,
lambda
=
1.
,
beta
,
gamma1
=
1e-4
,
gamma2
=
1e-4
,
Schoice
,
warp
=
true
,
refine
=
false
,
n_refine
=
0
,
newton_max_iters
=
15
)
end
u_sampled
=
sample
(
st
.
u
)
u_flow
=
to_img
(
u_sampled
)
# not yet in ctx
gtflow
=
FileIO
.
load
(
joinpath
(
ctx
.
indir
,
example
,
"flow10.flo"
))
endpoint_errors
=
collect
(
skipmissing
(
map_flow
(
endpoint_error
,
u_flow
,
gtflow
)))
angular_errors
=
collect
(
skipmissing
(
map_flow
(
angular_error
,
u_flow
,
gtflow
)))
endpoint_error_mean
=
mean
(
endpoint_errors
)
endpoint_error_stddev
=
stdm
(
endpoint_errors
,
endpoint_error_mean
)
angular_error_mean
=
mean
(
angular_errors
)
angular_error_stddev
=
stdm
(
angular_errors
,
angular_error_mean
)
return
(;
Schoice
,
beta
,
duration
,
endpoint_error_mean
,
endpoint_error_stddev
,
angular_error_mean
,
angular_error_stddev
)
end
df
=
DataFrame
()
for
Schoice
in
(
:
id
,
:
nabla
)
for
beta
in
10
.^
range
(
-
6
,
3
,
10
)
res
=
run
(
beta
,
Schoice
)
push!
(
df
,
res
)
end
end
CSV
.
write
(
joinpath
(
ctx
.
outdir
,
"schoice.csv"
),
df
)
end
function
test_image
(
n
=
2
^
6
;
supersample_factor
=
16
)
function
test_image
(
n
=
2
^
6
;
supersample_factor
=
16
)
q
=
supersample_factor
q
=
supersample_factor
...
...
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