fix: rm sys.path.append in main python file

avoid to raising error when there is a foler or python file that has same name in working directory
pull/2226/head
root 2022-08-16 13:24:57 +00:00 committed by Tingquan Gao
parent ae90a87f85
commit d64252b8dc
6 changed files with 17 additions and 21 deletions

View File

@ -2,7 +2,6 @@ include LICENSE.txt
include README.md include README.md
include docs/en/whl_en.md include docs/en/whl_en.md
recursive-include deploy/python *.py recursive-include deploy/python *.py
recursive-include deploy/configs *.yaml recursive-include deploy/utils *.py
recursive-include deploy/utils get_image_list.py config.py logger.py predictor.py
recursive-include ppcls/ *.py *.txt recursive-include ppcls/ *.py *.txt
recursive-include deploy/configs *.yaml

View File

@ -11,21 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(__dir__, '../')))
import cv2 import cv2
import numpy as np import numpy as np
from utils import logger from paddleclas.deploy.utils import logger, config
from utils import config from paddleclas.deploy.utils.predictor import Predictor
from utils.predictor import Predictor from paddleclas.deploy.utils.get_image_list import get_image_list
from utils.get_image_list import get_image_list from paddleclas.deploy.python.preprocess import create_operators
from python.preprocess import create_operators from paddleclas.deploy.python.postprocess import build_postprocess
from python.postprocess import build_postprocess
class ClsPredictor(Predictor): class ClsPredictor(Predictor):

View File

@ -28,7 +28,7 @@ import numpy as np
import importlib import importlib
from PIL import Image from PIL import Image
from python.det_preprocess import DetNormalizeImage, DetPadStride, DetPermute, DetResize from .det_preprocess import DetNormalizeImage, DetPadStride, DetPermute, DetResize
def create_operators(params): def create_operators(params):

View File

@ -17,7 +17,7 @@ import copy
import argparse import argparse
import yaml import yaml
from utils import logger from . import logger
__all__ = ['get_config'] __all__ = ['get_config']

View File

@ -16,7 +16,6 @@ import os
import sys import sys
__dir__ = os.path.dirname(__file__) __dir__ = os.path.dirname(__file__)
sys.path.append(os.path.join(__dir__, "")) sys.path.append(os.path.join(__dir__, ""))
sys.path.append(os.path.join(__dir__, "deploy"))
from typing import Union, Generator from typing import Union, Generator
import argparse import argparse
@ -33,12 +32,16 @@ from tqdm import tqdm
from prettytable import PrettyTable from prettytable import PrettyTable
import paddle import paddle
import ppcls.arch.backbone as backbone
from ppcls.utils import logger
from deploy.python.predict_cls import ClsPredictor from deploy.python.predict_cls import ClsPredictor
from deploy.utils.get_image_list import get_image_list from deploy.utils.get_image_list import get_image_list
from deploy.utils import config from deploy.utils import config
import ppcls.arch.backbone as backbone import deploy
from ppcls.utils import logger import ppcls
# 'deploy.python', 'deploy.utils', 'ppcls.arch', 'ppcls.utils'
# for building model with loading pretrained weights from backbone # for building model with loading pretrained weights from backbone
logger.init_logger() logger.init_logger()