def __init__(self, out_planes, criterion, pretrained_model=None, norm_layer=nn.BatchNorm2d):
    super(CPNet, self).__init__()
    self.backbone = resnet50(pretrained_model, norm_layer=norm_layer, bn_eps=config.bn_eps, bn_momentum=config.bn_momentum, deep_stem=True, stem_width=64)
    self.backbone.layer3.apply(partial(self._nostride_dilate, dilate=2))
    self.backbone.layer4.apply(partial(self._nostride_dilate, dilate=4))
    self.business_layer = []
    self.context = ObjectContext(2048, 512, norm_layer)
    self.head_layer = nn.Sequential(ConvBnRelu((2048 + 1024), 512, 3, 1, 1, has_bn=True, has_relu=True, has_bias=False, norm_layer=norm_layer), nn.Dropout2d(0.1, inplace=False), nn.Conv2d(512, out_planes, kernel_size=1))
    self.aux_layer = nn.Sequential(ConvBnRelu(1024, 512, 3, 1, 1, has_bn=True, has_relu=True, has_bias=False, norm_layer=norm_layer), nn.Dropout2d(0.1, inplace=False), nn.Conv2d(512, out_planes, kernel_size=1))
    self.business_layer.append(self.context)
    self.business_layer.append(self.head_layer)
    self.business_layer.append(self.aux_layer)
    self.criterion = criterion
    self.bce_criterion = nn.BCELoss(reduction='mean')
def __init__(self, out_planes, criterion, pretrained_model=None, norm_layer=nn.BatchNorm2d):
    super(CPNet, self).__init__()
    self.backbone = resnet50(pretrained_model, norm_layer=norm_layer, bn_eps=config.bn_eps, bn_momentum=config.bn_momentum, deep_stem=True, stem_width=64)
    self.backbone.layer3.apply(partial(self._nostride_dilate, dilate=2))
    self.backbone.layer4.apply(partial(self._nostride_dilate, dilate=4))
    self.business_layer = []
    self.context = ObjectContext(2048, 512, norm_layer)
    self.head_layer = nn.Sequential(ConvBnRelu((2048 + 1024), 512, 3, 1, 1, has_bn=True, has_relu=True, has_bias=False, norm_layer=norm_layer), nn.Dropout2d(0.1, inplace=False), nn.Conv2d(512, out_planes, kernel_size=1))
    self.aux_layer = nn.Sequential(ConvBnRelu(1024, 512, 3, 1, 1, has_bn=True, has_relu=True, has_bias=False, norm_layer=norm_layer), nn.Dropout2d(0.1, inplace=False), nn.Conv2d(512, out_planes, kernel_size=1))
    self.business_layer.append(self.context)
    self.business_layer.append(self.head_layer)
    self.business_layer.append(self.aux_layer)
    self.criterion = criterion
    self.bce_criterion = nn.BCELoss(reduction='mean')