未验证 提交 84c8958d 编写于 作者: M Manuel Garcia 提交者: GitHub

Optimize imports (#3601)

Besides removing unnecessary imports, this also fixes the missing logger module in test_architectures.py within the static directory.
上级 d77c236f
...@@ -12,13 +12,10 @@ ...@@ -12,13 +12,10 @@
# 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 sys
import os import os
import os.path as osp
import re import re
import json
import glob import glob
import cv2
import numpy as np import numpy as np
from multiprocessing import Pool from multiprocessing import Pool
from functools import partial from functools import partial
...@@ -80,10 +77,10 @@ def py_cpu_nms_poly_fast(dets, thresh): ...@@ -80,10 +77,10 @@ def py_cpu_nms_poly_fast(dets, thresh):
polys = [] polys = []
for i in range(len(dets)): for i in range(len(dets)):
tm_polygon = [dets[i][0], dets[i][1], tm_polygon = [
dets[i][2], dets[i][3], dets[i][0], dets[i][1], dets[i][2], dets[i][3], dets[i][4],
dets[i][4], dets[i][5], dets[i][5], dets[i][6], dets[i][7]
dets[i][6], dets[i][7]] ]
polys.append(tm_polygon) polys.append(tm_polygon)
polys = np.array(polys) polys = np.array(polys)
order = scores.argsort()[::-1] order = scores.argsort()[::-1]
...@@ -124,7 +121,7 @@ def py_cpu_nms_poly_fast(dets, thresh): ...@@ -124,7 +121,7 @@ def py_cpu_nms_poly_fast(dets, thresh):
def poly2origpoly(poly, x, y, rate): def poly2origpoly(poly, x, y, rate):
origpoly = [] origpoly = []
for i in range(int(len(poly)/2)): for i in range(int(len(poly) / 2)):
tmp_x = float(poly[i * 2] + x) / float(rate) tmp_x = float(poly[i * 2] + x) / float(rate)
tmp_y = float(poly[i * 2 + 1] + y) / float(rate) tmp_y = float(poly[i * 2 + 1] + y) / float(rate)
origpoly.append(tmp_x) origpoly.append(tmp_x)
...@@ -196,11 +193,14 @@ def merge_single(output_dir, nms, pred_class_lst): ...@@ -196,11 +193,14 @@ def merge_single(output_dir, nms, pred_class_lst):
for det in nameboxnmsdict[imgname]: for det in nameboxnmsdict[imgname]:
confidence = det[-1] confidence = det[-1]
bbox = det[0:-1] bbox = det[0:-1]
outline = imgname + ' ' + str(confidence) + ' ' + ' '.join(map(str, bbox)) outline = imgname + ' ' + str(confidence) + ' ' + ' '.join(
map(str, bbox))
f_out.write(outline + '\n') f_out.write(outline + '\n')
def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v1.0'): def dota_generate_test_result(pred_txt_dir,
output_dir='output',
dota_version='v1.0'):
""" """
pred_txt_dir: dir of pred txt pred_txt_dir: dir of pred txt
output_dir: dir of output output_dir: dir of output
...@@ -228,7 +228,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v ...@@ -228,7 +228,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v
pred_classes_lst = [] pred_classes_lst = []
for class_name in pred_classes.keys(): for class_name in pred_classes.keys():
print('class_name: {}, count: {}'.format(class_name, len(pred_classes[class_name]))) print('class_name: {}, count: {}'.format(class_name,
len(pred_classes[class_name])))
pred_classes_lst.append((class_name, pred_classes[class_name])) pred_classes_lst.append((class_name, pred_classes[class_name]))
# step2: merge # step2: merge
...@@ -241,7 +242,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v ...@@ -241,7 +242,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='dota anno to coco') parser = argparse.ArgumentParser(description='dota anno to coco')
parser.add_argument('--pred_txt_dir', help='path of pred txt dir') parser.add_argument('--pred_txt_dir', help='path of pred txt dir')
parser.add_argument('--output_dir', help='path of output dir', default='output') parser.add_argument(
'--output_dir', help='path of output dir', default='output')
parser.add_argument( parser.add_argument(
'--dota_version', '--dota_version',
help='dota_version, v1.0 or v1.5 or v2.0', help='dota_version, v1.0 or v1.5 or v2.0',
...@@ -251,5 +253,6 @@ if __name__ == '__main__': ...@@ -251,5 +253,6 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
# process # process
dota_generate_test_result(args.pred_txt_dir, args.output_dir, args.dota_version) dota_generate_test_result(args.pred_txt_dir, args.output_dir,
args.dota_version)
print('done!') print('done!')
...@@ -17,9 +17,6 @@ import os.path as osp ...@@ -17,9 +17,6 @@ import os.path as osp
import json import json
import glob import glob
import cv2 import cv2
import numpy as np
from PIL import Image
import logging
import argparse import argparse
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import os import os
import sys
import re import re
import argparse import argparse
import pandas as pd import pandas as pd
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
# 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 argparse
import os import os
import time
import logging import logging
import paddle import paddle
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import os import os
from PIL import Image
import cv2 import cv2
import math import math
import numpy as np import numpy as np
......
...@@ -13,12 +13,10 @@ ...@@ -13,12 +13,10 @@
# limitations under the License. # limitations under the License.
import os import os
import time
import yaml import yaml
import glob import glob
from functools import reduce from functools import reduce
from PIL import Image
import cv2 import cv2
import numpy as np import numpy as np
import math import math
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# 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.
from PIL import Image
import cv2 import cv2
import numpy as np import numpy as np
......
...@@ -19,7 +19,6 @@ import os ...@@ -19,7 +19,6 @@ import os
import cv2 import cv2
import numpy as np import numpy as np
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
from scipy import ndimage
import math import math
......
...@@ -21,7 +21,6 @@ import os ...@@ -21,7 +21,6 @@ import os
import sys import sys
import yaml import yaml
import copy
import collections import collections
try: try:
......
...@@ -13,21 +13,19 @@ ...@@ -13,21 +13,19 @@
# limitations under the License. # limitations under the License.
import os import os
import copy
import traceback import traceback
import six import six
import sys import sys
import multiprocessing as mp
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
import queue as Queue pass
else: else:
import Queue pass
import numpy as np import numpy as np
from paddle.io import DataLoader, DistributedBatchSampler from paddle.io import DataLoader, DistributedBatchSampler
from paddle.fluid.dataloader.collate import default_collate_fn from paddle.fluid.dataloader.collate import default_collate_fn
from ppdet.core.workspace import register, serializable, create from ppdet.core.workspace import register
from . import transform from . import transform
from .shm_utils import _get_shared_memory_size_in_M from .shm_utils import _get_shared_memory_size_in_M
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import os import os
import numpy as np import numpy as np
from collections import OrderedDict
try: try:
from collections.abc import Sequence from collections.abc import Sequence
except Exception: except Exception:
......
...@@ -23,8 +23,6 @@ import inspect ...@@ -23,8 +23,6 @@ import inspect
import math import math
from PIL import Image, ImageEnhance from PIL import Image, ImageEnhance
import numpy as np import numpy as np
import os
import sys
import cv2 import cv2
from copy import deepcopy from copy import deepcopy
......
...@@ -27,7 +27,6 @@ import cv2 ...@@ -27,7 +27,6 @@ import cv2
import numpy as np import numpy as np
import math import math
import copy import copy
import os
from ...modeling.keypoint_utils import get_affine_mat_kernel, warp_affine_joints, get_affine_transform, affine_transform from ...modeling.keypoint_utils import get_affine_mat_kernel, warp_affine_joints, get_affine_transform, affine_transform
from ppdet.core.workspace import serializable from ppdet.core.workspace import serializable
......
...@@ -31,7 +31,6 @@ import math ...@@ -31,7 +31,6 @@ import math
from .operators import BaseOperator, register_op from .operators import BaseOperator, register_op
from .batch_operators import Gt2TTFTarget from .batch_operators import Gt2TTFTarget
from ppdet.modeling.bbox_utils import bbox_iou_np_expand from ppdet.modeling.bbox_utils import bbox_iou_np_expand
from ppdet.core.workspace import serializable
from ppdet.utils.logger import setup_logger from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__) logger = setup_logger(__name__)
......
...@@ -35,10 +35,9 @@ import os ...@@ -35,10 +35,9 @@ import os
import copy import copy
import cv2 import cv2
from PIL import Image, ImageEnhance, ImageDraw from PIL import Image, ImageDraw
from ppdet.core.workspace import serializable from ppdet.core.workspace import serializable
from ppdet.modeling.layers import AnchorGrid
from ppdet.modeling import bbox_utils from ppdet.modeling import bbox_utils
from ..reader import Compose from ..reader import Compose
...@@ -46,7 +45,7 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process, ...@@ -46,7 +45,7 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process,
generate_sample_bbox, clip_bbox, data_anchor_sampling, generate_sample_bbox, clip_bbox, data_anchor_sampling,
satisfy_sample_constraint_coverage, crop_image_sampling, satisfy_sample_constraint_coverage, crop_image_sampling,
generate_sample_bbox_square, bbox_area_sampling, generate_sample_bbox_square, bbox_area_sampling,
is_poly, gaussian_radius, draw_gaussian, transform_bbox) is_poly, transform_bbox)
from ppdet.utils.logger import setup_logger from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__) logger = setup_logger(__name__)
......
...@@ -20,9 +20,7 @@ import os ...@@ -20,9 +20,7 @@ import os
import sys import sys
import datetime import datetime
import six import six
import numpy as np
import paddle
import paddle.distributed as dist import paddle.distributed as dist
from ppdet.utils.checkpoint import save_model from ppdet.utils.checkpoint import save_model
...@@ -217,7 +215,8 @@ class VisualDLWriter(Callback): ...@@ -217,7 +215,8 @@ class VisualDLWriter(Callback):
logger.error('visualdl not found, plaese install visualdl. ' logger.error('visualdl not found, plaese install visualdl. '
'for example: `pip install visualdl`.') 'for example: `pip install visualdl`.')
raise e raise e
self.vdl_writer = LogWriter(model.cfg.get('vdl_log_dir', 'vdl_log_dir/scalar')) self.vdl_writer = LogWriter(
model.cfg.get('vdl_log_dir', 'vdl_log_dir/scalar'))
self.vdl_loss_step = 0 self.vdl_loss_step = 0
self.vdl_mAP_step = 0 self.vdl_mAP_step = 0
self.vdl_image_step = 0 self.vdl_image_step = 0
......
...@@ -17,11 +17,9 @@ from __future__ import division ...@@ -17,11 +17,9 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import os import os
import sys
import copy import copy
import time import time
import random
import datetime
import numpy as np import numpy as np
from PIL import Image from PIL import Image
......
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup from paddle.utils.cpp_extension import CUDAExtension, setup
if __name__ == "__main__": if __name__ == "__main__":
setup( setup(
......
import numpy as np import numpy as np
import os
import sys import sys
import cv2
import time import time
import shapely
from shapely.geometry import Polygon from shapely.geometry import Polygon
import paddle import paddle
......
...@@ -150,7 +150,7 @@ def cocoapi_eval(jsonfile, ...@@ -150,7 +150,7 @@ def cocoapi_eval(jsonfile,
results_flatten = list(itertools.chain(*results_per_category)) results_flatten = list(itertools.chain(*results_per_category))
headers = ['category', 'AP'] * (num_columns // 2) headers = ['category', 'AP'] * (num_columns // 2)
results_2d = itertools.zip_longest( results_2d = itertools.zip_longest(
* [results_flatten[i::num_columns] for i in range(num_columns)]) *[results_flatten[i::num_columns] for i in range(num_columns)])
table_data = [headers] table_data = [headers]
table_data += [result for result in results_2d] table_data += [result for result in results_2d]
table = AsciiTable(table_data) table = AsciiTable(table_data)
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
# 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 six import six
import os
import numpy as np import numpy as np
import cv2
def get_det_res(bboxes, bbox_nums, image_id, label_to_cat_id_map, bias=0): def get_det_res(bboxes, bbox_nums, image_id, label_to_cat_id_map, bias=0):
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# 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 copy
import os import os
import json import json
from collections import OrderedDict
from collections import defaultdict from collections import defaultdict
import numpy as np import numpy as np
from pycocotools.coco import COCO from pycocotools.coco import COCO
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
# 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 os.path as osp import os.path as osp
import glob
import pkg_resources import pkg_resources
try: try:
......
...@@ -21,7 +21,6 @@ import paddle ...@@ -21,7 +21,6 @@ import paddle
import ppdet import ppdet
import unittest import unittest
# NOTE: weights downloading costs time, we choose # NOTE: weights downloading costs time, we choose
# a small model for unittesting # a small model for unittesting
MODEL_NAME = 'ppyolo/ppyolo_tiny_650e_coco' MODEL_NAME = 'ppyolo/ppyolo_tiny_650e_coco'
......
...@@ -16,7 +16,6 @@ from __future__ import absolute_import ...@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle
from ppdet.core.workspace import register, create from ppdet.core.workspace import register, create
from .meta_arch import BaseArch from .meta_arch import BaseArch
......
...@@ -2,7 +2,6 @@ from __future__ import absolute_import ...@@ -2,7 +2,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
from ppdet.core.workspace import register from ppdet.core.workspace import register
......
...@@ -19,7 +19,6 @@ from __future__ import print_function ...@@ -19,7 +19,6 @@ from __future__ import print_function
import paddle import paddle
from ppdet.core.workspace import register, create from ppdet.core.workspace import register, create
from .meta_arch import BaseArch from .meta_arch import BaseArch
import numpy as np
__all__ = ['S2ANet'] __all__ = ['S2ANet']
......
...@@ -20,10 +20,8 @@ import paddle ...@@ -20,10 +20,8 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
from paddle.regularizer import L2Decay
from paddle.nn.initializer import KaimingNormal from paddle.nn.initializer import KaimingNormal
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from numbers import Integral
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
__all__ = ['BlazeNet'] __all__ = ['BlazeNet']
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ppdet.modeling.ops import batch_norm, mish from ppdet.modeling.ops import batch_norm, mish
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
......
...@@ -17,9 +17,9 @@ import paddle ...@@ -17,9 +17,9 @@ import paddle
from paddle import ParamAttr from paddle import ParamAttr
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.nn import Conv2D, BatchNorm, AdaptiveAvgPool2D, Linear from paddle.nn import AdaptiveAvgPool2D, Linear
from paddle.regularizer import L2Decay from paddle.nn.initializer import Uniform
from paddle.nn.initializer import Uniform, KaimingNormal
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from numbers import Integral from numbers import Integral
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
......
...@@ -21,7 +21,7 @@ from paddle.nn.initializer import Normal ...@@ -21,7 +21,7 @@ from paddle.nn.initializer import Normal
from numbers import Integral from numbers import Integral
import math import math
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
__all__ = ['HRNet'] __all__ = ['HRNet']
......
...@@ -16,7 +16,6 @@ from __future__ import absolute_import ...@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
......
...@@ -12,9 +12,8 @@ ...@@ -12,9 +12,8 @@
# 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 paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .resnet import ResNet, Blocks, BasicBlock, BottleNeck from .resnet import ResNet, Blocks, BasicBlock, BottleNeck
......
...@@ -4,7 +4,6 @@ import paddle ...@@ -4,7 +4,6 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
from paddle.regularizer import L2Decay
from paddle.nn import Conv2D, MaxPool2D from paddle.nn import Conv2D, MaxPool2D
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
import math import math
import paddle import paddle
import paddle.nn.functional as F
import math
import numpy as np import numpy as np
......
...@@ -21,8 +21,6 @@ from paddle.nn.initializer import Normal, XavierUniform, KaimingNormal ...@@ -21,8 +21,6 @@ from paddle.nn.initializer import Normal, XavierUniform, KaimingNormal
from paddle.regularizer import L2Decay from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from .roi_extractor import RoIAlign from .roi_extractor import RoIAlign
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
from ..bbox_utils import bbox2delta from ..bbox_utils import bbox2delta
......
...@@ -15,16 +15,13 @@ ...@@ -15,16 +15,13 @@
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.nn.initializer import Normal, XavierUniform from paddle.nn.initializer import Normal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from ppdet.core.workspace import register
from .bbox_head import BBoxHead, TwoFCHead, XConvNormHead from .bbox_head import BBoxHead, TwoFCHead, XConvNormHead
from .roi_extractor import RoIAlign from .roi_extractor import RoIAlign
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
from ..bbox_utils import bbox2delta, delta2bbox, clip_bbox, nonempty_bbox from ..bbox_utils import delta2bbox, clip_bbox, nonempty_bbox
__all__ = ['CascadeTwoFCHead', 'CascadeXConvNormHead', 'CascadeHead'] __all__ = ['CascadeTwoFCHead', 'CascadeXConvNormHead', 'CascadeHead']
......
...@@ -12,12 +12,10 @@ ...@@ -12,12 +12,10 @@
# 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 numpy as np
import math import math
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import KaimingUniform from paddle.nn.initializer import KaimingUniform
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.losses import CTFocalLoss from ppdet.modeling.losses import CTFocalLoss
......
...@@ -14,11 +14,8 @@ ...@@ -14,11 +14,8 @@
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register
from paddle.regularizer import L2Decay
from paddle import ParamAttr
from ppdet.core.workspace import register
from ..layers import AnchorGeneratorSSD from ..layers import AnchorGeneratorSSD
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register from ppdet.core.workspace import register
from .. import layers as L from .. import layers as L
from ..backbones.hrnet import BasicBlock from ..backbones.hrnet import BasicBlock
......
...@@ -16,12 +16,9 @@ import paddle ...@@ -16,12 +16,9 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.nn.initializer import KaimingNormal from paddle.nn.initializer import KaimingNormal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from ppdet.modeling.layers import ConvNormLayer from ppdet.modeling.layers import ConvNormLayer
from .roi_extractor import RoIAlign from .roi_extractor import RoIAlign
......
...@@ -16,7 +16,7 @@ import paddle ...@@ -16,7 +16,7 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
from paddle.nn.initializer import Constant, Uniform, Normal from paddle.nn.initializer import Constant, Normal
from paddle.regularizer import L2Decay from paddle.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.layers import DeformableConvV2, LiteConv from ppdet.modeling.layers import DeformableConvV2, LiteConv
......
...@@ -21,7 +21,6 @@ import paddle ...@@ -21,7 +21,6 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
from paddle import ParamAttr from paddle import ParamAttr
from paddle import to_tensor from paddle import to_tensor
from paddle.nn import Conv2D, BatchNorm2D, GroupNorm
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.nn.initializer import Normal, Constant, XavierUniform from paddle.nn.initializer import Normal, Constant, XavierUniform
from paddle.regularizer import L2Decay from paddle.regularizer import L2Decay
......
...@@ -17,7 +17,7 @@ from __future__ import division ...@@ -17,7 +17,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle import paddle
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
__all__ = ['CTFocalLoss'] __all__ = ['CTFocalLoss']
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
......
...@@ -16,11 +16,10 @@ from __future__ import absolute_import ...@@ -16,11 +16,10 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle
import paddle.nn.functional as F import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .iou_loss import IouLoss from .iou_loss import IouLoss
from ..bbox_utils import xywh2xyxy, bbox_iou from ..bbox_utils import bbox_iou
@register @register
......
...@@ -19,9 +19,9 @@ from __future__ import print_function ...@@ -19,9 +19,9 @@ from __future__ import print_function
import numpy as np import numpy as np
import paddle import paddle
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ..bbox_utils import xywh2xyxy, bbox_iou from ..bbox_utils import bbox_iou
__all__ = ['IouLoss', 'GIoULoss', 'DIouLoss'] __all__ = ['IouLoss', 'GIoULoss', 'DIouLoss']
......
...@@ -20,7 +20,7 @@ from itertools import cycle, islice ...@@ -20,7 +20,7 @@ from itertools import cycle, islice
from collections import abc from collections import abc
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
__all__ = ['HrHRNetLoss', 'KeyPointMSELoss'] __all__ = ['HrHRNetLoss', 'KeyPointMSELoss']
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
This code is borrow from https://github.com/nwojke/deep_sort/blob/master/deep_sort/track.py This code is borrow from https://github.com/nwojke/deep_sort/blob/master/deep_sort/track.py
""" """
import numpy as np
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
__all__ = ['TrackState', 'Track'] __all__ = ['TrackState', 'Track']
......
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
# 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 numpy as np
import math
import paddle import paddle
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
import paddle.nn as nn import paddle.nn as nn
from paddle.nn.initializer import KaimingNormal from paddle.nn.initializer import KaimingNormal
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import ConvNormLayer
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
__all__ = ['BlazeNeck'] __all__ = ['BlazeNeck']
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
import numpy as np import numpy as np
import math import math
import paddle import paddle
import paddle.nn.functional as F
from paddle import ParamAttr
import paddle.nn as nn import paddle.nn as nn
from paddle.nn.initializer import KaimingUniform from paddle.nn.initializer import KaimingUniform
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -12,13 +12,11 @@ ...@@ -12,13 +12,11 @@
# 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 numpy as np
import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
from paddle.nn.initializer import XavierUniform from paddle.nn.initializer import XavierUniform
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import ConvNormLayer from ppdet.modeling.layers import ConvNormLayer
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
......
...@@ -16,8 +16,7 @@ import paddle ...@@ -16,8 +16,7 @@ import paddle
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
import paddle.nn as nn import paddle.nn as nn
from paddle.regularizer import L2Decay from ppdet.core.workspace import register
from ppdet.core.workspace import register, serializable
from ..shape_spec import ShapeSpec from ..shape_spec import ShapeSpec
__all__ = ['HRFPN'] __all__ = ['HRFPN']
......
...@@ -17,7 +17,6 @@ import paddle.nn as nn ...@@ -17,7 +17,6 @@ import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr from paddle import ParamAttr
from paddle.nn.initializer import Constant, Uniform, Normal, XavierUniform from paddle.nn.initializer import Constant, Uniform, Normal, XavierUniform
from paddle import ParamAttr
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from paddle.regularizer import L2Decay from paddle.regularizer import L2Decay
from ppdet.modeling.layers import DeformableConvV2, ConvNormLayer, LiteConv from ppdet.modeling.layers import DeformableConvV2, ConvNormLayer, LiteConv
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import DropBlock from ppdet.modeling.layers import DropBlock
from ..backbones.darknet import ConvBNLayer from ..backbones.darknet import ConvBNLayer
......
...@@ -21,12 +21,7 @@ from paddle.regularizer import L2Decay ...@@ -21,12 +21,7 @@ from paddle.regularizer import L2Decay
from paddle.fluid.framework import Variable, in_dygraph_mode from paddle.fluid.framework import Variable, in_dygraph_mode
from paddle.fluid import core from paddle.fluid import core
from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layer_helper import LayerHelper
from paddle.fluid.dygraph import layers from paddle.fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype
from paddle.fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype, convert_dtype
import math
import six
import numpy as np
from functools import reduce
__all__ = [ __all__ = [
'roi_pool', 'roi_pool',
......
...@@ -17,7 +17,7 @@ import paddle ...@@ -17,7 +17,7 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.bbox_utils import nonempty_bbox, rbox2poly, rbox2poly from ppdet.modeling.bbox_utils import nonempty_bbox, rbox2poly
from ppdet.modeling.layers import TTFBox from ppdet.modeling.layers import TTFBox
from .transformers import bbox_cxcywh_to_xyxy from .transformers import bbox_cxcywh_to_xyxy
try: try:
......
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
# 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 numpy as np
import math import math
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register from ppdet.core.workspace import register
from .. import ops
@register @register
......
...@@ -12,11 +12,7 @@ ...@@ -12,11 +12,7 @@
# 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 numpy as np
import paddle import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from .. import ops from .. import ops
......
...@@ -16,11 +16,8 @@ import paddle ...@@ -16,11 +16,8 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.nn.initializer import Normal from paddle.nn.initializer import Normal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling import ops
from .anchor_generator import AnchorGenerator from .anchor_generator import AnchorGenerator
from .target_layer import RPNTargetAssign from .target_layer import RPNTargetAssign
from .proposal_generator import ProposalGenerator from .proposal_generator import ProposalGenerator
......
...@@ -12,12 +12,9 @@ ...@@ -12,12 +12,9 @@
# 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 six
import math
import numpy as np import numpy as np
import paddle import paddle
from ..bbox_utils import bbox2delta, bbox_overlaps from ..bbox_utils import bbox2delta, bbox_overlaps
import copy
def rpn_anchor_target(anchors, def rpn_anchor_target(anchors,
......
...@@ -17,7 +17,6 @@ import math ...@@ -17,7 +17,6 @@ import math
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import KaimingUniform, Uniform from paddle.nn.initializer import KaimingUniform, Uniform
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.heads.centernet_head import ConvLayer from ppdet.modeling.heads.centernet_head import ConvLayer
......
...@@ -16,7 +16,6 @@ from __future__ import print_function ...@@ -16,7 +16,6 @@ from __future__ import print_function
import unittest import unittest
import contextlib import contextlib
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -24,7 +24,6 @@ import numpy as np ...@@ -24,7 +24,6 @@ import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.framework import Program, program_guard
from paddle.fluid.dygraph import base from paddle.fluid.dygraph import base
import ppdet.modeling.ops as ops import ppdet.modeling.ops as ops
......
...@@ -15,13 +15,9 @@ ...@@ -15,13 +15,9 @@
from __future__ import division from __future__ import division
import unittest import unittest
import numpy as np
from scipy.special import logit
from scipy.special import expit
import paddle import paddle
from paddle import fluid from paddle import fluid
from paddle.fluid import core
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
import os import os
import sys import sys
...@@ -31,7 +27,6 @@ if parent_path not in sys.path: ...@@ -31,7 +27,6 @@ if parent_path not in sys.path:
from ppdet.modeling.losses import YOLOv3Loss from ppdet.modeling.losses import YOLOv3Loss
from ppdet.data.transform.op_helper import jaccard_overlap from ppdet.data.transform.op_helper import jaccard_overlap
import random
import numpy as np import numpy as np
......
...@@ -17,14 +17,11 @@ from __future__ import division ...@@ -17,14 +17,11 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import math import math
import copy
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.optimizer as optimizer import paddle.optimizer as optimizer
from paddle.optimizer.lr import CosineAnnealingDecay
import paddle.regularizer as regularizer import paddle.regularizer as regularizer
from paddle import cos
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -20,12 +20,11 @@ import paddle ...@@ -20,12 +20,11 @@ import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable, load_config from ppdet.core.workspace import register, create, load_config
from ppdet.core.workspace import create
from ppdet.utils.logger import setup_logger
from ppdet.modeling import ops from ppdet.modeling import ops
from ppdet.utils.checkpoint import load_pretrain_weight from ppdet.utils.checkpoint import load_pretrain_weight
from ppdet.modeling.losses import YOLOv3Loss from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__) logger = setup_logger(__name__)
......
...@@ -16,7 +16,6 @@ from __future__ import absolute_import ...@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle
from paddle.utils import try_import from paddle.utils import try_import
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -20,7 +20,6 @@ from __future__ import unicode_literals ...@@ -20,7 +20,6 @@ from __future__ import unicode_literals
import errno import errno
import os import os
import time import time
import re
import numpy as np import numpy as np
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
......
...@@ -29,10 +29,10 @@ import binascii ...@@ -29,10 +29,10 @@ import binascii
import tarfile import tarfile
import zipfile import zipfile
from .voc_utils import create_list
from ppdet.core.workspace import BASE_KEY from ppdet.core.workspace import BASE_KEY
from .logger import setup_logger from .logger import setup_logger
from .voc_utils import create_list
logger = setup_logger(__name__) logger = setup_logger(__name__)
__all__ = [ __all__ = [
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# 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 functools
import logging import logging
import os import os
import sys import sys
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import collections import collections
import numpy as np import numpy as np
import datetime
__all__ = ['SmoothedValue', 'TrainingStats'] __all__ = ['SmoothedValue', 'TrainingStats']
......
...@@ -20,7 +20,6 @@ from __future__ import unicode_literals ...@@ -20,7 +20,6 @@ from __future__ import unicode_literals
import numpy as np import numpy as np
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
import cv2 import cv2
import os
import math import math
from .colormap import colormap from .colormap import colormap
......
...@@ -20,7 +20,6 @@ import os ...@@ -20,7 +20,6 @@ import os
import os.path as osp import os.path as osp
import re import re
import random import random
import shutil
__all__ = ['create_list'] __all__ = ['create_list']
......
...@@ -15,10 +15,9 @@ ...@@ -15,10 +15,9 @@
import os import os
import time import time
from functools import reduce from functools import reduce
import base64
import cv2 import cv2
import numpy as np import numpy as np
from paddlehub.module.module import moduleinfo, serving from paddlehub.module.module import moduleinfo
import blazeface.data_feed as D import blazeface.data_feed as D
......
...@@ -15,11 +15,9 @@ ...@@ -15,11 +15,9 @@
import os import os
import time import time
from functools import reduce from functools import reduce
import base64
import cv2 import cv2
import numpy as np import numpy as np
from paddlehub.module.module import moduleinfo, serving from paddlehub.module.module import moduleinfo
import solov2.processor as P import solov2.processor as P
import solov2.data_feed as D import solov2.data_feed as D
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
# limitations under the License. # limitations under the License.
import os import os
import cv2 import cv2
import json
import math import math
import numpy as np import numpy as np
import argparse
HAT_SCALES = { HAT_SCALES = {
'1.png': [3.0, 0.9, .0], '1.png': [3.0, 0.9, .0],
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import os import os
import time
import base64 import base64
import json import json
...@@ -21,8 +20,7 @@ import cv2 ...@@ -21,8 +20,7 @@ import cv2
import numpy as np import numpy as np
import paddle.nn as nn import paddle.nn as nn
import paddlehub as hub import paddlehub as hub
from paddlehub.module.module import moduleinfo, serving, Module from paddlehub.module.module import moduleinfo, serving
import solov2_blazeface.processor as P import solov2_blazeface.processor as P
......
...@@ -16,7 +16,7 @@ from __future__ import division ...@@ -16,7 +16,7 @@ from __future__ import division
import cv2 import cv2
import numpy as np import numpy as np
from PIL import Image, ImageDraw from PIL import Image
import solov2_blazeface.face_makeup_main as face_makeup_main import solov2_blazeface.face_makeup_main as face_makeup_main
......
...@@ -12,12 +12,8 @@ ...@@ -12,12 +12,8 @@
# 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 paddle
import paddlehub as hub import paddlehub as hub
import cv2 import cv2
from PIL import Image
import numpy as np
import base64
img_file = 'demo_images/test.jpg' img_file = 'demo_images/test.jpg'
background = 'element_source/background/1.png' background = 'element_source/background/1.png'
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -28,7 +30,6 @@ import yaml ...@@ -28,7 +30,6 @@ import yaml
import ast import ast
from functools import reduce from functools import reduce
from PIL import Image
import cv2 import cv2
import numpy as np import numpy as np
import paddle import paddle
...@@ -508,7 +509,7 @@ def predict_video(detector, camera_id): ...@@ -508,7 +509,7 @@ def predict_video(detector, camera_id):
fps = 30 fps = 30
width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
fourcc = cv2.VideoWriter_fourcc(* 'mp4v') fourcc = cv2.VideoWriter_fourcc(*'mp4v')
if not os.path.exists(FLAGS.output_dir): if not os.path.exists(FLAGS.output_dir):
os.makedirs(FLAGS.output_dir) os.makedirs(FLAGS.output_dir)
out_path = os.path.join(FLAGS.output_dir, video_name) out_path = os.path.join(FLAGS.output_dir, video_name)
......
...@@ -18,7 +18,6 @@ from __future__ import division ...@@ -18,7 +18,6 @@ from __future__ import division
import cv2 import cv2
import numpy as np import numpy as np
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
from scipy import ndimage
def visualize_box_mask(im, results, labels, mask_resolution=14, threshold=0.5): def visualize_box_mask(im, results, labels, mask_resolution=14, threshold=0.5):
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
# #
import os import os
import sys import sys
# sys.path.insert(0, os.path.abspath('.'))
import sphinx_rtd_theme
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
sys.path.insert(0, os.path.abspath("..")) sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../../")) sys.path.insert(0, os.path.abspath("../../"))
......
...@@ -31,7 +31,6 @@ import uuid ...@@ -31,7 +31,6 @@ import uuid
import logging import logging
import signal import signal
import threading import threading
import traceback
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -17,7 +17,6 @@ from __future__ import division ...@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals from __future__ import unicode_literals
import sys
import six import six
if six.PY3: if six.PY3:
import pickle import pickle
......
...@@ -24,7 +24,6 @@ import os ...@@ -24,7 +24,6 @@ import os
import time import time
import math import math
import struct import struct
import sys
import six import six
if six.PY3: if six.PY3:
...@@ -32,7 +31,6 @@ if six.PY3: ...@@ -32,7 +31,6 @@ if six.PY3:
else: else:
import cPickle as pickle import cPickle as pickle
import json
import uuid import uuid
import random import random
import numpy as np import numpy as np
......
...@@ -23,8 +23,6 @@ import inspect ...@@ -23,8 +23,6 @@ import inspect
import math import math
from PIL import Image, ImageEnhance from PIL import Image, ImageEnhance
import numpy as np import numpy as np
import os
import sys
import cv2 import cv2
from copy import deepcopy from copy import deepcopy
......
...@@ -20,8 +20,8 @@ import math ...@@ -20,8 +20,8 @@ import math
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Normal, Constant, NumpyArrayInitializer from paddle.fluid.initializer import Normal, Constant
from paddle.fluid.regularizer import L2Decay
from ppdet.modeling.ops import ConvNorm, DeformConvNorm from ppdet.modeling.ops import ConvNorm, DeformConvNorm
from ppdet.modeling.ops import MultiClassNMS from ppdet.modeling.ops import MultiClassNMS
......
...@@ -19,7 +19,6 @@ from __future__ import print_function ...@@ -19,7 +19,6 @@ from __future__ import print_function
import paddle import paddle
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.regularizer import L2Decay
from ppdet.modeling.ops import ConvNorm, DeformConvNorm, MaskMatrixNMS, DropBlock from ppdet.modeling.ops import ConvNorm, DeformConvNorm, MaskMatrixNMS, DropBlock
from ppdet.core.workspace import register from ppdet.core.workspace import register
......
...@@ -25,7 +25,6 @@ from paddle.fluid.initializer import Normal, Constant, Uniform, Xavier ...@@ -25,7 +25,6 @@ from paddle.fluid.initializer import Normal, Constant, Uniform, Xavier
from paddle.fluid.regularizer import L2Decay from paddle.fluid.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.ops import DeformConv, DropBlock, ConvNorm from ppdet.modeling.ops import DeformConv, DropBlock, ConvNorm
from ppdet.modeling.losses import GiouLoss
__all__ = ['TTFHead', 'TTFLiteHead'] __all__ = ['TTFHead', 'TTFLiteHead']
......
...@@ -22,8 +22,7 @@ from paddle import fluid ...@@ -22,8 +22,7 @@ from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.regularizer import L2Decay from paddle.fluid.regularizer import L2Decay
from ppdet.modeling.ops import MultiClassNMS, MultiClassSoftNMS, MatrixNMS from ppdet.modeling.ops import MultiClassNMS, MultiClassSoftNMS
from ppdet.modeling.losses.yolo_loss import YOLOv3Loss
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.ops import DropBlock from ppdet.modeling.ops import DropBlock
from .iou_aware import get_iou_aware_score from .iou_aware import get_iou_aware_score
......
...@@ -16,7 +16,6 @@ from __future__ import absolute_import ...@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
from collections import OrderedDict from collections import OrderedDict
from paddle import fluid from paddle import fluid
......
...@@ -17,7 +17,6 @@ from __future__ import division ...@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np import numpy as np
import sys
from collections import OrderedDict from collections import OrderedDict
import copy import copy
......
...@@ -21,7 +21,6 @@ from collections import OrderedDict ...@@ -21,7 +21,6 @@ from collections import OrderedDict
from paddle import fluid from paddle import fluid
from ppdet.core.workspace import register from ppdet.core.workspace import register
import numpy as np
from ppdet.utils.check import check_version from ppdet.utils.check import check_version
__all__ = ['CornerNetSqueeze'] __all__ = ['CornerNetSqueeze']
......
...@@ -16,7 +16,6 @@ from __future__ import absolute_import ...@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
from collections import OrderedDict from collections import OrderedDict
from paddle import fluid from paddle import fluid
......
...@@ -18,13 +18,9 @@ from __future__ import print_function ...@@ -18,13 +18,9 @@ from __future__ import print_function
from collections import OrderedDict from collections import OrderedDict
import copy import copy
import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import MSRA
from paddle.fluid.regularizer import L2Decay
from ppdet.experimental import mixed_precision_global_state
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.utils.check import check_version from ppdet.utils.check import check_version
......
...@@ -16,14 +16,10 @@ from __future__ import absolute_import ...@@ -16,14 +16,10 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import sys
from collections import OrderedDict from collections import OrderedDict
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Xavier
from paddle.fluid.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
......
...@@ -17,7 +17,6 @@ from __future__ import division ...@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals from __future__ import unicode_literals
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import ParamAttr from paddle.fluid import ParamAttr
from paddle.fluid.initializer import ConstantInitializer from paddle.fluid.initializer import ConstantInitializer
......
...@@ -20,10 +20,7 @@ from paddle import fluid ...@@ -20,10 +20,7 @@ from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Uniform from paddle.fluid.initializer import Uniform
import functools
from ppdet.core.workspace import register from ppdet.core.workspace import register
from .resnet import ResNet
import math
__all__ = ['Hourglass'] __all__ = ['Hourglass']
......
...@@ -20,8 +20,6 @@ from collections import OrderedDict ...@@ -20,8 +20,6 @@ from collections import OrderedDict
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Xavier
from paddle.fluid.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
......
...@@ -28,8 +28,6 @@ from numbers import Integral ...@@ -28,8 +28,6 @@ from numbers import Integral
from paddle.fluid.initializer import MSRA from paddle.fluid.initializer import MSRA
import math import math
from .name_adapter import NameAdapter
__all__ = ['HRNet'] __all__ = ['HRNet']
......
...@@ -22,10 +22,7 @@ import paddle.fluid as fluid ...@@ -22,10 +22,7 @@ import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.regularizer import L2Decay from paddle.fluid.regularizer import L2Decay
import math
import numpy as np import numpy as np
from collections import OrderedDict
from ppdet.core.workspace import register from ppdet.core.workspace import register
from numbers import Integral from numbers import Integral
......
...@@ -16,20 +16,11 @@ from __future__ import absolute_import ...@@ -16,20 +16,11 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
from collections import OrderedDict
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.framework import Variable
from paddle.fluid.regularizer import L2Decay
from paddle.fluid.initializer import Constant
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
from numbers import Integral
from .nonlocal_helper import add_space_nonlocal from .nonlocal_helper import add_space_nonlocal
from .name_adapter import NameAdapter from .resnet import ResNet
from .resnet import ResNet, ResNetC5
__all__ = ['Res2Net', 'Res2NetC5'] __all__ = ['Res2Net', 'Res2NetC5']
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import NumpyArrayInitializer
from paddle import fluid from paddle import fluid
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -18,7 +18,6 @@ from __future__ import print_function ...@@ -18,7 +18,6 @@ from __future__ import print_function
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Normal, Constant, NumpyArrayInitializer
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
INF = 1e8 INF = 1e8
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import NumpyArrayInitializer
from paddle import fluid from paddle import fluid
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -16,9 +16,6 @@ from __future__ import absolute_import ...@@ -16,9 +16,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import numpy as np import numpy as np
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import NumpyArrayInitializer
from paddle import fluid from paddle import fluid
from ppdet.core.workspace import register, serializable from ppdet.core.workspace import register, serializable
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layer_helper import LayerHelper
from paddle.fluid.framework import Variable
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
from paddle.fluid.layers import (tensor, iou_similarity, bipartite_match, from paddle.fluid.layers import (tensor, iou_similarity, bipartite_match,
target_assign, box_coder) target_assign, box_coder)
......
...@@ -17,12 +17,10 @@ from __future__ import division ...@@ -17,12 +17,10 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Normal, Xavier from paddle.fluid.initializer import Normal
from paddle.fluid.regularizer import L2Decay from paddle.fluid.regularizer import L2Decay
from paddle.fluid.initializer import MSRA
from ppdet.modeling.ops import MultiClassNMS from ppdet.modeling.ops import MultiClassNMS
from ppdet.modeling.ops import ConvNorm
from ppdet.modeling.losses import SmoothL1Loss from ppdet.modeling.losses import SmoothL1Loss
from ppdet.core.workspace import register from ppdet.core.workspace import register
......
...@@ -17,12 +17,8 @@ from __future__ import division ...@@ -17,12 +17,8 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from paddle import fluid from paddle import fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import MSRA
from paddle.fluid.regularizer import L2Decay
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.modeling.ops import ConvNorm
__all__ = ['FusedSemanticHead'] __all__ = ['FusedSemanticHead']
......
...@@ -17,10 +17,8 @@ from __future__ import division ...@@ -17,10 +17,8 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import unittest import unittest
import numpy as np
import paddle import paddle
import paddle.fluid as fluid
import os import os
import sys import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
...@@ -29,9 +27,9 @@ if parent_path not in sys.path: ...@@ -29,9 +27,9 @@ if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
try: try:
from ppdet.utils.check import enable_static_mode, logger
from ppdet.modeling.tests.decorator_helper import prog_scope from ppdet.modeling.tests.decorator_helper import prog_scope
from ppdet.core.workspace import load_config, merge_config, create from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.check import enable_static_mode
except ImportError as e: except ImportError as e:
if sys.argv[0].find('static') >= 0: if sys.argv[0].find('static') >= 0:
logger.error("Importing ppdet failed when running static model " logger.error("Importing ppdet failed when running static model "
......
...@@ -19,8 +19,6 @@ from __future__ import print_function ...@@ -19,8 +19,6 @@ from __future__ import print_function
import logging import logging
import numpy as np import numpy as np
import paddle.fluid as fluid
__all__ = ["bbox_overlaps", "box_to_delta"] __all__ = ["bbox_overlaps", "box_to_delta"]
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -24,7 +24,7 @@ import time ...@@ -24,7 +24,7 @@ import time
import paddle.fluid as fluid import paddle.fluid as fluid
from .voc_eval import bbox_eval as voc_bbox_eval from .voc_eval import bbox_eval as voc_bbox_eval
from .post_process import mstest_box_post_process, mstest_mask_post_process, box_flip from .post_process import mstest_box_post_process, mstest_mask_post_process
__all__ = ['parse_fetches', 'eval_run', 'eval_results', 'json_eval_results'] __all__ = ['parse_fetches', 'eval_run', 'eval_results', 'json_eval_results']
......
...@@ -18,7 +18,6 @@ from __future__ import print_function ...@@ -18,7 +18,6 @@ from __future__ import print_function
import os import os
import yaml import yaml
import numpy as np
from collections import OrderedDict from collections import OrderedDict
import logging import logging
......
...@@ -17,10 +17,6 @@ from __future__ import division ...@@ -17,10 +17,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals from __future__ import unicode_literals
import os
import sys
import numpy as np
from .coco_eval import bbox2out from .coco_eval import bbox2out
import logging import logging
......
...@@ -19,7 +19,6 @@ from __future__ import print_function ...@@ -19,7 +19,6 @@ from __future__ import print_function
import logging import logging
import numpy as np import numpy as np
import cv2 import cv2
import paddle.fluid as fluid
__all__ = ['nms'] __all__ = ['nms']
......
...@@ -18,8 +18,6 @@ from __future__ import print_function ...@@ -18,8 +18,6 @@ from __future__ import print_function
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
import sys
import numpy as np
from ..data.source.voc import pascalvoc_label from ..data.source.voc import pascalvoc_label
from .map_utils import DetectionMAP from .map_utils import DetectionMAP
......
...@@ -20,7 +20,6 @@ import os ...@@ -20,7 +20,6 @@ import os
import os.path as osp import os.path as osp
import re import re
import random import random
import shutil
__all__ = ['create_list'] __all__ = ['create_list']
......
...@@ -20,7 +20,6 @@ import os ...@@ -20,7 +20,6 @@ import os
import numpy as np import numpy as np
from ppdet.data.source.widerface import widerface_label from ppdet.data.source.widerface import widerface_label
from ppdet.utils.coco_eval import bbox2out
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -27,11 +29,9 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s' ...@@ -27,11 +29,9 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT) logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
import numpy as np
from collections import OrderedDict from collections import OrderedDict
from paddleslim.dist.single_distiller import merge, l2_loss from paddleslim.dist.single_distiller import merge, l2_loss
import paddle
from paddle import fluid from paddle import fluid
try: try:
......
...@@ -16,7 +16,8 @@ from __future__ import absolute_import ...@@ -16,7 +16,8 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 4))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 4)))
...@@ -28,13 +29,11 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s' ...@@ -28,13 +29,11 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT) logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
import numpy as np
from collections import OrderedDict from collections import OrderedDict
from paddleslim.dist.single_distiller import merge, l2_loss from paddleslim.dist.single_distiller import merge
from paddleslim.prune import Pruner from paddleslim.prune import Pruner
from paddleslim.analysis import flops from paddleslim.analysis import flops
import paddle
from paddle import fluid from paddle import fluid
try: try:
......
...@@ -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 numpy as np import numpy as np
import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr
from paddleslim.nas.search_space.search_space_base import SearchSpaceBase from paddleslim.nas.search_space.search_space_base import SearchSpaceBase
from paddleslim.nas.search_space.search_space_registry import SEARCHSPACE from paddleslim.nas.search_space.search_space_registry import SEARCHSPACE
from ppdet.modeling.backbones.blazenet import BlazeNet from ppdet.modeling.backbones.blazenet import BlazeNet
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -27,7 +29,6 @@ import numpy as np ...@@ -27,7 +29,6 @@ import numpy as np
import datetime import datetime
from collections import deque from collections import deque
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
...@@ -61,7 +62,6 @@ except ImportError as e: ...@@ -61,7 +62,6 @@ except ImportError as e:
from paddleslim.analysis import flops, TableLatencyEvaluator from paddleslim.analysis import flops, TableLatencyEvaluator
from paddleslim.nas import SANAS from paddleslim.nas import SANAS
import search_space
@register @register
......
...@@ -16,14 +16,14 @@ from __future__ import absolute_import ...@@ -16,14 +16,14 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import Pruner from paddleslim.prune import Pruner
from paddleslim.analysis import flops from paddleslim.analysis import flops
......
...@@ -16,13 +16,14 @@ from __future__ import absolute_import ...@@ -16,13 +16,14 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -26,7 +28,6 @@ import glob ...@@ -26,7 +28,6 @@ import glob
import numpy as np import numpy as np
from PIL import Image from PIL import Image
import paddle
from paddle import fluid from paddle import fluid
from paddleslim.prune import Pruner from paddleslim.prune import Pruner
from paddleslim.analysis import flops from paddleslim.analysis import flops
......
...@@ -16,7 +16,8 @@ from __future__ import absolute_import ...@@ -16,7 +16,8 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
...@@ -29,7 +30,6 @@ import datetime ...@@ -29,7 +30,6 @@ import datetime
from collections import deque from collections import deque
from paddleslim.prune import Pruner from paddleslim.prune import Pruner
from paddleslim.analysis import flops from paddleslim.analysis import flops
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -16,14 +16,14 @@ from __future__ import absolute_import ...@@ -16,14 +16,14 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import logging import logging
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -27,7 +29,6 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s' ...@@ -27,7 +29,6 @@ FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT) logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
import paddle
from paddle import fluid from paddle import fluid
try: try:
......
...@@ -16,17 +16,17 @@ from __future__ import absolute_import ...@@ -16,17 +16,17 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import glob
import numpy as np import numpy as np
from PIL import Image from PIL import Image
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# 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 sys
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.quant import quant_aware, convert
import numpy as np import numpy as np
from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layer_helper import LayerHelper
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -28,7 +30,6 @@ import datetime ...@@ -28,7 +30,6 @@ import datetime
from collections import deque from collections import deque
import shutil import shutil
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
...@@ -58,7 +59,7 @@ except ImportError as e: ...@@ -58,7 +59,7 @@ except ImportError as e:
else: else:
raise e raise e
from paddleslim.quant import quant_aware, convert from paddleslim.quant import quant_aware
from pact import pact, get_optimizer from pact import pact, get_optimizer
......
...@@ -16,29 +16,22 @@ from __future__ import absolute_import ...@@ -16,29 +16,22 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import time
import numpy as np
import datetime
from collections import deque
import paddle
from paddle import fluid from paddle import fluid
from ppdet.experimental import mixed_precision_context
from ppdet.core.workspace import load_config, merge_config, create from ppdet.core.workspace import load_config, merge_config, create
from ppdet.data.reader import create_reader from ppdet.data.reader import create_reader
from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode from ppdet.utils.check import check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint import ppdet.utils.checkpoint as checkpoint
from paddleslim.prune import sensitivity from paddleslim.prune import sensitivity
import logging import logging
......
...@@ -29,7 +29,6 @@ logging.basicConfig(level=logging.INFO, format=FORMAT) ...@@ -29,7 +29,6 @@ logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
from scipy.cluster.vq import kmeans from scipy.cluster.vq import kmeans
import random
import numpy as np import numpy as np
from tqdm import tqdm from tqdm import tqdm
......
...@@ -17,7 +17,7 @@ from __future__ import print_function ...@@ -17,7 +17,7 @@ from __future__ import print_function
import os import os
import sys import sys
from argparse import ArgumentParser, RawDescriptionHelpFormatter from argparse import ArgumentParser, RawDescriptionHelpFormatter
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -114,7 +114,8 @@ def list_modules(**kwargs): ...@@ -114,7 +114,8 @@ def list_modules(**kwargs):
print("") print("")
max_len = max([len(mod.name) for mod in modules]) max_len = max([len(mod.name) for mod in modules])
for mod in modules: for mod in modules:
print(color_tty.green(mod.name.ljust(max_len)), print(
color_tty.green(mod.name.ljust(max_len)),
mod.doc.split('\n')[0]) mod.doc.split('\n')[0])
print("") print("")
......
...@@ -16,13 +16,14 @@ from __future__ import absolute_import ...@@ -16,13 +16,14 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import logging import logging
......
...@@ -23,7 +23,6 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) ...@@ -23,7 +23,6 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -16,14 +16,14 @@ from __future__ import absolute_import ...@@ -16,14 +16,14 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import yaml
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -23,7 +23,6 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) ...@@ -23,7 +23,6 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import numpy as np import numpy as np
import cv2 import cv2
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -27,7 +29,6 @@ import numpy as np ...@@ -27,7 +29,6 @@ import numpy as np
import six import six
from PIL import Image, ImageOps from PIL import Image, ImageOps
import paddle
from paddle import fluid from paddle import fluid
import logging import logging
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -30,7 +32,6 @@ import six ...@@ -30,7 +32,6 @@ import six
from collections import deque from collections import deque
from paddle.fluid import profiler from paddle.fluid import profiler
import paddle
from paddle import fluid from paddle import fluid
from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter
from paddle.fluid.optimizer import ExponentialMovingAverage from paddle.fluid.optimizer import ExponentialMovingAverage
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -33,7 +35,6 @@ import random ...@@ -33,7 +35,6 @@ import random
import datetime import datetime
import six import six
from collections import deque from collections import deque
import paddle
from paddle.fluid import profiler from paddle.fluid import profiler
from paddle import fluid from paddle import fluid
......
...@@ -19,11 +19,9 @@ import glob ...@@ -19,11 +19,9 @@ import glob
import json import json
import os import os
import os.path as osp import os.path as osp
import sys
import shutil import shutil
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from tqdm import tqdm from tqdm import tqdm
import re
import numpy as np import numpy as np
import PIL.ImageDraw import PIL.ImageDraw
......
...@@ -27,13 +27,12 @@ from ppdet.utils.logger import setup_logger ...@@ -27,13 +27,12 @@ from ppdet.utils.logger import setup_logger
logger = setup_logger('ppdet.anchor_cluster') logger = setup_logger('ppdet.anchor_cluster')
from scipy.cluster.vq import kmeans from scipy.cluster.vq import kmeans
import random
import numpy as np import numpy as np
from tqdm import tqdm from tqdm import tqdm
from ppdet.utils.cli import ArgsParser from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.core.workspace import load_config, merge_config, create from ppdet.core.workspace import load_config, merge_config
class BaseAnchorCluster(object): class BaseAnchorCluster(object):
......
...@@ -16,7 +16,9 @@ from __future__ import absolute_import ...@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys
import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -24,7 +27,6 @@ if parent_path not in sys.path: ...@@ -24,7 +27,6 @@ if parent_path not in sys.path:
# ignore warning log # ignore warning log
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
import glob
import paddle import paddle
from paddle.distributed import ParallelEnv from paddle.distributed import ParallelEnv
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys
import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys
import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys
import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
...@@ -24,7 +27,6 @@ if parent_path not in sys.path: ...@@ -24,7 +27,6 @@ if parent_path not in sys.path:
# ignore warning log # ignore warning log
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
import glob
import paddle import paddle
from paddle.distributed import ParallelEnv from paddle.distributed import ParallelEnv
......
...@@ -16,22 +16,21 @@ from __future__ import absolute_import ...@@ -16,22 +16,21 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import os, sys import os
import sys
# add python path of PadleDetection to sys.path # add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2))) parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path: if parent_path not in sys.path:
sys.path.append(parent_path) sys.path.append(parent_path)
import random
import numpy as np
# ignore warning log # ignore warning log
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
import paddle import paddle
from ppdet.core.workspace import load_config, merge_config, create from ppdet.core.workspace import load_config, merge_config
from ppdet.utils.checkpoint import load_weight
from ppdet.engine import Trainer, init_parallel_env, set_random_seed, init_fleet_env from ppdet.engine import Trainer, init_parallel_env, set_random_seed, init_fleet_env
from ppdet.slim import build_slim_model from ppdet.slim import build_slim_model
......
...@@ -19,11 +19,9 @@ import glob ...@@ -19,11 +19,9 @@ import glob
import json import json
import os import os
import os.path as osp import os.path as osp
import sys
import shutil import shutil
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from tqdm import tqdm from tqdm import tqdm
import re
import numpy as np import numpy as np
import PIL.ImageDraw import PIL.ImageDraw
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册