未验证 提交 7a06e694 编写于 作者: G Guanghua Yu 提交者: GitHub

fix smoe model paddle version check (#1749)

上级 8d4f12bc
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册