未验证 提交 f3caf39c 编写于 作者: K Kaipeng Deng 提交者: GitHub

unify setup_logger (#1928)

上级 48ddaa99
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
import os import os
import numpy as np import numpy as np
import logging
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .dataset import DetDataset from .dataset import DetDataset
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@register @register
......
...@@ -20,8 +20,9 @@ import xml.etree.ElementTree as ET ...@@ -20,8 +20,9 @@ import xml.etree.ElementTree as ET
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .dataset import DetDataset from .dataset import DetDataset
import logging
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@register @register
......
...@@ -14,12 +14,13 @@ ...@@ -14,12 +14,13 @@
import os import os
import numpy as np import numpy as np
import logging
logger = logging.getLogger(__name__)
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .dataset import DataSet from .dataset import DataSet
from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@register @register
@serializable @serializable
......
...@@ -21,14 +21,14 @@ try: ...@@ -21,14 +21,14 @@ try:
except Exception: except Exception:
from collections import Sequence from collections import Sequence
import logging
import cv2 import cv2
import numpy as np import numpy as np
from .operator import register_op, BaseOperator, ResizeOp from .operator import register_op, BaseOperator, ResizeOp
from .op_helper import jaccard_overlap, gaussian2D from .op_helper import jaccard_overlap, gaussian2D
from scipy import ndimage from scipy import ndimage
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
__all__ = [ __all__ = [
'PadBatchOp', 'PadBatchOp',
......
...@@ -21,14 +21,14 @@ try: ...@@ -21,14 +21,14 @@ try:
except Exception: except Exception:
from collections import Sequence from collections import Sequence
import logging
import cv2 import cv2
import numpy as np import numpy as np
from .operator import register_op, BaseOperator from .operator import register_op, BaseOperator
from .op_helper import jaccard_overlap, gaussian2D from .op_helper import jaccard_overlap, gaussian2D
from .operators import NormalizeImage, Permute from .operators import NormalizeImage, Permute
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
__all__ = [ __all__ = [
'PadBatch', 'PadBatch',
......
...@@ -28,7 +28,6 @@ except Exception: ...@@ -28,7 +28,6 @@ except Exception:
from numbers import Number, Integral from numbers import Number, Integral
import uuid import uuid
import logging
import random import random
import math import math
import numpy as np import numpy as np
...@@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process, ...@@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process,
generate_sample_bbox_square, bbox_area_sampling, generate_sample_bbox_square, bbox_area_sampling,
is_poly, gaussian_radius, draw_gaussian) is_poly, gaussian_radius, draw_gaussian)
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
registered_ops = [] registered_ops = []
......
...@@ -28,7 +28,6 @@ except Exception: ...@@ -28,7 +28,6 @@ except Exception:
from numbers import Number from numbers import Number
import uuid import uuid
import logging
import random import random
import math import math
import numpy as np import numpy as np
...@@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process, ...@@ -47,7 +46,8 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process,
generate_sample_bbox_square, bbox_area_sampling, generate_sample_bbox_square, bbox_area_sampling,
is_poly, gaussian_radius, draw_gaussian) is_poly, gaussian_radius, draw_gaussian)
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@register_op @register_op
......
...@@ -17,8 +17,6 @@ from __future__ import division ...@@ -17,8 +17,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import math import math
import logging
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
...@@ -30,7 +28,8 @@ from ppdet.core.workspace import register, serializable ...@@ -30,7 +28,8 @@ from ppdet.core.workspace import register, serializable
__all__ = ['LearningRate', 'OptimizerBuilder'] __all__ = ['LearningRate', 'OptimizerBuilder']
logger = logging.getLogger(__name__) from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@serializable @serializable
......
...@@ -16,12 +16,12 @@ from __future__ import absolute_import ...@@ -16,12 +16,12 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import logging
import numpy as np 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): def bbox_overlaps(boxes_1, boxes_2):
......
...@@ -19,10 +19,11 @@ from __future__ import print_function ...@@ -19,10 +19,11 @@ from __future__ import print_function
import sys import sys
import paddle import paddle
import logging
import six import six
import paddle.version as fluid_version 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'] __all__ = ['check_gpu', 'check_version', 'check_config']
......
...@@ -24,8 +24,9 @@ import re ...@@ -24,8 +24,9 @@ import re
import numpy as np import numpy as np
import paddle import paddle
from .download import get_weights_path 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): def is_url(path):
......
...@@ -23,8 +23,8 @@ import json ...@@ -23,8 +23,8 @@ import json
import cv2 import cv2
import numpy as np import numpy as np
import logging from .logger import setup_logger
logger = logging.getLogger(__name__) logger = setup_logger(__name__)
__all__ = [ __all__ = [
'bbox_eval', 'bbox_eval',
......
...@@ -27,8 +27,8 @@ import zipfile ...@@ -27,8 +27,8 @@ import zipfile
from .voc_utils import create_list from .voc_utils import create_list
import logging from .logger import setup_logger
logger = logging.getLogger(__name__) logger = setup_logger(__name__)
__all__ = [ __all__ = [
'get_weights_path', 'get_dataset_path', 'download_dataset', 'get_weights_path', 'get_dataset_path', 'download_dataset',
......
...@@ -6,8 +6,9 @@ import os ...@@ -6,8 +6,9 @@ import os
import sys import sys
import json import json
from ppdet.py_op.post_process import get_det_res, get_seg_res 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): def json_eval_results(metric, json_directory=None, dataset=None):
......
...@@ -19,8 +19,9 @@ from __future__ import unicode_literals ...@@ -19,8 +19,9 @@ from __future__ import unicode_literals
import sys import sys
import numpy as np 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'] __all__ = ['bbox_area', 'jaccard_overlap', 'DetectionMAP']
......
...@@ -16,13 +16,13 @@ from __future__ import absolute_import ...@@ -16,13 +16,13 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import logging
import numpy as np import numpy as np
import cv2 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): def box_flip(boxes, im_shape):
......
...@@ -25,8 +25,8 @@ from ..data.source.voc import pascalvoc_label ...@@ -25,8 +25,8 @@ from ..data.source.voc import pascalvoc_label
from .map_utils import DetectionMAP from .map_utils import DetectionMAP
from .coco_eval import bbox2out from .coco_eval import bbox2out
import logging from .logger import setup_logger
logger = logging.getLogger(__name__) logger = setup_logger(__name__)
__all__ = ['bbox_eval', 'bbox2out', 'get_category_info'] __all__ = ['bbox_eval', 'bbox2out', 'get_category_info']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册