Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mu-map
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamino Huxohl
mu-map
Commits
e3837fb3
Commit
e3837fb3
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
implement capability to save visulizations of model predictions
parent
18aa3d5a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mu_map/random_search/eval/show_predictions.py
+20
-4
20 additions, 4 deletions
mu_map/random_search/eval/show_predictions.py
with
20 additions
and
4 deletions
mu_map/random_search/eval/show_predictions.py
+
20
−
4
View file @
e3837fb3
...
...
@@ -65,7 +65,7 @@ def main(
_mse
=
mse
(
prediction
,
mu_map
)
print_func
(
f
"
{
_id
:
03
d
}
|
{
_nmae
:
.
6
f
}
|
{
_mse
:
.
6
f
}
"
)
prediction
=
np
.
clip
(
prediction
,
0
,
prediction
.
max
())
prediction
=
np
.
clip
(
prediction
,
0
,
mu_map
.
max
())
diff
=
np
.
abs
(
prediction
-
mu_map
)
volumes
=
[
prediction
,
mu_map
,
diff
]
...
...
@@ -75,6 +75,8 @@ def main(
_slice
=
0
_break_outer
=
False
timeout
=
100
show_text
=
True
while
True
:
images
=
map
(
lambda
v
:
v
[
_slice
],
volumes
)
images
=
map
(
...
...
@@ -83,13 +85,14 @@ def main(
images
=
map
(
lambda
img
:
cv
.
resize
(
img
,
(
512
,
512
)),
images
)
images
=
list
(
images
)
txt
=
f
"
{
str
(
_slice
)
:{
len
(
str
(
n_slices
))
}}
/
{
n_slices
}
"
cv
.
putText
(
images
[
0
],
txt
,
(
0
,
30
),
cv
.
FONT_HERSHEY_SIMPLEX
,
1
,
255
,
3
)
if
show_text
:
txt
=
f
"
{
str
(
_slice
)
:{
len
(
str
(
n_slices
))
}}
/
{
n_slices
}
"
cv
.
putText
(
images
[
0
],
txt
,
(
0
,
30
),
cv
.
FONT_HERSHEY_SIMPLEX
,
1
,
255
,
3
)
_slice
=
(
_slice
+
1
)
%
n_slices
cv
.
imshow
(
wname
,
join_images
(
images
))
key
=
cv
.
waitKey
(
100
)
key
=
cv
.
waitKey
(
timeout
)
if
action
is
not
None
and
action
(
key
):
_break_outer
=
True
break
...
...
@@ -102,6 +105,19 @@ def main(
_slice
=
(
_slice
-
2
)
%
n_slices
elif
key
==
ord
(
"
p
"
):
timeout
=
0
if
timeout
>
0
else
100
elif
key
==
ord
(
"
t
"
):
show_text
=
not
show_text
_slice
=
(
_slice
-
1
)
%
n_slices
elif
key
==
ord
(
"
s
"
):
_slice
=
(
_slice
-
1
)
%
n_slices
cv
.
imwrite
(
"
prediction.png
"
,
images
[
0
])
cv
.
imwrite
(
"
mu_map.png
"
,
images
[
1
])
cv
.
imwrite
(
"
difference.png
"
,
images
[
2
])
with
open
(
"
info.txt
"
,
mode
=
"
w
"
)
as
f
:
f
.
write
(
f
"
Arguments:
{
args
}
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
f
"
Id:
{
_id
}
\n
"
)
f
.
write
(
f
"
Slice:
{
_slice
}
\n
"
)
if
_break_outer
:
break
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment