dump model structure
This commit is contained in:
parent
7214a74144
commit
d89d3384a0
|
@ -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:
|
||||||
|
|
|
@ -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):
|
||||||
|
|
||||||
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))
|
||||||
|
|
|
@ -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():
|
||||||
# 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,\
|
||||||
|
|
Loading…
Reference in New Issue