src/PredictPDPS.jl

Thu, 25 Apr 2024 14:20:38 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Thu, 25 Apr 2024 14:20:38 -0500
changeset 39
b180a4f3b9bd
parent 36
e4a8f662a1ac
child 45
21909e22f875
permissions
-rw-r--r--

merge

0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 ##################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 # Our main module
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3 ##################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 __precompile__()
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 module PredictPDPS
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9 ########################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 # Load external modules
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 ########################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
13 using ImageTools.ImFilter: gaussian
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 using AlgTools.Util
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 #####################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
17 # Load local modules
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
18 #####################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
19
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
20 include("OpticalFlow.jl")
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
21 include("Radon.jl")
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
22 include("ImGenerate.jl")
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
23 include("Run.jl")
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
24 include("AlgorithmProximal.jl")
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
25 include("AlgorithmBothMulti.jl")
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
26 include("AlgorithmFB.jl")
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
27 include("AlgorithmFBDual.jl")
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
28 include("AlgorithmNew.jl")
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
29 include("Stats.jl")
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
30 #include("PlotResults.jl")
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
31 include("PET/PET.jl")
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
32
23
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
33
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
34 import .AlgorithmBothMulti,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
35 .AlgorithmFB,
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
36 .AlgorithmFBDual,
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
37 .AlgorithmProximal,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
38 .AlgorithmNew
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
39
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
40 using .ImGenerate
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
41 using .OpticalFlow
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
42 using .Stats
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
43 #using .PlotResults
23
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
44 using .PET
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
45 using .Run
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
46
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
47 ##############
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
48 # Our exports
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
49 ##############
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
50
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
51 export run_experiments,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
52 batchrun_article,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
53 demo_known1, demo_known2, demo_known3,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
54 demo_unknown1,demo_unknown2,demo_unknown3,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
55 batchrun_denoising,
18
e6a2ebaf467d added data generation for new phantom
Neil Dizon <neil.dizon@helsinki.fi>
parents: 8
diff changeset
56 batchrun_predictors,
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
57 demo_denoising1, demo_denoising2, demo_denoising3,
20
7d3a75b875fa added zero dual predictor for denoising
Neil Dizon <neil.dizon@helsinki.fi>
parents: 18
diff changeset
58 demo_denoising4, demo_denoising5, demo_denoising6, demo_denoising7,
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
59 demo_petS1, demo_petS2, demo_petS3,
18
e6a2ebaf467d added data generation for new phantom
Neil Dizon <neil.dizon@helsinki.fi>
parents: 8
diff changeset
60 demo_petS4, demo_petS5, demo_petS6, demo_petS7,
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
61 demo_petB1, demo_petB2, demo_petB3,
18
e6a2ebaf467d added data generation for new phantom
Neil Dizon <neil.dizon@helsinki.fi>
parents: 8
diff changeset
62 demo_petB4, demo_petB5, demo_petB6, demo_petB7,
e6a2ebaf467d added data generation for new phantom
Neil Dizon <neil.dizon@helsinki.fi>
parents: 8
diff changeset
63 batchrun_shepplogan, batchrun_brainphantom, batchrun_pet,
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
64 calculate_statistics
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
65 #plot_denoising, plot_pet,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
66
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
67 ###################################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
68 # Parameterisation and experiments
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
69 ###################################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
70
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
71 const default_save_prefix="img/"
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
72
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
73 const default_params = (
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
74 ρ = 0,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
75 verbose_iter = 100,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
76 maxiter = 10000,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
77 save_results = true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
78 save_images = true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
79 save_images_iters = Set([1, 2, 3, 5,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
80 10, 25, 30, 50,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
81 100, 250, 300, 500,
25
c9b06736a477 added fv_plot
Neil Dizon <neil.dizon@helsinki.fi>
parents: 23
diff changeset
82 1000, 2000, 2500, 3000, 4000, 5000,
29
6a0ca7047f68 added new plots and filmstrips
Neil Dizon <neil.dizon@helsinki.fi>
parents: 28
diff changeset
83 6000, 7000, 7500, 8000, 9000, 10000, 8700]),
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
84 pixelwise_displacement=false,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
85 dual_flow = true, # For AlgorithmProximalfrom 2019 paper
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
86 handle_interrupt = true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
87 init = :zero,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
88 plot_movement = false,
27
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
89 stable_interval = Set(0),
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
90 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
91
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
92 const square = imgen_square((200, 300))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
93 const lighthouse = imgen_shake("lighthouse", (200, 300))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
94
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
95 const p_known₀_denoising = default_params ⬿ (
27
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
96 noise_level = 0.5,
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
97 shake_noise_level = 0.025,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
98 shake = 2.0,
27
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
99 α = 1.0,
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
100 ρ̃₀ = 1.0,
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
101 σ̃₀ = 1.0,
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
102 δ = 0.9,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
103 σ₀ = 1.0,
27
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
104 τ₀ = 0.01,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
105 #stable_interval = Set(0),
29
6a0ca7047f68 added new plots and filmstrips
Neil Dizon <neil.dizon@helsinki.fi>
parents: 28
diff changeset
106 stable_interval = union(Set(2500:5000),Set(8700:10000)),
27
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
107 )
515a89cf2178 stable interval
Neil Dizon <neil.dizon@helsinki.fi>
parents: 25
diff changeset
108
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
109 const p_known₀ = default_params ⬿ (
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
110 noise_level = 0.5,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
111 shake_noise_level = 0.05,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
112 shake = 2,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
113 α = 0.15,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
114 ρ̃₀ = 1,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
115 σ̃₀ = 1,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
116 δ = 0.9,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
117 σ₀ = 1,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
118 τ₀ = 0.01,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
119 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
120
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
121 const p_unknown₀ = default_params ⬿ (
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
122 noise_level = 0.3,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
123 shake_noise_level = 0.05,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
124 shake = 2,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
125 α = 0.2,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
126 ρ̃₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
127 σ̃₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
128 σ₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
129 δ = 0.9,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
130 λ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
131 θ = (300*200)*100^3,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
132 kernel = gaussian((3, 3), (11, 11)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
133 timestep = 0.5,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
134 displacement_count = 100,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
135 τ₀ = 0.01,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
136 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
137
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
138
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
139 # Experiments for 2019 paper
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
140
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
141 const experiments_pdps_known = (
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
142 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
143 p_known₀_denoising ⬿ (phantom_ρ = 0,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
144 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
145 p_known₀ ⬿ (phantom_ρ = 100,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
146 Experiment(AlgorithmProximal, DisplacementConstant, square,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
147 p_known₀ ⬿ (phantom_ρ = 0,))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
148 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
149
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
150 const experiments_pdps_unknown_multi = (
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
151 Experiment(AlgorithmBothMulti, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
152 p_unknown₀ ⬿ (phantom_ρ = 0,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
153 Experiment(AlgorithmBothMulti, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
154 p_unknown₀ ⬿ (phantom_ρ = 100,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
155 Experiment(AlgorithmBothMulti, DisplacementConstant, square,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
156 p_unknown₀ ⬿ (phantom_ρ = 0,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
157 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
158
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
159 const experiments_fb_known = (
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
160 Experiment(AlgorithmFB, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
161 p_known₀ ⬿ (τ̃₀=0.9, fb_inner_iterations = 10)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
162 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
163
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
164 const experiments_all = Iterators.flatten((
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
165 experiments_pdps_known,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
166 experiments_pdps_unknown_multi,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
167 experiments_fb_known
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
168 ))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
169
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
170 # Image stabilisation experiments for 2024 paper. PET experiments are in PET/PET.jl
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
171
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
172 const denoising_experiments_pdps_known = (
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
173 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
174 p_known₀_denoising ⬿ (predictor=DualScaling(),)),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
175 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
176 p_known₀_denoising ⬿ (predictor=Greedy(),)),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
177 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
178 p_known₀_denoising ⬿ (predictor=nothing,),),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
179 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
180 p_known₀_denoising ⬿ (predictor=PrimalOnly(),)),
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
181 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
182 p_known₀_denoising ⬿ (phantom_ρ = 100,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
183 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
184 p_known₀_denoising ⬿ (predictor=Rotation(),)),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
185 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
186 p_known₀_denoising ⬿ (predictor=ZeroDual(),)),
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
187 )
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
188
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
189 const denoising_experiments_all = Iterators.flatten((
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
190 denoising_experiments_pdps_known,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
191 ))
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
192
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
193 #######################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
194 # Demos and batch runs
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
195 #######################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
196
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
197 function demo(experiment; kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
198 run_experiments(;experiments=(experiment,),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
199 save_results=false,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
200 save_images=false,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
201 save_prefix=default_save_prefix,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
202 visualise=true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
203 recalculate=true,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
204 verbose_iter=50,
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
205 fullscreen=true,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
206 kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
207 end
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
208
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
209 demo_known1 = () -> demo(experiments_pdps_known[3])
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
210 demo_known2 = () -> demo(experiments_pdps_known[1])
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
211 demo_known3 = () -> demo(experiments_pdps_known[2])
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
212
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
213 demo_unknown1 = () -> demo(experiments_pdps_unknown_multi[3], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
214 demo_unknown2 = () -> demo(experiments_pdps_unknown_multi[1], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
215 demo_unknown3 = () -> demo(experiments_pdps_unknown_multi[2], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
216
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
217 demo_denoising1 = () -> demo(denoising_experiments_pdps_known[1]) # Dual scaling
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
218 demo_denoising2 = () -> demo(denoising_experiments_pdps_known[2]) # Greedy
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
219 demo_denoising3 = () -> demo(denoising_experiments_pdps_known[3]) # No Prediction
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
220 demo_denoising4 = () -> demo(denoising_experiments_pdps_known[4]) # Primal Only
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
221 demo_denoising5 = () -> demo(denoising_experiments_pdps_known[5]) # Proximal (old)
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
222 demo_denoising6 = () -> demo(denoising_experiments_pdps_known[6]) # Rotation
20
7d3a75b875fa added zero dual predictor for denoising
Neil Dizon <neil.dizon@helsinki.fi>
parents: 18
diff changeset
223 demo_denoising7 = () -> demo(denoising_experiments_pdps_known[7]) # Zero dual
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
224
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
225 function batchrun_article(kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
226 run_experiments(;experiments=experiments_all,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
227 save_prefix=default_save_prefix,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
228 save_results=true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
229 save_images=true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
230 visualise=false,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
231 recalculate=false,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
232 kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
233 end
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
234
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
235 function batchrun_denoising(;kwargs...)
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
236 run_experiments(;experiments=denoising_experiments_all,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
237 save_prefix=default_save_prefix,
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
238 save_results=true,
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
239 save_images=true,
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
240 visualise=false,
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
241 recalculate=false,
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
242 kwargs...)
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
243 end
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
244
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
245
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
246 function batchrun_predictors(;kwargs...)
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
247 batchrun_denoising(;kwargs...)
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
248 batchrun_pet(;kwargs...)
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
249 end
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
250
23
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
251 #########################
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
252 # Plotting SSIM and PSNR
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
253 #########################
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
254
34
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
255 #function plot_denoising(kwargs...)
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
256 # ssim_plot("lighthouse")
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
257 # psnr_plot("lighthouse")
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
258 # fv_plot("lighthouse")
aca9c90f151c Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents: 29
diff changeset
259 #end
23
1c4b7d1f261f added plotting functions
Neil Dizon <neil.dizon@helsinki.fi>
parents: 22
diff changeset
260
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
261 end # Module

mercurial