adapt codes to Paddle2.0-rc (#1153)
This commit is contained in:
parent
e0c8b88993
commit
cf8530b904
|
@ -16,6 +16,7 @@ import logging
|
|||
import os
|
||||
import imghdr
|
||||
import cv2
|
||||
import paddle
|
||||
from paddle import fluid
|
||||
|
||||
|
||||
|
@ -102,3 +103,10 @@ def create_multi_devices_program(program, loss_var_name):
|
|||
build_strategy=build_strategy,
|
||||
exec_strategy=exec_strategy)
|
||||
return compile_program
|
||||
|
||||
|
||||
def enable_static_mode():
|
||||
try:
|
||||
paddle.enable_static()
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -39,6 +39,7 @@ set_paddle_flags(
|
|||
import program
|
||||
from paddle import fluid
|
||||
from ppocr.utils.utility import initial_logger
|
||||
from ppocr.utils.utility import enable_static_mode
|
||||
logger = initial_logger()
|
||||
from ppocr.data.reader_main import reader_main
|
||||
from ppocr.utils.save_load import init_model
|
||||
|
@ -95,4 +96,5 @@ def main():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_static_mode()
|
||||
main()
|
||||
|
|
|
@ -41,6 +41,7 @@ set_paddle_flags(
|
|||
import tools.program as program
|
||||
from paddle import fluid
|
||||
from ppocr.utils.utility import initial_logger
|
||||
from ppocr.utils.utility import enable_static_mode
|
||||
|
||||
logger = initial_logger()
|
||||
from ppocr.data.reader_main import reader_main
|
||||
|
@ -109,6 +110,7 @@ def main():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_static_mode()
|
||||
parser = program.ArgsParser()
|
||||
FLAGS = parser.parse_args()
|
||||
main()
|
||||
|
|
|
@ -49,6 +49,7 @@ import cv2
|
|||
|
||||
from ppocr.utils.utility import initial_logger
|
||||
logger = initial_logger()
|
||||
from ppocr.utils.utility import enable_static_mode
|
||||
|
||||
|
||||
def draw_det_res(dt_boxes, config, img, img_name):
|
||||
|
@ -162,6 +163,7 @@ def main():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_static_mode()
|
||||
parser = program.ArgsParser()
|
||||
FLAGS = parser.parse_args()
|
||||
main()
|
||||
|
|
|
@ -41,6 +41,7 @@ import tools.program as program
|
|||
from paddle import fluid
|
||||
from ppocr.utils.utility import initial_logger
|
||||
logger = initial_logger()
|
||||
from ppocr.utils.utility import enable_static_mode
|
||||
from ppocr.data.reader_main import reader_main
|
||||
from ppocr.utils.save_load import init_model
|
||||
from ppocr.utils.character import CharacterOps
|
||||
|
@ -171,6 +172,7 @@ def main():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_static_mode()
|
||||
parser = program.ArgsParser()
|
||||
FLAGS = parser.parse_args()
|
||||
main()
|
||||
|
|
|
@ -39,6 +39,7 @@ set_paddle_flags(
|
|||
import tools.program as program
|
||||
from paddle import fluid
|
||||
from ppocr.utils.utility import initial_logger
|
||||
from ppocr.utils.utility import enable_static_mode
|
||||
logger = initial_logger()
|
||||
from ppocr.data.reader_main import reader_main
|
||||
from ppocr.utils.save_load import init_model
|
||||
|
@ -126,6 +127,7 @@ def test_reader():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
enable_static_mode()
|
||||
startup_program, train_program, place, config, train_alg_type = program.preprocess(
|
||||
)
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue