Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lwir-nn
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
lwir-nn
Commits
6c88d9e2
Commit
6c88d9e2
authored
Jul 30, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8-image reports
parent
4b02b283
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
418 additions
and
8 deletions
+418
-8
nn_eval_lwir-02.py
nn_eval_lwir-02.py
+382
-0
nn_eval_lwir.py
nn_eval_lwir.py
+36
-8
No files found.
nn_eval_lwir-02.py
0 → 100644
View file @
6c88d9e2
This diff is collapsed.
Click to expand it.
nn_eval_lwir.py
View file @
6c88d9e2
...
...
@@ -18,6 +18,7 @@ import imagej_tiffwriter
import
time
import
imagej_tiff
as
ijt
import
matplotlib.pyplot
as
plt
import
matplotlib.image
as
mpimg
from
matplotlib.backends.backend_pdf
import
PdfPages
import
qcstereo_functions
as
qsf
import
numpy
as
np
...
...
@@ -156,11 +157,16 @@ def get_fig_params(disparity_ranges):
extra_path
=
os
.
path
.
join
(
root_dir
,
dbg_parameters
[
'extra'
])
eo_width
=
dbg_parameters
[
'eo_params'
][
'width'
]
eo_height
=
dbg_parameters
[
'eo_params'
][
'height'
]
eo_woi
=
dbg_parameters
[
'eo_params'
][
'woi'
]
# (x,y,width, height)
eo_woi_rel
=
dbg_parameters
[
'eo_params'
][
'woi'
]
# (x,y,width, height)
eo_woi
=
{
"x"
:
eo_width
*
eo_woi_rel
[
'x'
],
"y"
:
eo_height
*
eo_woi_rel
[
'y'
],
"width"
:
eo_width
*
eo_woi_rel
[
'width'
],
"height"
:
eo_height
*
eo_woi_rel
[
'height'
],
}
eo_disparity_scale
=
1.0
/
dbg_parameters
[
'eo_params'
][
'disparity_scale'
]
# 14.2
image_sets
=
dbg_parameters
[
'extra_paths'
]
# list of dictionaries
pass
#temporary:
...
...
@@ -251,6 +257,28 @@ for mode in modes: # ['train']:
fig
.
canvas
.
set_window_title
(
img_pars
[
'title'
])
fig
.
suptitle
(
img_pars
[
'title'
])
#insert LWIR JPEG image
lwir_rgb
=
mpimg
.
imread
(
os
.
path
.
join
(
extra_path
,
img_pars
[
'lwir_path'
]))
ax_lwir
=
plt
.
subplot
(
421
)
ax_lwir
.
set_title
(
"LWIR image (1 of 4)"
)
plt
.
imshow
(
lwir_rgb
)
#insert EO JPEG image
eo_rgb
=
mpimg
.
imread
(
os
.
path
.
join
(
extra_path
,
img_pars
[
'eo_path'
]))
ax_eo
=
plt
.
subplot
(
422
)
ax_eo
.
set_title
(
"Visible range image (1 of 4)"
)
plt
.
imshow
(
eo_rgb
)
if
not
eo_woi
is
None
:
eo_woi_jpeg
=
{
"x"
:
eo_rgb
.
shape
[
1
]
*
eo_woi_rel
[
'x'
],
"y"
:
eo_rgb
.
shape
[
0
]
*
eo_woi_rel
[
'y'
],
"width"
:
eo_rgb
.
shape
[
1
]
*
eo_woi_rel
[
'width'
],
"height"
:
eo_rgb
.
shape
[
0
]
*
eo_woi_rel
[
'height'
],
}
xdata
=
[
eo_woi_jpeg
[
'x'
],
eo_woi_jpeg
[
'x'
]
+
eo_woi_jpeg
[
'width'
],
eo_woi_jpeg
[
'x'
]
+
eo_woi_jpeg
[
'width'
],
eo_woi_jpeg
[
'x'
],
eo_woi_jpeg
[
'x'
]]
ydata
=
[
eo_woi_jpeg
[
'y'
],
eo_woi_jpeg
[
'y'
],
eo_woi_jpeg
[
'y'
]
+
eo_woi_jpeg
[
'height'
],
eo_woi_jpeg
[
'y'
]
+
eo_woi_jpeg
[
'height'
],
eo_woi_jpeg
[
'y'
]]
plt
.
plot
(
xdata
,
ydata
,
color
=
WOI_COLOR
)
# Create EO DSI image
# load tiff image
...
...
@@ -258,7 +286,7 @@ for mode in modes: # ['train']:
ds_main
=
img_ds_main
.
image
[
...
,
img_pars
[
'dsi_slice'
]]
*
eo_disparity_scale
ds_main
=
np
.
maximum
(
ds_main
,
lim_val
[
0
])
ds_main
=
np
.
minimum
(
ds_main
,
lim_val
[
1
])
ax_conf
=
plt
.
subplot
(
322
)
ax_conf
=
plt
.
subplot
(
424
)
ax_conf
.
set_title
(
"Hi-res camera disparity map"
)
plt
.
imshow
(
ds_main
,
vmin
=
lim_val
[
0
],
vmax
=
lim_val
[
1
],
cmap
=
cmap_disp
)
setlimsxy
([
-
0.5
,
eo_width
-
0.5
,
-
0.5
,
eo_height
-
0.5
])
...
...
@@ -282,28 +310,28 @@ for mode in modes: # ['train']:
plt.colorbar(orientation='vertical') # location='bottom')
'''
ax_gtd
=
plt
.
subplot
(
321
)
ax_gtd
=
plt
.
subplot
(
423
)
ax_gtd
.
set_title
(
"Ground truth disparity map"
)
plt
.
imshow
(
data
[
...
,
qsf
.
GT_DISP
],
vmin
=
lim_val
[
0
],
vmax
=
lim_val
[
1
],
cmap
=
cmap_disp
)
setlimsxy
(
lim_xy
)
cross_out
(
plt
,
cross_out_mask
)
plt
.
colorbar
(
orientation
=
'vertical'
)
# location='bottom')
ax_hed
=
plt
.
subplot
(
323
)
ax_hed
=
plt
.
subplot
(
425
)
ax_hed
.
set_title
(
"Heuristic disparity map"
)
plt
.
imshow
(
data
[
...
,
qsf
.
HEUR_NAN
],
vmin
=
lim_val
[
0
],
vmax
=
lim_val
[
1
],
cmap
=
cmap_disp
)
setlimsxy
(
lim_xy
)
cross_out
(
plt
,
cross_out_mask
)
plt
.
colorbar
(
orientation
=
'vertical'
)
# location='bottom')
ax_nnd
=
plt
.
subplot
(
325
)
ax_nnd
=
plt
.
subplot
(
427
)
ax_nnd
.
set_title
(
"Network disparity output"
)
plt
.
imshow
(
data
[
...
,
qsf
.
NN_NAN
],
vmin
=
lim_val
[
0
],
vmax
=
lim_val
[
1
],
cmap
=
cmap_disp
)
setlimsxy
(
lim_xy
)
cross_out
(
plt
,
cross_out_mask
)
plt
.
colorbar
(
orientation
=
'vertical'
)
# location='bottom')
ax_hee
=
plt
.
subplot
(
324
)
ax_hee
=
plt
.
subplot
(
426
)
ax_hee
.
set_title
(
"Heuristic disparity error"
)
cross_out
(
plt
,
cross_out_mask
)
plt
.
imshow
(
data
[
...
,
qsf
.
HEUR_DIFF
],
vmin
=-
ERR_AMPL
,
vmax
=
ERR_AMPL
,
cmap
=
cmap_diff
)
...
...
@@ -311,7 +339,7 @@ for mode in modes: # ['train']:
cross_out
(
plt
,
cross_out_mask
)
plt
.
colorbar
(
orientation
=
'vertical'
)
# location='bottom')
ax_nne
=
plt
.
subplot
(
326
)
ax_nne
=
plt
.
subplot
(
428
)
ax_nne
.
set_title
(
"Network disparity error"
)
plt
.
imshow
(
data
[
...
,
qsf
.
NN_DIFF
],
vmin
=-
ERR_AMPL
,
vmax
=
ERR_AMPL
,
cmap
=
cmap_diff
)
setlimsxy
(
lim_xy
)
...
...
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