未验证 提交 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 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
import os.path as osp
import re
import json
import glob
import cv2
import numpy as np
from multiprocessing import Pool
from functools import partial
......@@ -80,10 +77,10 @@ def py_cpu_nms_poly_fast(dets, thresh):
polys = []
for i in range(len(dets)):
tm_polygon = [dets[i][0], dets[i][1],
dets[i][2], dets[i][3],
dets[i][4], dets[i][5],
dets[i][6], dets[i][7]]
tm_polygon = [
dets[i][0], dets[i][1], dets[i][2], dets[i][3], dets[i][4],
dets[i][5], dets[i][6], dets[i][7]
]
polys.append(tm_polygon)
polys = np.array(polys)
order = scores.argsort()[::-1]
......@@ -124,7 +121,7 @@ def py_cpu_nms_poly_fast(dets, thresh):
def poly2origpoly(poly, x, y, rate):
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_y = float(poly[i * 2 + 1] + y) / float(rate)
origpoly.append(tmp_x)
......@@ -196,11 +193,14 @@ def merge_single(output_dir, nms, pred_class_lst):
for det in nameboxnmsdict[imgname]:
confidence = det[-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')
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
output_dir: dir of output
......@@ -228,7 +228,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v
pred_classes_lst = []
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]))
# step2: merge
......@@ -241,7 +242,8 @@ def dota_generate_test_result(pred_txt_dir, output_dir='output', dota_version='v
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='dota anno to coco')
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(
'--dota_version',
help='dota_version, v1.0 or v1.5 or v2.0',
......@@ -251,5 +253,6 @@ if __name__ == '__main__':
args = parser.parse_args()
# 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!')
......@@ -17,9 +17,6 @@ import os.path as osp
import json
import glob
import cv2
import numpy as np
from PIL import Image
import logging
import argparse
# add python path of PadleDetection to sys.path
......
......@@ -13,7 +13,6 @@
# limitations under the License.
import os
import sys
import re
import argparse
import pandas as pd
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import os
import time
import logging
import paddle
......
......@@ -13,7 +13,7 @@
# limitations under the License.
import os
from PIL import Image
import cv2
import math
import numpy as np
......
......@@ -13,12 +13,10 @@
# limitations under the License.
import os
import time
import yaml
import glob
from functools import reduce
from PIL import Image
import cv2
import numpy as np
import math
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PIL import Image
import cv2
import numpy as np
......
......@@ -19,7 +19,6 @@ import os
import cv2
import numpy as np
from PIL import Image, ImageDraw
from scipy import ndimage
import math
......
......@@ -25,9 +25,9 @@
* PaddleDetection中提供的默认配置一般是采用8卡训练的配置,配置文件中的`batch_size`数为每卡的batch size,若训练的时候不是使用8卡或者对`batch_size`有修改,需要等比例的调小初始`learning_rate`来获得较好的收敛效果
* 如果使用自定义数据集并且样本数比较少,建议增大`snapshot_epoch`数来增加第一次进行eval的时候的训练轮数来保证模型已经较好收敛
* 如果使用自定义数据集并且样本数比较少,建议增大`snapshot_epoch`数来增加第一次进行eval的时候的训练轮数来保证模型已经较好收敛
* 若使用自定义数据集训练,可以加载我们发布的COCO或VOC数据集上训练好的权重进行finetune训练来加快收敛速度,可以使用`-o pretrain_weights=xxx`的方式指定预训练权重,xxx可以是Model Zoo里发布的模型权重链接
* 若使用自定义数据集训练,可以加载我们发布的COCO或VOC数据集上训练好的权重进行finetune训练来加快收敛速度,可以使用`-o pretrain_weights=xxx`的方式指定预训练权重,xxx可以是Model Zoo里发布的模型权重链接
......@@ -93,4 +93,4 @@ https://github.com/PaddlePaddle/PaddleDetection/blob/b87a1ea86fa18ce69e44a17ad1b
TestDataset:
!ImageFolder
anno_path: annotations/instances_val2017.json
```
\ No newline at end of file
```
......@@ -21,7 +21,6 @@ import os
import sys
import yaml
import copy
import collections
try:
......
......@@ -13,21 +13,19 @@
# limitations under the License.
import os
import copy
import traceback
import six
import sys
import multiprocessing as mp
if sys.version_info >= (3, 0):
import queue as Queue
pass
else:
import Queue
pass
import numpy as np
from paddle.io import DataLoader, DistributedBatchSampler
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 .shm_utils import _get_shared_memory_size_in_M
......
......@@ -14,7 +14,7 @@
import os
import numpy as np
from collections import OrderedDict
try:
from collections.abc import Sequence
except Exception:
......
......@@ -23,8 +23,6 @@ import inspect
import math
from PIL import Image, ImageEnhance
import numpy as np
import os
import sys
import cv2
from copy import deepcopy
......
......@@ -27,7 +27,6 @@ import cv2
import numpy as np
import math
import copy
import os
from ...modeling.keypoint_utils import get_affine_mat_kernel, warp_affine_joints, get_affine_transform, affine_transform
from ppdet.core.workspace import serializable
......
......@@ -31,7 +31,6 @@ import math
from .operators import BaseOperator, register_op
from .batch_operators import Gt2TTFTarget
from ppdet.modeling.bbox_utils import bbox_iou_np_expand
from ppdet.core.workspace import serializable
from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
......
......@@ -35,10 +35,9 @@ import os
import copy
import cv2
from PIL import Image, ImageEnhance, ImageDraw
from PIL import Image, ImageDraw
from ppdet.core.workspace import serializable
from ppdet.modeling.layers import AnchorGrid
from ppdet.modeling import bbox_utils
from ..reader import Compose
......@@ -46,7 +45,7 @@ from .op_helper import (satisfy_sample_constraint, filter_and_process,
generate_sample_bbox, clip_bbox, data_anchor_sampling,
satisfy_sample_constraint_coverage, crop_image_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
logger = setup_logger(__name__)
......
......@@ -20,9 +20,7 @@ import os
import sys
import datetime
import six
import numpy as np
import paddle
import paddle.distributed as dist
from ppdet.utils.checkpoint import save_model
......@@ -217,7 +215,8 @@ class VisualDLWriter(Callback):
logger.error('visualdl not found, plaese install visualdl. '
'for example: `pip install visualdl`.')
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_mAP_step = 0
self.vdl_image_step = 0
......
......@@ -17,11 +17,9 @@ from __future__ import division
from __future__ import print_function
import os
import sys
import copy
import time
import random
import datetime
import numpy as np
from PIL import Image
......
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup
from paddle.utils.cpp_extension import CUDAExtension, setup
if __name__ == "__main__":
setup(
......
import numpy as np
import os
import sys
import cv2
import time
import shapely
from shapely.geometry import Polygon
import paddle
......
......@@ -150,7 +150,7 @@ def cocoapi_eval(jsonfile,
results_flatten = list(itertools.chain(*results_per_category))
headers = ['category', 'AP'] * (num_columns // 2)
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 += [result for result in results_2d]
table = AsciiTable(table_data)
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
import os
import numpy as np
import cv2
def get_det_res(bboxes, bbox_nums, image_id, label_to_cat_id_map, bias=0):
......
......@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import os
import json
from collections import OrderedDict
from collections import defaultdict
import numpy as np
from pycocotools.coco import COCO
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import os.path as osp
import glob
import pkg_resources
try:
......
......@@ -21,7 +21,6 @@ import paddle
import ppdet
import unittest
# NOTE: weights downloading costs time, we choose
# a small model for unittesting
MODEL_NAME = 'ppyolo/ppyolo_tiny_650e_coco'
......
......@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle
from ppdet.core.workspace import register, create
from .meta_arch import BaseArch
......
......@@ -2,7 +2,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import paddle
import paddle.nn as nn
from ppdet.core.workspace import register
......
......@@ -19,7 +19,6 @@ from __future__ import print_function
import paddle
from ppdet.core.workspace import register, create
from .meta_arch import BaseArch
import numpy as np
__all__ = ['S2ANet']
......
......@@ -20,10 +20,8 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.regularizer import L2Decay
from paddle.nn.initializer import KaimingNormal
from ppdet.core.workspace import register, serializable
from numbers import Integral
from ..shape_spec import ShapeSpec
__all__ = ['BlazeNet']
......
......@@ -15,8 +15,7 @@
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, serializable
from ppdet.modeling.ops import batch_norm, mish
from ..shape_spec import ShapeSpec
......
......@@ -17,9 +17,9 @@ import paddle
from paddle import ParamAttr
import paddle.nn as nn
import paddle.nn.functional as F
from paddle.nn import Conv2D, BatchNorm, AdaptiveAvgPool2D, Linear
from paddle.regularizer import L2Decay
from paddle.nn.initializer import Uniform, KaimingNormal
from paddle.nn import AdaptiveAvgPool2D, Linear
from paddle.nn.initializer import Uniform
from ppdet.core.workspace import register, serializable
from numbers import Integral
from ..shape_spec import ShapeSpec
......
......@@ -21,7 +21,7 @@ from paddle.nn.initializer import Normal
from numbers import Integral
import math
from ppdet.core.workspace import register, serializable
from ppdet.core.workspace import register
from ..shape_spec import ShapeSpec
__all__ = ['HRNet']
......
......@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
......
......@@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
from .resnet import ResNet, Blocks, BasicBlock, BottleNeck
......
......@@ -4,7 +4,6 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.regularizer import L2Decay
from paddle.nn import Conv2D, MaxPool2D
from ppdet.core.workspace import register, serializable
from ..shape_spec import ShapeSpec
......
......@@ -14,8 +14,6 @@
import math
import paddle
import paddle.nn.functional as F
import math
import numpy as np
......
......@@ -21,8 +21,6 @@ from paddle.nn.initializer import Normal, XavierUniform, KaimingNormal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from .roi_extractor import RoIAlign
from ..shape_spec import ShapeSpec
from ..bbox_utils import bbox2delta
......
......@@ -15,16 +15,13 @@
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle.nn.initializer import Normal, XavierUniform
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from paddle.nn.initializer import Normal
from ppdet.core.workspace import register
from .bbox_head import BBoxHead, TwoFCHead, XConvNormHead
from .roi_extractor import RoIAlign
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']
......
......@@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import math
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import KaimingUniform
from ppdet.core.workspace import register
from ppdet.modeling.losses import CTFocalLoss
......
......@@ -14,11 +14,8 @@
import paddle
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
......
......@@ -14,7 +14,7 @@
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register
from .. import layers as L
from ..backbones.hrnet import BasicBlock
......
......@@ -16,12 +16,9 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle.nn.initializer import KaimingNormal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, create
from ppdet.modeling import ops
from ppdet.modeling.layers import ConvNormLayer
from .roi_extractor import RoIAlign
......
......@@ -16,7 +16,7 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
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 ppdet.core.workspace import register
from ppdet.modeling.layers import DeformableConvV2, LiteConv
......
......@@ -21,7 +21,6 @@ import paddle
import paddle.nn as nn
from paddle import ParamAttr
from paddle import to_tensor
from paddle.nn import Conv2D, BatchNorm2D, GroupNorm
import paddle.nn.functional as F
from paddle.nn.initializer import Normal, Constant, XavierUniform
from paddle.regularizer import L2Decay
......
......@@ -17,7 +17,7 @@ from __future__ import division
from __future__ import print_function
import paddle
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
__all__ = ['CTFocalLoss']
......
......@@ -15,7 +15,7 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
......
......@@ -16,11 +16,10 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
from .iou_loss import IouLoss
from ..bbox_utils import xywh2xyxy, bbox_iou
from ..bbox_utils import bbox_iou
@register
......
......@@ -19,9 +19,9 @@ from __future__ import print_function
import numpy as np
import paddle
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
from ..bbox_utils import xywh2xyxy, bbox_iou
from ..bbox_utils import bbox_iou
__all__ = ['IouLoss', 'GIoULoss', 'DIouLoss']
......
......@@ -20,7 +20,7 @@ from itertools import cycle, islice
from collections import abc
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
__all__ = ['HrHRNetLoss', 'KeyPointMSELoss']
......
......@@ -15,7 +15,6 @@
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
__all__ = ['TrackState', 'Track']
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import math
import paddle
import paddle.nn.functional as F
from paddle import ParamAttr
import paddle.nn as nn
from paddle.nn.initializer import KaimingNormal
from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import ConvNormLayer
from ..shape_spec import ShapeSpec
__all__ = ['BlazeNeck']
......
......@@ -15,8 +15,6 @@
import numpy as np
import math
import paddle
import paddle.nn.functional as F
from paddle import ParamAttr
import paddle.nn as nn
from paddle.nn.initializer import KaimingUniform
from ppdet.core.workspace import register, serializable
......
......@@ -12,13 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import XavierUniform
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import ConvNormLayer
from ..shape_spec import ShapeSpec
......
......@@ -16,8 +16,7 @@ import paddle
import paddle.nn.functional as F
from paddle import ParamAttr
import paddle.nn as nn
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register, serializable
from ppdet.core.workspace import register
from ..shape_spec import ShapeSpec
__all__ = ['HRFPN']
......
......@@ -17,7 +17,6 @@ import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import Constant, Uniform, Normal, XavierUniform
from paddle import ParamAttr
from ppdet.core.workspace import register, serializable
from paddle.regularizer import L2Decay
from ppdet.modeling.layers import DeformableConvV2, ConvNormLayer, LiteConv
......
......@@ -15,7 +15,6 @@
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from ppdet.core.workspace import register, serializable
from ppdet.modeling.layers import DropBlock
from ..backbones.darknet import ConvBNLayer
......
......@@ -21,12 +21,7 @@ from paddle.regularizer import L2Decay
from paddle.fluid.framework import Variable, in_dygraph_mode
from paddle.fluid import core
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, convert_dtype
import math
import six
import numpy as np
from functools import reduce
from paddle.fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype
__all__ = [
'roi_pool',
......
......@@ -17,7 +17,7 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
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 .transformers import bbox_cxcywh_to_xyxy
try:
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import math
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register
from .. import ops
@register
......
......@@ -12,11 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable
from .. import ops
......
......@@ -16,11 +16,8 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle.nn.initializer import Normal
from paddle.regularizer import L2Decay
from ppdet.core.workspace import register
from ppdet.modeling import ops
from .anchor_generator import AnchorGenerator
from .target_layer import RPNTargetAssign
from .proposal_generator import ProposalGenerator
......
......@@ -12,12 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
import math
import numpy as np
import paddle
from ..bbox_utils import bbox2delta, bbox_overlaps
import copy
def rpn_anchor_target(anchors,
......
......@@ -17,7 +17,6 @@ import math
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle import ParamAttr
from paddle.nn.initializer import KaimingUniform, Uniform
from ppdet.core.workspace import register
from ppdet.modeling.heads.centernet_head import ConvLayer
......
......@@ -16,7 +16,6 @@ from __future__ import print_function
import unittest
import contextlib
import numpy as np
import paddle
import paddle.fluid as fluid
......
......@@ -24,7 +24,6 @@ import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.fluid.framework import Program, program_guard
from paddle.fluid.dygraph import base
import ppdet.modeling.ops as ops
......
......@@ -15,13 +15,9 @@
from __future__ import division
import unittest
import numpy as np
from scipy.special import logit
from scipy.special import expit
import paddle
from paddle import fluid
from paddle.fluid import core
# add python path of PadleDetection to sys.path
import os
import sys
......@@ -31,7 +27,6 @@ if parent_path not in sys.path:
from ppdet.modeling.losses import YOLOv3Loss
from ppdet.data.transform.op_helper import jaccard_overlap
import random
import numpy as np
......
......@@ -17,14 +17,11 @@ from __future__ import division
from __future__ import print_function
import math
import copy
import paddle
import paddle.nn as nn
import paddle.optimizer as optimizer
from paddle.optimizer.lr import CosineAnnealingDecay
import paddle.regularizer as regularizer
from paddle import cos
from ppdet.core.workspace import register, serializable
......
......@@ -20,12 +20,11 @@ import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register, serializable, load_config
from ppdet.core.workspace import create
from ppdet.utils.logger import setup_logger
from ppdet.core.workspace import register, create, load_config
from ppdet.modeling import ops
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__)
......
......@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle
from paddle.utils import try_import
from ppdet.core.workspace import register, serializable
......
......@@ -20,7 +20,6 @@ from __future__ import unicode_literals
import errno
import os
import time
import re
import numpy as np
import paddle
import paddle.nn as nn
......
......@@ -29,10 +29,10 @@ import binascii
import tarfile
import zipfile
from .voc_utils import create_list
from ppdet.core.workspace import BASE_KEY
from .logger import setup_logger
from .voc_utils import create_list
logger = setup_logger(__name__)
__all__ = [
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import functools
import logging
import os
import sys
......
......@@ -14,7 +14,6 @@
import collections
import numpy as np
import datetime
__all__ = ['SmoothedValue', 'TrainingStats']
......
......@@ -20,7 +20,6 @@ from __future__ import unicode_literals
import numpy as np
from PIL import Image, ImageDraw
import cv2
import os
import math
from .colormap import colormap
......
......@@ -20,7 +20,6 @@ import os
import os.path as osp
import re
import random
import shutil
__all__ = ['create_list']
......
......@@ -15,10 +15,9 @@
import os
import time
from functools import reduce
import base64
import cv2
import numpy as np
from paddlehub.module.module import moduleinfo, serving
from paddlehub.module.module import moduleinfo
import blazeface.data_feed as D
......
......@@ -15,11 +15,9 @@
import os
import time
from functools import reduce
import base64
import cv2
import numpy as np
from paddlehub.module.module import moduleinfo, serving
from paddlehub.module.module import moduleinfo
import solov2.processor as P
import solov2.data_feed as D
......
......@@ -13,10 +13,8 @@
# limitations under the License.
import os
import cv2
import json
import math
import numpy as np
import argparse
HAT_SCALES = {
'1.png': [3.0, 0.9, .0],
......
......@@ -13,7 +13,6 @@
# limitations under the License.
import os
import time
import base64
import json
......@@ -21,8 +20,7 @@ import cv2
import numpy as np
import paddle.nn as nn
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
......
......@@ -16,7 +16,7 @@ from __future__ import division
import cv2
import numpy as np
from PIL import Image, ImageDraw
from PIL import Image
import solov2_blazeface.face_makeup_main as face_makeup_main
......
......@@ -12,12 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import paddle
import paddlehub as hub
import cv2
from PIL import Image
import numpy as np
import base64
img_file = 'demo_images/test.jpg'
background = 'element_source/background/1.png'
......
......@@ -16,7 +16,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, sys
import os
import sys
# add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
......@@ -28,7 +30,6 @@ import yaml
import ast
from functools import reduce
from PIL import Image
import cv2
import numpy as np
import paddle
......@@ -508,7 +509,7 @@ def predict_video(detector, camera_id):
fps = 30
width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
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):
os.makedirs(FLAGS.output_dir)
out_path = os.path.join(FLAGS.output_dir, video_name)
......
......@@ -18,7 +18,6 @@ from __future__ import division
import cv2
import numpy as np
from PIL import Image, ImageDraw
from scipy import ndimage
def visualize_box_mask(im, results, labels, mask_resolution=14, threshold=0.5):
......
......@@ -18,11 +18,6 @@
#
import os
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("../../"))
......
......@@ -31,7 +31,6 @@ import uuid
import logging
import signal
import threading
import traceback
logger = logging.getLogger(__name__)
......
......@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import six
if six.PY3:
import pickle
......
......@@ -24,7 +24,6 @@ import os
import time
import math
import struct
import sys
import six
if six.PY3:
......@@ -32,7 +31,6 @@ if six.PY3:
else:
import cPickle as pickle
import json
import uuid
import random
import numpy as np
......
......@@ -23,8 +23,6 @@ import inspect
import math
from PIL import Image, ImageEnhance
import numpy as np
import os
import sys
import cv2
from copy import deepcopy
......
......@@ -20,8 +20,8 @@ import math
import paddle.fluid as fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Normal, Constant, NumpyArrayInitializer
from paddle.fluid.regularizer import L2Decay
from paddle.fluid.initializer import Normal, Constant
from ppdet.modeling.ops import ConvNorm, DeformConvNorm
from ppdet.modeling.ops import MultiClassNMS
......
......@@ -19,7 +19,6 @@ from __future__ import print_function
import paddle
from paddle import fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.regularizer import L2Decay
from ppdet.modeling.ops import ConvNorm, DeformConvNorm, MaskMatrixNMS, DropBlock
from ppdet.core.workspace import register
......
......@@ -25,7 +25,6 @@ from paddle.fluid.initializer import Normal, Constant, Uniform, Xavier
from paddle.fluid.regularizer import L2Decay
from ppdet.core.workspace import register
from ppdet.modeling.ops import DeformConv, DropBlock, ConvNorm
from ppdet.modeling.losses import GiouLoss
__all__ = ['TTFHead', 'TTFLiteHead']
......
......@@ -22,8 +22,7 @@ from paddle import fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.regularizer import L2Decay
from ppdet.modeling.ops import MultiClassNMS, MultiClassSoftNMS, MatrixNMS
from ppdet.modeling.losses.yolo_loss import YOLOv3Loss
from ppdet.modeling.ops import MultiClassNMS, MultiClassSoftNMS
from ppdet.core.workspace import register
from ppdet.modeling.ops import DropBlock
from .iou_aware import get_iou_aware_score
......
......@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from collections import OrderedDict
from paddle import fluid
......
......@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function
import numpy as np
import sys
from collections import OrderedDict
import copy
......
......@@ -21,7 +21,6 @@ from collections import OrderedDict
from paddle import fluid
from ppdet.core.workspace import register
import numpy as np
from ppdet.utils.check import check_version
__all__ = ['CornerNetSqueeze']
......
......@@ -16,7 +16,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from collections import OrderedDict
from paddle import fluid
......
......@@ -18,13 +18,9 @@ from __future__ import print_function
from collections import OrderedDict
import copy
import numpy as np
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.utils.check import check_version
......
......@@ -16,14 +16,10 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from collections import OrderedDict
from paddle import fluid
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
......
......@@ -17,7 +17,6 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import paddle
import paddle.fluid as fluid
from paddle.fluid import ParamAttr
from paddle.fluid.initializer import ConstantInitializer
......
......@@ -20,10 +20,7 @@ from paddle import fluid
from paddle.fluid.param_attr import ParamAttr
from paddle.fluid.initializer import Uniform
import functools
from ppdet.core.workspace import register
from .resnet import ResNet
import math
__all__ = ['Hourglass']
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册