Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
f2a2f595
Unverified
Commit
f2a2f595
authored
Jul 12, 2020
by
xiaoting
Committed by
GitHub
Jul 12, 2020
Browse files
Merge pull request #304 from lyl120117/dev_vis
dump model structure
parents
3b60404e
d89d3384
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
configs/rec/rec_icdar15_train.yml
configs/rec/rec_icdar15_train.yml
+1
-0
tools/program.py
tools/program.py
+3
-0
tools/train.py
tools/train.py
+9
-0
No files found.
configs/rec/rec_icdar15_train.yml
View file @
f2a2f595
...
@@ -14,6 +14,7 @@ Global:
...
@@ -14,6 +14,7 @@ Global:
character_type
:
en
character_type
:
en
loss_type
:
ctc
loss_type
:
ctc
distort
:
true
distort
:
true
debug
:
false
reader_yml
:
./configs/rec/rec_icdar15_reader.yml
reader_yml
:
./configs/rec/rec_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy
pretrain_weights
:
./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy
checkpoints
:
checkpoints
:
...
...
tools/program.py
View file @
f2a2f595
...
@@ -75,6 +75,8 @@ class AttrDict(dict):
...
@@ -75,6 +75,8 @@ class AttrDict(dict):
global_config
=
AttrDict
()
global_config
=
AttrDict
()
default_config
=
{
'Global'
:
{
'debug'
:
False
,
}}
def
load_config
(
file_path
):
def
load_config
(
file_path
):
"""
"""
...
@@ -85,6 +87,7 @@ def load_config(file_path):
...
@@ -85,6 +87,7 @@ def load_config(file_path):
Returns: global config
Returns: global config
"""
"""
merge_config
(
default_config
)
_
,
ext
=
os
.
path
.
splitext
(
file_path
)
_
,
ext
=
os
.
path
.
splitext
(
file_path
)
assert
ext
in
[
'.yml'
,
'.yaml'
],
"only support yaml files for now"
assert
ext
in
[
'.yml'
,
'.yaml'
],
"only support yaml files for now"
merge_config
(
yaml
.
load
(
open
(
file_path
),
Loader
=
yaml
.
Loader
))
merge_config
(
yaml
.
load
(
open
(
file_path
),
Loader
=
yaml
.
Loader
))
...
...
tools/train.py
View file @
f2a2f595
...
@@ -43,6 +43,7 @@ logger = initial_logger()
...
@@ -43,6 +43,7 @@ logger = initial_logger()
from
ppocr.data.reader_main
import
reader_main
from
ppocr.data.reader_main
import
reader_main
from
ppocr.utils.save_load
import
init_model
from
ppocr.utils.save_load
import
init_model
from
ppocr.utils.character
import
CharacterOps
from
ppocr.utils.character
import
CharacterOps
from
paddle.fluid.contrib.model_stat
import
summary
def
main
():
def
main
():
...
@@ -87,6 +88,14 @@ def main():
...
@@ -87,6 +88,14 @@ def main():
# compile program for multi-devices
# compile program for multi-devices
train_compile_program
=
program
.
create_multi_devices_program
(
train_compile_program
=
program
.
create_multi_devices_program
(
train_program
,
train_opt_loss_name
)
train_program
,
train_opt_loss_name
)
# dump mode structure
if
config
[
'Global'
][
'debug'
]:
if
'Attention'
in
config
[
'Head'
].
keys
():
logger
.
warning
(
'Does not suport dump attention...'
)
else
:
summary
(
train_program
)
init_model
(
config
,
train_program
,
exe
)
init_model
(
config
,
train_program
,
exe
)
train_info_dict
=
{
'compile_program'
:
train_compile_program
,
\
train_info_dict
=
{
'compile_program'
:
train_compile_program
,
\
...
...
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