未验证 提交 2ec822ce 编写于 作者: D Double_V 提交者: GitHub

Merge pull request #1098 from yukavio/develop

fix some bug
...@@ -30,7 +30,7 @@ python setup.py install ...@@ -30,7 +30,7 @@ python setup.py install
``` ```
### 2. 获取预训练模型 ### 2. 获取预训练模型
模型裁剪需要加载事先训练好的模型,PaddleOCR也提供了一系列模型[../../../doc/doc_ch/models_list.md],开发者可根据需要自行选择模型或使用自己的模型。 模型裁剪需要加载事先训练好的模型,PaddleOCR也提供了一系列(模型)[../../../doc/doc_ch/models_list.md],开发者可根据需要自行选择模型或使用自己的模型。
### 3. 敏感度分析训练 ### 3. 敏感度分析训练
......
...@@ -24,6 +24,7 @@ sys.path.append(os.path.join(__dir__, '..', '..', '..')) ...@@ -24,6 +24,7 @@ sys.path.append(os.path.join(__dir__, '..', '..', '..'))
sys.path.append(os.path.join(__dir__, '..', '..', '..', 'tools')) sys.path.append(os.path.join(__dir__, '..', '..', '..', 'tools'))
import program import program
import paddle
from paddle import fluid from paddle import fluid
from ppocr.utils.utility import initial_logger from ppocr.utils.utility import initial_logger
logger = initial_logger() logger = initial_logger()
...@@ -32,6 +33,12 @@ from paddleslim.prune import load_model ...@@ -32,6 +33,12 @@ from paddleslim.prune import load_model
def main(): def main():
# Run code with static graph mode.
try:
paddle.enable_static()
except:
pass
startup_prog, eval_program, place, config, _ = program.preprocess() startup_prog, eval_program, place, config, _ = program.preprocess()
feeded_var_names, target_vars, fetches_var_name = program.build_export( feeded_var_names, target_vars, fetches_var_name = program.build_export(
......
...@@ -19,6 +19,7 @@ from __future__ import print_function ...@@ -19,6 +19,7 @@ from __future__ import print_function
import os import os
import sys import sys
import numpy as np import numpy as np
import paddle
__dir__ = os.path.dirname(__file__) __dir__ = os.path.dirname(__file__)
sys.path.append(__dir__) sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..', '..', '..')) sys.path.append(os.path.join(__dir__, '..', '..', '..'))
...@@ -49,6 +50,12 @@ skip_list = [ ...@@ -49,6 +50,12 @@ skip_list = [
def main(): def main():
# Run code with static graph mode.
try:
paddle.enable_static()
except:
pass
config = program.load_config(FLAGS.config) config = program.load_config(FLAGS.config)
program.merge_config(FLAGS.opt) program.merge_config(FLAGS.opt)
logger.info(config) logger.info(config)
......
...@@ -25,6 +25,7 @@ sys.path.append(os.path.join(__dir__, '..', '..', '..', 'tools')) ...@@ -25,6 +25,7 @@ sys.path.append(os.path.join(__dir__, '..', '..', '..', 'tools'))
import json import json
import cv2 import cv2
import paddle
from paddle import fluid from paddle import fluid
import paddleslim as slim import paddleslim as slim
from copy import deepcopy from copy import deepcopy
...@@ -60,6 +61,12 @@ def eval_function(eval_args, mode='eval'): ...@@ -60,6 +61,12 @@ def eval_function(eval_args, mode='eval'):
def main(): def main():
# Run code with static graph mode.
try:
paddle.enable_static()
except:
pass
config = program.load_config(FLAGS.config) config = program.load_config(FLAGS.config)
program.merge_config(FLAGS.opt) program.merge_config(FLAGS.opt)
logger.info(config) logger.info(config)
......
...@@ -39,6 +39,7 @@ set_paddle_flags( ...@@ -39,6 +39,7 @@ set_paddle_flags(
) )
import program import program
import paddle
from paddle import fluid from paddle import fluid
from ppocr.utils.utility import initial_logger from ppocr.utils.utility import initial_logger
logger = initial_logger() logger = initial_logger()
...@@ -76,6 +77,11 @@ def main(): ...@@ -76,6 +77,11 @@ def main():
# The decay coefficient of moving average, default is 0.9 # The decay coefficient of moving average, default is 0.9
'moving_rate': 0.9, 'moving_rate': 0.9,
} }
# Run code with static graph mode.
try:
paddle.enable_static()
except:
pass
startup_prog, eval_program, place, config, alg_type = program.preprocess() startup_prog, eval_program, place, config, alg_type = program.preprocess()
......
...@@ -85,6 +85,12 @@ def get_optimizer(): ...@@ -85,6 +85,12 @@ def get_optimizer():
def main(): def main():
# Run code with static graph mode.
try:
paddle.enable_static()
except:
pass
train_build_outputs = program.build( train_build_outputs = program.build(
config, train_program, startup_program, mode='train') config, train_program, startup_program, mode='train')
train_loader = train_build_outputs[0] train_loader = train_build_outputs[0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册