src/PredictPDPS.jl

Fri, 03 May 2024 12:40:26 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 03 May 2024 12:40:26 -0500
changeset 56
cfce789d9749
parent 52
cb029cdb141a
child 66
dc69a0d234ae
permissions
-rw-r--r--

Add more authors and version

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,
50
b413b7df8cd6 remove activated dual
Neil Dizon <neil.dizon@helsinki.fi>
parents: 48
diff changeset
58 demo_denoising4, demo_denoising5, demo_denoising6, demo_denoising7, #demo_denoising8,
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₀ = default_params ⬿ (
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
96 noise_level = 0.5,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
97 shake_noise_level = 0.05,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
98 shake = 2,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
99 α = 0.15,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
100 ρ̃₀ = 1,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
101 σ̃₀ = 1,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
102 δ = 0.9,
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
103 σ₀ = 1,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
104 τ₀ = 0.01,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
105 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
106
45
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
107 # Experiments for 2019 paper
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
108
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
109 const p_unknown₀ = default_params ⬿ (
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
110 noise_level = 0.3,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
111 shake_noise_level = 0.05,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
112 shake = 2,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
113 α = 0.2,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
114 ρ̃₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
115 σ̃₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
116 σ₀ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
117 δ = 0.9,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
118 λ = 1,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
119 θ = (300*200)*100^3,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
120 kernel = gaussian((3, 3), (11, 11)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
121 timestep = 0.5,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
122 displacement_count = 100,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
123 τ₀ = 0.01,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
124 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
125
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
126 const experiments_pdps_known = (
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
127 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
46
Tuomo Valkonen <tuomov@iki.fi>
parents: 45
diff changeset
128 p_known₀ ⬿ (phantom_ρ = 0,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
129 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
130 p_known₀ ⬿ (phantom_ρ = 100,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
131 Experiment(AlgorithmProximal, DisplacementConstant, square,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
132 p_known₀ ⬿ (phantom_ρ = 0,))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
133 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
134
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
135 const experiments_pdps_unknown_multi = (
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
136 Experiment(AlgorithmBothMulti, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
137 p_unknown₀ ⬿ (phantom_ρ = 0,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
138 Experiment(AlgorithmBothMulti, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
139 p_unknown₀ ⬿ (phantom_ρ = 100,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
140 Experiment(AlgorithmBothMulti, DisplacementConstant, square,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
141 p_unknown₀ ⬿ (phantom_ρ = 0,)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
142 )
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
143
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
144 const experiments_fb_known = (
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
145 Experiment(AlgorithmFB, DisplacementConstant, lighthouse,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
146 p_known₀ ⬿ (τ̃₀=0.9, fb_inner_iterations = 10)),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
147 )
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 const experiments_all = Iterators.flatten((
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
150 experiments_pdps_known,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
151 experiments_pdps_unknown_multi,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
152 experiments_fb_known
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
153 ))
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
154
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
155 # 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
156
45
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
157 const p_known₀_denoising = default_params ⬿ (
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
158 noise_level = 0.5,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
159 shake_noise_level = 0.025,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
160 shake = 2.0,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
161 α = 0.25,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
162 ρ̃₀ = 1.0,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
163 σ̃₀ = 1.0,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
164 δ = 0.9,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
165 σ₀ = 1.0,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
166 τ₀ = 0.01,
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
167 #stable_interval = Set(0),
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
168 stable_interval = union(Set(2500:5000),Set(8700:10000)),
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
169 )
21909e22f875 Fix default α
Tuomo Valkonen <tuomov@iki.fi>
parents: 36
diff changeset
170
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
171 const denoising_experiments_pdps_known = (
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
172 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
52
cb029cdb141a activation function for dual scscaling
Neil Dizon <neil.dizon@helsinki.fi>
parents: 50
diff changeset
173 p_known₀_denoising ⬿ (predictor=DualScaling(x -> (-abs(x-1)^1/5 + 1),0.75,1e-12),)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
174 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
175 p_known₀_denoising ⬿ (predictor=Greedy(),)),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
176 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
177 p_known₀_denoising ⬿ (predictor=nothing,),),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
178 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
179 p_known₀_denoising ⬿ (predictor=PrimalOnly(),)),
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
180 Experiment(AlgorithmProximal, DisplacementConstant, lighthouse,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
181 p_known₀_denoising ⬿ (phantom_ρ = 100,)),
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
182 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
183 p_known₀_denoising ⬿ (predictor=Rotation(),)),
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
184 Experiment(AlgorithmNew, DisplacementConstant, lighthouse,
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
185 p_known₀_denoising ⬿ (predictor=ZeroDual(),)),
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
186 )
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
187
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
188 const denoising_experiments_all = Iterators.flatten((
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
189 denoising_experiments_pdps_known,
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
190 ))
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
191
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
192 #######################
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
193 # Demos and batch runs
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
194 #######################
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 function demo(experiment; kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
197 run_experiments(;experiments=(experiment,),
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
198 save_results=false,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
199 save_images=false,
36
e4a8f662a1ac Reduce code duplication.
Tuomo Valkonen <tuomov@iki.fi>
parents: 35
diff changeset
200 save_prefix=default_save_prefix,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
201 visualise=true,
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
202 recalculate=true,
28
f7c1007f0127 added function to generate table
Neil Dizon <neil.dizon@helsinki.fi>
parents: 27
diff changeset
203 verbose_iter=50,
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
204 fullscreen=true,
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
205 kwargs...)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
206 end
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
207
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
208 demo_known1 = () -> demo(experiments_pdps_known[3])
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
209 demo_known2 = () -> demo(experiments_pdps_known[1])
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
210 demo_known3 = () -> demo(experiments_pdps_known[2])
5
843e7611b068 added new predictors
Neil Dizon <neil.dizon@helsinki.fi>
parents: 4
diff changeset
211
0
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
212 demo_unknown1 = () -> demo(experiments_pdps_unknown_multi[3], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
213 demo_unknown2 = () -> demo(experiments_pdps_unknown_multi[1], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
214 demo_unknown3 = () -> demo(experiments_pdps_unknown_multi[2], plot_movement=true)
a55e35d20336 Initialise independent repo
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
215
8
e4ad8f7ce671 Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents: 6
diff changeset
216 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
217 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
218 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
219 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
220 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
221 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
222 demo_denoising7 = () -> demo(denoising_experiments_pdps_known[7]) # Zero dual
50
b413b7df8cd6 remove activated dual
Neil Dizon <neil.dizon@helsinki.fi>
parents: 48
diff changeset
223
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