Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.pytorch
Commits
887d9e54
Commit
887d9e54
authored
Nov 27, 2019
by
Guillaume HEUSCH
Browse files
[extractor] modified the code to load the model, to be consistent with MCDeepPixBiS
parent
705fc0c8
Pipeline
#35593
passed with stage
in 10 minutes and 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/pytorch/extractor/image/DeepPixBiS.py
View file @
887d9e54
...
...
@@ -52,24 +52,17 @@ class DeepPixBiSExtractor(Extractor):
logger
.
debug
(
"No pretrained file provided"
)
pass
else
:
# With the new training
logger
.
debug
(
'Starting to load the pretrained PAD model'
)
try
:
cp
=
torch
.
load
(
model_file
)
except
:
try
:
cp
=
torch
.
load
(
model_file
,
map_location
=
lambda
storage
,
loc
:
storage
)
except
:
raise
ValueError
(
'Could not load the model'
)
raise
ValueError
(
'Failed to load the model file : {}'
.
format
(
model_file
))
if
'state_dict'
in
cp
:
self
.
network
.
load_state_dict
(
cp
[
'state_dict'
])
else
:
## check this part
self
.
network
.
load_state_dict
(
cp
)
else
:
raise
ValueError
(
'Failed to load the state_dict for model file: {}'
.
format
(
model_file
)
)
logger
.
debug
(
'Loaded the pretrained PAD model'
)
self
.
network
.
eval
()
...
...
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