mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2025-12-26 14:38:20 +00:00
pse post-processing is only compiled when needed
This commit is contained in:
parent
85352c93c1
commit
39ac3b5ab4
@ -18,7 +18,6 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
import platform
|
||||
|
||||
__all__ = ['build_post_process']
|
||||
|
||||
@ -26,21 +25,24 @@ from .db_postprocess import DBPostProcess, DistillationDBPostProcess
|
||||
from .east_postprocess import EASTPostProcess
|
||||
from .sast_postprocess import SASTPostProcess
|
||||
from .rec_postprocess import CTCLabelDecode, AttnLabelDecode, SRNLabelDecode, DistillationCTCLabelDecode, \
|
||||
TableLabelDecode, NRTRLabelDecode, SARLabelDecode , SEEDLabelDecode
|
||||
TableLabelDecode, NRTRLabelDecode, SARLabelDecode, SEEDLabelDecode
|
||||
from .cls_postprocess import ClsPostProcess
|
||||
from .pg_postprocess import PGPostProcess
|
||||
from .pse_postprocess import PSEPostProcess
|
||||
|
||||
|
||||
def build_post_process(config, global_config=None):
|
||||
support_dict = [
|
||||
'DBPostProcess', 'PSEPostProcess', 'EASTPostProcess', 'SASTPostProcess',
|
||||
'CTCLabelDecode', 'AttnLabelDecode', 'ClsPostProcess', 'SRNLabelDecode',
|
||||
'PGPostProcess', 'DistillationCTCLabelDecode', 'TableLabelDecode',
|
||||
'DBPostProcess', 'EASTPostProcess', 'SASTPostProcess', 'CTCLabelDecode',
|
||||
'AttnLabelDecode', 'ClsPostProcess', 'SRNLabelDecode', 'PGPostProcess',
|
||||
'DistillationCTCLabelDecode', 'TableLabelDecode',
|
||||
'DistillationDBPostProcess', 'NRTRLabelDecode', 'SARLabelDecode',
|
||||
'SEEDLabelDecode'
|
||||
]
|
||||
|
||||
if config['name'] == 'PSEPostProcess':
|
||||
from .pse_postprocess import PSEPostProcess
|
||||
support_dict.append('PSEPostProcess')
|
||||
|
||||
config = copy.deepcopy(config)
|
||||
module_name = config.pop('name')
|
||||
if global_config is not None:
|
||||
|
||||
@ -21,8 +21,9 @@ ori_path = os.getcwd()
|
||||
os.chdir('ppocr/postprocess/pse_postprocess/pse')
|
||||
if subprocess.call(
|
||||
'{} setup.py build_ext --inplace'.format(python_path), shell=True) != 0:
|
||||
raise RuntimeError('Cannot compile pse: {}'.format(
|
||||
os.path.dirname(os.path.realpath(__file__))))
|
||||
raise RuntimeError(
|
||||
'Cannot compile pse: {}, if your system is windows, you need to install all the default components of `desktop development using C++` in visual studio 2019+'.
|
||||
format(os.path.dirname(os.path.realpath(__file__))))
|
||||
os.chdir(ori_path)
|
||||
|
||||
from .pse import pse
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user