Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
89fbf5c2
Commit
89fbf5c2
authored
3 years ago
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up, adding parameters for different debug modes
parent
decd04ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
47 deletions
+64
-47
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+9
-5
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+49
-37
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+6
-5
No files found.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
89fbf5c2
...
...
@@ -266,24 +266,28 @@ public class IntersceneLma {
}
if
(
rslt
[
0
])
{
// better
if
(
iter
>=
num_iter
)
{
// better, but num tries exceeded
if
(
debug_level
>
0
)
System
.
out
.
println
(
"Step "
+
iter
+
": Improved, but number of steps exceeded maximal"
);
if
(
debug_level
>
1
)
System
.
out
.
println
(
"Step "
+
iter
+
": Improved, but number of steps exceeded maximal"
);
}
else
{
if
(
debug_level
>
0
)
System
.
out
.
println
(
"Step "
+
iter
+
": LMA: Success"
);
if
(
debug_level
>
1
)
System
.
out
.
println
(
"Step "
+
iter
+
": LMA: Success"
);
}
}
else
{
// improved over initial ?
if
(
last_rms
[
0
]
<
initial_rms
[
0
])
{
// NaN
rslt
[
0
]
=
true
;
if
(
debug_level
>
0
)
System
.
out
.
println
(
"Step "
+
iter
+
": Failed to converge, but result improved over initial"
);
if
(
debug_level
>
1
)
System
.
out
.
println
(
"Step "
+
iter
+
": Failed to converge, but result improved over initial"
);
}
else
{
if
(
debug_level
>
0
)
System
.
out
.
println
(
"Step "
+
iter
+
": Failed to converge"
);
if
(
debug_level
>
1
)
System
.
out
.
println
(
"Step "
+
iter
+
": Failed to converge"
);
}
}
if
(
debug_level
>
0
)
{
boolean
show_intermediate
=
true
;
if
(
show_intermediate
&&
(
debug_level
>
0
))
{
System
.
out
.
println
(
"LMA: full RMS="
+
last_rms
[
0
]+
" ("
+
initial_rms
[
0
]+
"), pure RMS="
+
last_rms
[
1
]+
" ("
+
initial_rms
[
1
]+
") + lambda="
+
lambda
);
}
if
(
debug_level
>
0
)
{
if
((
debug_level
>
1
)
||
(
iter
==
1
)
||
last_run
)
{
if
(!
show_intermediate
)
{
System
.
out
.
println
(
"LMA: full RMS="
+
last_rms
[
0
]+
" ("
+
initial_rms
[
0
]+
"), pure RMS="
+
last_rms
[
1
]+
" ("
+
initial_rms
[
1
]+
") + lambda="
+
lambda
);
}
String
[]
lines
=
printOldNew
(
false
);
// boolean allvectors)
for
(
String
line
:
lines
)
{
System
.
out
.
println
(
line
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
89fbf5c2
...
...
@@ -29,7 +29,7 @@ import java.util.Properties;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
public
class
IntersceneLmaParameters
{
public
boolean
ilma_thread_invariant
=
true
;
// Do not use DoubleAdder, provide results not dependent on threads
public
boolean
ilma_thread_invariant
=
true
;
// Do not use DoubleAdder, provide results not dependent on threads
public
boolean
[]
ilma_lma_select
=
new
boolean
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
[]
ilma_regularization_weights
=
new
double
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
boolean
ilma_ignore_ers
=
false
;
// ignore linear and angular velocities, assume tham zeroes
...
...
@@ -43,6 +43,8 @@ public class IntersceneLmaParameters {
public
int
ilma_num_iter
=
20
;
public
int
ilma_num_corr
=
10
;
// maximal number of full correlation+LMA cycles
public
int
ilma_debug_level
=
1
;
public
boolean
ilma_debug_adjust_series
=
false
;
// Debug images for series of pose and ers
public
boolean
ilma_debug_invariant
=
false
;
// Monitoring variations when restarting program (should be ilma_thread_invariant=true)
public
IntersceneLmaParameters
()
{
ilma_lma_select
[
ErsCorrection
.
DP_DVAZ
]=
true
;
...
...
@@ -133,11 +135,14 @@ public class IntersceneLmaParameters {
"A hard limit on LMA iterations."
);
gd
.
addNumericField
(
"Maximal number of correlation +LMA iterations"
,
this
.
ilma_num_corr
,
0
,
3
,
""
,
"Outer cycle (recalculate correlations + lma). Otherwise exits if LMA exits at first iteration."
);
gd
.
addCheckbox
(
"Debug adjust_series()"
,
this
.
ilma_debug_adjust_series
,
"Generate debug images for series of pose and ERS (derivatives of pose)"
);
gd
.
addCheckbox
(
"Debug thread-invariant"
,
this
.
ilma_debug_invariant
,
"Generate debug images and text output to verify same results regardless of threads"
);
gd
.
addNumericField
(
"Debug level"
,
this
.
ilma_debug_level
,
0
,
3
,
""
,
"Debug level of interscene LMA operation."
);
}
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
this
.
ilma_thread_invariant
=
gd
.
getNextBoolean
();
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
...
...
@@ -156,6 +161,8 @@ public class IntersceneLmaParameters {
this
.
ilma_rms_diff
=
gd
.
getNextNumber
();
this
.
ilma_num_iter
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_num_corr
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_debug_adjust_series
=
gd
.
getNextBoolean
();
this
.
ilma_debug_invariant
=
gd
.
getNextBoolean
();
this
.
ilma_debug_level
=
(
int
)
gd
.
getNextNumber
();
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
...
...
@@ -164,17 +171,19 @@ public class IntersceneLmaParameters {
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
,
this
.
ilma_lma_select
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
,
this
.
ilma_regularization_weights
[
i
]+
""
);
}
properties
.
setProperty
(
prefix
+
"ilma_ignore_ers"
,
this
.
ilma_ignore_ers
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_lin"
,
this
.
ilma_ers_adj_lin
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_ang"
,
this
.
ilma_ers_adj_ang
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda"
,
this
.
ilma_lambda
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_good"
,
this
.
ilma_lambda_scale_good
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_bad"
,
this
.
ilma_lambda_scale_bad
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_max"
,
this
.
ilma_lambda_max
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_rms_diff"
,
this
.
ilma_rms_diff
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_iter"
,
this
.
ilma_num_iter
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_corr"
,
this
.
ilma_num_corr
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ignore_ers"
,
this
.
ilma_ignore_ers
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_lin"
,
this
.
ilma_ers_adj_lin
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_ang"
,
this
.
ilma_ers_adj_ang
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda"
,
this
.
ilma_lambda
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_good"
,
this
.
ilma_lambda_scale_good
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_bad"
,
this
.
ilma_lambda_scale_bad
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_max"
,
this
.
ilma_lambda_max
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_rms_diff"
,
this
.
ilma_rms_diff
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_iter"
,
this
.
ilma_num_iter
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_corr"
,
this
.
ilma_num_corr
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_adjust_series"
,
this
.
ilma_debug_adjust_series
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_invariant"
,
this
.
ilma_debug_invariant
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"ilma_thread_invariant"
)!=
null
)
this
.
ilma_thread_invariant
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_thread_invariant"
));
...
...
@@ -184,18 +193,19 @@ public class IntersceneLmaParameters {
pn_sel
=
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
;
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_regularization_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
pn_sel
));
}
if
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
)!=
null
)
this
.
ilma_ignore_ers
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
)!=
null
)
this
.
ilma_ers_adj_lin
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
)!=
null
)
this
.
ilma_ers_adj_ang
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
)!=
null
)
this
.
ilma_lambda
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
)!=
null
)
this
.
ilma_lambda_scale_good
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
)!=
null
)
this
.
ilma_lambda_scale_bad
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
)!=
null
)
this
.
ilma_lambda_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
)!=
null
)
this
.
ilma_rms_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
)!=
null
)
this
.
ilma_num_iter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
)!=
null
)
this
.
ilma_num_corr
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
)!=
null
)
this
.
ilma_debug_level
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
)!=
null
)
this
.
ilma_ignore_ers
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
)!=
null
)
this
.
ilma_ers_adj_lin
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
)!=
null
)
this
.
ilma_ers_adj_ang
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
)!=
null
)
this
.
ilma_lambda
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
)!=
null
)
this
.
ilma_lambda_scale_good
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
)!=
null
)
this
.
ilma_lambda_scale_bad
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
)!=
null
)
this
.
ilma_lambda_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
)!=
null
)
this
.
ilma_rms_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
)!=
null
)
this
.
ilma_num_iter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
)!=
null
)
this
.
ilma_num_corr
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_adjust_series"
)!=
null
)
this
.
ilma_debug_adjust_series
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_debug_adjust_series"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_invariant"
)!=
null
)
this
.
ilma_debug_invariant
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_debug_invariant"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
)!=
null
)
this
.
ilma_debug_level
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
));
}
@Override
...
...
@@ -204,17 +214,19 @@ public class IntersceneLmaParameters {
ilp
.
ilma_thread_invariant
=
this
.
ilma_thread_invariant
;
System
.
arraycopy
(
this
.
ilma_lma_select
,
0
,
ilp
.
ilma_lma_select
,
0
,
ilma_lma_select
.
length
);
System
.
arraycopy
(
this
.
ilma_regularization_weights
,
0
,
ilp
.
ilma_regularization_weights
,
0
,
ilma_regularization_weights
.
length
);
ilp
.
ilma_ignore_ers
=
this
.
ilma_ignore_ers
;
ilp
.
ilma_ers_adj_lin
=
this
.
ilma_ers_adj_lin
;
ilp
.
ilma_ers_adj_ang
=
this
.
ilma_ers_adj_ang
;
ilp
.
ilma_lambda
=
this
.
ilma_lambda
;
ilp
.
ilma_lambda_scale_good
=
this
.
ilma_lambda_scale_good
;
ilp
.
ilma_lambda_scale_bad
=
this
.
ilma_lambda_scale_bad
;
ilp
.
ilma_lambda_max
=
this
.
ilma_lambda_max
;
ilp
.
ilma_rms_diff
=
this
.
ilma_rms_diff
;
ilp
.
ilma_num_iter
=
this
.
ilma_num_iter
;
ilp
.
ilma_num_corr
=
this
.
ilma_num_corr
;
ilp
.
ilma_debug_level
=
this
.
ilma_debug_level
;
ilp
.
ilma_ignore_ers
=
this
.
ilma_ignore_ers
;
ilp
.
ilma_ers_adj_lin
=
this
.
ilma_ers_adj_lin
;
ilp
.
ilma_ers_adj_ang
=
this
.
ilma_ers_adj_ang
;
ilp
.
ilma_lambda
=
this
.
ilma_lambda
;
ilp
.
ilma_lambda_scale_good
=
this
.
ilma_lambda_scale_good
;
ilp
.
ilma_lambda_scale_bad
=
this
.
ilma_lambda_scale_bad
;
ilp
.
ilma_lambda_max
=
this
.
ilma_lambda_max
;
ilp
.
ilma_rms_diff
=
this
.
ilma_rms_diff
;
ilp
.
ilma_num_iter
=
this
.
ilma_num_iter
;
ilp
.
ilma_num_corr
=
this
.
ilma_num_corr
;
ilp
.
ilma_debug_adjust_series
=
this
.
ilma_debug_adjust_series
;
ilp
.
ilma_debug_invariant
=
this
.
ilma_debug_invariant
;
ilp
.
ilma_debug_level
=
this
.
ilma_debug_level
;
return
ilp
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
89fbf5c2
...
...
@@ -581,7 +581,7 @@ public class OpticalFlow {
final
int
debug_level
,
//1
final
boolean
enable_debug_images
)
// true
{
boolean
debug_mismatch
=
(
debug_level
>
-
10
);
//
true
;
boolean
debug_mismatch
=
(
debug_level
>
-
10
);
//
&& enable_debug_images)
;
// int debug_corr2d = 0;// 10
final
TileProcessor
tp
=
reference_QuadClt
.
getTileProcessor
();
...
...
@@ -3602,8 +3602,7 @@ public class OpticalFlow {
int
debug_level
)
{
boolean
show_results
=
true
;
boolean
show_results
=
clt_parameters
.
ilp
.
ilma_debug_adjust_series
;
if
(
ref_index
<
0
)
{
ref_index
+=
scenes
.
length
;
}
...
...
@@ -8428,6 +8427,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
double
[][]
flowXY
=
new
double
[
macroTiles
][
2
];
// zero pre-shifts
// double [][] flowXY_frac = new double [macroTiles][]; // Will contain fractional X/Y shift for CLT
double
[][]
reference_tiles_macro
=
new
double
[
macroTiles
][];
// hack below to pass nlma for debugging. Change clt_parameters.ilp.ilma_num_corr to -11 after first pass
int
test_debug_level
=
clt_parameters
.
ilp
.
ilma_debug_invariant
?
(
clt_parameters
.
ofp
.
debug_level_iterate
-
nlma
):
-
11
;
double
[][]
vector_XYS
=
correlate2DIterate
(
// returns optical flow and confidence
clt_parameters
.
img_dtt
,
// final ImageDttParameters imgdtt_params,
// for prepareSceneTiles()
...
...
@@ -8460,7 +8461,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters
.
ofp
.
min_change
,
// final double min_change,
clt_parameters
.
ofp
.
best_neibs_num
,
// final int best_num,
clt_parameters
.
ofp
.
ref_stdev
,
// final double ref_stdev,
clt_parameters
.
ofp
.
debug_level_iterate
-
nlma
,
// final int debug_level)
test_debug_level
,
//
clt_parameters.ofp.debug_level_iterate-nlma, // final int debug_level)
clt_parameters
.
ofp
.
enable_debug_images
);
//final boolean enable_debug_images)
if
(
dbg_img
!=
null
)
{
for
(
int
iy
=
0
;
iy
<
macroTilesY
;
iy
++)
{
...
...
@@ -8505,7 +8506,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
}
}
if
(
dbg_img
!=
null
)
{
if
(
clt_parameters
.
ilp
.
ilma_debug_invariant
)
{
//
dbg_img != null) {
/*
long [] long_xyz0 = new long [camera_xyz0.length];
long [] long_atr0 = new long [camera_atr0.length];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment