未验证 提交 19f551fd 编写于 作者: G Guanghua Yu 提交者: GitHub

fix smoe model paddle version check (#1748)

上级 512fad42
...@@ -24,8 +24,6 @@ from paddle.fluid.regularizer import L2Decay ...@@ -24,8 +24,6 @@ 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
from ppdet.utils.check import check_version
from six.moves import zip from six.moves import zip
import numpy as np import numpy as np
...@@ -71,7 +69,6 @@ class SOLOv2Head(object): ...@@ -71,7 +69,6 @@ class SOLOv2Head(object):
kernel='gaussian', kernel='gaussian',
sigma=2.0).__dict__, sigma=2.0).__dict__,
drop_block=False): drop_block=False):
check_version('2.0.0-rc0')
self.num_classes = num_classes self.num_classes = num_classes
self.seg_num_grids = num_grids self.seg_num_grids = num_grids
self.cate_out_channels = self.num_classes - 1 self.cate_out_channels = self.num_classes - 1
......
...@@ -348,7 +348,11 @@ class TTFHead(object): ...@@ -348,7 +348,11 @@ class TTFHead(object):
return pred, target, weight return pred, target, weight
def get_loss(self, pred_hm, pred_wh, target_hm, box_target, 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 hm_loss = self.ct_focal_loss(pred_hm, target_hm) * self.hm_weight
shape = fluid.layers.shape(target_hm) shape = fluid.layers.shape(target_hm)
shape.stop_gradient = True shape.stop_gradient = True
......
...@@ -23,6 +23,7 @@ import paddle.fluid as fluid ...@@ -23,6 +23,7 @@ import paddle.fluid as fluid
from ppdet.experimental import mixed_precision_global_state 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 .input_helper import multiscale_def from .input_helper import multiscale_def
...@@ -62,6 +63,7 @@ class CascadeMaskRCNN(object): ...@@ -62,6 +63,7 @@ class CascadeMaskRCNN(object):
rpn_only=False, rpn_only=False,
fpn='FPN'): fpn='FPN'):
super(CascadeMaskRCNN, self).__init__() super(CascadeMaskRCNN, self).__init__()
check_version('2.0.0-rc0')
assert fpn is not None, "cascade RCNN requires FPN" assert fpn is not None, "cascade RCNN requires FPN"
self.backbone = backbone self.backbone = backbone
self.fpn = fpn self.fpn = fpn
......
...@@ -23,6 +23,7 @@ import paddle.fluid as fluid ...@@ -23,6 +23,7 @@ import paddle.fluid as fluid
from ppdet.experimental import mixed_precision_global_state 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 .input_helper import multiscale_def from .input_helper import multiscale_def
__all__ = ['CascadeRCNN'] __all__ = ['CascadeRCNN']
...@@ -57,6 +58,7 @@ class CascadeRCNN(object): ...@@ -57,6 +58,7 @@ class CascadeRCNN(object):
rpn_only=False, rpn_only=False,
fpn='FPN'): fpn='FPN'):
super(CascadeRCNN, self).__init__() super(CascadeRCNN, self).__init__()
check_version('2.0.0-rc0')
assert fpn is not None, "cascade RCNN requires FPN" assert fpn is not None, "cascade RCNN requires FPN"
self.backbone = backbone self.backbone = backbone
self.fpn = fpn self.fpn = fpn
......
...@@ -24,6 +24,7 @@ import copy ...@@ -24,6 +24,7 @@ import copy
import paddle.fluid as fluid import paddle.fluid as fluid
from ppdet.core.workspace import register from ppdet.core.workspace import register
from ppdet.utils.check import check_version
from .input_helper import multiscale_def from .input_helper import multiscale_def
__all__ = ['CascadeRCNNClsAware'] __all__ = ['CascadeRCNNClsAware']
...@@ -60,6 +61,7 @@ class CascadeRCNNClsAware(object): ...@@ -60,6 +61,7 @@ class CascadeRCNNClsAware(object):
bbox_assigner='CascadeBBoxAssigner', bbox_assigner='CascadeBBoxAssigner',
fpn='FPN', ): fpn='FPN', ):
super(CascadeRCNNClsAware, self).__init__() super(CascadeRCNNClsAware, self).__init__()
check_version('2.0.0-rc0')
assert fpn is not None, "cascade RCNN requires FPN" assert fpn is not None, "cascade RCNN requires FPN"
self.backbone = backbone self.backbone = backbone
self.fpn = fpn self.fpn = fpn
......
...@@ -26,6 +26,7 @@ from paddle.fluid.initializer import MSRA ...@@ -26,6 +26,7 @@ from paddle.fluid.initializer import MSRA
from paddle.fluid.regularizer import L2Decay from paddle.fluid.regularizer import L2Decay
from ppdet.experimental import mixed_precision_global_state 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 .input_helper import multiscale_def from .input_helper import multiscale_def
...@@ -70,6 +71,7 @@ class HybridTaskCascade(object): ...@@ -70,6 +71,7 @@ class HybridTaskCascade(object):
rpn_only=False, rpn_only=False,
fpn='FPN'): fpn='FPN'):
super(HybridTaskCascade, self).__init__() super(HybridTaskCascade, self).__init__()
check_version('2.0.0-rc0')
assert fpn is not None, "HTC requires FPN" assert fpn is not None, "HTC requires FPN"
self.backbone = backbone self.backbone = backbone
self.fpn = fpn self.fpn = fpn
......
...@@ -22,6 +22,7 @@ from paddle import fluid ...@@ -22,6 +22,7 @@ from paddle import fluid
from ppdet.experimental import mixed_precision_global_state 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
__all__ = ['SOLOv2'] __all__ = ['SOLOv2']
...@@ -47,6 +48,7 @@ class SOLOv2(object): ...@@ -47,6 +48,7 @@ class SOLOv2(object):
bbox_head='SOLOv2Head', bbox_head='SOLOv2Head',
mask_head='SOLOv2MaskHead'): mask_head='SOLOv2MaskHead'):
super(SOLOv2, self).__init__() super(SOLOv2, self).__init__()
check_version('2.0.0-rc0')
self.backbone = backbone self.backbone = backbone
self.fpn = fpn self.fpn = fpn
self.bbox_head = bbox_head self.bbox_head = bbox_head
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册