File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6969
7070``` bash
7171
72- # 设置PYTHONPATH环境变量
73- export PYTHONPATH=.
74- # windows下设置环境变量
75- SET PYTHONPATH=.
76-
7772# 预测image_dir指定的单张图像
7873python3 tools/infer/predict_system.py --image_dir=" ./doc/imgs/11.jpg" --det_model_dir=" ./inference/ch_det_mv3_db/" --rec_model_dir=" ./inference/ch_rec_mv3_crnn/"
7974
Original file line number Diff line number Diff line change @@ -69,11 +69,6 @@ The following code implements text detection and recognition inference tandemly.
6969
7070``` bash
7171
72- # Set PYTHONPATH environment variable
73- export PYTHONPATH=.
74- # Setting environment variable in Windows
75- SET PYTHONPATH=.
76-
7772# Prediction on a single image by specifying image path to image_dir
7873python3 tools/infer/predict_system.py --image_dir=" ./doc/imgs/11.jpg" --det_model_dir=" ./inference/ch_det_mv3_db/" --rec_model_dir=" ./inference/ch_rec_mv3_crnn/"
7974
Original file line number Diff line number Diff line change 1717from __future__ import print_function
1818
1919import os
20+ import os
21+ import sys
22+ __dir__ = os .path .dirname (__file__ )
23+ sys .path .append (__dir__ )
24+ sys .path .append (os .path .join (__dir__ , '..' ))
2025
2126
2227def set_paddle_flags (** kwargs ):
Original file line number Diff line number Diff line change 1818
1919import os
2020import sys
21- import time
22- import multiprocessing
23- import numpy as np
21+ __dir__ = os . path . dirname ( __file__ )
22+ sys . path . append ( __dir__ )
23+ sys . path . append ( os . path . join ( __dir__ , '..' ))
2424
2525
2626def set_paddle_flags (** kwargs ):
Original file line number Diff line number Diff line change 1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14+ import os
15+ import sys
16+ __dir__ = os .path .dirname (__file__ )
17+ sys .path .append (__dir__ )
18+ sys .path .append (os .path .join (__dir__ , '../..' ))
1419
15- import utility
20+ import tools . infer . utility as utility
1621from ppocr .utils .utility import initial_logger
1722logger = initial_logger ()
1823from ppocr .utils .utility import get_image_file_list
Original file line number Diff line number Diff line change 1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14+ import os
15+ import sys
16+ __dir__ = os .path .dirname (__file__ )
17+ sys .path .append (__dir__ )
18+ sys .path .append (os .path .join (__dir__ , '../..' ))
1419
1520import utility
1621from ppocr .utils .utility import initial_logger
Original file line number Diff line number Diff line change 1616__dir__ = os .path .dirname (__file__ )
1717sys .path .append (__dir__ )
1818sys .path .append (os .path .join (__dir__ , '../..' ))
19- import utility
19+
20+ import tools .infer .utility as utility
2021from ppocr .utils .utility import initial_logger
2122logger = initial_logger ()
2223import cv2
23- import predict_det
24- import predict_rec
24+ import tools . infer . predict_det as predict_det
25+ import tools . infer . predict_rec as predict_rec
2526import copy
2627import numpy as np
2728import math
Original file line number Diff line number Diff line change 1616from __future__ import division
1717from __future__ import print_function
1818
19- import os
20- import sys
21- import time
2219import numpy as np
2320from copy import deepcopy
2421import json
2522
26- # from paddle.fluid.contrib.model_stat import summary
23+ import os
24+ import sys
25+ __dir__ = os .path .dirname (__file__ )
26+ sys .path .append (__dir__ )
27+ sys .path .append (os .path .join (__dir__ , '..' ))
2728
2829
2930def set_paddle_flags (** kwargs ):
Original file line number Diff line number Diff line change 1616from __future__ import division
1717from __future__ import print_function
1818
19- import os
20- import time
21- import multiprocessing
2219import numpy as np
20+ import os
21+ import sys
22+ __dir__ = os .path .dirname (__file__ )
23+ sys .path .append (__dir__ )
24+ sys .path .append (os .path .join (__dir__ , '..' ))
2325
2426
2527def set_paddle_flags (** kwargs ):
@@ -35,10 +37,7 @@ def set_paddle_flags(**kwargs):
3537 FLAGS_eager_delete_tensor_gb = 0 , # enable GC to save memory
3638)
3739
38- from paddle import fluid
39-
40- # from ppocr.utils.utility import load_config, merge_config
41- import program
40+ import tools .program as program
4241from paddle import fluid
4342from ppocr .utils .utility import initial_logger
4443logger = initial_logger ()
@@ -47,7 +46,6 @@ def set_paddle_flags(**kwargs):
4746from ppocr .utils .character import CharacterOps
4847from ppocr .utils .utility import create_module
4948from ppocr .utils .utility import get_image_file_list
50- logger = initial_logger ()
5149
5250
5351def main ():
Original file line number Diff line number Diff line change 1818
1919import os
2020import sys
21- import time
22- import multiprocessing
23- import numpy as np
21+ __dir__ = os . path . dirname ( __file__ )
22+ sys . path . append ( __dir__ )
23+ sys . path . append ( os . path . join ( __dir__ , '..' ))
2424
2525
2626def set_paddle_flags (** kwargs ):
You can’t perform that action at this time.
0 commit comments