Skip to content

Commit

Permalink
discard export PYTHONPATH manually
Browse files Browse the repository at this point in the history
  • Loading branch information
LDOUBLEV committed Jun 12, 2020
1 parent 25189dc commit cc6c606
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 32 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ cd ..

```bash

# 设置PYTHONPATH环境变量
export PYTHONPATH=.
# windows下设置环境变量
SET PYTHONPATH=.

# 预测image_dir指定的单张图像
python3 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/"

Expand Down
5 changes: 0 additions & 5 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ The following code implements text detection and recognition inference tandemly.

```bash

# Set PYTHONPATH environment variable
export PYTHONPATH=.
# Setting environment variable in Windows
SET PYTHONPATH=.

# Prediction on a single image by specifying image path to image_dir
python3 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/"

Expand Down
5 changes: 5 additions & 0 deletions tools/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
from __future__ import print_function

import os
import os
import sys
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..'))


def set_paddle_flags(**kwargs):
Expand Down
6 changes: 3 additions & 3 deletions tools/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import os
import sys
import time
import multiprocessing
import numpy as np
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..'))


def set_paddle_flags(**kwargs):
Expand Down
7 changes: 6 additions & 1 deletion tools/infer/predict_det.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '../..'))

import utility
import tools.infer.utility as utility
from ppocr.utils.utility import initial_logger
logger = initial_logger()
from ppocr.utils.utility import get_image_file_list
Expand Down
5 changes: 5 additions & 0 deletions tools/infer/predict_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '../..'))

import utility
from ppocr.utils.utility import initial_logger
Expand Down
7 changes: 4 additions & 3 deletions tools/infer/predict_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '../..'))
import utility

import tools.infer.utility as utility
from ppocr.utils.utility import initial_logger
logger = initial_logger()
import cv2
import predict_det
import predict_rec
import tools.infer.predict_det as predict_det
import tools.infer.predict_rec as predict_rec
import copy
import numpy as np
import math
Expand Down
9 changes: 5 additions & 4 deletions tools/infer_det.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
from __future__ import division
from __future__ import print_function

import os
import sys
import time
import numpy as np
from copy import deepcopy
import json

# from paddle.fluid.contrib.model_stat import summary
import os
import sys
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..'))


def set_paddle_flags(**kwargs):
Expand Down
14 changes: 6 additions & 8 deletions tools/infer_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
from __future__ import division
from __future__ import print_function

import os
import time
import multiprocessing
import numpy as np
import os
import sys
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..'))


def set_paddle_flags(**kwargs):
Expand All @@ -35,10 +37,7 @@ def set_paddle_flags(**kwargs):
FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
)

from paddle import fluid

# from ppocr.utils.utility import load_config, merge_config
import program
import tools.program as program
from paddle import fluid
from ppocr.utils.utility import initial_logger
logger = initial_logger()
Expand All @@ -47,7 +46,6 @@ def set_paddle_flags(**kwargs):
from ppocr.utils.character import CharacterOps
from ppocr.utils.utility import create_module
from ppocr.utils.utility import get_image_file_list
logger = initial_logger()


def main():
Expand Down
6 changes: 3 additions & 3 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import os
import sys
import time
import multiprocessing
import numpy as np
__dir__ = os.path.dirname(__file__)
sys.path.append(__dir__)
sys.path.append(os.path.join(__dir__, '..'))


def set_paddle_flags(**kwargs):
Expand Down

0 comments on commit cc6c606

Please sign in to comment.