diff --git a/ppdet/modeling/anchor_heads/corner_head.py b/ppdet/modeling/anchor_heads/corner_head.py index fc7c64c19d742515a0edee6a6281e54c490b9ae3..a43416d15c3b110593ae51e8d77ad5866725959c 100644 --- a/ppdet/modeling/anchor_heads/corner_head.py +++ b/ppdet/modeling/anchor_heads/corner_head.py @@ -23,12 +23,8 @@ from paddle.fluid.initializer import Constant from ..backbones.hourglass import _conv_norm, kaiming_init from ppdet.core.workspace import register import numpy as np -try: - import cornerpool_lib -except: - print( - "warning: cornerpool_lib not found, compile in ext_op at first if needed" - ) +import logging +logger = logging.getLogger(__name__) __all__ = ['CornerHead'] @@ -247,6 +243,10 @@ class CornerHead(object): ae_threshold=1, num_dets=1000, top_k=100): + try: + import cornerpool_lib + except: + logger.error("cornerpool_lib not found, compile in ext_op at first") self.train_batch_size = train_batch_size self.test_batch_size = test_batch_size self.num_classes = num_classes diff --git a/ppdet/modeling/architectures/cornernet_squeeze.py b/ppdet/modeling/architectures/cornernet_squeeze.py index bcba613783195dfb3ec50711c5715d979a693c19..fb2ce42a11e5d30a6e0ffcfd60ea5f6b50047764 100644 --- a/ppdet/modeling/architectures/cornernet_squeeze.py +++ b/ppdet/modeling/architectures/cornernet_squeeze.py @@ -59,7 +59,7 @@ class CornerNetSqueeze(object): body_feats = self.backbone(im) if self.fpn is not None: body_feats, _ = self.fpn.get_output(body_feats) - body_feats = [body_feats.values()[-1]] + body_feats = [list(body_feats.values())[-1]] if mode == 'train': target_vars = [ 'tl_heatmaps', 'br_heatmaps', 'tag_masks', 'tl_regrs', diff --git a/ppdet/modeling/losses/yolo_loss.py b/ppdet/modeling/losses/yolo_loss.py index b2661a4aa43cf21e68ad00cbdcfd81098fa34608..9696dfbab30cc0eae485c87670e35afa0ee0b11b 100644 --- a/ppdet/modeling/losses/yolo_loss.py +++ b/ppdet/modeling/losses/yolo_loss.py @@ -166,7 +166,7 @@ class YOLOv3Loss(object): # self.scale_x_y, Sequence) else self.scale_x_y[i] loss_obj_pos, loss_obj_neg = self._calc_obj_loss( output, obj, tobj, gt_box, self._batch_size, anchors, - num_classes, downsample, self._ignore_thresh, scale_x_y) + num_classes, downsample, self._ignore_thresh) loss_cls = fluid.layers.sigmoid_cross_entropy_with_logits(cls, tcls) loss_cls = fluid.layers.elementwise_mul(loss_cls, tobj, axis=0) @@ -276,7 +276,7 @@ class YOLOv3Loss(object): return (tx, ty, tw, th, tscale, tobj, tcls) def _calc_obj_loss(self, output, obj, tobj, gt_box, batch_size, anchors, - num_classes, downsample, ignore_thresh, scale_x_y): + num_classes, downsample, ignore_thresh): # A prediction bbox overlap any gt_bbox over ignore_thresh, # objectness loss will be ignored, process as follows: