Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
BoxuanXu
/
FlaskDriverMXNet2SeetaNet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit de33175f
authored
Sep 12, 2017
by
BoxuanXu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix converter try except bug
1 parent
a72aa6a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
src/converter.py
src/converter.py
View file @
de33175
...
@@ -401,17 +401,21 @@ def test():
...
@@ -401,17 +401,21 @@ def test():
logging
.
info
(
load_graph
(
sym
))
logging
.
info
(
load_graph
(
sym
))
def
load_checkpoint
(
params
,
network_struct
):
def
load_checkpoint
(
params
,
network_struct
):
symbol
=
mx
.
sym
.
load
(
network_struct
)
try
:
save_dict
=
mx
.
nd
.
load
(
params
)
symbol
=
mx
.
sym
.
load
(
network_struct
)
arg_params
=
{}
save_dict
=
mx
.
nd
.
load
(
params
)
aux_params
=
{}
arg_params
=
{}
for
k
,
v
in
save_dict
.
items
():
aux_params
=
{}
for
k
,
v
in
save_dict
.
items
():
tp
,
name
=
k
.
split
(
':'
,
1
)
tp
,
name
=
k
.
split
(
':'
,
1
)
if
tp
==
'arg'
:
if
tp
==
'arg'
:
arg_params
[
name
]
=
v
arg_params
[
name
]
=
v
if
tp
==
'aux'
:
if
tp
==
'aux'
:
aux_params
[
name
]
=
v
aux_params
[
name
]
=
v
return
(
symbol
,
arg_params
,
aux_params
)
return
(
symbol
,
arg_params
,
aux_params
)
except
Exception
,
e
:
logging
.
info
(
'model load failed!!!'
)
return
(
None
,
None
,
None
)
#function created by xuboxuan@20170807
#function created by xuboxuan@20170807
#if __name__ == '__main__':
#if __name__ == '__main__':
...
@@ -420,12 +424,14 @@ def Run_Converter(model_param,model_json,seetanet_model):
...
@@ -420,12 +424,14 @@ def Run_Converter(model_param,model_json,seetanet_model):
#parser.add_argument('--model_param',type=str,default = None)
#parser.add_argument('--model_param',type=str,default = None)
#parser.add_argument('--model_json',type=str,default = None)
#parser.add_argument('--model_json',type=str,default = None)
#args = parser.parse_args()
#args = parser.parse_args()
#model_param = "wKgB
6Fmo2w2ASRqpBky2APcM8zs
.params"
#model_param = "wKgB
7Vm2iBaALVPdENbR4G1D6sc
.params"
#model_json = "wKgB6
Vmo2w2AXrJbAAGjO2NrZLE75
.json"
#model_json = "wKgB6
lm2iBaAcq2PAAANvOLMPRI82
.json"
#seetanet_model = "model_test"
#seetanet_model = "model_test"
try
:
try
:
sym
,
arg_params
,
aux_params
=
\
sym
,
arg_params
,
aux_params
=
\
load_checkpoint
(
model_param
,
model_json
)
load_checkpoint
(
model_param
,
model_json
)
if
sym
is
None
or
arg_params
is
None
or
aux_params
is
None
:
return
None
graph
=
load_graph
(
model_json
)
graph
=
load_graph
(
model_json
)
converter
=
Converter
(
graph
,
arg_params
,
aux_params
)
converter
=
Converter
(
graph
,
arg_params
,
aux_params
)
logging
.
info
(
'start to convert model parameters'
)
logging
.
info
(
'start to convert model parameters'
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment