Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepdraw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
medai
software
deepdraw
Commits
46bacfef
Commit
46bacfef
authored
4 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[engine] Deploy h5py instead of bob.io.base for HDF5 I/O
parent
821d7e81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Streamlining
Pipeline
#39074
failed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/ip/binseg/engine/evaluator.py
+3
-2
3 additions, 2 deletions
bob/ip/binseg/engine/evaluator.py
bob/ip/binseg/engine/predictor.py
+5
-3
5 additions, 3 deletions
bob/ip/binseg/engine/predictor.py
with
8 additions
and
5 deletions
bob/ip/binseg/engine/evaluator.py
+
3
−
2
View file @
46bacfef
...
@@ -13,7 +13,7 @@ from tqdm import tqdm
...
@@ -13,7 +13,7 @@ from tqdm import tqdm
import
torch
import
torch
import
torchvision.transforms.functional
as
VF
import
torchvision.transforms.functional
as
VF
import
bob.io.base
import
h5py
from
..utils.metric
import
base_metrics
from
..utils.metric
import
base_metrics
from
..utils.plot
import
precision_recall_f1iso_confintval
from
..utils.plot
import
precision_recall_f1iso_confintval
...
@@ -231,7 +231,8 @@ def run(data_loader, predictions_folder, output_folder, overlayed_folder=None,
...
@@ -231,7 +231,8 @@ def run(data_loader, predictions_folder, output_folder, overlayed_folder=None,
image
=
sample
[
1
].
to
(
"
cpu
"
)
image
=
sample
[
1
].
to
(
"
cpu
"
)
gt
=
sample
[
2
].
to
(
"
cpu
"
)
gt
=
sample
[
2
].
to
(
"
cpu
"
)
pred_fullpath
=
os
.
path
.
join
(
predictions_folder
,
stem
+
"
.hdf5
"
)
pred_fullpath
=
os
.
path
.
join
(
predictions_folder
,
stem
+
"
.hdf5
"
)
pred
=
bob
.
io
.
base
.
load
(
pred_fullpath
).
astype
(
"
float32
"
)
with
h5py
.
File
(
pred_fullpath
,
"
r
"
)
as
f
:
pred
=
f
[
"
array
"
][:]
pred
=
torch
.
from_numpy
(
pred
)
pred
=
torch
.
from_numpy
(
pred
)
if
stem
in
data
:
if
stem
in
data
:
raise
RuntimeError
(
f
"
{
stem
}
entry already exists in data.
"
raise
RuntimeError
(
f
"
{
stem
}
entry already exists in data.
"
...
...
This diff is collapsed.
Click to expand it.
bob/ip/binseg/engine/predictor.py
+
5
−
3
View file @
46bacfef
...
@@ -12,7 +12,7 @@ from tqdm import tqdm
...
@@ -12,7 +12,7 @@ from tqdm import tqdm
import
torch
import
torch
import
torchvision.transforms.functional
as
VF
import
torchvision.transforms.functional
as
VF
import
bob.io.base
import
h5py
from
..utils.summary
import
summary
from
..utils.summary
import
summary
...
@@ -44,8 +44,10 @@ def _save_hdf5(stem, prob, output_folder):
...
@@ -44,8 +44,10 @@ def _save_hdf5(stem, prob, output_folder):
if
not
os
.
path
.
exists
(
fulldir
):
if
not
os
.
path
.
exists
(
fulldir
):
tqdm
.
write
(
f
"
Creating directory
{
fulldir
}
...
"
)
tqdm
.
write
(
f
"
Creating directory
{
fulldir
}
...
"
)
os
.
makedirs
(
fulldir
,
exist_ok
=
True
)
os
.
makedirs
(
fulldir
,
exist_ok
=
True
)
bob
.
io
.
base
.
save
(
prob
.
cpu
().
squeeze
(
0
).
numpy
(),
fullpath
)
with
h5py
.
File
(
fullpath
,
'
w
'
)
as
f
:
data
=
prob
.
cpu
().
squeeze
(
0
).
numpy
()
f
.
create_dataset
(
"
array
"
,
data
=
data
,
compression
=
"
gzip
"
,
compression_opts
=
9
)
def
_save_image
(
stem
,
extension
,
data
,
output_folder
):
def
_save_image
(
stem
,
extension
,
data
,
output_folder
):
"""
Saves a PIL image into a file
"""
Saves a PIL image into a file
...
...
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