diff --git a/ppdet/data/source/coco.py b/ppdet/data/source/coco.py index 394ffdc86cd9aff3e45e731b27128cb3a369bcc6..4dad8265f5e793376a58f831d56c6f428d83ca48 100644 --- a/ppdet/data/source/coco.py +++ b/ppdet/data/source/coco.py @@ -14,11 +14,11 @@ import os import numpy as np -import logging from ppdet.core.workspace import register, serializable from .dataset import DetDataset -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) @register diff --git a/ppdet/data/source/voc.py b/ppdet/data/source/voc.py index fa28b12df19e44d2bc102bfb0d75739ce71073f9..6ef016f3ef774fd7bb890bfe7c15978b571b601f 100644 --- a/ppdet/data/source/voc.py +++ b/ppdet/data/source/voc.py @@ -20,8 +20,9 @@ import xml.etree.ElementTree as ET from ppdet.core.workspace import register, serializable from .dataset import DetDataset -import logging -logger = logging.getLogger(__name__) + +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) @register diff --git a/ppdet/data/source/widerface.py b/ppdet/data/source/widerface.py index f866d8d0fc6cb41b5b7ac7226245a0fe6fefe0c0..3a2b5224ec1f23b4d4ffd480cde29a62116fd327 100644 --- a/ppdet/data/source/widerface.py +++ b/ppdet/data/source/widerface.py @@ -14,12 +14,13 @@ import os import numpy as np -import logging -logger = logging.getLogger(__name__) from ppdet.core.workspace import register, serializable from .dataset import DataSet +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) + @register @serializable diff --git a/ppdet/data/transform/batch_operator.py b/ppdet/data/transform/batch_operator.py index acfc326bb8252b3e2c62de9126ff965f2434bbe1..ad68fb199b1fd88ccbebeed4e51b1af7ee7fa307 100644 --- a/ppdet/data/transform/batch_operator.py +++ b/ppdet/data/transform/batch_operator.py @@ -21,14 +21,14 @@ try: except Exception: from collections import Sequence -import logging import cv2 import numpy as np from .operator import register_op, BaseOperator, ResizeOp from .op_helper import jaccard_overlap, gaussian2D from scipy import ndimage -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) __all__ = [ 'PadBatchOp', diff --git a/ppdet/data/transform/batch_operators.py b/ppdet/data/transform/batch_operators.py index dbb640496a8be6bb128ed74ccb61e3e08a853fad..424b0b2b06225b438a08084aa600f9278e7ab0f1 100644 --- a/ppdet/data/transform/batch_operators.py +++ b/ppdet/data/transform/batch_operators.py @@ -21,14 +21,14 @@ try: except Exception: from collections import Sequence -import logging import cv2 import numpy as np from .operator import register_op, BaseOperator from .op_helper import jaccard_overlap, gaussian2D from .operators import NormalizeImage, Permute -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) __all__ = [ 'PadBatch', diff --git a/ppdet/data/transform/operator.py b/ppdet/data/transform/operator.py index 6c39ed6e94080eca5bb69c9058ab25883df297ae..0392e7fe6e4c7b3675f33022469aab005d840194 100644 --- a/ppdet/data/transform/operator.py +++ b/ppdet/data/transform/operator.py @@ -28,7 +28,6 @@ except Exception: from numbers import Number, Integral import uuid -import logging import random import math import numpy as np @@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process, generate_sample_bbox_square, bbox_area_sampling, is_poly, gaussian_radius, draw_gaussian) -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) registered_ops = [] diff --git a/ppdet/data/transform/operators.py b/ppdet/data/transform/operators.py index cf2cef7a9e433ffc5f46adb738f005b899bb7ce9..ef4e5eb094c39f58b3c0a5e1cd6db5532da1d254 100644 --- a/ppdet/data/transform/operators.py +++ b/ppdet/data/transform/operators.py @@ -28,7 +28,6 @@ except Exception: from numbers import Number import uuid -import logging import random import math import numpy as np @@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process, generate_sample_bbox_square, bbox_area_sampling, is_poly, gaussian_radius, draw_gaussian) -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) @register_op diff --git a/ppdet/optimizer.py b/ppdet/optimizer.py index 21e9e4ce723a657b3981c758a4ce82da07b7c00b..a11fde40de2a6705c2cc79021b1241ffd081a505 100644 --- a/ppdet/optimizer.py +++ b/ppdet/optimizer.py @@ -17,8 +17,6 @@ from __future__ import division from __future__ import print_function import math -import logging - import paddle import paddle.nn as nn @@ -30,7 +28,8 @@ from ppdet.core.workspace import register, serializable __all__ = ['LearningRate', 'OptimizerBuilder'] -logger = logging.getLogger(__name__) +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) @serializable diff --git a/ppdet/utils/bbox_utils.py b/ppdet/utils/bbox_utils.py index c6204d73bc141cd9208127f164cfac3f0f934d9f..63c93976c1c63cf85e35a6ddc79ee32f0eb3b716 100644 --- a/ppdet/utils/bbox_utils.py +++ b/ppdet/utils/bbox_utils.py @@ -16,12 +16,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import logging import numpy as np -__all__ = ["bbox_overlaps", "box_to_delta"] +from .logger import setup_logger +logger = setup_logger(__name__) -logger = logging.getLogger(__name__) +__all__ = ["bbox_overlaps", "box_to_delta"] def bbox_overlaps(boxes_1, boxes_2): diff --git a/ppdet/utils/check.py b/ppdet/utils/check.py index 32f889c03851430610bd35fbf3ff0afbc0a368fb..4fc1d14f144cc36c5cfb15cd1b3c77a55ed2a943 100644 --- a/ppdet/utils/check.py +++ b/ppdet/utils/check.py @@ -19,10 +19,11 @@ from __future__ import print_function import sys import paddle -import logging import six import paddle.version as fluid_version -logger = logging.getLogger(__name__) + +from .logger import setup_logger +logger = setup_logger(__name__) __all__ = ['check_gpu', 'check_version', 'check_config'] diff --git a/ppdet/utils/checkpoint.py b/ppdet/utils/checkpoint.py index 44e3f8269b16b8b6a9c11c2d6bc6120cfce782f3..89b22b8b2dfb196b3f87b65bf7e3b00c9b2210ff 100644 --- a/ppdet/utils/checkpoint.py +++ b/ppdet/utils/checkpoint.py @@ -24,8 +24,9 @@ import re import numpy as np import paddle from .download import get_weights_path -import logging -logger = logging.getLogger(__name__) + +from .logger import setup_logger +logger = setup_logger(__name__) def is_url(path): diff --git a/ppdet/utils/coco_eval.py b/ppdet/utils/coco_eval.py index b065a276a9b06e589db1538cad2a9040b1bf2257..b5ad0de7566a54b19e941ffd220a9d3b9cd7fc44 100644 --- a/ppdet/utils/coco_eval.py +++ b/ppdet/utils/coco_eval.py @@ -23,8 +23,8 @@ import json import cv2 import numpy as np -import logging -logger = logging.getLogger(__name__) +from .logger import setup_logger +logger = setup_logger(__name__) __all__ = [ 'bbox_eval', diff --git a/ppdet/utils/download.py b/ppdet/utils/download.py index 64bdc09fa97586b31da12956f1bf57ec19e60e17..279d33206f2a3ce1d89219a8065dec8850fee3f9 100644 --- a/ppdet/utils/download.py +++ b/ppdet/utils/download.py @@ -27,8 +27,8 @@ import zipfile from .voc_utils import create_list -import logging -logger = logging.getLogger(__name__) +from .logger import setup_logger +logger = setup_logger(__name__) __all__ = [ 'get_weights_path', 'get_dataset_path', 'download_dataset', diff --git a/ppdet/utils/eval_utils.py b/ppdet/utils/eval_utils.py index 6049cb6356677df23c560c020bbb7e7975587bf5..60cbbc6c41e1bcd1a973c5d35e6ab2438efe8eaf 100644 --- a/ppdet/utils/eval_utils.py +++ b/ppdet/utils/eval_utils.py @@ -6,8 +6,9 @@ import os import sys import json from ppdet.py_op.post_process import get_det_res, get_seg_res -import logging -logger = logging.getLogger(__name__) + +from .logger import setup_logger +logger = setup_logger(__name__) def json_eval_results(metric, json_directory=None, dataset=None): diff --git a/ppdet/utils/map_utils.py b/ppdet/utils/map_utils.py index 085556972a4d069b731acf8268abaa86190d8fcc..65ec2bb9ecb6eae658ea9be7f86fae515d760de4 100644 --- a/ppdet/utils/map_utils.py +++ b/ppdet/utils/map_utils.py @@ -19,8 +19,9 @@ from __future__ import unicode_literals import sys import numpy as np -import logging -logger = logging.getLogger(__name__) + +from .logger import setup_logger +logger = setup_logger(__name__) __all__ = ['bbox_area', 'jaccard_overlap', 'DetectionMAP'] diff --git a/ppdet/utils/post_process.py b/ppdet/utils/post_process.py index ad8f2f23365c0d09941642a5bc558ff2360a42f0..45f9f9908af32f816c8965587d4e428b1b34ad5e 100644 --- a/ppdet/utils/post_process.py +++ b/ppdet/utils/post_process.py @@ -16,13 +16,13 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import logging import numpy as np import cv2 -__all__ = ['nms'] +from .logger import setup_logger +logger = setup_logger(__name__) -logger = logging.getLogger(__name__) +__all__ = ['nms'] def box_flip(boxes, im_shape): diff --git a/ppdet/utils/voc_eval.py b/ppdet/utils/voc_eval.py index 2bf14489bfd1bf868757171e864e57185a69311e..4210c100944d093120926e253fbc08e0bea621f0 100644 --- a/ppdet/utils/voc_eval.py +++ b/ppdet/utils/voc_eval.py @@ -25,8 +25,8 @@ from ..data.source.voc import pascalvoc_label from .map_utils import DetectionMAP from .coco_eval import bbox2out -import logging -logger = logging.getLogger(__name__) +from .logger import setup_logger +logger = setup_logger(__name__) __all__ = ['bbox_eval', 'bbox2out', 'get_category_info']