diff --git a/ppdet/modeling/anchor_heads/solov2_head.py b/ppdet/modeling/anchor_heads/solov2_head.py index 18546593a4a7dd3cdf987d4cf2de3d9b06c08019..21cdad72941a8ca0d3672b81b216f45be66a6fc1 100644 --- a/ppdet/modeling/anchor_heads/solov2_head.py +++ b/ppdet/modeling/anchor_heads/solov2_head.py @@ -24,8 +24,6 @@ from paddle.fluid.regularizer import L2Decay from ppdet.modeling.ops import ConvNorm, DeformConvNorm, MaskMatrixNMS, DropBlock from ppdet.core.workspace import register -from ppdet.utils.check import check_version - from six.moves import zip import numpy as np @@ -71,7 +69,6 @@ class SOLOv2Head(object): kernel='gaussian', sigma=2.0).__dict__, drop_block=False): - check_version('2.0.0-rc0') self.num_classes = num_classes self.seg_num_grids = num_grids self.cate_out_channels = self.num_classes - 1 diff --git a/ppdet/modeling/anchor_heads/ttf_head.py b/ppdet/modeling/anchor_heads/ttf_head.py index 8640b3f48b70cad16eaa947bc459be987c26dc38..ba9ec802e80cc37afd4bce8c157b7840eb3ec289 100644 --- a/ppdet/modeling/anchor_heads/ttf_head.py +++ b/ppdet/modeling/anchor_heads/ttf_head.py @@ -348,7 +348,11 @@ class TTFHead(object): return pred, target, weight def get_loss(self, pred_hm, pred_wh, target_hm, box_target, target_weight): - pred_hm = paddle.clip(fluid.layers.sigmoid(pred_hm), 1e-4, 1 - 1e-4) + try: + pred_hm = paddle.clip(fluid.layers.sigmoid(pred_hm), 1e-4, 1 - 1e-4) + except: + pred_hm = paddle.tensor.clamp( + fluid.layers.sigmoid(pred_hm), 1e-4, 1 - 1e-4) hm_loss = self.ct_focal_loss(pred_hm, target_hm) * self.hm_weight shape = fluid.layers.shape(target_hm) shape.stop_gradient = True diff --git a/ppdet/modeling/architectures/cascade_mask_rcnn.py b/ppdet/modeling/architectures/cascade_mask_rcnn.py index 0e2b23556174d097b4afcb2d9d36589af0d472c6..0fc5bb135260a9ea66369ccc49d4fb12094059d2 100644 --- a/ppdet/modeling/architectures/cascade_mask_rcnn.py +++ b/ppdet/modeling/architectures/cascade_mask_rcnn.py @@ -23,6 +23,7 @@ import paddle.fluid as fluid from ppdet.experimental import mixed_precision_global_state from ppdet.core.workspace import register +from ppdet.utils.check import check_version from .input_helper import multiscale_def @@ -62,6 +63,7 @@ class CascadeMaskRCNN(object): rpn_only=False, fpn='FPN'): super(CascadeMaskRCNN, self).__init__() + check_version('2.0.0-rc0') assert fpn is not None, "cascade RCNN requires FPN" self.backbone = backbone self.fpn = fpn diff --git a/ppdet/modeling/architectures/cascade_rcnn.py b/ppdet/modeling/architectures/cascade_rcnn.py index ee72eca40709505ea51c3c7d3a8ff510a0199eec..e018caeae47bc23599c52703f4f81595e566e027 100644 --- a/ppdet/modeling/architectures/cascade_rcnn.py +++ b/ppdet/modeling/architectures/cascade_rcnn.py @@ -23,6 +23,7 @@ import paddle.fluid as fluid from ppdet.experimental import mixed_precision_global_state from ppdet.core.workspace import register +from ppdet.utils.check import check_version from .input_helper import multiscale_def __all__ = ['CascadeRCNN'] @@ -57,6 +58,7 @@ class CascadeRCNN(object): rpn_only=False, fpn='FPN'): super(CascadeRCNN, self).__init__() + check_version('2.0.0-rc0') assert fpn is not None, "cascade RCNN requires FPN" self.backbone = backbone self.fpn = fpn diff --git a/ppdet/modeling/architectures/cascade_rcnn_cls_aware.py b/ppdet/modeling/architectures/cascade_rcnn_cls_aware.py index 5eeb1bffb78147a7a5da6742e1517e6502e1d83e..837d87e974642ffaf213c96f33660016fa1057d7 100644 --- a/ppdet/modeling/architectures/cascade_rcnn_cls_aware.py +++ b/ppdet/modeling/architectures/cascade_rcnn_cls_aware.py @@ -24,6 +24,7 @@ import copy import paddle.fluid as fluid from ppdet.core.workspace import register +from ppdet.utils.check import check_version from .input_helper import multiscale_def __all__ = ['CascadeRCNNClsAware'] @@ -60,6 +61,7 @@ class CascadeRCNNClsAware(object): bbox_assigner='CascadeBBoxAssigner', fpn='FPN', ): super(CascadeRCNNClsAware, self).__init__() + check_version('2.0.0-rc0') assert fpn is not None, "cascade RCNN requires FPN" self.backbone = backbone self.fpn = fpn diff --git a/ppdet/modeling/architectures/htc.py b/ppdet/modeling/architectures/htc.py index 16c2909161265ceb0abbf0de44355867ccae37a2..c20822f85ed1920523d8f98f4b11356c4ad3ed46 100644 --- a/ppdet/modeling/architectures/htc.py +++ b/ppdet/modeling/architectures/htc.py @@ -26,6 +26,7 @@ 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 from .input_helper import multiscale_def @@ -70,6 +71,7 @@ class HybridTaskCascade(object): rpn_only=False, fpn='FPN'): super(HybridTaskCascade, self).__init__() + check_version('2.0.0-rc0') assert fpn is not None, "HTC requires FPN" self.backbone = backbone self.fpn = fpn diff --git a/ppdet/modeling/architectures/solov2.py b/ppdet/modeling/architectures/solov2.py index 9fc5ef34a368515b044e780935f2da7ad0ca63af..6c590e4a932c7a295717c9a8e9cfc01b8ddc1971 100644 --- a/ppdet/modeling/architectures/solov2.py +++ b/ppdet/modeling/architectures/solov2.py @@ -22,6 +22,7 @@ from paddle import fluid from ppdet.experimental import mixed_precision_global_state from ppdet.core.workspace import register +from ppdet.utils.check import check_version __all__ = ['SOLOv2'] @@ -47,6 +48,7 @@ class SOLOv2(object): bbox_head='SOLOv2Head', mask_head='SOLOv2MaskHead'): super(SOLOv2, self).__init__() + check_version('2.0.0-rc0') self.backbone = backbone self.fpn = fpn self.bbox_head = bbox_head